|
@@ -30,21 +30,21 @@
|
|
|
<div class="divider" />
|
|
|
<!-- 题目模块 -->
|
|
|
<!-- 题目预加载 -->
|
|
|
- <m-empty v-if="!currentAnswer" />
|
|
|
+ <m-empty v-if="!currentSubject" />
|
|
|
<!-- 题目预加载end -->
|
|
|
<div class="problem-box" v-else>
|
|
|
<!-- 题目内容 -->
|
|
|
<div class="problem">
|
|
|
- <span class="type">{{ topicType(currentAnswer.type) }}</span>
|
|
|
- <span class="text">{{ currentAnswer.explain }}</span>
|
|
|
- <img v-if="currentAnswer.image" :src="currentAnswer.image" class="img" />
|
|
|
+ <span class="type">{{ topicType(currentSubject.type) }}</span>
|
|
|
+ <span class="text">{{ currentSubject.explain }}</span>
|
|
|
+ <img v-if="currentSubject.image" :src="currentSubject.image" class="img" />
|
|
|
</div>
|
|
|
<!-- 背题模式展示 -->
|
|
|
<div v-if="typeParams.answerShow">
|
|
|
<div>
|
|
|
<div
|
|
|
class="answer-box"
|
|
|
- v-for="(item, index) in currentAnswer.opts"
|
|
|
+ v-for="(item, index) in currentSubject.opts"
|
|
|
:key="Number(index)"
|
|
|
>
|
|
|
<div class="choose-icon">
|
|
@@ -52,28 +52,28 @@
|
|
|
</div>
|
|
|
<span
|
|
|
class="answer-text"
|
|
|
- :class="{ true: currentAnswer.answer.includes(item) }"
|
|
|
+ :class="{ true: currentSubject.answer.includes(item) }"
|
|
|
>
|
|
|
{{ item }}
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="checkbox-answer">
|
|
|
- 答案: {{ currentAnswer.answer.toString() }}
|
|
|
+ 答案: {{ currentSubject.answer.toString() }}
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 背题模式展示end -->
|
|
|
<!-- 选择内容 -->
|
|
|
- <div v-else-if="currentAnswer.isTrue === null">
|
|
|
+ <div v-else-if="currentSubject.isTrue === null">
|
|
|
<!-- 单选 -->
|
|
|
<van-radio-group
|
|
|
- v-model="currentAnswer.userAnswer"
|
|
|
- v-if="currentAnswer.type < 2"
|
|
|
+ v-model="currentSubject.userAnswer"
|
|
|
+ v-if="currentSubject.type < 2"
|
|
|
@change="userAnswerChange"
|
|
|
icon-size="35px"
|
|
|
>
|
|
|
<van-radio
|
|
|
- v-for="(item, index) in currentAnswer.opts"
|
|
|
+ v-for="(item, index) in currentSubject.opts"
|
|
|
:key="Number(index)"
|
|
|
:name="item"
|
|
|
class="answer"
|
|
@@ -87,9 +87,9 @@
|
|
|
</van-radio-group>
|
|
|
<!-- 多选 -->
|
|
|
<div v-else>
|
|
|
- <van-checkbox-group v-model="currentAnswer.userAnswer" icon-size="35px">
|
|
|
+ <van-checkbox-group v-model="currentSubject.userAnswer" icon-size="35px">
|
|
|
<van-checkbox
|
|
|
- v-for="(item, index) in currentAnswer.opts"
|
|
|
+ v-for="(item, index) in currentSubject.opts"
|
|
|
:key="Number(index)"
|
|
|
:name="item"
|
|
|
class="answer"
|
|
@@ -105,7 +105,7 @@
|
|
|
round
|
|
|
type="primary"
|
|
|
class="checkbox-btn"
|
|
|
- :disabled="currentAnswer.userAnswer.length == 0"
|
|
|
+ :disabled="currentSubject.userAnswer.length == 0"
|
|
|
@click="userAnswerChange"
|
|
|
>确定</van-button
|
|
|
>
|
|
@@ -115,7 +115,7 @@
|
|
|
<div v-else>
|
|
|
<div>
|
|
|
<div
|
|
|
- v-for="(item, index) in currentAnswer.optsBack"
|
|
|
+ v-for="(item, index) in currentSubject.optsBack"
|
|
|
:key="Number(index)"
|
|
|
class="answer-box"
|
|
|
>
|
|
@@ -147,7 +147,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="checkbox-answer">
|
|
|
- 答案: {{ currentAnswer.answer.toString() }}
|
|
|
+ 答案: {{ currentSubject.answer.toString() }}
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 展示答题后选择内容end -->
|
|
@@ -163,12 +163,12 @@
|
|
|
</div>
|
|
|
<div
|
|
|
class="function-item"
|
|
|
- @click="audioPlay([currentAnswer.issuemp3, currentAnswer.answermp3])"
|
|
|
+ @click="audioPlay([currentSubject.issuemp3, currentSubject.answermp3])"
|
|
|
>
|
|
|
<m-icon type="a-dtda" size="25px" />
|
|
|
<span>读题+答案</span>
|
|
|
</div>
|
|
|
- <div class="function-item" @click="audioPlay(currentAnswer.issuemp3)">
|
|
|
+ <div class="function-item" @click="audioPlay(currentSubject.issuemp3)">
|
|
|
<m-icon type="duti" size="25px" />
|
|
|
<span>读题</span>
|
|
|
</div>
|
|
@@ -183,12 +183,12 @@
|
|
|
<div class="skills-box" @click.stop>
|
|
|
<div class="skills">
|
|
|
<div class="title">技巧讲解</div>
|
|
|
- <img :src="currentAnswer.explainGif" class="img" />
|
|
|
+ <img :src="currentSubject.explainGif" class="img" />
|
|
|
<van-divider class="divider">本题速记口诀</van-divider>
|
|
|
- <div class="text">{{ currentAnswer.explainJq }}</div>
|
|
|
+ <div class="text">{{ currentSubject.explainJq }}</div>
|
|
|
<div class="btn">
|
|
|
<span @click="skillsShow = false">关闭</span>
|
|
|
- <span @click="audioPlay(currentAnswer.explainMp3)">语音重播</span>
|
|
|
+ <span @click="audioPlay(currentSubject.explainMp3)">语音重播</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -200,11 +200,11 @@
|
|
|
<div class="skills">
|
|
|
<div class="title">官方解释</div>
|
|
|
<div class="text">
|
|
|
- {{ currentAnswer.explainJs }}
|
|
|
+ {{ currentSubject.explainJs }}
|
|
|
</div>
|
|
|
<div class="btn">
|
|
|
<span @click="officialShow = false">关闭</span>
|
|
|
- <span @click="audioPlay(currentAnswer.explainjsmp3)">语音重播</span>
|
|
|
+ <span @click="audioPlay(currentSubject.explainjsmp3)">语音重播</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -215,7 +215,7 @@
|
|
|
<van-popup v-model:show="setShow" position="bottom">
|
|
|
<van-cell center title="答对跳转下一题">
|
|
|
<template #right-icon>
|
|
|
- <van-switch v-model="isJump" size="24" />
|
|
|
+ <van-switch v-model="isJumpNext" size="24" />
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
<van-cell center title="答题音效提示">
|
|
@@ -227,7 +227,7 @@
|
|
|
<!-- 设置操作栏end -->
|
|
|
<!-- 底部操作栏 -->
|
|
|
<van-tabbar placeholder route>
|
|
|
- <van-tabbar-item @click="currentAnswerIndexBack"
|
|
|
+ <van-tabbar-item @click="lastSubject"
|
|
|
>上一题
|
|
|
<template #icon>
|
|
|
<m-icon type="shangyiti" />
|
|
@@ -246,7 +246,7 @@
|
|
|
</template>
|
|
|
</van-tabbar-item>
|
|
|
<van-tabbar-item
|
|
|
- >{{ idIndex }}/{{ total }}
|
|
|
+ >{{ currentSubjectIndex+1 }}/{{ subjectTotal }}
|
|
|
<template #icon>
|
|
|
<m-icon type="zongtishu" />
|
|
|
</template>
|
|
@@ -257,7 +257,7 @@
|
|
|
<m-icon type="gfjs" />
|
|
|
</template>
|
|
|
</van-tabbar-item>
|
|
|
- <van-tabbar-item @click="currentAnswerIndexGo"
|
|
|
+ <van-tabbar-item @click="nextSubject"
|
|
|
>下一题
|
|
|
<template #icon>
|
|
|
<m-icon type="xiayiti" />
|
|
@@ -268,51 +268,45 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import * as Api from "@/api";
|
|
|
-import { useRoute, useRouter } from "vue-router";
|
|
|
-import { ref, watch, computed, reactive, onBeforeMount, nextTick } from "vue";
|
|
|
-import { useTopicMode, useAudioSet, useTopicShow } from "./hooks";
|
|
|
+import { useRouter } from "vue-router";
|
|
|
+import { ref } from "vue";
|
|
|
+import {
|
|
|
+ useTopicMode,
|
|
|
+ useAudioSet,
|
|
|
+ useSubjectShowLogic,
|
|
|
+} from "./hooks";
|
|
|
const router = useRouter();
|
|
|
const onClickLeft = () => {
|
|
|
router.back();
|
|
|
};
|
|
|
|
|
|
-const route = useRoute();
|
|
|
-
|
|
|
//答题模式选择逻辑
|
|
|
const { answerTypeList, currentType, typeParams } = useTopicMode();
|
|
|
|
|
|
-//技巧讲解
|
|
|
const skillsShow = ref(false); //显示技巧讲解
|
|
|
-
|
|
|
-//官方解释
|
|
|
const officialShow = ref(false); //显示官方解释
|
|
|
|
|
|
//设置操作栏
|
|
|
const setShow = ref(false); //显示设置栏
|
|
|
-const isJump = ref(false); //答对跳转下一题
|
|
|
const isSoundEffect = ref(true); //答题音效
|
|
|
|
|
|
-//记录模块
|
|
|
-const trueNum = ref(0); //答对数量
|
|
|
-const falseNum = ref(0); //答错数量
|
|
|
-const idIndex = ref(0); //当前题目标志位
|
|
|
-const total = ref(0); //题目总数量
|
|
|
|
|
|
-//题目展示逻辑
|
|
|
const {
|
|
|
- topicList,
|
|
|
- topicType,
|
|
|
- currentAnswerIndex,
|
|
|
- currentAnswer,
|
|
|
- currentAnswerIndexBack,
|
|
|
- currentAnswerIndexGo,
|
|
|
+ currentSubject,
|
|
|
+ currentSubjectIndex,
|
|
|
+ subjectTotal,
|
|
|
+ nextSubject,
|
|
|
+ lastSubject,
|
|
|
+ trueNum,
|
|
|
+ falseNum,
|
|
|
+ isJumpNext,
|
|
|
userAnswerChange,
|
|
|
-} = useTopicShow(trueNum, falseNum, idIndex, total, isJump, route.query);
|
|
|
+ topicType,
|
|
|
+} = useSubjectShowLogic();
|
|
|
|
|
|
//音频模块
|
|
|
const { aotuPlayFlag, audioPlay, audioPause, aotuPlaySet, issueAudioPlay } =
|
|
|
- useAudioSet(currentAnswerIndex);
|
|
|
+ useAudioSet(currentSubjectIndex);
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|