|
|
@@ -1,16 +1,20 @@
|
|
|
<template>
|
|
|
- <ie-page ref="iePageRef">
|
|
|
- <ie-navbar :title="pageTitle" />
|
|
|
- <view class="px-30 py-16 bg-back">
|
|
|
- <view class="flex items-center justify-end gap-x-4" @click="handleViewHistory">
|
|
|
- <uv-icon name="clock" size="16" color="#31A0FC"></uv-icon>
|
|
|
- <text class="text-28 text-primary">查看记录</text>
|
|
|
- <uv-icon name="arrow-right" size="16" color="#31A0FC"></uv-icon>
|
|
|
+ <ie-page>
|
|
|
+ <z-paging ref="pagingRef" v-model="treeData" :loading-more-enabled="false" :auto="false" @query="loadKnowledgeList">
|
|
|
+ <template #top>
|
|
|
+ <ie-navbar :title="pageTitle" />
|
|
|
+ <view class="px-30 py-16 bg-back">
|
|
|
+ <view class="flex items-center justify-end gap-x-4" @click="handleViewHistory">
|
|
|
+ <uv-icon name="clock" size="16" color="#31A0FC"></uv-icon>
|
|
|
+ <text class="text-28 text-primary">查看记录</text>
|
|
|
+ <uv-icon name="arrow-right" size="16" color="#31A0FC"></uv-icon>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ <view class="px-40">
|
|
|
+ <knowledgeTree :tree-data="treeData" @start-practice="handleStartPractice" />
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <view class="px-40">
|
|
|
- <knowledgeTree :tree-data="treeData" @start-practice="handleStartPractice" />
|
|
|
- </view>
|
|
|
+ </z-paging>
|
|
|
</ie-page>
|
|
|
</template>
|
|
|
|
|
|
@@ -23,11 +27,12 @@ import * as Study from '@/types/study';
|
|
|
import { EnumPaperType, EnumUserRole } from '@/common/enum';
|
|
|
import { useUserStore } from '@/store/userStore';
|
|
|
import { useAuth } from '@/hooks/useAuth';
|
|
|
-const { prevData, transferTo } = useTransferPage();
|
|
|
|
|
|
+const { prevData, transferTo } = useTransferPage();
|
|
|
const userStore = useUserStore();
|
|
|
-const iePageRef = ref<InstanceType<typeof IePage>>();
|
|
|
+const pagingRef = ref();
|
|
|
const { hasPermission } = useAuth();
|
|
|
+
|
|
|
const pageTitle = computed(() => {
|
|
|
return '教材同步练习';
|
|
|
});
|
|
|
@@ -39,20 +44,22 @@ const handleViewHistory = () => {
|
|
|
data: {}
|
|
|
});
|
|
|
}
|
|
|
-const loadKnowledgeList = async () => {
|
|
|
+
|
|
|
+const loadKnowledgeList = async (page: number, size: number) => {
|
|
|
try {
|
|
|
uni.$ie.showLoading();
|
|
|
const { data } = await getTextbooksKnowledgeList();
|
|
|
treeData.value = data as Study.KnowledgeNode[];
|
|
|
+ pagingRef.value.complete(data);
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
+ pagingRef.value.complete(false);
|
|
|
} finally {
|
|
|
uni.$ie.hideLoading();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const handleStartPractice = async (node: Study.KnowledgeNode) => {
|
|
|
- // const isVip = await userStore.checkVip();
|
|
|
const hasAuth = hasPermission([EnumUserRole.VIP, EnumUserRole.AGENT, EnumUserRole.TEACHER]);
|
|
|
if (hasAuth) {
|
|
|
transferTo('/pagesStudy/pages/exam-start/exam-start', {
|
|
|
@@ -69,7 +76,10 @@ const handleStartPractice = async (node: Study.KnowledgeNode) => {
|
|
|
}
|
|
|
|
|
|
onShow(() => {
|
|
|
- loadKnowledgeList();
|
|
|
+ nextTick(() => {
|
|
|
+ // 下拉刷新数据
|
|
|
+ pagingRef.value?.refresh();
|
|
|
+ });
|
|
|
});
|
|
|
</script>
|
|
|
|