From 7f595c09a9b608cb8c00a0ce965d813f55e4f682 Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Wed, 11 Dec 2024 10:33:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E6=A8=A1=E5=9E=8B=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/views/model/index.vue | 133 +------------------------ 1 file changed, 1 insertion(+), 132 deletions(-) diff --git a/src/renderer/src/views/model/index.vue b/src/renderer/src/views/model/index.vue index a1bfade..30f51af 100644 --- a/src/renderer/src/views/model/index.vue +++ b/src/renderer/src/views/model/index.vue @@ -248,138 +248,7 @@ const onchange = (item) => { router.push(path) } } -// 获取资源列表 -const getResourceList = async () => { - const entpcourseidarray = courseObj?.entp?.id - if (!entpcourseidarray) return msgUtils.msgWarning('请选择章节?') - const params = { - pageSize: 100, parentid: 0, entpcourseidarray, - orderByColumn: 'timestamp', isAsc: 'desc', - } - const res = await HTTP_SERVER_API('getCourseFileList', params) - if (res?.code == 200) { - sourceOpt.data = res?.rows || [] - } else { - msgUtils.msgWarning('获取资源列表, 请重试') - } -} -// 统一HTTP处理 -const HTTP_SERVER_API = (type, params = {}) => { - switch (type) { - case 'addSmarttalk': { // 获取课程 - const def = { - fileId: '', // 文件id - Entpcoursefile 对应id - fileFlag: 'aippt', - fileShowName: courseObj.coursetitle + '.aippt', - textbookId: courseObj.textbookId, - levelFirstId: courseObj.levelFirstId, - levelSecondId: courseObj.levelSecondId, - fileSource: '个人', - fileRoot: '备课' - } - return API_smarttalk.creatAPT({...def, ...params}) - } - case 'addEntpcourse': { // 添加课程 - const node = courseObj.node || {} - if (!node) return msgUtils.msgWarning('请选择章节?') - const def = { // 默认参数 - entpid: userStore.user.deptId, // 部门id - level: 1, // 层级 - parentid: 0, // 父级id - dictid: 0, // 字典id - evalid: node.id, // 章节id - evalparentid: node.parentid, // 单元id(父级id) - edusubject: node.edusubject, // 学科 - edudegree: node.edudegree, // 年级 - edustage: node.edustage, // 阶段 - coursetype: '课标学科', // 课程类型 - coursetitle: node.itemtitle, // 课程名称 - coursedesc: '', // 课程描述 - status: '', // 状态 - dflag: 0, // 状态 - edituserid: userStore.id, // 编辑人id - createblankfile: 'no', // 创建空白文件 - } - courseObj.entp = def - return API_entpcourse.addEntpcourse(def) - } - case 'addEntpcoursefile': { // 添加课程文件 - const enpt = courseObj.entp - const def = { - parentid: 0, - entpid: userStore.user.deptId, - entpcourseid: enpt.id, - ppttype: 'file', - title: enpt.coursetitle, - fileurl: '', - filetype: 'aippt', - datacontent: '', - filekey: '', - filetag: '', - fileidx: 0, - dflag: 0, - status: '', - edituserid: userStore.id - } - // return Promise.resolve(1) - return API_entpcoursefile.addEntpcoursefileReturnId({...def,...params}) - } - case 'getCourseList': { // 获取课程列表 - return API_entpcourse.listEntpcourse(params) - } - case 'getCourseFileList':{ // 获取课程文件列表 - return API_entpcoursefile.listEntpcoursefileNew(params) - } - } -} -// 事件回调 -const handleAll = async(type, row) =>{ - // console.log(type) - switch (type) { - case 'refresh': // 刷新 - getResourceList() - break; - case 'resource': // 资源库 - break; - case 'upload': // 上传 - break; - case 'add':{ // 添加PPT-list - 课程文件 - const enpt = courseObj.entp // 获取课程信息 - if (!enpt) { // 如果没有,就新增课程 - const resid = await HTTP_SERVER_API('addEntpcourse') - courseObj.entp.id = resid - } - // 生成ppt课件-父级 - const p_params = {parentContent: '{"width":1000,"ratio":0.5625}'} - const id = await HTTP_SERVER_API('addEntpcoursefile', p_params) - if (!!id??null) { // 生成第一个幻灯片 - const params = { - parentid: id, - title: '第一页', - filetype: 'slide', - datacontent: '{"elements":[],"background":{"type":"solid","color":"#fff"}}' // json内容 - } - // 生成ppt课件-子级(slide) - await HTTP_SERVER_API('addEntpcoursefile', params) - // 生成备课资源-Smarttalk - await HTTP_SERVER_API('addSmarttalk',{fileId: id}) - // 刷新资源列表 - await getResourceList() - } else { - msgUtils.msgWarning('添加失败!') - } - break; - } - case 'open': { // 打开资源-pptist - if (row.filetype != 'aippt') return msgUtils.msgWarning('暂不支持该类型文件操作!') - sessionStore.set('curr.resource', row) // 缓存当前资源信息 - createWindow('open-win', { - url: '/pptist', // 窗口关闭时,清除缓存 - close: () => { - sessionStore.set('curr.resource', null) // 清除缓存 - getResourceList() // 刷新资源列表 - } - }) + const changeClass = async (type, row, other) => { switch(type) { case 'click': { // 点击-打开课件-aippt