From 6c66c97e330ea5c813a6288be71ef093d83b589d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E4=BA=86=E4=B8=AA=E7=99=BD?= <543593352@qq.com> Date: Mon, 11 Nov 2024 12:53:16 +0800 Subject: [PATCH] 1 --- .../container/newTask/taskTypeView.vue | 120 +++++++++++++----- 1 file changed, 91 insertions(+), 29 deletions(-) diff --git a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue index e68b0a4..4ad19c4 100644 --- a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue +++ b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue @@ -286,8 +286,8 @@ import whiteboard from '@/components/whiteboard/whiteboard.vue' import prevReadMsgDialog from '@/views/classTask/container/newTask/prevReadMsg-Dialog.vue' import examDetailsDrawer from '@/components/exam-question/examDetailsDrawer.vue' import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuestion/jyeoo" - -import {debounce } from '@/utils/comm' + +import {throttle,debounce } from '@/utils/comm' import { useToolState } from '@/store/modules/tool' import useUserStore from '@/store/modules/user' const userStore = useUserStore().user @@ -434,6 +434,28 @@ const handleQueryParamFromEntpCourseWork = (queryType) => { handleQueryFromEntpCourseWork(queryType); }; +let obj = {}; + +function Apis(key) { + obj[key] = []; + return function(task) { + return new Promise((resolve, reject) => { + obj[key].push(task); + Promise.all([...obj[key]]).then(res => { + const i = obj[key].findIndex(item => { + return item == task; + }); + resolve(obj[key][i]); + //arr.splice(i, 1); + }) + }) + } + } + + + const client = new Apis('/paht'); + + /** * @desc: 1、习题训练 - 新查询试题 * @return: {*} @@ -442,42 +464,60 @@ const handleQueryParamFromEntpCourseWork = (queryType) => { * 1 - 按条件查询 * 2 - 按关键词查询 */ + const t = function(name, time) { + return new Promise(resolve => { + const queryForm = { + // 分页参数 + currentPage: paginationParams.pageNum, + pageSize: paginationParams.pageSize, + // 课程相关参数 + eid: props.bookobj.levelSecondId, + sectionName: props.bookobj.coursetitle, + edusubject: userStore.edusubject, + edustage: userStore.edustage, + // + // 题类 + worktype: entpCourseWorkQueryParams.worktype.label, + workTypeId: entpCourseWorkQueryParams.worktype.value, + // 题源 + workgroup: entpCourseWorkQueryParams.workgroup, + // 年份 + yearStr: entpCourseWorkQueryParams.yearStr !== '-1' ? entpCourseWorkQueryParams.yearStr:'', + // 知识点 + thirdId: entpCourseWorkQueryParams.point.length > 0 ? entpCourseWorkQueryParams.point[0]:'', + // 关键字 + keyword: entpCourseWorkQueryParams.keyWord && entpCourseWorkQueryParams.keyWord !== '' ? entpCourseWorkQueryParams.keyWord:'', + + } + const entpcourseworkres = listEntpcourseworkNew(queryForm); + + resolve(entpcourseworkres); + }) + } const handleQueryFromEntpCourseWork= async (queryType) => { pageParams.value.loading = true; - const queryForm = { - // 分页参数 - currentPage: paginationParams.pageNum, - pageSize: paginationParams.pageSize, - // 课程相关参数 - eid: props.bookobj.levelSecondId, - sectionName: props.bookobj.coursetitle, - edusubject: userStore.edusubject, - edustage: userStore.edustage, - // - // 题类 - worktype: entpCourseWorkQueryParams.worktype.label, - workTypeId: entpCourseWorkQueryParams.worktype.value, - // 题源 - workgroup: entpCourseWorkQueryParams.workgroup, - // 年份 - yearStr: entpCourseWorkQueryParams.yearStr !== '-1' ? entpCourseWorkQueryParams.yearStr:'', - // 知识点 - thirdId: entpCourseWorkQueryParams.point.length > 0 ? entpCourseWorkQueryParams.point[0]:'', - // 关键字 - keyword: entpCourseWorkQueryParams.keyWord && entpCourseWorkQueryParams.keyWord !== '' ? entpCourseWorkQueryParams.keyWord:'', - - } + // 初中政治特殊处理( warn: 需确认是否修改 ) // if (this.courseObj.edusubject=='政治' && this.courseObj.edustage=='初中') { // // [初中+政治]需改为[初中+道德与法治] // queryForm.edusubject = '道德与法治'; // } + + client(t('任务1', 1500)).then(res => { + console.log("请求返回",res); + if(paginationParams.pageNum == 1){ + workResource.entpCourseWorkList = []; + workResource.entpCourseWorkTotal = 0; - const entpcourseworkres = await listEntpcourseworkNew(queryForm); - const data = entpcourseworkres.data; - if(data && data.length>0){ + // 初始化下拉滚动条参数 + // pageParams.value.loading = false; + // pageParams.value.isFirst = true; + // pageParams.value.originCount = 0; + } + const data = res.data || []; + if(data && data.length>0){ // workResource.entpCourseWorkList = entpcourseworkres.data; // workResource.entpCourseWorkTotal = entpcourseworkres.data.length; @@ -498,6 +538,12 @@ const handleQueryFromEntpCourseWork= async (queryType) => { } } pageParams.value.loading = false; + }); + + //const entpcourseworkres = await listEntpcourseworkNew(queryForm); + + // const data = entpcourseworkres.data; + } // 教学资源,从课标分析、教材分析里来 @@ -956,6 +1002,23 @@ onMounted(async() => { }) +// const refreshData = () => { +// console.log("刷新数据") +// // 初始化滚动加载参数 +// initPageParams(); +// // 习题资源 +// handleQueryFromEntpCourseWork(0); +// // 框架梳理 +// getQueryFromEvaluationclue(); +// // 知识点 +// getEntpCourseWorkPointList(); +// } +// // 结合防抖和节流 +// const debounceQueryData = debounce(throttle(refreshData, 1000), 1000); + + + +// 防抖 const debounceQueryData = debounce(() => { console.log("防抖 加载数据中...") // 初始化滚动加载参数 @@ -968,7 +1031,6 @@ const debounceQueryData = debounce(() => { getEntpCourseWorkPointList(); }, 1000); - watch(() => props.propsformobj.uniquekey, (newVal) => { console.log(props.propsformobj,'propsformobj') if(props.propsformobj.uniquekey){