Commit 9a048c59 by xuyl

优化定时器代码

1 parent 6a3069c9
......@@ -49,7 +49,7 @@ export default {
verifyQRCodeFailsToOpen: false,
addLoading: false,
qrCodeInterval: null,
qrCodeIntervalList:[],
qrCodeIntervalList: [],
qrcodeUrl: '',
qrCodeVisible: false,
qrcodeId: '',
......@@ -153,16 +153,16 @@ export default {
await this.$apis.collocation
.getLoginQcCode({})
.then(res => {
this.addLoading = false
;(this.verifyQRCodeFailsToOpen = true), (this.qrcodeUrl = `data:image/png;base64,${res.qcCodeUrl}`)
this.qrcodeId = res.id
this.addLoading = false
;(this.verifyQRCodeFailsToOpen = true), (this.qrcodeUrl = `data:image/png;base64,${res.qcCodeUrl}`)
this.qrcodeId = res.id
})
.catch(err => {
this.qrCodeVisible = false
this.clearAllInterval()
})
},
clearAllInterval(){
clearAllInterval() {
this.qrCodeIntervalList.forEach(item => {
clearInterval(item);
})
......@@ -190,7 +190,7 @@ export default {
},
refreshQrcode: utils.debounce(function () {
this.handleqrCode()
}, 3000)
}, 5000)
},
computed: {
listenChange() {
......@@ -203,7 +203,7 @@ export default {
if (val.qrCodeVisible == true && val.verifyQRCodeFailsToOpen == true) {
this.verifyQRCodeIsInvalid()
} 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!