From d709c858da839c3fd654181bc41283ccb0e3bab8 Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Thu, 29 Aug 2024 15:28:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E6=B2=A1=E6=9C=89=E7=94=A8?= =?UTF-8?q?=E5=88=B0=E7=9A=84=E4=B8=9A=E5=8A=A1=EF=BC=9A-=E4=BD=86?= =?UTF-8?q?=E6=98=AF=E8=A7=A3=E5=86=B3=E4=BB=A3=E7=A0=81=E9=87=8C=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Verifition/src/Verify/VerifyPoints.vue | 30 ++++--------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/src/components/Verifition/src/Verify/VerifyPoints.vue b/src/components/Verifition/src/Verify/VerifyPoints.vue index 0c2745048..86aff851c 100644 --- a/src/components/Verifition/src/Verify/VerifyPoints.vue +++ b/src/components/Verifition/src/Verify/VerifyPoints.vue @@ -147,9 +147,8 @@ onMounted(() => { return false } }) + const canvas = ref(null) -const timer1 = ref(0) -const timer2 = ref(0) const canvasClick = (e) => { checkPosArr.push(getMousePos(canvas, e)) if (num.value == checkNum.value) { @@ -159,7 +158,7 @@ const canvasClick = (e) => { checkPosArr.length = 0 checkPosArr.push(...arr) //等创建坐标执行完 - timer1.value = setTimeout(() => { + setTimeout(() => { // var flag = this.comparePos(this.fontPos, this.checkPosArr); //发送后端请求 var captchaVerification = secretKey.value @@ -179,13 +178,9 @@ const canvasClick = (e) => { text.value = t('captcha.success') bindingClick.value = false if (mode.value == 'pop') { - timer2.value = setTimeout(() => { + setTimeout(() => { proxy.$parent.clickShow = false refresh() - if(timer2.value){ - clearTimeout(timer2.value) - timer2.value = 0 - } }, 1500) } proxy.$parent.$emit('success', { captchaVerification }) @@ -194,33 +189,18 @@ const canvasClick = (e) => { barAreaColor.value = '#d9534f' barAreaBorderColor.value = '#d9534f' text.value = t('captcha.fail') - timer2.value = setTimeout(() => { + setTimeout(() => { refresh() - if(timer2.value){ - clearTimeout(timer2.value) - timer2.value = 0 - } }, 700) } }) - if(timer1.value){ - clearTimeout(timer1.value) - timer1.value = 0 - } }, 400) } if (num.value < checkNum.value) { num.value = createPoint(getMousePos(canvas, e)) } } -onBeforeUnmount(() => { - if(timer1.value){ - clearTimeout(timer1.value) - } - if(timer2.value){ - clearTimeout(timer2.value) - } -}) + //获取坐标 const getMousePos = function (obj, e) { var x = e.offsetX