2026-02-06 17:45:44 +08:00
|
|
|
|
<script setup lang="ts">
|
2026-02-28 08:46:11 +08:00
|
|
|
|
import { NImage } from 'naive-ui'
|
2026-02-11 17:27:08 +08:00
|
|
|
|
import { computed, onBeforeUnmount, ref } from 'vue'
|
|
|
|
|
|
import { useRoute } from 'vue-router'
|
2026-02-06 17:45:44 +08:00
|
|
|
|
import CompetitionLayout from '@/components/custom/user/CompetitionLayout.vue'
|
|
|
|
|
|
import { useRouterPush } from '@/hooks/common/router'
|
2026-02-28 08:46:11 +08:00
|
|
|
|
import { fetchCheckNextStep, fetchGetCurrentQuestion, fetchGetGameStatistics } from '@/service/api/game'
|
2026-02-11 17:27:08 +08:00
|
|
|
|
import { useCompetitionStore } from '@/store/modules/competition'
|
|
|
|
|
|
|
|
|
|
|
|
const store = useCompetitionStore()
|
2026-02-06 17:45:44 +08:00
|
|
|
|
|
|
|
|
|
|
const { routerPushByKey } = useRouterPush()
|
2026-02-11 17:27:08 +08:00
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
const activityId = computed(() => route.query?.activityId as string)
|
|
|
|
|
|
const groupsId = computed(() => route.query?.groupsId as string)
|
|
|
|
|
|
const teamId = computed(() => route.query?.teamId as string)
|
|
|
|
|
|
const teamIds = computed(() => route.query?.teamIds as string)
|
|
|
|
|
|
const currentQuestionMainInfo = computed(() => store.currentQuestionMainInfo)
|
2026-02-28 08:46:11 +08:00
|
|
|
|
const currentQuestionDetail = computed(() => store.currentQuestionDetail)
|
2026-02-11 17:27:08 +08:00
|
|
|
|
|
|
|
|
|
|
const TeamGroup_QuestionID = computed(() => currentQuestionMainInfo.value?.TeamGroup_QuestionID || 0)
|
2026-02-28 08:46:11 +08:00
|
|
|
|
const QuestionID = computed(() => currentQuestionMainInfo.value?.Activity_Question.ID || 0)
|
2026-03-05 18:08:17 +08:00
|
|
|
|
const QuestionDetailID = computed(() => currentQuestionDetail.value?.Id || 0)
|
2026-02-11 17:27:08 +08:00
|
|
|
|
|
2026-02-06 17:45:44 +08:00
|
|
|
|
const zoomedImage = ref<string | null>(null)
|
2026-02-11 17:27:08 +08:00
|
|
|
|
const isCompleted = ref(false)
|
|
|
|
|
|
const showNextBtn = ref(false)
|
2026-02-06 17:45:44 +08:00
|
|
|
|
|
2026-02-28 08:46:11 +08:00
|
|
|
|
const teams = ref<any[]>([])
|
2026-02-06 17:45:44 +08:00
|
|
|
|
|
|
|
|
|
|
function handleBack() {
|
2026-02-11 17:27:08 +08:00
|
|
|
|
routerPushByKey('user_game', {
|
|
|
|
|
|
query: {
|
|
|
|
|
|
activityId: activityId.value,
|
|
|
|
|
|
groupsId: groupsId.value,
|
|
|
|
|
|
teamId: teamId.value,
|
|
|
|
|
|
teamIds: teamIds.value,
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
2026-02-06 17:45:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function handleNext() {
|
2026-02-11 17:27:08 +08:00
|
|
|
|
if (isCompleted.value) {
|
|
|
|
|
|
routerPushByKey('user_groups', {
|
|
|
|
|
|
query: {
|
|
|
|
|
|
activityId: activityId.value,
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
routerPushByKey('user_draw', {
|
|
|
|
|
|
query: {
|
|
|
|
|
|
activityId: activityId.value,
|
|
|
|
|
|
groupsId: groupsId.value,
|
|
|
|
|
|
teamId: teamId.value,
|
|
|
|
|
|
teamIds: teamIds.value,
|
2026-03-09 17:34:40 +08:00
|
|
|
|
RoundType: Number(currentQuestionMainInfo.value?.Activity_Question.RoundType) || 0,
|
2026-02-11 17:27:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
// 清空当前题目信息
|
|
|
|
|
|
store.initData()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取题目详情
|
|
|
|
|
|
* 检测是否还有题可以抽取,如果data为0,则提示没有题可抽取
|
|
|
|
|
|
*/
|
|
|
|
|
|
async function initQuestions() {
|
|
|
|
|
|
if (!activityId.value)
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
const { data: outlineData, error } = await fetchGetCurrentQuestion({
|
|
|
|
|
|
ActivityID: Number(activityId.value),
|
|
|
|
|
|
GroupID: Number(groupsId.value),
|
2026-03-09 17:34:40 +08:00
|
|
|
|
RoundType: Number(currentQuestionMainInfo.value?.Activity_Question.RoundType) || 0,
|
2026-02-11 17:27:08 +08:00
|
|
|
|
})
|
|
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
|
|
console.log(outlineData, 'outlineData')
|
|
|
|
|
|
if (error) {
|
|
|
|
|
|
window?.$message?.error(error.message)
|
|
|
|
|
|
}
|
|
|
|
|
|
isCompleted.value = outlineData?.data?.IsCompleted || false
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (error) {
|
|
|
|
|
|
window.$message?.error('获取题目失败,请重试')
|
|
|
|
|
|
console.error(error)
|
|
|
|
|
|
}
|
2026-02-06 17:45:44 +08:00
|
|
|
|
}
|
2026-02-11 17:27:08 +08:00
|
|
|
|
|
|
|
|
|
|
const timer = ref<ReturnType<typeof setInterval> | undefined>(undefined)
|
2026-02-28 08:46:11 +08:00
|
|
|
|
const statisticsTimer = ref<ReturnType<typeof setInterval> | undefined>(undefined)
|
2026-02-11 17:27:08 +08:00
|
|
|
|
|
|
|
|
|
|
/** 定时刷新 检查评委是否已经完成打分,是否可以下一步 fetchCheckNextStep */
|
|
|
|
|
|
async function checkNextStep() {
|
|
|
|
|
|
if (!activityId.value || !groupsId.value)
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
const { data: nextStepData, error } = await fetchCheckNextStep(TeamGroup_QuestionID.value || 0)
|
|
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
|
|
console.log(nextStepData, 'nextStepData')
|
|
|
|
|
|
if (error) {
|
|
|
|
|
|
window?.$message?.error(error.message)
|
|
|
|
|
|
}
|
|
|
|
|
|
const isUse = nextStepData?.data?.IsUse || false
|
|
|
|
|
|
showNextBtn.value = isUse
|
|
|
|
|
|
if (isUse) {
|
|
|
|
|
|
await initQuestions()
|
|
|
|
|
|
clearInterval(timer.value)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (error) {
|
|
|
|
|
|
window.$message?.error('检查是否可以下一步失败,请重试')
|
|
|
|
|
|
console.error(error)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-28 08:46:11 +08:00
|
|
|
|
/** 获取游戏现场统计结果 */
|
|
|
|
|
|
async function fetchGetGameStatisticsData() {
|
|
|
|
|
|
if (store.currentQuestionInfo && store.currentQuestionDetail) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const _params = {
|
|
|
|
|
|
TeamGroupID: Number(groupsId.value),
|
|
|
|
|
|
QuestionID: Number(QuestionID.value),
|
2026-03-05 18:08:17 +08:00
|
|
|
|
QuestionDetaiID: Number(QuestionDetailID.value),
|
2026-02-28 08:46:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
const { data } = await fetchGetGameStatistics(_params)
|
|
|
|
|
|
teams.value = (data?.data as any[]) || []
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (error: any) {
|
|
|
|
|
|
console.error('Failed to fetch game statistics', error)
|
|
|
|
|
|
window.$message?.error(error.message || '获取游戏现场统计结果失败')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-11 17:27:08 +08:00
|
|
|
|
// 定时刷新 检查是否可以下一步
|
2026-03-09 08:37:32 +08:00
|
|
|
|
timer.value = setInterval(checkNextStep, 3000)
|
2026-02-28 08:46:11 +08:00
|
|
|
|
// 定时刷新 游戏统计数据
|
2026-03-09 08:37:32 +08:00
|
|
|
|
statisticsTimer.value = setInterval(fetchGetGameStatisticsData, 3000)
|
2026-02-11 17:27:08 +08:00
|
|
|
|
|
|
|
|
|
|
/** 销毁 定时刷新 检查是否可以下一步 */
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
|
clearInterval(timer.value)
|
2026-02-28 08:46:11 +08:00
|
|
|
|
clearInterval(statisticsTimer.value)
|
2026-02-11 17:27:08 +08:00
|
|
|
|
})
|
2026-02-06 17:45:44 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<CompetitionLayout
|
2026-02-11 17:27:08 +08:00
|
|
|
|
:show-title="true" :show-back="false" :show-next="showNextBtn" title="答题图解" action-position="top"
|
|
|
|
|
|
back-btn-text="返回" :next-btn-text="isCompleted ? '该组已完成,回到选组' : '下一题'" btn-theme="light" @back="handleBack"
|
2026-02-06 17:45:44 +08:00
|
|
|
|
@next="handleNext"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="relative h-full w-full flex flex-col items-center px-12 pt-10 font-sans">
|
|
|
|
|
|
<!-- Content -->
|
|
|
|
|
|
<div class="w-full flex flex-col flex-1 overflow-hidden">
|
|
|
|
|
|
<div class="mb-2 text-xl text-red-600 font-bold">
|
2026-02-28 08:46:11 +08:00
|
|
|
|
备注:评委正在评分中,请等待。。。
|
2026-02-06 17:45:44 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-10 08:45:26 +08:00
|
|
|
|
<div v-if="teams && teams.length > 0" class="grid grid-cols-4 h-full gap-6 pb-8">
|
2026-02-06 17:45:44 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-for="team in teams" :key="team.id"
|
|
|
|
|
|
class="flex flex-col border-2 border-gray-200 rounded-xl bg-white/90 p-4 shadow-sm"
|
|
|
|
|
|
>
|
2026-02-28 08:46:11 +08:00
|
|
|
|
<div
|
|
|
|
|
|
class="mb-3 flex items-center gap-2 rounded-full from-sky-300 to-cyan-200 bg-gradient-to-r px-4 py-2 shadow-sm"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="text-lg text-white font-bold drop-shadow">{{ team.TeamName }}</span>
|
|
|
|
|
|
<span class="ml-2 rounded-full bg-white/40 px-2 py-0.5 text-sm">正确 <span class="text-md text-blue">{{
|
|
|
|
|
|
team.correctCount }}</span> 字</span>
|
|
|
|
|
|
<span class="text-s rounded-full bg-white/40 px-2 py-0.5">积分 <span class="text-md text-blue">{{ team.Points
|
|
|
|
|
|
}}</span></span>
|
2026-02-06 17:45:44 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Answer Image Area -->
|
|
|
|
|
|
<div
|
2026-02-28 08:46:11 +08:00
|
|
|
|
class="relative mb-4 flex-1 overflow-hidden border border-gray-300 rounded bg-gray-50"
|
2026-02-06 17:45:44 +08:00
|
|
|
|
>
|
|
|
|
|
|
<!-- Grid Background Simulation -->
|
|
|
|
|
|
<div class="pointer-events-none absolute inset-0 grid grid-cols-8 gap-px bg-gray-200 opacity-20">
|
2026-02-28 08:46:11 +08:00
|
|
|
|
<!-- <div v-for="n in 64" :key="n" class="bg-white" /> -->
|
2026-02-06 17:45:44 +08:00
|
|
|
|
</div>
|
2026-02-28 08:46:11 +08:00
|
|
|
|
<NImage
|
|
|
|
|
|
:src="team.UserAnswerPicture"
|
|
|
|
|
|
class="h-full w-full"
|
|
|
|
|
|
object-fit="contain"
|
|
|
|
|
|
/>
|
2026-02-06 17:45:44 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Stats & Score -->
|
2026-02-28 08:46:11 +08:00
|
|
|
|
<!-- <div class="flex flex-col gap-2">
|
2026-02-06 17:45:44 +08:00
|
|
|
|
<div class="text-sm text-gray-700 font-medium">
|
|
|
|
|
|
写了数量{{ team.writtenCount }},正确{{ team.correctCount }}个,积分{{ team.score }}
|
|
|
|
|
|
</div>
|
2026-02-28 08:46:11 +08:00
|
|
|
|
</div> -->
|
2026-02-06 17:45:44 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Zoom Modal -->
|
|
|
|
|
|
<div
|
2026-02-11 17:27:08 +08:00
|
|
|
|
v-if="zoomedImage" class="fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm"
|
2026-02-06 17:45:44 +08:00
|
|
|
|
@click="zoomedImage = null"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="relative max-h-[90vh] max-w-[90vw] p-4">
|
|
|
|
|
|
<img :src="zoomedImage" class="max-h-full max-w-full rounded bg-white shadow-2xl" alt="Zoomed Answer">
|
|
|
|
|
|
<div class="absolute bottom-4 left-1/2 text-sm text-white/80 -translate-x-1/2">
|
|
|
|
|
|
点击任意处关闭
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</CompetitionLayout>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
/* Custom Scrollbar for content if needed */
|
|
|
|
|
|
::-webkit-scrollbar {
|
|
|
|
|
|
width: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar-track {
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
|
|
|
|
background: #cbd5e1;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|