This commit is contained in:
Mrx
2026-01-21 13:16:21 +08:00
parent d109f50b1d
commit 8c3e07e928

View File

@@ -23,7 +23,7 @@
<button class="refresh-btn" @click="refreshCaptcha" :disabled="isRefreshing">
{{ isRefreshing ? '刷新中...' : '刷新验证' }}
</button>
<button class="confirm-btn" :disabled="clickedList.length < 4 || !!successMessage" @click="handleConfirm">
<button class="confirm-btn" :disabled="clickedList.length < 3 || !!successMessage" @click="handleConfirm">
确认
</button>
</div>
@@ -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 === '智能查') {