From 781829373a0ae77f41d6e62ed2314249e6e011b4 Mon Sep 17 00:00:00 2001 From: lyc Date: Mon, 23 Sep 2024 13:01:13 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=94=9F=E6=88=90=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/components/ai-chart/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/src/components/ai-chart/index.vue b/src/renderer/src/components/ai-chart/index.vue index 8d95703..18b00f5 100644 --- a/src/renderer/src/components/ai-chart/index.vue +++ b/src/renderer/src/components/ai-chart/index.vue @@ -115,7 +115,7 @@ const outerAi = [ title: '生成图片', secondTit: '文生图大模型', img: new URL('../../../src/assets/images/ai-01.png', import.meta.url).href, - path: '/ais/aisd3' + path: '/ais/aiwenxinyige' }, { id: 2, From 713a592bcff3c61593ff0459c0efaa2f20e64fee Mon Sep 17 00:00:00 2001 From: lyc Date: Mon, 23 Sep 2024 16:49:48 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=B7=B3=E8=BD=AC=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/desktop/index.vue | 53 ++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/src/renderer/src/views/desktop/index.vue b/src/renderer/src/views/desktop/index.vue index 679fc19..233a6d8 100644 --- a/src/renderer/src/views/desktop/index.vue +++ b/src/renderer/src/views/desktop/index.vue @@ -8,7 +8,7 @@
{{ item.name }}
    -
  • +
  • {{ menu.name }}
  • @@ -63,23 +63,27 @@ const menuList = [{ name: '课标分析', icon: 'icon-kecheng', isOuter: true, - path: '/teaching/chatwithstandard' + path: '/teaching/chatwithstandard', + id: '1-1' }, { name: '教材分析', icon: 'icon-jiaocaixuanze', isOuter: true, - path: '/teaching/chatwithtextbook' + path: '/teaching/chatwithtextbook?', + id: '1-2' }, { name: '考试分析', icon: 'icon-kaoshi', - path: '/examReport' + path: '/examReport', + id: '1-3' }, { name: '学情分析', icon: 'icon-xueqingfenxi', - disabled: true + disabled: true, + id: '1-4' }, // { // name: '教学设计', @@ -89,12 +93,14 @@ const menuList = [{ { name: '教学实践', icon: 'icon-jiaoxuefenxi', - path: '/prepare' + path: '/prepare', + id: '1-5' }, { name: '教学反思', icon: 'icon-jiaoxuefansi', - disabled: true + disabled: true, + id: '1-6' }, ] }, @@ -107,7 +113,8 @@ const menuList = [{ name: '作业设计', icon: 'icon-jiaoxuefansi', isOuter: true, - path: '/teaching/classtaskassign?titleName=作业布置&openDialog=newClassTask' + path: '/teaching/classtaskassign?titleName=作业布置&openDialog=newClassTask', + id: '2-1' //path: '/newClassTask' //path: '/classTaskAssign' //isOuter: true, @@ -117,17 +124,20 @@ const menuList = [{ name: '作业布置', icon: 'icon-xiezuo1', isOuter: true, - path: '/teaching/classtaskassign?titleName=作业布置' + path: '/teaching/classtaskassign?titleName=作业布置?', + id: '2-2' }, { name: '作业批改', icon: 'icon-pigai', - path: '/classTask' + path: '/classTask', + id: '2-3' }, { name: '作业统计', icon: 'icon-tongji', - disabled: true + disabled: true, + id: '2-4' }, ] }, @@ -139,44 +149,45 @@ const menuList = [{ { name: '教学计划', icon: 'icon-jiaoxuejihua', - disabled: true + disabled: true, + id: '3-1' }, { name: '教学组织', icon: 'icon-organization-framework-line', - disabled: true + disabled: true, + id: '3-2' }, { name: '教学质量', icon: 'icon-jiaoxuezhiliangfenxi', - disabled: true + disabled: true, + id: '3-3' }, { name: '教学反馈', icon: 'icon-fankui', - disabled: true + disabled: true, + id: '3-4' }, ] } ] -const clickMenu = ({isOuter, path, disabled}) =>{ +const clickMenu = ({isOuter, path, disabled, id}) =>{ if(disabled) return // 弹窗 if(isOuter){ let configObj = outLink().getBaseData() let fullPath = configObj.fullPath + path - if(path == '/teaching/classtaskassign?titleName=作业布置&openDialog=newClassTask' || path == '/teaching/classtaskassign?titleName=作业布置'){ + if(id == '1-2' || id == '2-1' || id == '2-2' ){ // 头部 教材分析打开外部链接需要当前章节ID const { levelFirstId, levelSecondId, bookeId } = JSON.parse(localStorage.getItem('unitId')) - let unitId = levelSecondId ? levelSecondId : levelFirstId - fullPath = fullPath + `&unitId=${unitId}&bookeId=${bookeId}` - - console.log(fullPath) } fullPath = fullPath.replaceAll('//', '/') + console.log(fullPath) // 通知主进程 ipcRenderer.send('openWindow', { key: path, From 852b92e1f39e22496f8bc5179676427c7473f2ef Mon Sep 17 00:00:00 2001 From: lyc Date: Mon, 23 Sep 2024 17:22:43 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/views/desktop/index.vue | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/renderer/src/views/desktop/index.vue b/src/renderer/src/views/desktop/index.vue index 233a6d8..c92a5be 100644 --- a/src/renderer/src/views/desktop/index.vue +++ b/src/renderer/src/views/desktop/index.vue @@ -47,13 +47,10 @@ import outLink from '@/utils/linkConfig' import * as echarts from 'echarts' import { useGetClassWork } from '@/hooks/useGetClassWork' - const router = useRouter() const { ipcRenderer } = window.electron || {} -const type = ref(-1) const chartDom = ref(null); let chartInstance = null - const menuList = [{ name: '课程教学', span: 24, @@ -70,7 +67,7 @@ const menuList = [{ name: '教材分析', icon: 'icon-jiaocaixuanze', isOuter: true, - path: '/teaching/chatwithtextbook?', + path: '/teaching/chatwithtextbook', id: '1-2' }, { @@ -85,11 +82,6 @@ const menuList = [{ disabled: true, id: '1-4' }, - // { - // name: '教学设计', - // icon: 'icon-jiaoxuesheji', - // path: '/prepare' - // }, { name: '教学实践', icon: 'icon-jiaoxuefenxi', @@ -115,16 +107,12 @@ const menuList = [{ isOuter: true, path: '/teaching/classtaskassign?titleName=作业布置&openDialog=newClassTask', id: '2-1' - //path: '/newClassTask' - //path: '/classTaskAssign' - //isOuter: true, - //path: '/teaching/classtaskassign?titleName=作业布置&&openDialog=newClassTask' }, { name: '作业布置', icon: 'icon-xiezuo1', isOuter: true, - path: '/teaching/classtaskassign?titleName=作业布置?', + path: '/teaching/classtaskassign?titleName=作业布置', id: '2-2' }, { @@ -184,10 +172,14 @@ const clickMenu = ({isOuter, path, disabled, id}) =>{ // 头部 教材分析打开外部链接需要当前章节ID const { levelFirstId, levelSecondId, bookeId } = JSON.parse(localStorage.getItem('unitId')) let unitId = levelSecondId ? levelSecondId : levelFirstId - fullPath = fullPath + `&unitId=${unitId}&bookeId=${bookeId}` + if(fullPath.indexOf('?') == -1){ + fullPath += `?unitId=${unitId}&bookeId=${bookeId}` + } + else{ + fullPath += `&unitId=${unitId}&bookeId=${bookeId}` + } } fullPath = fullPath.replaceAll('//', '/') - console.log(fullPath) // 通知主进程 ipcRenderer.send('openWindow', { key: path, From c9292af67b4ba52423132f50aaef90c26697eac4 Mon Sep 17 00:00:00 2001 From: zdg Date: Mon, 23 Sep 2024 17:26:44 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96-=E4=B8=8B=E8=AF=BE?= =?UTF-8?q?=E5=92=8Cstroe=E7=9B=91=E5=90=AC=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/plugins/shareStore.js | 48 ++++++++++++++------ src/renderer/src/store/modules/tool.js | 2 +- src/renderer/src/views/classManage/index.vue | 2 +- src/renderer/src/views/tool/sphere.vue | 4 +- 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/src/renderer/src/plugins/shareStore.js b/src/renderer/src/plugins/shareStore.js index 0db8119..c4c2567 100644 --- a/src/renderer/src/plugins/shareStore.js +++ b/src/renderer/src/plugins/shareStore.js @@ -5,6 +5,8 @@ const isNode = typeof require !== 'undefined' // 是否支持node函数 const { ipcRenderer } = isNode?require('electron'):{} // app使用 import { sessionStore } from '@/utils/store' import CircularJSON from 'circular-json' +import _ from 'lodash' + // import { diff } from 'jsondiffpatch' // const Remote = isNode?require('@electron/remote'):{} // 远程模块 @@ -19,19 +21,14 @@ export function shareStorePlugin({store}) { const storeName = mutation.storeId // 用于多窗口共享(需要共享的状态名称) const names = ['tool'] - if (names.includes(storeName)) { - const { storeId: storeName, payload, events, type } = mutation // direct - // if (!Object.keys(payload).length) return - // if (type != 'direct' || !events || Array.isArray(events) || !events.key) return - stateSyncWatch(storeName, state) // 需要同步 - } + if (names.includes(storeName)) stateSyncWatch(storeName, state) // 需要同步 }) // 暴露方法-手动同步 store.stateSync = (storeName, key, value) => { const state = store.$state if (!storeName && !!key && !!value) stateSync(storeName, key, value, state) - else stateSyncAll(store, state) + else stateSyncAll(store) } // 暴露方法-发送当前状态-新窗口 store.stateSyncInit = wid => stateSyncInit(wid, store) @@ -58,21 +55,42 @@ function stateSync(storeName, key, value, state) { function stateSyncWatch(storeName, newState) { const oldState = sessionStore.store // 旧数据 const diffData = findDifferences(oldState, newState) - // console.log('state-change-diffData', diffData) + if(!_.keys(diffData).length) return // 没有变化就终止执行 + // 数据处理: 找出差异 + console.log('state-change-diffData', diffData) try { + let pinaValue = {} // store pina状态管理需要的数据格式 + // 数据转换处理 for(const key in diffData) { const value = diffData[key] || null const newValue = {} // 重新组装pinia需要的数据 {a:{b:1}} 这种 const keyArr = key.split('.') || [] keyArr.reduce((o,c,i)=>{o[c] = i === keyArr.length-1 ? value : {};return o[c]}, newValue) - const jsonStr = JSON.stringify(newValue) // 从新组装-json数据 - // 更新本地数据-session - // console.log('state-change-update:', key, value) - sessionStore.set(key, value) - // 通知主线程更新 - ipcRenderer?.invoke('pinia-state-change', storeName, jsonStr) - // console.log('======',key, value, jsonStr ) + // 合并数据 loadsh _.merge() 函数 + _.merge(pinaValue, newValue) } + + // 数据处理: electron-store + const [key, value] = _.toPairs(pinaValue)[0] // 对象转换为数组 {a:1} toPairs [['a',1]] + // 无数据就终止执行 + if (!key || !value) return + + // 更新本地数据-session + // 直接获取当前最新值(整体更新),上面获取到value是差异值,并不能知道删除还是新增 + const newValAll = _.get(newState, key) + const oldValAll = sessionStore.get(key) + + // 没变化也终止执行 + if (_.isEqual(oldValAll, newValAll)) return + + // 更新本地数据-session + sessionStore.set(key, newValAll) + + // 数据处理: pina-store + const jsonStr = JSON.stringify(pinaValue) // 从新组装-json数据 + // 通知主线程更新 + ipcRenderer?.invoke('pinia-state-change', storeName, jsonStr) + // console.log('======',key, value, jsonStr ) } catch (error) { console.log('state-change-error', error) } diff --git a/src/renderer/src/store/modules/tool.js b/src/renderer/src/store/modules/tool.js index 3f5c5d3..8c818cd 100644 --- a/src/renderer/src/store/modules/tool.js +++ b/src/renderer/src/store/modules/tool.js @@ -23,7 +23,7 @@ export const useToolState = defineStore('tool', { }), actions: { async resetDef() { // 重置数据-下课 - // this.model = 'select' // 悬浮球-当前模式 + this.model = 'select' // 悬浮球-当前模式 await sleep(50) // 休眠50ms this.showBoardAll = false // 全屏画板-是否显示 await sleep(50) // 休眠50ms diff --git a/src/renderer/src/views/classManage/index.vue b/src/renderer/src/views/classManage/index.vue index c3c25c7..058a0f9 100644 --- a/src/renderer/src/views/classManage/index.vue +++ b/src/renderer/src/views/classManage/index.vue @@ -302,7 +302,7 @@ addClasses({classIds:classids.value.join(','),userId:userStore.userId}).then(res => { if (res.code === 200) { dialogVisible.value = false - ElMessage({x + ElMessage({ message: res.msg, type: 'success', }) diff --git a/src/renderer/src/views/tool/sphere.vue b/src/renderer/src/views/tool/sphere.vue index d003ad5..572e3d4 100644 --- a/src/renderer/src/views/tool/sphere.vue +++ b/src/renderer/src/views/tool/sphere.vue @@ -219,15 +219,15 @@ const sideChange = async o => { }).then(async() => { await imChatRef.value?.imChatObj?.imChat?.sendMsgClosed() // 发送下课消息 // const elMsg = ElMessage.warning({duration:0,message:'正在下课...'}) - // const elMsg = ElLoading.service({lock: true, text: '正在下课...', background: 'rgba(0, 0, 0, 0.7)'}) + const elMsg = ElLoading.service({lock: true, text: '正在下课...', background: 'rgba(0, 0, 0, 0.7)'}) // 延迟2秒后关闭窗口,如果马上解散群,会导致群组不存在 setTimeout(async() => { - // elMsg.close() // toolStore.isToolWin = false toolStore.resetDef() // 重置状态 await imChatRef.value?.deleteGroup() // 解散群 await imChatRef.value?.logout() // 退出im await classManageApi.endClass(route.query.reservId) + elMsg.close() ipcMsgSend('tool-sphere:close') // 关闭窗口 }, 500);