Commit 9a048c59 by xuyl

优化定时器代码

1 parent 6a3069c9
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
verifyQRCodeFailsToOpen: false, verifyQRCodeFailsToOpen: false,
addLoading: false, addLoading: false,
qrCodeInterval: null, qrCodeInterval: null,
qrCodeIntervalList:[], qrCodeIntervalList: [],
qrcodeUrl: '', qrcodeUrl: '',
qrCodeVisible: false, qrCodeVisible: false,
qrcodeId: '', qrcodeId: '',
...@@ -153,16 +153,16 @@ export default { ...@@ -153,16 +153,16 @@ export default {
await this.$apis.collocation await this.$apis.collocation
.getLoginQcCode({}) .getLoginQcCode({})
.then(res => { .then(res => {
this.addLoading = false this.addLoading = false
;(this.verifyQRCodeFailsToOpen = true), (this.qrcodeUrl = `data:image/png;base64,${res.qcCodeUrl}`) ;(this.verifyQRCodeFailsToOpen = true), (this.qrcodeUrl = `data:image/png;base64,${res.qcCodeUrl}`)
this.qrcodeId = res.id this.qrcodeId = res.id
}) })
.catch(err => { .catch(err => {
this.qrCodeVisible = false this.qrCodeVisible = false
this.clearAllInterval() this.clearAllInterval()
}) })
}, },
clearAllInterval(){ clearAllInterval() {
this.qrCodeIntervalList.forEach(item => { this.qrCodeIntervalList.forEach(item => {
clearInterval(item); clearInterval(item);
}) })
...@@ -190,7 +190,7 @@ export default { ...@@ -190,7 +190,7 @@ export default {
}, },
refreshQrcode: utils.debounce(function () { refreshQrcode: utils.debounce(function () {
this.handleqrCode() this.handleqrCode()
}, 3000) }, 5000)
}, },
computed: { computed: {
listenChange() { listenChange() {
...@@ -203,7 +203,7 @@ export default { ...@@ -203,7 +203,7 @@ export default {
if (val.qrCodeVisible == true && val.verifyQRCodeFailsToOpen == true) { if (val.qrCodeVisible == true && val.verifyQRCodeFailsToOpen == true) {
this.verifyQRCodeIsInvalid() this.verifyQRCodeIsInvalid()
} else { } else {
this.clearAllInterval() this.clearAllInterval()
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!