|
@@ -7,6 +7,7 @@
|
|
}"
|
|
}"
|
|
:showBack="false"
|
|
:showBack="false"
|
|
headerColor="#fff"
|
|
headerColor="#fff"
|
|
|
|
+ @scrolltolower="scrolltolower"
|
|
>
|
|
>
|
|
<div class="top">
|
|
<div class="top">
|
|
<div
|
|
<div
|
|
@@ -118,6 +119,16 @@ const errorTotal = ref(0);
|
|
const dataList = ref([]);
|
|
const dataList = ref([]);
|
|
const examList = ref([]);
|
|
const examList = ref([]);
|
|
const favoriteList = ref([]);
|
|
const favoriteList = ref([]);
|
|
|
|
+const pageParams = ref({
|
|
|
|
+ limit: 10,
|
|
|
|
+ page_num: 1,
|
|
|
|
+});
|
|
|
|
+const initPage = () => {
|
|
|
|
+ pageParams.value = {
|
|
|
|
+ limit: 10,
|
|
|
|
+ page_num: 1,
|
|
|
|
+ };
|
|
|
|
+};
|
|
|
|
|
|
const toHistory = (item) => {
|
|
const toHistory = (item) => {
|
|
router.push({
|
|
router.push({
|
|
@@ -128,24 +139,40 @@ const toHistory = (item) => {
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
-const requestTopic = (is_correct, onSucess) => {
|
|
|
|
|
|
+const scrolltolower = (e) => {
|
|
|
|
+ pageParams.value.page_num += 1;
|
|
|
|
+ requestTopic(isRight.value);
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const requestTopic = (is_correct) => {
|
|
|
|
+ const t = isRight.value ? rightTotal.value : errorTotal.value;
|
|
|
|
+ if (t < pageParams.value.limit * (pageParams.value.page_num - 1)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
request(
|
|
request(
|
|
"api/question_bank/question_reception/study_book/get_answer_topic_record",
|
|
"api/question_bank/question_reception/study_book/get_answer_topic_record",
|
|
{
|
|
{
|
|
chapter_id: currentTab.value,
|
|
chapter_id: currentTab.value,
|
|
is_correct,
|
|
is_correct,
|
|
|
|
+ showToast: false,
|
|
|
|
+ ...pageParams.value,
|
|
}
|
|
}
|
|
).then((res) => {
|
|
).then((res) => {
|
|
- if (onSucess) {
|
|
|
|
- onSucess(res.data.data);
|
|
|
|
- return;
|
|
|
|
|
|
+ let da = [];
|
|
|
|
+ if (pageParams.value.page_num !== 1) {
|
|
|
|
+ console.log(pageParams.value);
|
|
|
|
+
|
|
|
|
+ da = dataList.value;
|
|
}
|
|
}
|
|
|
|
+ da.push(...res.data.data);
|
|
if (is_correct) {
|
|
if (is_correct) {
|
|
rightTotal.value = res.data.total;
|
|
rightTotal.value = res.data.total;
|
|
- dataList.value = res.data.data;
|
|
|
|
} else {
|
|
} else {
|
|
errorTotal.value = res.data.total;
|
|
errorTotal.value = res.data.total;
|
|
}
|
|
}
|
|
|
|
+ if (isRight.value === is_correct) {
|
|
|
|
+ dataList.value = da;
|
|
|
|
+ }
|
|
});
|
|
});
|
|
};
|
|
};
|
|
const requestExamList = () => {
|
|
const requestExamList = () => {
|
|
@@ -156,13 +183,24 @@ const requestExamList = () => {
|
|
});
|
|
});
|
|
};
|
|
};
|
|
const requestFavo = () => {
|
|
const requestFavo = () => {
|
|
|
|
+ if (
|
|
|
|
+ info.value.favorite_total <
|
|
|
|
+ pageParams.value.limit * (pageParams.value.page_num - 1)
|
|
|
|
+ )
|
|
|
|
+ return;
|
|
request(
|
|
request(
|
|
"api/question_bank/question_reception/favorite/get_user_favorite_list",
|
|
"api/question_bank/question_reception/favorite/get_user_favorite_list",
|
|
{
|
|
{
|
|
chapter_id: currentTab.value,
|
|
chapter_id: currentTab.value,
|
|
|
|
+ ...pageParams.value,
|
|
}
|
|
}
|
|
).then((res) => {
|
|
).then((res) => {
|
|
- favoriteList.value = res.data.data;
|
|
|
|
|
|
+ let da = [];
|
|
|
|
+ if (pageParams.value.page_num !== 1) {
|
|
|
|
+ da = favoriteList.value;
|
|
|
|
+ }
|
|
|
|
+ da.push(...res.data.data);
|
|
|
|
+ favoriteList.value = da;
|
|
});
|
|
});
|
|
};
|
|
};
|
|
const toFavorite = () => {
|
|
const toFavorite = () => {
|
|
@@ -175,6 +213,7 @@ const toFavorite = () => {
|
|
});
|
|
});
|
|
};
|
|
};
|
|
watch([currentIndex, show], () => {
|
|
watch([currentIndex, show], () => {
|
|
|
|
+ initPage();
|
|
switch (currentIndex.value) {
|
|
switch (currentIndex.value) {
|
|
case 1:
|
|
case 1:
|
|
requestExamList();
|
|
requestExamList();
|
|
@@ -187,6 +226,7 @@ watch([currentIndex, show], () => {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
watch([currentTab, show], () => {
|
|
watch([currentTab, show], () => {
|
|
|
|
+ initPage();
|
|
switch (currentIndex.value) {
|
|
switch (currentIndex.value) {
|
|
case 0:
|
|
case 0:
|
|
isRight.value = 1;
|
|
isRight.value = 1;
|
|
@@ -204,10 +244,8 @@ watch([currentTab, show], () => {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
watch([isRight, show], () => {
|
|
watch([isRight, show], () => {
|
|
- dataList.value = [];
|
|
|
|
- requestTopic(isRight.value, (data) => {
|
|
|
|
- dataList.value = data;
|
|
|
|
- });
|
|
|
|
|
|
+ initPage();
|
|
|
|
+ requestTopic(isRight.value);
|
|
});
|
|
});
|
|
onShow(() => {
|
|
onShow(() => {
|
|
show.value = true;
|
|
show.value = true;
|
|
@@ -221,6 +259,11 @@ onShow(() => {
|
|
|
|
|
|
onHide(() => {
|
|
onHide(() => {
|
|
show.value = false;
|
|
show.value = false;
|
|
|
|
+ info.value = {};
|
|
|
|
+ dataList.value = [];
|
|
|
|
+ examList.value = [];
|
|
|
|
+ favoriteList.value = [];
|
|
|
|
+ initPage();
|
|
});
|
|
});
|
|
// 示例数据
|
|
// 示例数据
|
|
</script>
|
|
</script>
|