From c72d103082886add0aaaa4d8156ff8c9d38c668d Mon Sep 17 00:00:00 2001 From: lyc Date: Wed, 14 Aug 2024 14:57:00 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/hooks/useGetHomework.js | 6 +- src/renderer/src/views/prepare/index.vue | 120 +----------------- .../src/views/tool/components/homework.vue | 2 +- 3 files changed, 13 insertions(+), 115 deletions(-) diff --git a/src/renderer/src/hooks/useGetHomework.js b/src/renderer/src/hooks/useGetHomework.js index c881f94..ebdabf3 100644 --- a/src/renderer/src/hooks/useGetHomework.js +++ b/src/renderer/src/hooks/useGetHomework.js @@ -11,6 +11,7 @@ let chapterId = null export const useGetHomework = async (node) => { /** * node + * 左侧选择章节的节点数据 */ if (!node) return curNode = node @@ -26,7 +27,10 @@ export const useGetHomework = async (node) => { chapterId = rows[0].id } - return await getHomeWorkList() + return new Promise(async (resolve) =>{ + const res = await getHomeWorkList() + resolve({res,chapterId}) + }) } diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index a26068a..7bbd9ca 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -139,7 +139,6 @@ import { useToolState } from '@/store/modules/tool' import MoveFile from '@/components/move-file/index.vue' import FileListItem from '@/views/prepare/container/file-list-item.vue' import { getSmarttalkPage, moveSmarttalk } from '@/api/file' -import { homeworklist, listEntpcourse } from '@/api/teaching/classwork' import { toTimeText } from '@/utils/date' import { ElMessage } from 'element-plus' import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile' @@ -148,8 +147,9 @@ import SetHomework from './container/set-homework.vue' import outLink from '@/utils/linkConfig' import { createWindow } from '@/utils/tool' import { cloneDeep } from 'lodash' -import { delClasswork, addEntpcourse } from '@/api/teaching/classwork' +import { delClasswork } from '@/api/teaching/classwork' import { getSelfReserv, startClass } from '@/api/classManage' +import { useGetHomework } from '@/hooks/useGetHomework' const toolStore = useToolState() const fs = require('fs') const { ipcRenderer } = window.electron || {} @@ -428,44 +428,11 @@ export default { this.initHomeWork() await this.asyncAllFile() }, + // 获取作业 async initHomeWork() { - - if (this.uploadData.levelSecondId) { - // 获取作业列表所需ID 可能存在没有 - let { rows } = await this.getChapterId() - if (rows.length > 0) { - this.entpcourseid = rows[0].id - } else { - await this.createEntpcourse() - let { rows } = await this.getChapterId() - this.entpcourseid = rows[0].id - } - - // 查询作业 - this.getHomeWorkList() - } - }, - // 创建新的entpcourse - createEntpcourse() { - // 参照 web AIx 传入参数 - var cform = {} - cform.entpid = this.userStore.deptId - cform.level = 1 - cform.parentid = 0 - cform.dictid = 0 - cform.evalid = this.currentNode.id - cform.evalparentid = 0 - cform.edusubject = this.currentNode.edusubject - cform.edudegree = this.currentNode.edudegree - cform.edustage = this.currentNode.edustage - cform.coursetype = '课标学科' - cform.coursetitle = this.currentNode.itemtitle - cform.coursedesc = '' - cform.status = '' - cform.dflag = 0 - cform.edituserid = this.userStore.userId - cform.createblankfile = 'yes' - return addEntpcourse(cform) + const { res, chapterId } = await useGetHomework(this.currentNode) + this.entpcourseid = chapterId + this.currentWorkList = cloneDeep(res) }, openReserv() { this.$refs['reservDialog'].openDialog() @@ -495,79 +462,6 @@ export default { cookieData: { ...configObj.data } }) }, - // 根据教材章节单元ID 查询作业列表所需ID - getChapterId() { - return listEntpcourse({ - evalid: this.uploadData.levelSecondId, - edituserid: this.userStore.userId, - pageSize: 500 - }) - }, - - // 查询作业列表 - getHomeWorkList() { - homeworklist({ - entpcourseid: this.entpcourseid, - edituserid: this.userStore.userId, - pageSize: 100 - }).then((res) => { - //以下代码 参照AIx web端 作业布置 - let list = [] - for (var i = 0; i < res.rows.length; i++) { - res.rows[i].taskconfig = [] - - // 找child - for (var j = 0; j < res.rows.length; j++) { - if (res.rows[j].parentid == res.rows[i].id) { - var ss = [] - if (res.rows[j].classworkdatastudentids != null) { - ss = JSON.parse('[' + res.rows[j].classworkdatastudentids + ']') - } - var js = { - id: res.rows[j].id, - classid: res.rows[j].classid, - classcaption: res.rows[j].classcaption, - parentid: 0, - worktype: '', - workkey: res.rows[j].workkey, - worktag: '', - entpcourseid: 0, - evalid: 0, - edusubject: '', - edudegree: '', - workdate: '', - title: '', - workcodes: '', - studentlist: ss, - deaddate: res.rows[j].deaddate, - timelength: res.rows[j].timelength, - weights: res.rows[j].weights, - feedtype: res.rows[j].feedtype - } - res.rows[i].taskconfig.push(js) - } - } - res.rows[i].fileShowName = res.rows[i].uniquekey - - // 注意slideid>0的,这一些作业是添加到PPT页面的,所以在作业管理中不能出现 - // 2024-05-15,酉阳,jackyshen - if (res.rows[i].classid == 0 && res.rows[i].slideid == 0) { - list.push(res.rows[i]) - } - - // 如果是习题训练任务,则检查一共有多少道 - if (res.rows[i].entpcourseworklist != '') { - res.rows[i].entpcourseworklistarray = JSON.parse( - '[' + res.rows[i].entpcourseworklist + ']' - ) - } else { - res.rows[i].entpcourseworklistarray = [] - } - } - // 深度克隆 - this.currentWorkList = cloneDeep(list) - }) - }, getWeekday1(date) { const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'] const weekday = new Date(date).getDay() @@ -586,7 +480,7 @@ export default { ElMessage.success('操作成功') this.isLoading = false await this.asyncAllFile() - this.getHomeWorkList() + this.initHomeWork() }) .catch(() => { this.isLoading = false diff --git a/src/renderer/src/views/tool/components/homework.vue b/src/renderer/src/views/tool/components/homework.vue index ce13160..9f4d59b 100644 --- a/src/renderer/src/views/tool/components/homework.vue +++ b/src/renderer/src/views/tool/components/homework.vue @@ -118,7 +118,7 @@ const closeHomework = () => { const changeChapter = async (data)=>{ - const res = await useGetHomework(data) + const { res } = await useGetHomework(data) dataList.value = res let cata = parseCataByNode(data) From 4754ed641c092120a701db73da816081b74f09b6 Mon Sep 17 00:00:00 2001 From: lyc Date: Wed, 14 Aug 2024 16:40:43 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=B8=8A=E8=AF=BE-=E4=BD=9C=E4=B8=9A=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/tool/components/homework.vue | 75 ++----------------- 1 file changed, 8 insertions(+), 67 deletions(-) diff --git a/src/renderer/src/views/tool/components/homework.vue b/src/renderer/src/views/tool/components/homework.vue index 9f4d59b..1ecbcf8 100644 --- a/src/renderer/src/views/tool/components/homework.vue +++ b/src/renderer/src/views/tool/components/homework.vue @@ -73,7 +73,6 @@ import { ref, onMounted, toRaw } from 'vue'; import { useRoute } from 'vue-router'; import useUserStore from '@/store/modules/user' -import { homeworklist } from '@/api/teaching/classwork' import { getSmarttalkPage, getPrepareById } from '@/api/file' import SetHomework from '@/views/prepare/container/set-homework.vue' import FileImage from '@/components/file-image/index.vue' @@ -145,7 +144,7 @@ const openFileLink = (item) =>{ // 获取资源数据 const getResource = () => { let querySearch = toRaw(toolStore.curSubjectNode).querySearch - + querySearch.orderByColumn = 'uploadTime' querySearch.isAsc = 'desc' querySearch.pageSize = 500 @@ -156,71 +155,13 @@ const getResource = () => { } -// 获取作业数据 -const getHomework = () => { +//获取作业数据 +const getHomework = async () => { + const data = toRaw(toolStore.curSubjectNode).data.node loading.value = true try { - homeworklist({ - entpcourseid: entpcourseid.value, - edituserid: usertore.userId, - pageSize: 100 - }).then(res => { - //以下代码 参照AIx web端 作业布置 - let list = [] - for (var i = 0; i < res.rows.length; i++) { - res.rows[i].taskconfig = [] - - // 找child - for (var j = 0; j < res.rows.length; j++) { - if (res.rows[j].parentid == res.rows[i].id) { - var ss = [] - if (res.rows[j].classworkdatastudentids != null) { - ss = JSON.parse('[' + res.rows[j].classworkdatastudentids + ']') - } - var js = { - id: res.rows[j].id, - classid: res.rows[j].classid, - classcaption: res.rows[j].classcaption, - parentid: 0, - worktype: '', - workkey: res.rows[j].workkey, - worktag: '', - entpcourseid: 0, - evalid: 0, - edusubject: '', - edudegree: '', - workdate: '', - title: '', - workcodes: '', - studentlist: ss, - deaddate: res.rows[j].deaddate, - timelength: res.rows[j].timelength, - weights: res.rows[j].weights, - feedtype: res.rows[j].feedtype - } - res.rows[i].taskconfig.push(js) - } - } - res.rows[i].fileShowName = res.rows[i].uniquekey - - // 注意slideid>0的,这一些作业是添加到PPT页面的,所以在作业管理中不能出现 - // 2024-05-15,酉阳,jackyshen - if (res.rows[i].classid == 0 && res.rows[i].slideid == 0) { - list.push(res.rows[i]) - } - - // 如果是习题训练任务,则检查一共有多少道 - if (res.rows[i].entpcourseworklist != '') { - res.rows[i].entpcourseworklistarray = JSON.parse( - '[' + res.rows[i].entpcourseworklist + ']' - ) - } else { - res.rows[i].entpcourseworklistarray = [] - } - } - - dataList.value = list - }) + const { res } = await useGetHomework(data) + dataList.value = res } finally { loading.value = false } @@ -245,10 +186,10 @@ function leave(el, done) { onMounted(() => { entpcourseid.value = route.query.entpcourseid lesson.value = route.query.label - getHomework() setTimeout(()=>{ + getHomework() getResource() - },1000) + },200) }) From 2a84455f05a9a6524a7196c1c2936957538d647d Mon Sep 17 00:00:00 2001 From: lyc Date: Thu, 15 Aug 2024 09:55:37 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=95=99=E6=9D=90=E5=B0=81=E9=9D=A2baseUrl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/components/choose-textbook/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/src/components/choose-textbook/index.vue b/src/renderer/src/components/choose-textbook/index.vue index 9c02172..3c2f6a5 100644 --- a/src/renderer/src/components/choose-textbook/index.vue +++ b/src/renderer/src/components/choose-textbook/index.vue @@ -46,7 +46,7 @@ import { onMounted, ref, nextTick, toRaw, reactive } from 'vue'; import useUserStore from '@/store/modules/user' import { listEvaluation } from '@/api/subject' -const BaseUrl = 'https://prev.ysaix.com:7868/' +const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH // 定义要发送的emit事件 const emit = defineEmits(['nodeClick', 'changeBook']) // store From 1dce3f6f70779379ca06206bebc41a35c5ca82eb Mon Sep 17 00:00:00 2001 From: zhangxuelin <959231531@qq.com> Date: Thu, 15 Aug 2024 09:57:46 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/utils/tool.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/utils/tool.js b/src/renderer/src/utils/tool.js index a1f0baf..a874e2d 100644 --- a/src/renderer/src/utils/tool.js +++ b/src/renderer/src/utils/tool.js @@ -87,10 +87,10 @@ export function ipcHandle(fn,key, cb) { let wins_tool = null let winPdf=null export const createWindow = async (type, data) => { - if (wins_tool) return console.error('createWindow: win is have') - if (!type) return console.error('createWindow: type is null') switch(type) { case 'tool-sphere': { // 创建-悬浮球 + if (wins_tool) return console.error('createWindow: win is have') + if (!type) return console.error('createWindow: type is null') const option = data.option||{} const defOption = { frame: false, // 要创建无边框窗口 From 6e8c96ce2ec4ded9d2ee41e36e45f868c153f9cd Mon Sep 17 00:00:00 2001 From: lyc Date: Thu, 15 Aug 2024 10:31:11 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=B8=83=E7=BD=AE=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=97=A5=E6=9C=9F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/prepare/container/set-homework.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/views/prepare/container/set-homework.vue b/src/renderer/src/views/prepare/container/set-homework.vue index c607e43..5aa5d35 100644 --- a/src/renderer/src/views/prepare/container/set-homework.vue +++ b/src/renderer/src/views/prepare/container/set-homework.vue @@ -263,9 +263,15 @@ export default { getCurrentDate() { const now = new Date(); const year = now.getFullYear(); - const month = now.getMonth() + 1; // 月份是从0开始的,所以需要+1 - const day = now.getDate() - return `${year}-${month.length == 2 ? month : '0' + month}-${day.length == 2 ? day : '0' + day}`; + let month = now.getMonth() + 1; // 月份是从0开始的,所以需要+1 + let day = now.getDate() + if(month < 10){ + month = '0' + month + } + if(day < 10){ + day = '0' + day + } + return `${year}-${month}-${day}`; }, validateGrade(rule, value, callback) { if (this.studentList.length == 0) { From 2ee5e24e6f7870c45baf3cf726d214af082f1ece Mon Sep 17 00:00:00 2001 From: zhangxuelin <959231531@qq.com> Date: Thu, 15 Aug 2024 11:18:33 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=20bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/views/classManage/classReserv.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/views/classManage/classReserv.vue b/src/renderer/src/views/classManage/classReserv.vue index 11529c1..dbabd76 100644 --- a/src/renderer/src/views/classManage/classReserv.vue +++ b/src/renderer/src/views/classManage/classReserv.vue @@ -55,9 +55,11 @@ const toolStore = useToolState() watch( () => [dataList,toolStore.isToolWin], () => { - getSelfReserv().then((res) => { + setTimeout(()=>{ + getSelfReserv().then((res) => { dataList.value = [...res.data] - }) + }) + },300) } ) onMounted(() => {