|
@@ -68,78 +68,44 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="context">
|
|
|
- <template v-if="currentIndex === 0">
|
|
|
- <div class="card" v-for="item in 10" :key="item">
|
|
|
- <div class="question-header">
|
|
|
- <span class="question-type">单选题</span>
|
|
|
- <span class="question-date">2025-03-20 20:30:20</span>
|
|
|
- </div>
|
|
|
- <div class="question-text">
|
|
|
- 根据中药七情配伍理论,属于相畏的药组是?
|
|
|
- </div>
|
|
|
- <div class="options">
|
|
|
- <div
|
|
|
- class="option"
|
|
|
- v-for="(option, i) in ['A', 'B', 'C', 'D', 'E']"
|
|
|
- :key="i"
|
|
|
- >
|
|
|
- <span class="option-select">{{ option }}</span>
|
|
|
- <span>选项内容</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="footer">
|
|
|
- <div class="c-primary">查看解析与考点</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <template v-if="currentIndex === 0 && dataList.length">
|
|
|
+ <QuestionsItem :data="dataList" :isRight="isRight" />
|
|
|
</template>
|
|
|
- <template v-if="currentIndex === 1">
|
|
|
- <div class="card" v-for="item in 10" :key="item">
|
|
|
+ <template v-else-if="currentIndex === 1 && examList.length">
|
|
|
+ <div class="card" v-for="item in examList" :key="item.catalogue_id">
|
|
|
<div class="card-header">
|
|
|
- <span class="title">2024年真题</span>
|
|
|
- <span class="exam-count">已考试15次</span>
|
|
|
+ <span class="title">{{ item.year }}年真题</span>
|
|
|
+ <span class="exam-count">已考试{{ item.exam_count }}次</span>
|
|
|
</div>
|
|
|
<div class="card-body">
|
|
|
- <span>最低分:20分</span>
|
|
|
- <span>最高分:98分</span>
|
|
|
+ <span>最低分:{{ item.min_score }}分</span>
|
|
|
+ <span>最高分:{{ item.max_score }}分</span>
|
|
|
</div>
|
|
|
<div class="footer">
|
|
|
- <div class="c-primary">再考一次</div>
|
|
|
+ <div class="c-primary" @click="toHistory(item)">再考一次</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <template v-if="currentIndex === 2">
|
|
|
- <div class="card" v-for="item in 10" :key="item">
|
|
|
- <div class="question-header">
|
|
|
- <span class="question-type">单选题</span>
|
|
|
- <span class="question-date">2025-03-20 20:30:20</span>
|
|
|
- </div>
|
|
|
- <div class="question-text">
|
|
|
- 根据中药七情配伍理论,属于相畏的药组是?
|
|
|
- </div>
|
|
|
- <div class="options">
|
|
|
- <div
|
|
|
- class="option"
|
|
|
- v-for="(option, i) in ['A', 'B', 'C', 'D', 'E']"
|
|
|
- :key="i"
|
|
|
- >
|
|
|
- <span class="option-select">{{ option }}</span>
|
|
|
- <span>选项内容</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="footer">
|
|
|
- <div class="c-primary">查看解析与考点</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <template v-else-if="currentIndex === 2 && favoriteList.length">
|
|
|
+ <QuestionsItem
|
|
|
+ :data="favoriteList"
|
|
|
+ :isRight="isRight"
|
|
|
+ :onClick="toFavorite"
|
|
|
+ />
|
|
|
</template>
|
|
|
+ <Empty v-else text="暂无数据"></Empty>
|
|
|
</div>
|
|
|
</Container>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import Container from "@/components/Container/Container.vue";
|
|
|
+import Empty from "@/components/Empty/Empty.vue";
|
|
|
import { ref, watch } from "vue";
|
|
|
import { onShow } from "@dcloudio/uni-app";
|
|
|
import { request } from "../../utils/request";
|
|
|
+import QuestionsItem from "../../components/Topic/QuestionsItem.vue";
|
|
|
+import { router } from "../../utils/router";
|
|
|
|
|
|
const currentIndex = ref(0);
|
|
|
const currentTab = ref(0);
|
|
@@ -147,21 +113,92 @@ const isRight = ref(1);
|
|
|
const info = ref({});
|
|
|
const rightTotal = ref(0);
|
|
|
const errorTotal = ref(0);
|
|
|
-
|
|
|
-watch([currentTab, isRight], () => {
|
|
|
+const dataList = ref([]);
|
|
|
+const examList = ref([]);
|
|
|
+const favoriteList = ref([]);
|
|
|
+const toHistory = (item) => {
|
|
|
+ router.push({
|
|
|
+ path: "/pages/real/history",
|
|
|
+ query: {
|
|
|
+ id: item.catalogue_id,
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+const requestTopic = (is_correct, onSucess) => {
|
|
|
request(
|
|
|
"api/question_bank/question_reception/study_book/get_answer_topic_record",
|
|
|
{
|
|
|
chapter_id: currentTab.value,
|
|
|
- is_correct: isRight.value,
|
|
|
+ is_correct,
|
|
|
}
|
|
|
).then((res) => {
|
|
|
- if (isRight.value) {
|
|
|
+ if (onSucess) {
|
|
|
+ onSucess(res.data.data);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (is_correct) {
|
|
|
rightTotal.value = res.data.total;
|
|
|
+ dataList.value = res.data.data;
|
|
|
} else {
|
|
|
errorTotal.value = res.data.total;
|
|
|
}
|
|
|
});
|
|
|
+};
|
|
|
+const requestExamList = () => {
|
|
|
+ request("api/question_bank/question_reception/real_topic/get_exam_record", {
|
|
|
+ chapter_id: currentTab.value,
|
|
|
+ }).then((res) => {
|
|
|
+ examList.value = res.data;
|
|
|
+ });
|
|
|
+};
|
|
|
+const requestFavo = () => {
|
|
|
+ request(
|
|
|
+ "api/question_bank/question_reception/favorite/get_user_favorite_list",
|
|
|
+ {
|
|
|
+ chapter_id: currentTab.value,
|
|
|
+ }
|
|
|
+ ).then((res) => {
|
|
|
+ favoriteList.value = res.data.data;
|
|
|
+ });
|
|
|
+};
|
|
|
+const toFavorite = (item) => {
|
|
|
+ console.log(item);
|
|
|
+};
|
|
|
+watch(currentIndex, () => {
|
|
|
+ switch (currentIndex.value) {
|
|
|
+ case 1:
|
|
|
+ requestExamList();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ requestFavo();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+watch(currentTab, () => {
|
|
|
+ switch (currentIndex.value) {
|
|
|
+ case 0:
|
|
|
+ isRight.value = 1;
|
|
|
+ requestTopic(isRight.value);
|
|
|
+ requestTopic(Number(!isRight.value));
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ requestExamList();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ requestFavo();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+});
|
|
|
+watch(isRight, () => {
|
|
|
+ dataList.value = [];
|
|
|
+ requestTopic(isRight.value, (data) => {
|
|
|
+ dataList.value = data;
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
onShow(() => {
|