|
@@ -26,8 +26,8 @@ const wrongTwo = ref(0)
|
|
|
const additionNumCount = ref(2)
|
|
|
// 统计每个层级答对个数
|
|
|
const rightCountList: Result[] = reactive([])
|
|
|
-// 测试时长 100 秒
|
|
|
-const gameDuration = ref(100 * 1000)
|
|
|
+// 测试时长 300 秒
|
|
|
+const gameDuration = ref(300)
|
|
|
// 游戏结束时间戳
|
|
|
const gameEndTime = ref(0)
|
|
|
// 游戏开始时间戳
|
|
@@ -71,10 +71,10 @@ function createComputeSpanText() {
|
|
|
}
|
|
|
|
|
|
function userClick(answer: number) {
|
|
|
- // 如果游戏时长大于或等于 100 秒,则游戏结束
|
|
|
+ // 如果游戏时长大于或等于 300 秒,则游戏结束
|
|
|
gameEndTime.value = performance.now()
|
|
|
const duration = gameEndTime.value - gameStartTime.value
|
|
|
- if (duration >= gameDuration.value) {
|
|
|
+ if (duration >= gameDuration.value * 1000) {
|
|
|
// 游戏结束,发送数据
|
|
|
sendData()
|
|
|
return
|
|
@@ -135,6 +135,9 @@ function sendData() {
|
|
|
return acc
|
|
|
}, 0)
|
|
|
|
|
|
+ gameData.gameId = subjectInfo.value.id
|
|
|
+ gameData.gameName = subjectInfo.value.name
|
|
|
+
|
|
|
gameData.levelList = rightCountList.map((item) => {
|
|
|
return {
|
|
|
level: item.name,
|
|
@@ -180,49 +183,67 @@ onMounted(() => {
|
|
|
<section class="app-container">
|
|
|
<van-nav-bar class="self-nav-bar" :title="subjectInfo.name" left-arrow @click-left="router.go(-1)" />
|
|
|
<count-down v-if="showCountDown" :time="5" color="white" @end-count-down="endCountDown" />
|
|
|
- <div v-else style="" class="w-[90%] mx-auto mt-[15px] p-[15px] border-6 border-white border-solid rounded-[8px] bg-[#425363]">
|
|
|
- <div class="h-[80px] flex flex-row justify-center items-center bg-[#D2E2F1] rounded-[8px]">
|
|
|
- <span class="text-[40px] text-[#222222]">{{ showSpanText }}</span>
|
|
|
+ <div v-else style="" class="mx-auto mt-[15px] w-[90%] border-6 border-white rounded-[8px] border-solid bg-[#425363] p-[15px]">
|
|
|
+ <div class="h-[80px] flex flex-row items-center justify-center rounded-[8px] bg-[#D2E2F1]">
|
|
|
+ <span
|
|
|
+ class="text-[#222222]"
|
|
|
+ :class="{
|
|
|
+ 'text-[40px]': showSpanText.length <= 11,
|
|
|
+ 'text-[36px]': showSpanText.length === 12,
|
|
|
+ 'text-[34px]': showSpanText.length === 13,
|
|
|
+ 'text-[32px]': [14, 15].includes(showSpanText.length),
|
|
|
+ 'text-[30px]': [16, 17].includes(showSpanText.length),
|
|
|
+ 'text-[27px]': [18, 19].includes(showSpanText.length),
|
|
|
+ 'text-[24px]': [20, 21].includes(showSpanText.length),
|
|
|
+ 'text-[21px]': [22, 23].includes(showSpanText.length),
|
|
|
+ 'text-[19px]': [24, 25].includes(showSpanText.length),
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ {{ showSpanText }}
|
|
|
+ </span>
|
|
|
</div>
|
|
|
- <div class="flex flex-row justify-between mt-[24px]">
|
|
|
- <div class="w-[72px] h-[72px] flex flex-row justify-center items-center bg-white rounded-[8px]" @click="userClick(1)">
|
|
|
+ <div class="mt-[24px] flex flex-row justify-between">
|
|
|
+ <div class="h-[72px] w-[72px] flex flex-row items-center justify-center rounded-[8px] bg-white" @click="userClick(1)">
|
|
|
<span class="text-[32px] text-[#222222]">1</span>
|
|
|
</div>
|
|
|
- <div class="w-[72px] h-[72px] flex flex-row justify-center items-center bg-white rounded-[8px]" @click="userClick(2)">
|
|
|
+ <div class="h-[72px] w-[72px] flex flex-row items-center justify-center rounded-[8px] bg-white" @click="userClick(2)">
|
|
|
<span class="text-[32px] text-[#222222]">2</span>
|
|
|
</div>
|
|
|
- <div class="w-[72px] h-[72px] flex flex-row justify-center items-center bg-white rounded-[8px]" @click="userClick(3)">
|
|
|
+ <div class="h-[72px] w-[72px] flex flex-row items-center justify-center rounded-[8px] bg-white" @click="userClick(3)">
|
|
|
<span class="text-[32px] text-[#222222]">3</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="flex flex-row justify-between mt-[24px]">
|
|
|
- <div class="w-[72px] h-[72px] flex flex-row justify-center items-center bg-white rounded-[8px]" @click="userClick(4)">
|
|
|
+ <div class="mt-[24px] flex flex-row justify-between">
|
|
|
+ <div class="h-[72px] w-[72px] flex flex-row items-center justify-center rounded-[8px] bg-white" @click="userClick(4)">
|
|
|
<span class="text-[32px] text-[#222222]">4</span>
|
|
|
</div>
|
|
|
- <div class="w-[72px] h-[72px] flex flex-row justify-center items-center bg-white rounded-[8px]" @click="userClick(5)">
|
|
|
+ <div class="h-[72px] w-[72px] flex flex-row items-center justify-center rounded-[8px] bg-white" @click="userClick(5)">
|
|
|
<span class="text-[32px] text-[#222222]">5</span>
|
|
|
</div>
|
|
|
- <div class="w-[72px] h-[72px] flex flex-row justify-center items-center bg-white rounded-[8px]" @click="userClick(6)">
|
|
|
+ <div class="h-[72px] w-[72px] flex flex-row items-center justify-center rounded-[8px] bg-white" @click="userClick(6)">
|
|
|
<span class="text-[32px] text-[#222222]">6</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="flex flex-row justify-between mt-[24px]">
|
|
|
- <div class="w-[72px] h-[72px] flex flex-row justify-center items-center bg-white rounded-[8px]" @click="userClick(7)">
|
|
|
+ <div class="mt-[24px] flex flex-row justify-between">
|
|
|
+ <div class="h-[72px] w-[72px] flex flex-row items-center justify-center rounded-[8px] bg-white" @click="userClick(7)">
|
|
|
<span class="text-[32px] text-[#222222]">7</span>
|
|
|
</div>
|
|
|
- <div class="w-[72px] h-[72px] flex flex-row justify-center items-center bg-white rounded-[8px]" @click="userClick(8)">
|
|
|
+ <div class="h-[72px] w-[72px] flex flex-row items-center justify-center rounded-[8px] bg-white" @click="userClick(8)">
|
|
|
<span class="text-[32px] text-[#222222]">8</span>
|
|
|
</div>
|
|
|
- <div class="w-[72px] h-[72px] flex flex-row justify-center items-center bg-white rounded-[8px]" @click="userClick(9)">
|
|
|
+ <div class="h-[72px] w-[72px] flex flex-row items-center justify-center rounded-[8px] bg-white" @click="userClick(9)">
|
|
|
<span class="text-[32px] text-[#222222]">9</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="flex flex-row justify-center mt-[24px]">
|
|
|
- <div class="w-[72px] h-[72px] flex flex-row justify-center items-center bg-white rounded-[8px]" @click="userClick(0)">
|
|
|
+ <div class="mt-[24px] flex flex-row justify-center">
|
|
|
+ <div class="h-[72px] w-[72px] flex flex-row items-center justify-center rounded-[8px] bg-white" @click="userClick(0)">
|
|
|
<span class="text-[32px] text-[#222222]">0</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="absolute bottom-[16px] left-[50%] h-[45px] w-[200px] translate-x-[-50%]">
|
|
|
+ <count-down v-if="!showCountDown" text="" is-format :time="gameDuration" :size="32" color="white" @end-count-down="userClick(0)" />
|
|
|
+ </div>
|
|
|
</section>
|
|
|
</template>
|
|
|
|