This commit is contained in:
yahaozhang
2025-10-03 10:02:16 +08:00
parent dace987070
commit fcfb0b3c71
4 changed files with 290 additions and 65 deletions

View File

@@ -197,38 +197,8 @@ export default {
}
const handleQrReadyEarly = async () => {
try {
if (!state.isWaitingQr) return
if (!state.mecmachineId) return
if (state.qrInfo && state.qrInfo.url) return
// 结束等待并清理相关定时器
state.isWaitingQr = false
clearQrDelayCountdown()
if (typeof clearQrDelayTimeout === 'function') {
clearQrDelayTimeout(state)
}
// 立即拉取二维码并开始倒计时与登录轮询
await fetchQrCodeAfterDelay(
state,
countdown,
state.mecmachineId,
state.qrCreatedAt,
state.qrExpireAt
)
if (state.status === 'USING') {
startCountdown()
startLoginPolling(state.code, handleLoggedInStatus, handleCompletedStatus)
startProgressPolling(state.code, (progressData) => {
state.currentPoints = progressData.currentPoints || state.currentPoints
state.totalPoints = progressData.totalPoints || state.totalPoints
if (progressData.completedPoints !== undefined) {
state.completedPoints = progressData.completedPoints
}
})
}
} catch (error) {
console.error('提前获取二维码失败:', error)
}
// 移除提前显示二维码的逻辑,确保必须等待指定时间后才显示
console.log('二维码提前就绪事件被忽略,必须等待指定时间后才显示')
}
return {