Merge branch 'qinqing_dev' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk into qinqing_dev
This commit is contained in:
commit
ff441c6579
|
@ -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数据
|
||||
// 合并数据 loadsh _.merge() 函数
|
||||
_.merge(pinaValue, newValue)
|
||||
}
|
||||
|
||||
// 数据处理: electron-store
|
||||
const [key, value] = _.toPairs(pinaValue)[0] // 对象转换为数组 {a:1} toPairs [['a',1]]
|
||||
// 无数据就终止执行
|
||||
if (!key || !value) return
|
||||
|
||||
// 更新本地数据-session
|
||||
// console.log('state-change-update:', key, value)
|
||||
sessionStore.set(key, value)
|
||||
// 直接获取当前最新值(整体更新),上面获取到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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -38,10 +38,6 @@ const handleSelect = (itemDom,pathKey) => {
|
|||
const result = parts.slice(0, 2).join("-")
|
||||
const index = props.menuItems.findIndex(item=>item.index===result)
|
||||
const id = props.classList[pathKey[0]].id
|
||||
// router.push({
|
||||
// path: `${props.menuItems[index].path}/${id}`,
|
||||
// query: { id }
|
||||
// })
|
||||
emits('handleSelect',{index,id})
|
||||
}
|
||||
const menuClick = (item,index) => {
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<template>
|
||||
<el-card style="width: 100%;height: 100%">
|
||||
<!-- <template #header>-->
|
||||
<!-- <div style="text-align: left">-->
|
||||
<!-- <el-button type="danger" @click="deleteClassRoom">删除班级</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </template>-->
|
||||
<el-descriptions :column="1">
|
||||
<el-descriptions-item label="班级名称">{{ classInfo.caption }}</el-descriptions-item>
|
||||
<el-descriptions-item label="教师">
|
||||
|
|
|
@ -6,12 +6,6 @@
|
|||
<div >
|
||||
<Aside :menuItems="menuItems" :classList="classList" @handleSelect="handleSelect"></Aside>
|
||||
</div>
|
||||
<!-- 隐藏操作按钮-->
|
||||
<!-- <template #footer>-->
|
||||
<!-- <div>-->
|
||||
<!-- <el-button @click="addClass" type="primary" :icon="Plus" >新增班级</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </template>-->
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button @click="addClass" type="primary" :icon="Plus" >加入班级</el-button>
|
||||
|
@ -41,29 +35,6 @@
|
|||
:rules="rules"
|
||||
ref="myForm"
|
||||
>
|
||||
<!-- <el-form-item label="班级名称" style="margin-right: 10px;width: 50%" prop="caption">-->
|
||||
<!-- <el-input v-model="classForm.caption" placeholder="请输入班级名称"></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="任选学科" style="margin-right: 10px;">-->
|
||||
<!-- <el-radio-group v-model="classForm.edusubject" class="ml-4">-->
|
||||
<!-- <template v-for="(item, index) in courseList" :key="index">-->
|
||||
<!-- <el-radio v-if="item.edustage == userStore.edustage" :value="item.itemtitle">{{ item.itemtitle }}</el-radio>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="年级" style="margin-right: 10px;" prop="agekey">-->
|
||||
<!-- <el-radio-group v-model="classForm.edudegree">-->
|
||||
<!-- <template v-for="(item,index) in gradeList" :key="index">-->
|
||||
<!-- <el-radio v-if="item.edustage == userStore.edustage" :value="item.value">{{ item.label }}</el-radio>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="老师" prop="teacherid">-->
|
||||
<!-- {{ userStore.nickName }}-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="简要说明" style="margin-right: 10px;" prop="classdesc">-->
|
||||
<!-- <el-input v-model="classForm.classdesc" placeholder="请输入简要说明"></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="老师" style="margin-right: 10px;width: 50%">
|
||||
<el-text>
|
||||
{{userStore.nickName}}
|
||||
|
@ -242,67 +213,15 @@
|
|||
return defaultLabel;
|
||||
}
|
||||
}
|
||||
//获取所有学科
|
||||
// const getCourseList = () => {
|
||||
// // 获取基础的学科
|
||||
// listEvaluation({ itemkey: "subject", pageSize: 500 }).then((res) => {
|
||||
// courseList.value = [...res.rows];
|
||||
// });
|
||||
// }
|
||||
// 新增班级
|
||||
const addClass = () => {
|
||||
dialogVisible.value = true
|
||||
// getCourseList()
|
||||
}
|
||||
// const btnSave = () => {
|
||||
// myForm.value.validate((valid) => {
|
||||
// if (valid) {
|
||||
// //查看班级是否重名
|
||||
// listClassmain({ entpid: userStore.deptId, status: 'open', pageSize: 500 }).then(response => {
|
||||
// const data = [...response.rows]
|
||||
// const existList = [];
|
||||
// data.forEach(item => {
|
||||
// if (parseInt(textSimilar(item.caption, classForm.caption, 2)) > 80) {
|
||||
// existList.push(item);
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// if (existList.length == 0) {
|
||||
// const age = classForm.edudegree;
|
||||
// const index = gradeList.value.findIndex(item => item.label === age);
|
||||
// classForm.agekey = gradeList.value[index].agekey
|
||||
// classForm.edudegree = `${gradeList.value[index].agekey}年级`
|
||||
// classForm.entpid = userStore.deptId;
|
||||
// classForm.status = 'open';
|
||||
// classForm.teachername = userStore.nickName;
|
||||
// classForm.teacherid = userStore.userId;
|
||||
// classForm.teacherSubject = classForm.edusubject;
|
||||
// addClassmain(classForm).then(response => {
|
||||
// if (response.code === 200) {
|
||||
// dialogVisible.value = false
|
||||
// ElMessage({
|
||||
// message: '新增成功',
|
||||
// type: 'success',
|
||||
// })
|
||||
// getClassInfo()
|
||||
// }
|
||||
// });
|
||||
// }else{
|
||||
// ElMessage({
|
||||
// message: '班级名称重复',
|
||||
// type: 'warning',
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
//新增班级
|
||||
const btnSave = () => {
|
||||
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',
|
||||
})
|
||||
|
|
|
@ -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,
|
||||
|
@ -69,7 +66,7 @@ const menuList = [{
|
|||
name: '教材分析',
|
||||
icon: 'icon-jiaocaixuanze',
|
||||
isOuter: true,
|
||||
path: '/teaching/chatwithtextbook?',
|
||||
path: '/teaching/chatwithtextbook',
|
||||
id: '1-2'
|
||||
},
|
||||
{
|
||||
|
@ -84,11 +81,6 @@ const menuList = [{
|
|||
disabled: true,
|
||||
id: '1-4'
|
||||
},
|
||||
// {
|
||||
// name: '教学设计',
|
||||
// icon: 'icon-jiaoxuesheji',
|
||||
// path: '/prepare'
|
||||
// },
|
||||
{
|
||||
name: '教学实践',
|
||||
icon: 'icon-jiaoxuefenxi',
|
||||
|
@ -114,16 +106,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'
|
||||
},
|
||||
{
|
||||
|
@ -183,10 +171,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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue