|
@@ -70,7 +70,11 @@
|
|
|
</div>
|
|
|
<div class="context">
|
|
|
<template v-if="currentIndex === 0 && dataList.length">
|
|
|
- <QuestionsItem :data="dataList" :isRight="isRight" :catalogue_id="currentTab" />
|
|
|
+ <QuestionsItem
|
|
|
+ :data="dataList"
|
|
|
+ :isRight="isRight"
|
|
|
+ :catalogue_id="currentTab"
|
|
|
+ />
|
|
|
</template>
|
|
|
<template v-else-if="currentIndex === 1 && examList.length">
|
|
|
<div class="card" v-for="item in examList" :key="item.catalogue_id">
|
|
@@ -88,11 +92,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<template v-else-if="currentIndex === 2 && favoriteList.length">
|
|
|
- <QuestionsItem
|
|
|
- :data="favoriteList"
|
|
|
- isRight
|
|
|
- :onClick="toFavorite"
|
|
|
- />
|
|
|
+ <QuestionsItem :data="favoriteList" isRight :onClick="toFavorite" />
|
|
|
</template>
|
|
|
<Empty v-else text="暂无数据"></Empty>
|
|
|
</div>
|
|
@@ -103,11 +103,12 @@
|
|
|
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 { onShow, onHide } from "@dcloudio/uni-app";
|
|
|
import { request } from "../../utils/request";
|
|
|
import QuestionsItem from "../../components/Topic/QuestionsItem.vue";
|
|
|
import { router } from "../../utils/router";
|
|
|
|
|
|
+const show = ref(true);
|
|
|
const currentIndex = ref(0);
|
|
|
const currentTab = ref(0);
|
|
|
const isRight = ref(1);
|
|
@@ -117,6 +118,7 @@ const errorTotal = ref(0);
|
|
|
const dataList = ref([]);
|
|
|
const examList = ref([]);
|
|
|
const favoriteList = ref([]);
|
|
|
+
|
|
|
const toHistory = (item) => {
|
|
|
router.push({
|
|
|
url: "/pages/real/history",
|
|
@@ -168,11 +170,11 @@ const toFavorite = () => {
|
|
|
url: "/pages/learn/favorite",
|
|
|
params: {
|
|
|
chapter_id: currentTab.value,
|
|
|
- title: '收藏'
|
|
|
+ title: "收藏",
|
|
|
},
|
|
|
});
|
|
|
};
|
|
|
-watch(currentIndex, () => {
|
|
|
+watch([currentIndex, show], () => {
|
|
|
switch (currentIndex.value) {
|
|
|
case 1:
|
|
|
requestExamList();
|
|
@@ -184,8 +186,7 @@ watch(currentIndex, () => {
|
|
|
break;
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
-watch(currentTab, () => {
|
|
|
+watch([currentTab, show], () => {
|
|
|
switch (currentIndex.value) {
|
|
|
case 0:
|
|
|
isRight.value = 1;
|
|
@@ -202,14 +203,14 @@ watch(currentTab, () => {
|
|
|
break;
|
|
|
}
|
|
|
});
|
|
|
-watch(isRight, () => {
|
|
|
+watch([isRight, show], () => {
|
|
|
dataList.value = [];
|
|
|
requestTopic(isRight.value, (data) => {
|
|
|
dataList.value = data;
|
|
|
});
|
|
|
});
|
|
|
-
|
|
|
onShow(() => {
|
|
|
+ show.value = true;
|
|
|
request(
|
|
|
"api/question_bank/question_reception/study_book/get_study_record_title"
|
|
|
).then((res) => {
|
|
@@ -217,6 +218,10 @@ onShow(() => {
|
|
|
currentTab.value = res.data.chapter_infos[0].id;
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+onHide(() => {
|
|
|
+ show.value = false;
|
|
|
+});
|
|
|
// 示例数据
|
|
|
</script>
|
|
|
|