From 5f02463a0cd75f967da8bec4f69c30be1784e19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E5=B2=A9?= Date: Tue, 2 Dec 2025 19:22:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=93=E6=9E=9C=E9=A1=B5?= =?UTF-8?q?=EF=BC=8C=E8=AE=A9=E7=BB=93=E6=9E=9C=E9=A1=B5=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=97=B6=E5=80=99=E5=8F=AF=E4=BB=A5=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E8=87=AA=E5=B7=B1=E7=9A=84=E6=88=90=E7=BB=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/competition/result.vue | 121 ++++++++++++++++++------------- 1 file changed, 71 insertions(+), 50 deletions(-) diff --git a/src/pages/competition/result.vue b/src/pages/competition/result.vue index 641cb5fb..21f2d3c7 100644 --- a/src/pages/competition/result.vue +++ b/src/pages/competition/result.vue @@ -8,20 +8,20 @@ - + - + - + - + - + @@ -31,7 +31,7 @@ - + @@ -44,20 +44,20 @@ {{ pkData.correctNub }} /{{ pkData.qnsNub }} - {{resultStr}} + {{ resultStr }} 总分 {{ pkData.totalScore }} - {{resultStr}} + {{ resultStr }} 用时 {{ formatSecondsToMS(pkData.timeTaken) }} - {{resultStr}} + {{ resultStr }} - + @@ -69,17 +69,17 @@ {{ pkData.correctNubPk }} /{{ pkData.qnsNubPk }} - {{resultStr}} + {{ resultStr }} 总分 {{ pkData.totalScorePk }} - {{resultStr}} + {{ resultStr }} 用时 {{ formatSecondsToMS(pkData.timeTakenPk) }} - {{resultStr}} + {{ resultStr }} @@ -116,8 +116,9 @@ import points from '@/components/points-and-badge/points'; import usePointsAndBadge from '@/components/points-and-badge/usePointsAndBadge'; const { pointAndBadgesRun, badgeRef, pointsRef } = usePointsAndBadge(); - const resultStr = computed(() => mode.value === 'pk_result'?"加载中":"结算中") + const resultStr = computed(() => (mode.value === 'pk_result' ? '加载中' : '结算中')); const action = ref(''); + const myAction = ref(''); const mode = ref(''); // 模式 PK中 pk_in, Pk列表查询 pk_result const autoSub = ref('00'); // 是否是自动提交 00 不是 01是 const pkData = reactive({ @@ -164,36 +165,36 @@ mode.value = e.mode || 'pk_result'; autoSub.value = e.autoSub || '00'; const pkDataInit = common.getPageCache('competition_pk_to_resulf'); - const userInfo = getUserInfo(); - console.log('userInfo', userInfo); + // const userInfo = getUserInfo(); + // console.log('userInfo', userInfo); console.log('pkDataInit', pkDataInit); Object.assign(pkData, { userName: pkDataInit.userName ?? '', isAnony: pkDataInit.isAnony ?? '', pkIsAnony: pkDataInit.pkIsAnony ?? '', - userNamePk: pkDataInit.pkUserName ?? '' + userNamePk: pkDataInit.pkUserName ?? '', + imgPk: pkDataInit.pkImgAddr ?? '' }); }); onMounted(() => { action.value = 'loading'; + myAction.value = 'loading'; - setTimeout(() => { - queryCompetitionAnswerResult({ execId: pkData.execId, autoSub:autoSub.value }).then(({ body }) => { - if (mode.value === 'pk_in') { - console.log('调用它'); - pointAndBadgesRun('11'); - } - // 计算需要额外延时的时间 - const currentTime = Math.floor(Date.now() / 1000); - // 2. 计算对手的答题结束时间(秒) - const opponentEndTime = body.endTime + body.timeDifference; - // 3. 计算当前时间到对手结束时间的延迟时间(秒),负数则取0 - const delayTime = Math.max(0, opponentEndTime - currentTime); - console.log('计算需要额外延时的时间', delayTime); - setTimeout(() => { + setTimeout( + () => { + queryCompetitionAnswerResult({ execId: pkData.execId, autoSub: autoSub.value }).then(({ body }) => { + if (mode.value === 'pk_in') { + console.log('调用它'); + pointAndBadgesRun('11'); + } + // 计算需要额外延时的时间 + const currentTime = Math.floor(Date.now() / 1000); + // 2. 计算对手的答题结束时间(秒) + const opponentEndTime = body.endTime + body.timeDifference; + // 3. 计算当前时间到对手结束时间的延迟时间(秒),负数则取0 + const delayTime = Math.max(0, opponentEndTime - currentTime); + console.log('计算需要额外延时的时间', delayTime); const userResult = body.userResult; - pkData.answerResult = body.answerResult; // 答题结果 Y代表我赢,N代表我输 - pkData.timeDifference = body.timeDifference; // 时差 int 单位 s Object.assign(pkData, { // 自己的 isAnony: userResult.isAnony, // 匿名 String @@ -206,18 +207,38 @@ userIdPk: userResult.userIdPk, // 用户Id String userNamePk: userResult.userNamePk, // 用户姓名 String imgPk: userResult.imgPk, // 用户姓名 String - pkIsAnony: userResult.isAnonyPk, // 匿名 String - correctNubPk: userResult.correctNubPk, // 正确数 int - qnsNubPk: userResult.qnsNubPk || 0, // 总数 int - timeTakenPk: userResult.timeTakenPk || 0, // 用时 int - totalScorePk: userResult.totalScorePk || 0 // 对方总分 + pkIsAnony: userResult.isAnonyPk // 匿名 String }); - nextTick(() => { - action.value = 'result'; - }); - }, delayTime * 1000); - }); - }, mode.value === 'pk_result'?0:1000); + myAction.value = 'result'; + setTimeout(() => { + pkData.answerResult = body.answerResult; // 答题结果 Y代表我赢,N代表我输 + pkData.timeDifference = body.timeDifference; // 时差 int 单位 s + Object.assign(pkData, { + // 自己的 + // isAnony: userResult.isAnony, // 匿名 String + // userName: userResult.userName, // 匿名 String + // correctNub: userResult.correctNub, // 正确数 int + // qnsNub: userResult.qnsNub, // 总数 int + // timeTaken: userResult.timeTaken, // 用时 int + // totalScore: userResult.totalScore || 0, // 我方总分 + // 对方的 + // userIdPk: userResult.userIdPk, // 用户Id String + // userNamePk: userResult.userNamePk, // 用户姓名 String + // imgPk: userResult.imgPk, // 用户姓名 String + // pkIsAnony: userResult.isAnonyPk, // 匿名 String + correctNubPk: userResult.correctNubPk, // 正确数 int + qnsNubPk: userResult.qnsNubPk || 0, // 总数 int + timeTakenPk: userResult.timeTakenPk || 0, // 用时 int + totalScorePk: userResult.totalScorePk || 0 // 对方总分 + }); + nextTick(() => { + action.value = 'result'; + }); + }, delayTime * 1000); + }); + }, + mode.value === 'pk_result' ? 0 : 1000 + ); }); @@ -387,12 +408,12 @@ display: none; } // loading 状态样式(保持不变) - &.loading { - .mascot-div { + .loading { + &.mascot-div { left: 50%; transform: translateX(-50%); } - .mascot-msg-div { + &.mascot-msg-div { opacity: 1; pointer-events: auto; } @@ -434,14 +455,14 @@ } // 当 action=result 时,触发结果动画 - &.result { + .result { // 胜利状态:入场 + 浮动 + 闪光 - .result-container-div.victory { + &.result-container-div.victory { animation: victoryEnter 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards, victoryFloat 2s ease-in-out infinite 0.8s; } // 失败状态:入场 + 抖动 - .result-container-div.defeat { + &.result-container-div.defeat { // defeatShake 1s ease-in-out infinite 0.6s animation: defeatEnter 0.6s ease-out forwards, defeatRotateSway 1s ease-in-out 0.6s 1; // 入场后开始晃动,2秒结束,仅1次 }