diff --git a/electron-builder-prod.yml b/electron-builder-prod.yml index e14028f..9dfb51e 100644 --- a/electron-builder-prod.yml +++ b/electron-builder-prod.yml @@ -6,11 +6,6 @@ directories: win: executableName: AIx icon: resources/logo2.ico - extraFiles: - - from: ./node_modules/im_electron_sdk/lib/ - to: ./resources - filter: - - '**/*' files: - '!**/.vscode/*' - '!src/*' @@ -51,3 +46,9 @@ publish: url: https://prev.ysaix.com:7868/src/assets/smarttalk/ electronDownload: mirror: https://npmmirror.com/mirrors/electron/ +# 额外依赖打包到输出目录 +extraFiles: + - from: ./node_modules/im_electron_sdk/lib/ + to: ./resources + filter: + - '**/*' diff --git a/electron-builder-test.yml b/electron-builder-test.yml index d77cf79..6159547 100644 --- a/electron-builder-test.yml +++ b/electron-builder-test.yml @@ -13,11 +13,6 @@ asarUnpack: win: executableName: AIx icon: resources/logo2.ico - extraFiles: - - from: ./node_modules/im_electron_sdk/lib/ - to: ./resources - filter: - - '**/*' nsis: oneClick: false allowToChangeInstallationDirectory: true @@ -50,3 +45,9 @@ publish: url: http://localhost:3000 electronDownload: mirror: https://npmmirror.com/mirrors/electron/ +# 额外依赖打包到输出目录 +extraFiles: + - from: ./node_modules/im_electron_sdk/lib/ + to: ./resources + filter: + - '**/*' diff --git a/package.json b/package.json index 7af5238..38a9124 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "pinia-plugin-persistedstate": "^3.2.1", "spark-md5": "^3.0.2", "vue-router": "^4.4.0", + "xgplayer": "^3.0.19", "xlsx": "^0.18.5" }, "devDependencies": { diff --git a/src/main/index.js b/src/main/index.js index 1a38d28..f10b4de 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -155,7 +155,6 @@ async function createLinkWin(data) { // 初始化完成 app.on('ready', () => { process.env.LANG = 'en_US.UTF-8' - process.env['ELECTRON_DISABLE_SANDBOX'] = true; // 设置应用程序用户模型标识符 electronApp.setAppUserModelId('com.electron') diff --git a/src/renderer/index.html b/src/renderer/index.html index 3441296..8ee7d0b 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -8,7 +8,7 @@ http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:" /> --> - + diff --git a/src/renderer/src/api/apiService.js b/src/renderer/src/api/apiService.js index ad79922..0b28e0d 100644 --- a/src/renderer/src/api/apiService.js +++ b/src/renderer/src/api/apiService.js @@ -13,9 +13,11 @@ export class ApiService { if (!!data) config[method=='get'?'params':'data'] = data if (!!option) Object.assign(config, option) // 特殊格式处理 - if (type == 'file') config.headers = { 'Content-Type': 'multipart/form-data' } - else if (type == 'json') config.headers = { 'Content-Type': 'application/json' } - else if (type == 'form') config.headers = { 'Content-Type': 'application/x-www-form-urlencoded' } + let headers + if (type == 'file') headers = { 'Content-Type': 'multipart/form-data' } + else if (type == 'json') headers = { 'Content-Type': 'application/json' } + else if (type == 'form') headers = { 'Content-Type': 'application/x-www-form-urlencoded' } + headers && (config.headers = { ...config.headers, ...headers }) return request(config) } } diff --git a/src/renderer/src/api/classManage/index.js b/src/renderer/src/api/classManage/index.js index dc58160..d07edf6 100644 --- a/src/renderer/src/api/classManage/index.js +++ b/src/renderer/src/api/classManage/index.js @@ -160,10 +160,12 @@ export function deleteSmartReserv(id) { }) } export function startClass(id, ex3) { + const params = {id} + !!ex3 && (params.ex3 = ex3) return request({ url: '/smarttalk/classReserv/startClass', method: 'get', - params: {id, ex3} + params }) } export function endClass(id) { diff --git a/src/renderer/src/api/file/third.js b/src/renderer/src/api/file/third.js new file mode 100644 index 0000000..5019721 --- /dev/null +++ b/src/renderer/src/api/file/third.js @@ -0,0 +1,64 @@ +//查询第三方课件的接口 +import request from '@/utils/request' +//获取学科 +export const getSubjects = (params) => { + return request({ + url: '/smarttalk/cnjy/getSubjects', + method: 'get', + params + }) +} +//获取教材版本 +export const getTextbookVersion = (params) => { + return request({ + url: '/smarttalk/cnjy/getVersions', + method: 'get', + params + }) +} +//获得书籍 +export const getTextbook = (params) => { + return request({ + url: '/smarttalk/cnjy/getBooks', + method: 'get', + params + }) +} +//获取书籍章节 +export const getBook = (params) => { + return request({ + url: '/smarttalk/cnjy/getChapters', + method: 'get', + params + }) +} +//获取知识点信息 +export const getKnowledge = (params) => { + return request({ + url: '/smarttalk/cnjy/getKnowledgePoints', + method: 'get', + params + }) +} +//查询列表资源 +export const getBookList = (params) => { + return request({ + url: '/smarttalk/cnjy/getDocuments', + method: 'post', + params + }) +} +//获取图片路径 +export const getImgPath = (params) => { + return request({ + url: '/smarttalk/cnjy/getPreview', + method: 'get', + params + }) +} + + + + + + diff --git a/src/renderer/src/assets/iconfont/iconfont.css b/src/renderer/src/assets/iconfont/iconfont.css index 696d349..c1fab69 100644 --- a/src/renderer/src/assets/iconfont/iconfont.css +++ b/src/renderer/src/assets/iconfont/iconfont.css @@ -1,9 +1,9 @@ @font-face { font-family: "iconfont"; /* Project id 2794390 */ - src: url('iconfont.woff2?t=1723453634574') format('woff2'), - url('iconfont.woff?t=1723453634574') format('woff'), - url('iconfont.ttf?t=1723453634574') format('truetype'), - url('iconfont.svg?t=1723453634574#iconfont') format('svg'); + src: url('iconfont.woff2?t=1724212790213') format('woff2'), + url('iconfont.woff?t=1724212790213') format('woff'), + url('iconfont.ttf?t=1724212790213') format('truetype'), + url('iconfont.svg?t=1724212790213#iconfont') format('svg'); } .iconfont { @@ -14,6 +14,90 @@ -moz-osx-font-smoothing: grayscale; } +.icon-yiwen:before { + content: "\e687"; +} + +.icon-yiwen-01:before { + content: "\e688"; +} + +.icon-yihuo:before { + content: "\e689"; +} + +.icon-a-yiwen:before { + content: "\e6b1"; +} + +.icon-zan:before { + content: "\e658"; +} + +.icon-zan1:before { + content: "\e659"; +} + +.icon-zan2:before { + content: "\e65a"; +} + +.icon-zan3:before { + content: "\e65c"; +} + +.icon-zan4:before { + content: "\e67c"; +} + +.icon-yizan:before { + content: "\e67e"; +} + +.icon-zan5:before { + content: "\e67f"; +} + +.icon-zan-yizan:before { + content: "\e680"; +} + +.icon-zan6:before { + content: "\e681"; +} + +.icon-MBEfenggeduosetubiao-xihuan:before { + content: "\e682"; +} + +.icon-zan7:before { + content: "\e683"; +} + +.icon-zan11:before { + content: "\e6ff"; +} + +.icon-zan8:before { + content: "\e684"; +} + +.icon-dianzan-red:before { + content: "\e685"; +} + +.icon-zan9:before { + content: "\e69e"; +} + +.icon-zanping:before { + content: "\100ae"; +} + +.icon-zan10:before { + content: "\e686"; +} + .icon-arrangement:before { content: "\e656"; } diff --git a/src/renderer/src/assets/iconfont/iconfont.js b/src/renderer/src/assets/iconfont/iconfont.js index a7091de..2ad9df4 100644 --- a/src/renderer/src/assets/iconfont/iconfont.js +++ b/src/renderer/src/assets/iconfont/iconfont.js @@ -1 +1 @@ -window._iconfont_svg_string_2794390='',function(l){var h=(h=document.getElementsByTagName("script"))[h.length-1],c=h.getAttribute("data-injectcss"),h=h.getAttribute("data-disable-injectsvg");if(!h){var a,v,t,z,i,p=function(h,c){c.parentNode.insertBefore(h,c)};if(c&&!l.__iconfont__svg__cssinject__){l.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(h){console&&console.log(h)}}a=function(){var h,c=document.createElement("div");c.innerHTML=l._iconfont_svg_string_2794390,(c=c.getElementsByTagName("svg")[0])&&(c.setAttribute("aria-hidden","true"),c.style.position="absolute",c.style.width=0,c.style.height=0,c.style.overflow="hidden",c=c,(h=document.body).firstChild?p(c,h.firstChild):h.appendChild(c))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(a,0):(v=function(){document.removeEventListener("DOMContentLoaded",v,!1),a()},document.addEventListener("DOMContentLoaded",v,!1)):document.attachEvent&&(t=a,z=l.document,i=!1,o(),z.onreadystatechange=function(){"complete"==z.readyState&&(z.onreadystatechange=null,M())})}function M(){i||(i=!0,t())}function o(){try{z.documentElement.doScroll("left")}catch(h){return void setTimeout(o,50)}M()}}(window); \ No newline at end of file +window._iconfont_svg_string_2794390='',(c=>{var h=(l=(l=document.getElementsByTagName("script"))[l.length-1]).getAttribute("data-injectcss"),l=l.getAttribute("data-disable-injectsvg");if(!l){var a,t,z,p,i,v=function(h,l){l.parentNode.insertBefore(h,l)};if(h&&!c.__iconfont__svg__cssinject__){c.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(h){console&&console.log(h)}}a=function(){var h,l=document.createElement("div");l.innerHTML=c._iconfont_svg_string_2794390,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(h=document.body).firstChild?v(l,h.firstChild):h.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(a,0):(t=function(){document.removeEventListener("DOMContentLoaded",t,!1),a()},document.addEventListener("DOMContentLoaded",t,!1)):document.attachEvent&&(z=a,p=c.document,i=!1,d(),p.onreadystatechange=function(){"complete"==p.readyState&&(p.onreadystatechange=null,M())})}function M(){i||(i=!0,z())}function d(){try{p.documentElement.doScroll("left")}catch(h){return void setTimeout(d,50)}M()}})(window); \ No newline at end of file diff --git a/src/renderer/src/assets/iconfont/iconfont.json b/src/renderer/src/assets/iconfont/iconfont.json index 27f830f..30d5f43 100644 --- a/src/renderer/src/assets/iconfont/iconfont.json +++ b/src/renderer/src/assets/iconfont/iconfont.json @@ -5,6 +5,153 @@ "css_prefix_text": "icon-", "description": "", "glyphs": [ + { + "icon_id": "20574719", + "name": "疑问", + "font_class": "yiwen", + "unicode": "e687", + "unicode_decimal": 59015 + }, + { + "icon_id": "21052326", + "name": "yiwen-01", + "font_class": "yiwen-01", + "unicode": "e688", + "unicode_decimal": 59016 + }, + { + "icon_id": "30456317", + "name": "疑惑", + "font_class": "yihuo", + "unicode": "e689", + "unicode_decimal": 59017 + }, + { + "icon_id": "33439935", + "name": "[疑问]", + "font_class": "a-yiwen", + "unicode": "e6b1", + "unicode_decimal": 59057 + }, + { + "icon_id": "1242129", + "name": "赞", + "font_class": "zan", + "unicode": "e658", + "unicode_decimal": 58968 + }, + { + "icon_id": "1741390", + "name": "赞", + "font_class": "zan1", + "unicode": "e659", + "unicode_decimal": 58969 + }, + { + "icon_id": "3159200", + "name": "赞", + "font_class": "zan2", + "unicode": "e65a", + "unicode_decimal": 58970 + }, + { + "icon_id": "3402139", + "name": "赞", + "font_class": "zan3", + "unicode": "e65c", + "unicode_decimal": 58972 + }, + { + "icon_id": "4931286", + "name": "赞 (1)", + "font_class": "zan4", + "unicode": "e67c", + "unicode_decimal": 59004 + }, + { + "icon_id": "4942300", + "name": "已赞", + "font_class": "yizan", + "unicode": "e67e", + "unicode_decimal": 59006 + }, + { + "icon_id": "5806181", + "name": "赞", + "font_class": "zan5", + "unicode": "e67f", + "unicode_decimal": 59007 + }, + { + "icon_id": "7172310", + "name": "赞-已赞", + "font_class": "zan-yizan", + "unicode": "e680", + "unicode_decimal": 59008 + }, + { + "icon_id": "7293361", + "name": "赞2", + "font_class": "zan6", + "unicode": "e681", + "unicode_decimal": 59009 + }, + { + "icon_id": "8705087", + "name": "MBE风格多色图标-喜欢", + "font_class": "MBEfenggeduosetubiao-xihuan", + "unicode": "e682", + "unicode_decimal": 59010 + }, + { + "icon_id": "10024138", + "name": "赞", + "font_class": "zan7", + "unicode": "e683", + "unicode_decimal": 59011 + }, + { + "icon_id": "11055391", + "name": "赞", + "font_class": "zan11", + "unicode": "e6ff", + "unicode_decimal": 59135 + }, + { + "icon_id": "11086734", + "name": "赞", + "font_class": "zan8", + "unicode": "e684", + "unicode_decimal": 59012 + }, + { + "icon_id": "23592614", + "name": "点赞", + "font_class": "dianzan-red", + "unicode": "e685", + "unicode_decimal": 59013 + }, + { + "icon_id": "26327261", + "name": "赞", + "font_class": "zan9", + "unicode": "e69e", + "unicode_decimal": 59038 + }, + { + "icon_id": "27804883", + "name": "赞评", + "font_class": "zanping", + "unicode": "100ae", + "unicode_decimal": 65710 + }, + { + "icon_id": "29252894", + "name": "赞", + "font_class": "zan10", + "unicode": "e686", + "unicode_decimal": 59014 + }, { "icon_id": "4978988", "name": "作业-布置作业", diff --git a/src/renderer/src/assets/iconfont/iconfont.svg b/src/renderer/src/assets/iconfont/iconfont.svg index d9830a0..8201a34 100644 --- a/src/renderer/src/assets/iconfont/iconfont.svg +++ b/src/renderer/src/assets/iconfont/iconfont.svg @@ -14,6 +14,48 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/renderer/src/assets/iconfont/iconfont.ttf b/src/renderer/src/assets/iconfont/iconfont.ttf index 1d65d03..43f8dc3 100644 Binary files a/src/renderer/src/assets/iconfont/iconfont.ttf and b/src/renderer/src/assets/iconfont/iconfont.ttf differ diff --git a/src/renderer/src/assets/iconfont/iconfont.woff b/src/renderer/src/assets/iconfont/iconfont.woff index caf53bc..9fc1445 100644 Binary files a/src/renderer/src/assets/iconfont/iconfont.woff and b/src/renderer/src/assets/iconfont/iconfont.woff differ diff --git a/src/renderer/src/assets/iconfont/iconfont.woff2 b/src/renderer/src/assets/iconfont/iconfont.woff2 index a1b77bc..e1759ea 100644 Binary files a/src/renderer/src/assets/iconfont/iconfont.woff2 and b/src/renderer/src/assets/iconfont/iconfont.woff2 differ diff --git a/src/renderer/src/components/choose-textbook/index.vue b/src/renderer/src/components/choose-textbook/index.vue index 3c2f6a5..69be80f 100644 --- a/src/renderer/src/components/choose-textbook/index.vue +++ b/src/renderer/src/components/choose-textbook/index.vue @@ -75,8 +75,7 @@ const curBookImg = ref('') const curBookPath = ref('') // 上册 const volumeOne = ref([]) -// 下册 -const volumeTwo = ref([]) + // 当前节点 const currentNode = reactive({ data:{} @@ -111,9 +110,11 @@ const getSubjectContent = async () => { //获取教材版本 await getSubject() //上册 - volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册') - //下册 - volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册') + /** + * 不区分上下册 + * 2024/08/20调整 + */ + volumeOne.value = data.filter(item => item.level == 1) getTreeData() } @@ -132,12 +133,8 @@ const changeBook = ({ id, itemtitle, avartar, fileurl }) => { const getTreeData = () => { //数据过滤 let upData = transData(volumeOne.value) - let downData = transData(volumeTwo.value) - if(upData.length && downData.length){ - treeData.value = [...upData,...downData] - } - else if(upData.length || downData.length){ - treeData.value = upData.length ? upData : downData + if(upData.length){ + treeData.value = [...upData] } else{ treeData.value = [] diff --git a/src/renderer/src/components/choose-textbook/third.vue b/src/renderer/src/components/choose-textbook/third.vue new file mode 100644 index 0000000..14d3d45 --- /dev/null +++ b/src/renderer/src/components/choose-textbook/third.vue @@ -0,0 +1,287 @@ + + + + + diff --git a/src/renderer/src/components/choose-textbook/third/index.vue b/src/renderer/src/components/choose-textbook/third/index.vue new file mode 100644 index 0000000..68903df --- /dev/null +++ b/src/renderer/src/components/choose-textbook/third/index.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/renderer/src/components/choose-textbook/third/selectSubject.vue b/src/renderer/src/components/choose-textbook/third/selectSubject.vue new file mode 100644 index 0000000..af4b57b --- /dev/null +++ b/src/renderer/src/components/choose-textbook/third/selectSubject.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/src/renderer/src/components/file-preview/index.vue b/src/renderer/src/components/file-preview/index.vue new file mode 100644 index 0000000..350695b --- /dev/null +++ b/src/renderer/src/components/file-preview/index.vue @@ -0,0 +1,124 @@ + + + + \ No newline at end of file diff --git a/src/renderer/src/components/move-file/index.vue b/src/renderer/src/components/move-file/index.vue index cb9d2b0..8e0a0bb 100644 --- a/src/renderer/src/components/move-file/index.vue +++ b/src/renderer/src/components/move-file/index.vue @@ -88,8 +88,6 @@ const curBookId = ref(-1) const curBookName = ref('') // 上册 const volumeOne = ref([]) -// 下册 -const volumeTwo = ref([]) // 当前节点 const currentNode = reactive({ data: {} @@ -127,9 +125,12 @@ const getSubjectContent = async () => { //获取教材版本 getSubject() //上册 - volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册') - //下册 - volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册') + /** + * 不区分上下册 + * 2024/08/20调整 + */ + volumeOne.value = data.filter(item => item.level == 1) + getTreeData() } @@ -160,13 +161,8 @@ const isHaveUnit = (id) => { const getTreeData = () => { //数据过滤 let upData = transData(volumeOne.value) - let downData = transData(volumeTwo.value) - - if(upData.length && downData.length){ - treeData.value = [...upData,...downData] - } - else if(upData.length || downData.length){ - treeData.value = upData.length ? upData : downData + if(upData.length){ + treeData.value = [...upData] } else{ treeData.value = [] diff --git a/src/renderer/src/components/pdf/index.vue b/src/renderer/src/components/pdf/index.vue index e588373..ae43c6e 100644 --- a/src/renderer/src/components/pdf/index.vue +++ b/src/renderer/src/components/pdf/index.vue @@ -100,12 +100,17 @@ const renderPage = async (canvasobj) => { }) } // 保存数据 -const savaDataStore = () => { +const savaDataStore = (type) => { if(!toolState.isToolWin){ toolState.isPdfWin=false toolState.showBoardAll=true //恢复默认值 - ipcRenderer.invoke('tool-sphere:reset') //重置tool状态 - ipcRenderer.send('open-PDF:minimize') + if(type=='rest'){ + ipcRenderer.invoke('tool-sphere:reset') //重置tool状态 + ipcRenderer.send('open-PDF:close') + }else{ + ipcRenderer.invoke('open-PDF:minimize') + } + return } imgarr.value.forEach((a) => { @@ -139,8 +144,15 @@ const savaDataStore = () => { Promise.all(promises).then(res=>{ toolState.isPdfWin=false toolState.showBoardAll=true //恢复默认值 - ipcRenderer.invoke('tool-sphere:reset') //重置tool状态 - ipcRenderer.send('open-PDF:minimize') + // ipcRenderer.send('open-PDF:minimize') + if(type=='rest'){ + ipcRenderer.invoke('tool-sphere:reset') //重置tool状态 + ipcRenderer.send('open-PDF:close') + }else{ + ipcRenderer.send('open-PDF:minimize') + } + // ipcRenderer.send('open-PDF:close') + }) } const updatePage = (canvasobj) => { diff --git a/src/renderer/src/components/set-homework/index.vue b/src/renderer/src/components/set-homework/index.vue new file mode 100644 index 0000000..233bf99 --- /dev/null +++ b/src/renderer/src/components/set-homework/index.vue @@ -0,0 +1,323 @@ + + + + + diff --git a/src/renderer/src/plugins/imChat/enumbers.js b/src/renderer/src/plugins/imChat/enumbers.js index 0145323..05d12c3 100644 --- a/src/renderer/src/plugins/imChat/enumbers.js +++ b/src/renderer/src/plugins/imChat/enumbers.js @@ -381,14 +381,14 @@ const TIMResult= { * * | 名称 | 含义 | 值(number) | * | ---- | ---- | ---- | -* | kTIMLog_Off | 关闭日志输出 | 0 | -* | kTIMLog_Test | 失败,IM SDK未初始化 | 1 | -* | kTIMLog_Verbose | 失败,IM SDK未初始化 | 2 | -* | kTIMLog_Debug | 接口调用失败,错误的Json格式或Json Key | 3 | -* | kTIMLog_Info | 接口调用失败,参数错误 | 4 | -* | kTIMLog_Warn | 接口调用失败,无效的会话 | 5 | -* | kTIMLog_Error | 接口调用失败,无效的群组 | 6 | -* | kTIMLog_Assert | 断言日志| 7 | +* | kTIMLog_Off | 关闭日志输出 | 0 | +* | kTIMLog_Test | 全量日志 | 1 | +* | kTIMLog_Verbose| 开发调试过程中一些详细信息日志 | 2 | +* | kTIMLog_Debug | 调试日志 | 3 | +* | kTIMLog_Info | 信息日志 | 4 | +* | kTIMLog_Warn | 警告日志 | 5 | +* | kTIMLog_Error | 错误日志 | 6 | +* | kTIMLog_Assert | 断言日志 | 7 | */ const TIMLogLevel= { kTIMLog_Off : 0, diff --git a/src/renderer/src/plugins/imChat/imLiseners.js b/src/renderer/src/plugins/imChat/imLiseners.js index d80bb7e..0342a76 100644 --- a/src/renderer/src/plugins/imChat/imLiseners.js +++ b/src/renderer/src/plugins/imChat/imLiseners.js @@ -5,7 +5,7 @@ */ // @ts-ignore const API = window?.api || {} -const timRenderInstance = API.getTimRender() +const timRenderInstance = API?.getTimRender?.() || {} // im 事件监听 export class IMListeners { diff --git a/src/renderer/src/plugins/imChat/index.js b/src/renderer/src/plugins/imChat/index.js index dac2ef7..3b42935 100644 --- a/src/renderer/src/plugins/imChat/index.js +++ b/src/renderer/src/plugins/imChat/index.js @@ -9,6 +9,7 @@ import * as TYPES from './enumbers' // sdk相关枚举 import MsgEnum from './msgEnum' // 消息相关枚举(自定义) import IMListeners from './imLiseners' // im消息-监听器 +// @ts-ignore const API = window.api // TIM生成签名 // import * as GenerateUserSig from './userSig' // 引入签名生成器 @@ -25,29 +26,33 @@ export class ImChat { } defOption = { // 默认配置 // 日志等级-全量日志 - log_level: TYPES.TIMLogLevel.kTIMLog_Test, + log_level: TYPES.TIMLogLevel.kTIMLog_Off, // 群组类型-会议群(Meeting),成员上限 6000 人 group_type: TYPES.TIMGroupType.kTIMGroup_ChatRoom, } + /** + * @description 构造函数 + * @param {number} SDKAppID + * @param {string} userSig + * @param {string} userID + * @param {boolean} isInit + */ constructor(SDKAppID, userSig, userID, isInit) { this.SDKAppID = SDKAppID this.userSig = userSig - // const sig = 'eJwtjN0KgjAYQN9l16Vzcz8I3RhE9J*JV94IW-ZV6nASWfTurfTynAPnjdLNyXvoFkWIeBhN-gxK1x2cYdCMTQnlYmxW3QpjQKEo4BhjGgrKh6KfBlrtPGOMuDTYDqqfE26BWUjEeIHSrW1cL-SulHd5KI7zxDbpdh1cX0nuX7JK7HtroNerZhnnPpYz9PkCe5Mx1w__' - // this.userSig = sig this.userID = userID - window.test = this - // this.timGroupId = '@TGS#3CYWMK2ON' // 测试使用 - if (isInit) return this.init() + // window.test = this + if (isInit) this.init() } // 设置配置 async setConfig() { await this.timChat.TIMSetConfig({ // TIMSetConfigParam json_config: { // JSONCongfig - set_config_log_level: this.defOption.log_level, - set_config_callback_log_level: this.defOption.log_level, - // set_config_is_log_output_console: true, + set_config_log_level: TYPES.TIMLogLevel.kTIMLog_Test, + set_config_callback_log_level: TYPES.TIMLogLevel.kTIMLog_Error, + set_config_is_log_output_console: true, // set_config_user_config: { // 用户配置 // user_config_is_read_receipt: true, // true表示要收已读回执事件 // user_config_is_sync_report: true, // true表示服务端要删掉已读状态 @@ -63,7 +68,6 @@ export class ImChat { // 日志监听 this.timChat.TIMSetLogCallback({ callback: data => { - // console.log('[im-chat]:', data[1]) this.setConsole('%cchat-log ', data[1]) }, user_data: '' @@ -91,15 +95,18 @@ export class ImChat { } // 生成签名 genTestUserSig() { - const options = { - SDKAppID: this.SDKAppID, - secretKey: this.secretKey, - userID: this.userID, - } - const { userSig } = GenerateUserSig.genTestUserSig(options) - this.userSig = userSig + // const options = { + // SDKAppID: this.SDKAppID, + // secretKey: this.secretKey, + // userID: this.userID, + // } + // const { userSig } = GenerateUserSig.genTestUserSig(options) + // this.userSig = userSig } - // 监听 + /** + * @description 监听消息 + * @param {Function} callback + */ watch(callback) { // // 先移除监听 // this.timChat.TIMRemoveRecvNewMsgCallback() @@ -162,16 +169,20 @@ export class ImChat { logout() { if (!this.timChat) return return this.timChat.TIMLogout().then(res => { - console.log('登出成功', res) + this.setConsole('%cim-chat: logout', '登出成功') this.status.isLogin = false this.timChat.TIMUninit() // 反初始化 return res }).catch(error => { - console.log('登出失败', error) + this.setConsole('%cim-chat: logout', '登出失败', error) return error }) } - // 创建群组 群名和初始成员 userID + /** + * @description 创建群组 群名和初始成员 userID + * @param {any} name + * @param {any[]} memberList + */ createGroup(name, memberList=[]) { if (!this.timChat) return if (!!this.timGroupId) return console.log('群组已存在') @@ -220,7 +231,10 @@ export class ImChat { data: '', // 用户自定义数据 }) } - // 设置群消息接收 + /** + * @description 设置群消息接收 + * @param {string} timGroupId + */ setGroupMsgReceive(timGroupId) { if (!this.timGroupId) this.timGroupId = timGroupId || '' if (!this.timGroupId) return console.log('timGroupId为空') @@ -240,7 +254,11 @@ export class ImChat { return error }) } - // 发送消息 + /** + * @description 发送消息 + * @param {any} conv_id + * @param {any} msg + */ sendMsg(conv_id, msg) { if (!conv_id) return console.log('conv_id为空') if (typeof msg == 'object') msg = JSON.stringify(msg) @@ -259,15 +277,33 @@ export class ImChat { user_data: '', // 用户自定义数据 // callback: (data) => {} } - console.log('发送消息', option) + // console.log('发送消息', option) + this.setConsole('%cim-chat: 发送消息', option) return this.timChat.TIMMsgSendMessageV2(option) } + /** + * @description 发送群消息 + * @param {any} msg + * @param {*} head + * @param {*} type + */ + sendMsgGroup(msg, head, type) { + const msgObj = this.getMsgObj(head, msg, type) + // console.log('发送群消息', msgObj) + return this.sendMsg(this.timGroupId, msgObj) + } // 发送关闭(下课)消息 sendMsgClosed(){ - const msg = this.getMsgObj(MsgEnum.HEADS.MSG_closed, '下课', MsgEnum.TYPES.TEACHER) + const msg = this.getMsgObj(MsgEnum.HEADS.MSG_closed, '下课') return this.sendMsg(this.timGroupId, msg) } - // 获取消息对象 + /** + * @description 获取消息对象 + * @param {string} msgHead + * @param {string} msg + * @param {string} type + * @param {string|number} sender + */ getMsgObj(msgHead, msg, type, sender, option={}) { if (!msgHead) throw new Error('msgHead is required') if (!msg) throw new Error('msg is required') @@ -275,19 +311,27 @@ export class ImChat { return { msgKey: msgHead, msgcontent: msg, - msgType: type ?? MsgEnum.TYPES.STUDENT, // 默认为学生 + msgType: type || MsgEnum.TYPES.TEACHER, // 默认为老师 senduserid: sender ?? this.userID, ...option } } - // 设置控制台样式 + /** + * @description 设置控制台样式 + * @param {string} hearStr + * @param {string[]} args + */ setConsole(hearStr,...args) { const css = 'color: #fff;background-color:#2ccb92;padding:3px 5px;border-radius:3px;' const time = new Date().toLocaleTimeString() if (!hearStr) hearStr = '%c' + time console.log(hearStr, css, ...args) } - // 获取数据字符串 + /** + * @description 获取数据字符串 + * @param {*} data + * @returns + */ toStr = (data) => { if (typeof data === 'string') data = {type: data} return JSON.stringify(data) diff --git a/src/renderer/src/plugins/imChat/msgEnum.js b/src/renderer/src/plugins/imChat/msgEnum.js index dec2ba8..da8e486 100644 --- a/src/renderer/src/plugins/imChat/msgEnum.js +++ b/src/renderer/src/plugins/imChat/msgEnum.js @@ -95,6 +95,7 @@ export class MsgEnum { // === 新定义-消息头 === /** @desc: 点赞 */ MSG_0001: 0x0001, + /** @desc: 疑惑 */ MSG_0002: 0x0002, MSG_0003: 0x0003, MSG_0004: 0x0004, @@ -109,6 +110,7 @@ export class MsgEnum { MSG_0013: 0x000d, MSG_0014: 0x000e, MSG_0015: 0x000f, + /** @desc: 作业推送 */ MSG_0016: 0x0010, MSG_0017: 0x0011, MSG_0018: 0x0012, diff --git a/src/renderer/src/store/modules/thirdTextbook.js b/src/renderer/src/store/modules/thirdTextbook.js new file mode 100644 index 0000000..0c499da --- /dev/null +++ b/src/renderer/src/store/modules/thirdTextbook.js @@ -0,0 +1,23 @@ +import { defineStore } from 'pinia' + +const useThirdStore = defineStore('third', { + state: () => ({ + activeGrade:'', + gradeName:'', + subjectName:'', + textbookVersionId:'' + }), + actions: { + // 登录 + getSelectBookInfo(params){ + this.activeGrade = params.activeGrade + this.gradeName = params.gradeName + this.subjectName = params.subjectName + this.textbookVersionId = params.textbookVersionId + } + + }, + persist: true +}) + +export default useThirdStore diff --git a/src/renderer/src/utils/hasPermission.js b/src/renderer/src/utils/hasPermission.js index 2242209..4d7cb4a 100644 --- a/src/renderer/src/utils/hasPermission.js +++ b/src/renderer/src/utils/hasPermission.js @@ -7,7 +7,6 @@ export const hasPermission = (value, def = true) => { if (!value) { return def } - const allCodeList = useUserStore().roles // 如果不是数组,直接判断pinia里的权限数组有没有相同的元素即可 if (!Array.isArray(value)) { @@ -15,4 +14,4 @@ export const hasPermission = (value, def = true) => { } // intersection是lodash提供的一个方法,用于返回一个所有给定数组都存在的元素组成的数组 return array.intersection(value, allCodeList).length > 0 -} \ No newline at end of file +} diff --git a/src/renderer/src/utils/resourceDict.js b/src/renderer/src/utils/resourceDict.js index a1a1a61..9a26a2b 100644 --- a/src/renderer/src/utils/resourceDict.js +++ b/src/renderer/src/utils/resourceDict.js @@ -6,7 +6,11 @@ export const tabs = [ { label: '校本资源', value: '校本' - } + }, + { + label: '第三方资源', + value: '第三方' + }, ] @@ -67,3 +71,45 @@ export const resourceType = [ value: '教案' } ] +// 年级划分 +export const gradeList = [ + { + label:'小学', + value:1 + }, + { + label:'初中', + value:2 + }, + { + label:'高中', + value:3 + }, +] +//课件类别 +export const coursewareTypeList = [ + { + label:'全部', + value:'' + }, + { + label:'课件', + value:3 + }, + { + label:'教案', + value:8 + }, + { + label:'试卷', + value:7 + }, + { + label:'学案', + value:4 + }, + { + label:'素材', + value:6 + }, +] diff --git a/src/renderer/src/utils/tool.js b/src/renderer/src/utils/tool.js index ff4bfdc..eb647ce 100644 --- a/src/renderer/src/utils/tool.js +++ b/src/renderer/src/utils/tool.js @@ -115,6 +115,16 @@ export const createWindow = async (type, data) => { return wins_tool } case 'open-PDF': { //课本展示-pdf + if(winPdf){ //判断是否已经打开 + if (winPdf.isMinimized()){ + winPdf.restore(); + } else{ + winPdf.focus(); + toolState.isPdfWin=true + } + + return + } const option = data.option||{} const defOption = { frame: false, // 要创建无边框窗口 @@ -123,12 +133,6 @@ export const createWindow = async (type, data) => { } data.isConsole = true // 是否开启控制台 data.option = {...defOption, ...option} - if(winPdf){ //判断是否已经打开 - // if (winPdf.isMinimized()) winPdf.restore(); - winPdf.focus(); - // toolState.isPdfWin=true - return - } const win = await toolWindow(data) win.type = type // 唯一标识 win.show() @@ -190,7 +194,6 @@ export function toolWindow({url, isConsole, isWeb=true, option={}}) { // 内部监听器-是否打印 if (!!isConsole) { win.webContents.on('console-message', (e,leve,m,lin,s) => { - console.log(m) if(m.startsWith('%c')){ // 特殊打印 const arr = m.match(/(%c[^ ]+)(?:\s+(.*;))(.*)/) console.log(arr[1],arr[2],arr[3]) @@ -240,12 +243,22 @@ const eventHandles = (type, win) => { break} case 'open-PDF': { // 最小化窗口 minimize() - Remote.ipcMain.once('open-PDF:minimize', () => { + Remote.ipcMain.handle('open-PDF:minimize', () => { + // winPdf=null + // win&&win.destroy() + win&&win.minimize(); //缩小功能 + }) + // 关闭窗口 + Remote.ipcMain.once('open-PDF:close', () => { winPdf=null win&&win.destroy() - // win&&win.minimize(); //缩小功能 }) - publicMethods() // 加载公共方法 + const on = { + onClosed: () => { + Remote.ipcMain.removeHandler('open-PDF:minimize') + } + } + publicMethods(on) // 加载公共方法 break} default: break diff --git a/src/renderer/src/views/classBegins/index.vue b/src/renderer/src/views/classBegins/index.vue index a0f8d07..a1b4ec3 100644 --- a/src/renderer/src/views/classBegins/index.vue +++ b/src/renderer/src/views/classBegins/index.vue @@ -26,7 +26,10 @@ 下一页 + +
最小化 + 关闭
@@ -72,9 +75,10 @@ const navtopage = (type) => { pdfCanvaslist.value.initPdf('rest') } // 关闭窗口 -const minimize = async () => { - await pdfCanvaslist.value.savaDataStore() +const minimize = async (type='minimize') => { + await pdfCanvaslist.value.savaDataStore(type) } + const handleUpdate = (data) => { numPagesTotal.value = data if (numPagesTotal.value == 1) { @@ -138,7 +142,8 @@ const getUniqueArrayByLastOccurrence=(array)=> { flex-wrap: wrap; .pdf-btn { position: absolute; - right: 0; + // right: 0; + left: 0; bottom: 0; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5); border-radius: 5px 0 0 0; @@ -163,5 +168,28 @@ const getUniqueArrayByLastOccurrence=(array)=> { } } } + .pdf-btn-right{ + position: absolute; + right: 0; + bottom: 0; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5); + border-radius: 5px 0 0 0; + button { + margin-left: 0; + border: none; + font-size: 16px; + // padding: 4px 7px; + border-radius: 0; + width: 80px; + height: 70px; + :deep(> span) { + display: block !important; + } + .iconfont { + font-size: 26px; + margin-bottom: 10px; + } + } + } } diff --git a/src/renderer/src/views/prepare/container/set-homework.vue b/src/renderer/src/views/prepare/container/set-homework.vue deleted file mode 100644 index 5aa5d35..0000000 --- a/src/renderer/src/views/prepare/container/set-homework.vue +++ /dev/null @@ -1,332 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index 04b11d4..9ecdac4 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -114,7 +114,6 @@ v-model="setDialog" :entpcourseid="entpcourseid" :row="row" - @on-close="closeHomework" /> + {{item.label }} + + + + +
@@ -30,13 +48,36 @@
+ \ No newline at end of file + diff --git a/src/renderer/src/views/resource/container/third-list.vue b/src/renderer/src/views/resource/container/third-list.vue new file mode 100644 index 0000000..b163266 --- /dev/null +++ b/src/renderer/src/views/resource/container/third-list.vue @@ -0,0 +1,260 @@ + + + + + diff --git a/src/renderer/src/views/resource/index.vue b/src/renderer/src/views/resource/index.vue index 6438cbb..5629cd2 100644 --- a/src/renderer/src/views/resource/index.vue +++ b/src/renderer/src/views/resource/index.vue @@ -1,7 +1,8 @@ \ No newline at end of file diff --git a/src/renderer/src/views/tool/sphere.vue b/src/renderer/src/views/tool/sphere.vue index c6edbf5..cef6cde 100644 --- a/src/renderer/src/views/tool/sphere.vue +++ b/src/renderer/src/views/tool/sphere.vue @@ -7,7 +7,7 @@ - + @@ -67,7 +67,8 @@ const classObj = reactive({ // 课程相关 data: {} // 课程信息 }) const msgIds = [] // 消息id -const btnList = [ // 工具栏按钮列表 +const electron = window.electron // electron +const btnList = [ // 工具栏按钮列表 { label: '选择', value: 'select', icon: 'icon-mouse' }, { label: '画笔', value: 'brush', icon: 'icon-huabi' }, { label: '板擦', value: 'erase', icon: 'icon-xiangpica' }, @@ -78,10 +79,10 @@ const btnList = [ // 工具栏按钮列表 ] // === 页面加载完毕 === onMounted(async() => { - getClassInfo() // 获取课堂详情 ex3 + if (!electron) return // 浏览器端 + getClassInfo() // 获取课堂详情 ex3 setTimeout(() => { - // classManageApi.startClass(classObj.id) // 开始上课-临时 - resetStatus() // 开启重置状态-监听 + resetStatus() // 开启重置状态-监听 }, 200); }) @@ -91,10 +92,10 @@ const getClassInfo = async () => { const { data } = await classManageApi.getClassInfo(classObj.id) classObj.data = data // 群id - let timGroupId = data?.ex3 && data?.ex3 != 'undefined' ? data.ex3: '' - console.log('timGroupId:', timGroupId) + let timGroupId = data?.ex3 || '' + console.log('获取群ID:', timGroupId) const chat = await imChatRef.value?.initImChat(timGroupId) // 初始化im-chat - if (!timGroupId) timGroupId = chat.timGroupId + if (!timGroupId) timGroupId = chat?.timGroupId classManageApi.startClass(classObj.id, timGroupId) // 开始上课 } // 切换tab-change @@ -127,12 +128,13 @@ const chatChange = (type, data, ...args) => { const msgId = (args||[])[0].message_msg_id const { msgKey:head, msgcontent:msg, senduserid:sendId, msgType } = data switch(head) { - case MsgEnum.HEADS.MSG_0001: + case MsgEnum.HEADS.MSG_0001: // 点赞 + case MsgEnum.HEADS.MSG_0002: // 疑惑 // console.log('点赞:', data) - if(msgIds.includes(msgId)) return - upvoteRef.value.trigger() - if (msgIds.length >= 100) msgIds.shift() // 删除第一个 - msgIds.push(msgId) // 添加到数组 + if(msgIds.includes(msgId)) return // 忽略重复-点赞消息 + upvoteRef.value.trigger(head, data.name) // 触发点赞|疑惑 + if (msgIds.length >= 100) msgIds.shift() // 删除第一个 + msgIds.push(msgId) // 添加到数组 break default: console.log('未知消息:', data) @@ -147,6 +149,7 @@ const setIgnore = (bool) => {ipcMsgSend('tool-sphere:set:ignore', bool)} // 重置状态: 鼠标|画板 const resetStatus = () => { if (toolStore.isToolWin) return // 已经打开过-忽略 + ipcMain?.removeHandler('tool-sphere:reset') // 避免已绑定,先移除在绑定 ipcMain?.handle?.('tool-sphere:reset', () => { setTimeout(() => { boardVueRef.value.handleMode(tabActive.value)