Compare commits
15 Commits
3992cc814a
...
8a17273605
Author | SHA1 | Date |
---|---|---|
lyc | 8a17273605 | |
lyc | 22c377cd57 | |
zhengdegang | b13dae5b92 | |
zdg | a7743ba249 | |
zdg | 3038223a7f | |
lyc | 5e247006c5 | |
lyc | f2387c709a | |
lyc | 03f98c8beb | |
lyc | b085d96c0e | |
zhengdegang | 9b5a2ec88d | |
zdg | 32b0cdafc6 | |
zdg | 17e3ee62df | |
zhengdegang | 1f43e70175 | |
zdg | 0973128e0e | |
zdg | 61493a7f4e |
|
@ -13,6 +13,7 @@ const defaultData = {
|
|||
showBoardAll: false, // 全屏画板-是否显示
|
||||
isPdfWin: false, // pdf窗口是否打开
|
||||
isToolWin: false, // 工具窗口是否打开
|
||||
isTaskWin: false, // 批改窗口是否打开
|
||||
curSubjectNode: {
|
||||
querySearch: {} // 查询资源所需参数
|
||||
},
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 51 KiB |
|
@ -80,9 +80,7 @@ import { updateUserInfo } from '@/api/system/user'
|
|||
import logoIco from '@/assets/images/logo.png'
|
||||
import { listEvaluation } from '@/api/classManage/index'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
|
||||
const toolState = useToolState();
|
||||
let homeTitle = ref(import.meta.env.VITE_APP_TITLE)
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const userStore = useUserStore()
|
||||
|
@ -153,7 +151,8 @@ function handleCommand(command) {
|
|||
|
||||
function logout() {
|
||||
const hasClass = sessionStore.has('activeClass.id')
|
||||
if (hasClass || toolState.isToolWin) return ElMessage.warning('当前正在上课,请先结束上课')
|
||||
const hasTool = sessionStore.get('isToolWin')
|
||||
if (hasClass || hasTool) return ElMessage.warning('当前正在上课,请先结束上课')
|
||||
ElMessageBox.confirm('确认退出系统吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
|
|
@ -4,14 +4,7 @@
|
|||
<Header />
|
||||
</el-header>
|
||||
<el-main>
|
||||
<template v-if="currentRoute.path != '/home'">
|
||||
<el-page-header @back="goBack">
|
||||
<template #content>
|
||||
<span class="text-large mr-3"> {{ currentRoute.meta.title }} </span>
|
||||
</template>
|
||||
</el-page-header>
|
||||
</template>
|
||||
<AppMain :style="{ height: currentRoute.path == '/home' ? '100%' : 'calc(100% - 45px)'}" />
|
||||
<AppMain />
|
||||
</el-main>
|
||||
<Uploader v-if="uploaderStore.uploadList && uploaderStore.uploadList.length > 0" />
|
||||
<AiChart/>
|
||||
|
@ -19,32 +12,16 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { watch } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import Header from './components/Header.vue'
|
||||
import AppMain from './components/AppMain.vue'
|
||||
import Uploader from './components/Uploader.vue'
|
||||
import AiChart from '@/components/ai-chart/index.vue'
|
||||
import uploaderState from '@/store/modules/uploader'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const router = useRouter()
|
||||
const currentRoute = ref('')
|
||||
|
||||
watch(
|
||||
() => router.currentRoute.value,
|
||||
(newValue) => {
|
||||
currentRoute.value = newValue
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
let uploaderStore = ref(uploaderState())
|
||||
|
||||
const goBack = () =>{
|
||||
router.back()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -10,6 +10,8 @@ import _ from 'lodash'
|
|||
// import { diff } from 'jsondiffpatch'
|
||||
// const Remote = isNode?require('@electron/remote'):{} // 远程模块
|
||||
|
||||
const exArrs = ['subject'] // 不需要同步key-排除
|
||||
|
||||
export function shareStorePlugin({store}) {
|
||||
store.$subscribe((mutation, state) => { // 自动同步
|
||||
// mutation 变量包含了变化前后的状态
|
||||
|
@ -54,6 +56,7 @@ function stateSync(storeName, key, value, state) {
|
|||
// 同步数据-发送给主线程-单独($subscribe-监听使用)
|
||||
function stateSyncWatch(storeName, newState) {
|
||||
const oldState = sessionStore.store // 旧数据
|
||||
exArrs.forEach(k => Object.keys(oldState).includes(k) && (delete oldState[k]))
|
||||
const diffData = findDifferences(oldState, newState)
|
||||
if(!_.keys(diffData).length) return // 没有变化就终止执行
|
||||
// 数据处理: 找出差异
|
||||
|
@ -62,35 +65,36 @@ function stateSyncWatch(storeName, newState) {
|
|||
let pinaValue = {} // store pina状态管理需要的数据格式
|
||||
// 数据转换处理
|
||||
for(const key in diffData) {
|
||||
const value = diffData[key] || null
|
||||
const value = diffData[key]
|
||||
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)
|
||||
// 合并数据 loadsh _.merge() 函数
|
||||
_.merge(pinaValue, newValue)
|
||||
}
|
||||
|
||||
const piniaArr = _.toPairs(pinaValue) // 对象转换为数组 {a:1} toPairs [['a',1]]
|
||||
const setData = (key, value) => {
|
||||
// 无数据就终止执行
|
||||
if (!key) 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 )
|
||||
}
|
||||
// 数据处理: 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 )
|
||||
for(let [key, value] of piniaArr) {
|
||||
setData(key, value)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('state-change-error', error)
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<div :title="value" v-if="!!value">
|
||||
<vue-qr :text="value" :size="200" :margin="10" colorDark="green" colorLight="white" :logoSrc="getStaticUrl('/img/logo.png')" :logoScale="0.2" :dotScale="0.7"></vue-qr>
|
||||
</div>
|
||||
<!-- <el-button type="primary" :icon="Refresh" round title="刷新" @click="getQrUrl()" /> -->
|
||||
<el-button type="primary" :icon="Refresh" round title="刷新" @click="getQrUrl()" />
|
||||
<!-- <el-button type="warning" :loading="dt.loadingDel" @click="removeClasscourse()">删除记录</el-button>-->
|
||||
</template>
|
||||
<!-- 手机登录 -->
|
||||
|
@ -96,7 +96,7 @@ import * as Http_api from '@/api/apiService' // api接口
|
|||
import useUserStore from "@/store/modules/user" // 状态管理:user
|
||||
import CryptoJS from 'crypto-js'
|
||||
|
||||
const baseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||
let baseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||
const userStore = useUserStore()
|
||||
const visible = ref(false) // 是否打开窗口
|
||||
const myClassActive = ref({}) // 我的课件:准备上课的APT课件
|
||||
|
@ -286,30 +286,30 @@ const getQrUrl = async() => {
|
|||
const { userName, userId } = userStore.user
|
||||
if (!id||!userName) return
|
||||
// 原始方法(需要wx登录)
|
||||
const qrCodeUrl = `wxlogin?username=${userName}&nextaction=classteaching&id=${id}`
|
||||
teacherForm.form.qrUrl = baseUrl + qrCodeUrl
|
||||
// // const baseUrl = 'https://localhost:7860'
|
||||
// // token跳转
|
||||
// const url = `/teaching/classteachingonmobile?classcourseid=${id}` // 跳转移动端-上课
|
||||
// let qrCodeUrl = '' // 移动端-二维码地址
|
||||
// try {
|
||||
// // 走后端缓存url
|
||||
// const res = await Http_api.toLink.setLink(url) // 设置链接-缓存
|
||||
// if (res.code == 200) {
|
||||
// const redisKey = res.data
|
||||
// const base64Key = CryptoJS.enc.Utf8.parse(redisKey).toString(CryptoJS.enc.Base64) // base64加密
|
||||
// const enStrUrl = encodeURIComponent(base64Key) // url转码
|
||||
// qrCodeUrl = `?_server=${enStrUrl}`
|
||||
// teacherForm.form.qrUrl = baseUrl + qrCodeUrl
|
||||
// }
|
||||
// } catch (error) { // 异常, 直接加密token
|
||||
// const jsonStr = JSON.stringify({ url, token: userStore.token }) // json数据:{url, token}
|
||||
// const key = `Ax19i14Ga6qEDOkGTo` // AES加密-key
|
||||
// const enStr = CryptoJS.AES.encrypt(jsonStr, key).toString() // AES加密-数据
|
||||
// const enStrUrl = encodeURIComponent(enStr) // url转码
|
||||
// qrCodeUrl = `?_web=${enStrUrl}`
|
||||
// }
|
||||
// const qrCodeUrl = `wxlogin?username=${userName}&nextaction=classteaching&id=${id}`
|
||||
// teacherForm.form.qrUrl = baseUrl + qrCodeUrl
|
||||
// baseUrl = 'https://localhost:7860'
|
||||
// token跳转
|
||||
let url = `teaching/classteachingonmobile?classcourseid=${id}` // 跳转移动端-上课
|
||||
let qrCodeUrl = '' // 移动端-二维码地址
|
||||
try {
|
||||
// 走后端缓存url
|
||||
const res = await Http_api.toLink.setLink('/' + url) // 设置链接-缓存
|
||||
if (res.code == 200) {
|
||||
const redisKey = res.data
|
||||
const base64Key = CryptoJS.enc.Utf8.parse(redisKey).toString(CryptoJS.enc.Base64) // base64加密
|
||||
const enStrUrl = encodeURIComponent(base64Key) // url转码
|
||||
qrCodeUrl = `${url}&_server=${enStrUrl}`
|
||||
teacherForm.form.qrUrl = baseUrl + qrCodeUrl
|
||||
}
|
||||
} catch (error) { // 异常, 直接加密token
|
||||
const jsonStr = JSON.stringify({ url, token: userStore.token }) // json数据:{url, token}
|
||||
const key = `Ax19i14Ga6qEDOkGTo` // AES加密-key
|
||||
const enStr = CryptoJS.AES.encrypt(jsonStr, key).toString() // AES加密-数据
|
||||
const enStrUrl = encodeURIComponent(enStr) // url转码
|
||||
qrCodeUrl = `${url}&?_web=${enStrUrl}`
|
||||
}
|
||||
teacherForm.form.qrUrl = baseUrl + qrCodeUrl
|
||||
}
|
||||
// 定时器监听
|
||||
|
||||
|
|
|
@ -220,13 +220,13 @@ const sideChange = async o => {
|
|||
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)'})
|
||||
// toolStore.isToolWin = false
|
||||
toolStore.resetDef() // 重置状态
|
||||
await classManageApi.endClass(route.query.reservId)
|
||||
// 延迟2秒后关闭窗口,如果马上解散群,会导致群组不存在
|
||||
setTimeout(async() => {
|
||||
// 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