|
|
@ -147,9 +147,8 @@ onMounted(() => { |
|
|
|
return false |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
const canvas = ref(null) |
|
|
|
const timer1 = ref<NodeJS.Timeout | number>(0) |
|
|
|
const timer2 = ref<NodeJS.Timeout | number>(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 |
|
|
|