diff --git a/src/renderer/src/hooks/useHandleData.js b/src/renderer/src/hooks/useHandleData.js new file mode 100644 index 0000000..289117d --- /dev/null +++ b/src/renderer/src/hooks/useHandleData.js @@ -0,0 +1,34 @@ +import { ElMessageBox, ElMessage } from "element-plus"; + +/** + * @description 操作单条数据信息(二次确认【删除、禁用、启用、重置密码】) + * @param {Function} api 操作数据接口的api方法(必传) + * @param {Object} params 携带的操作数据参数 {id,params}(必传) + * @param {String} message 提示信息(必传) + * @param {String} confirmType icon类型(不必传,默认为 warning) | "success" | "warning" | "info" | "error" + * @return Promise + */ + +export const useHandleData = ( + api, + params, + message, + confirmType= "warning" +) => { + return new Promise((resolve, reject) => { + ElMessageBox.confirm(`是否${message}?`, "温馨提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: confirmType, + draggable: true + }).then(async () => { + const res = await api(params); + if (!res) return reject(false); + ElMessage({ + type: "success", + message: `${message}成功!` + }); + resolve(true); + }).catch(() => { }); + }); +}; diff --git a/src/renderer/src/router/index.js b/src/renderer/src/router/index.js index 9a1a89c..07ecd68 100644 --- a/src/renderer/src/router/index.js +++ b/src/renderer/src/router/index.js @@ -117,6 +117,12 @@ const dynamicRoutes = [ name: 'classTaskAssign', meta: { title: '作业布置', showBread: true } }, + { + path: 'newClassTaskAssign', + component: () => import('@/views/classTask/newClassTaskAssign/index.vue'), + name: 'newClassTaskAssign', + meta: { title: '新作业设计', showBread: true } + }, { path: 'classTask', component: () => import('@/views/classTask/classTask.vue'), diff --git a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue index 04ff553..a512cc6 100644 --- a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue +++ b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue @@ -465,10 +465,10 @@ function Apis(key) { }) }) } - } +} - const client = new Apis('/paht'); +const client = new Apis('/paht'); /** @@ -513,13 +513,6 @@ const handleQueryFromEntpCourseWork= async (queryType) => { pageParams.value.loading = true; - - // 初中政治特殊处理( warn: 需确认是否修改 ) - // if (this.courseObj.edusubject=='政治' && this.courseObj.edustage=='初中') { - // // [初中+政治]需改为[初中+道德与法治] - // queryForm.edusubject = '道德与法治'; - // } - client(t('任务1', 1500)).then(res => { //console.log("请求返回",res); // if(paginationParams.pageNum == 1){ @@ -533,31 +526,31 @@ const handleQueryFromEntpCourseWork= async (queryType) => { // } const data = res.data || []; if(data && data.length>0){ - // workResource.entpCourseWorkList = entpcourseworkres.data; - // workResource.entpCourseWorkTotal = entpcourseworkres.data.length; + // workResource.entpCourseWorkList = entpcourseworkres.data; + // workResource.entpCourseWorkTotal = entpcourseworkres.data.length; - data.forEach(item=> { - if (item.worktype == '选择题') { - item.worktype = '单选题' + data.forEach(item=> { + if (item.worktype == '选择题') { + item.worktype = '单选题' + } + }) + + // 格式化试题信息 + processList(data); + //workResource.entpCourseWorkList.push(...data); + workResource.entpCourseWorkList = data; + + // 初次加载时更新当前试题数量 + if (pageParams.value.isFirst) { + pageParams.value.isFirst = false; + pageParams.value.originCount = workResource.entpCourseWorkList.length; + pageParams.value.total = parseInt(res.msg); + paginationParams.pageNum = Math.ceil(parseInt(res.msg)/paginationParams.pageSize); + console.log('first->', pageParams.value, paginationParams); } - }) - - // 格式化试题信息 - processList(data); - //workResource.entpCourseWorkList.push(...data); - workResource.entpCourseWorkList = data; - - // 初次加载时更新当前试题数量 - if (pageParams.value.isFirst) { - pageParams.value.isFirst = false; - pageParams.value.originCount = workResource.entpCourseWorkList.length; - pageParams.value.total = parseInt(res.msg); - paginationParams.pageNum = Math.ceil(parseInt(res.msg)/paginationParams.pageSize); - console.log('first->', pageParams.value, paginationParams); } - } - pageParams.value.loading = false; -}); + pageParams.value.loading = false; + }); //const entpcourseworkres = await listEntpcourseworkNew(queryForm); @@ -741,10 +734,6 @@ const handleClassWorkSave = async () => { return; } - - - - if (classWorkForm.worktype === "课堂展示") { boardLoading.value = true let canvasJson = proxy.$refs.boardref.getCanvasJson() diff --git a/src/renderer/src/views/classTask/newClassTask.vue b/src/renderer/src/views/classTask/newClassTask.vue index 61a7b08..6f3d245 100644 --- a/src/renderer/src/views/classTask/newClassTask.vue +++ b/src/renderer/src/views/classTask/newClassTask.vue @@ -16,6 +16,7 @@ 作业设计 +
{{ scope.row.worktype == "课堂展示" ? scope.row.worktag : scope.row.title }}
+