diff --git a/src/components/ClickCaptcha.vue b/src/components/ClickCaptcha.vue index a79ade6..4aeca7b 100644 --- a/src/components/ClickCaptcha.vue +++ b/src/components/ClickCaptcha.vue @@ -23,7 +23,7 @@ - @@ -47,8 +47,8 @@ const canvasWidth = 300 const canvasHeight = 180 const bgImgUrl = '/image/clickCaptcha.jpg' // 可替换为任意背景图 -const allChars = ['大', '数', '据', '天', '远', '风', '险', '报', '告'] -const targetChars = ref(['天', '远', '数', '据']) // 目标点击顺序固定 +const allChars = ['大', '数', '据', '天', '远', '风', '险', '报', '告', '智', '能', '查'] +const targetChars = ref(['智', '能', '查']) // 目标点击顺序固定 const charPositions = ref([]) // [{char, x, y, w, h}] const clickedIndex = ref(0) const errorMessage = ref('') @@ -127,14 +127,14 @@ function refreshCaptcha() { } function generateCaptcha() { - // 乱序排列7个字 + // 乱序排列所有字 const chars = [...allChars] for (let i = chars.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)) ;[chars[i], chars[j]] = [chars[j], chars[i]] } currentChars = chars - targetChars.value = ['天', '远', '数', '据'] + targetChars.value = ['智', '能', '查'] clickedIndex.value = 0 errorMessage.value = '' successMessage.value = '' @@ -190,13 +190,13 @@ function handleCanvasClick(e) { } function handleConfirm() { - if (clickedList.value.length < 4) { - errorMessage.value = '请依次点击4个字' + if (clickedList.value.length < 3) { + errorMessage.value = '请依次点击3个字' setTimeout(() => (errorMessage.value = ''), 1200) return } const userSeq = clickedList.value - .slice(0, 4) + .slice(0, 3) .map(item => item.char) .join('') if (userSeq === '智能查') {