Compare commits
11 Commits
9ab2c17b3e
...
09914eb8f9
Author | SHA1 | Date |
---|---|---|
zhengdegang | 09914eb8f9 | |
zdg | f1cdb7b400 | |
zhengdegang | d4f58d8a05 | |
zdg | a4647ff828 | |
zdg | 7e18f2e9d9 | |
zhengdegang | e79d554987 | |
zdg | fbacb32940 | |
zhengdegang | 7d20a7ee50 | |
zdg | e494c303f0 | |
zdg | 0fcaf3f3e7 | |
zouyf | 91f43987f7 |
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "aix-win",
|
||||
"version": "2.1.21",
|
||||
"version": "2.1.27",
|
||||
"description": "",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "上海交大重庆人工智能研究院",
|
||||
|
|
|
@ -175,6 +175,7 @@ async function createLinkWin(data) {
|
|||
data.fullPath += '?urlSource=smarttalk&t' + Date.now()
|
||||
}
|
||||
linkWin[data.key].loadURL(data.fullPath)
|
||||
if (import.meta.env.VITE_SHOW_DEV_TOOLS === 'true') linkWin[data.key].webContents.openDevTools()
|
||||
|
||||
linkWin[data.key].once('ready-to-show', () => {
|
||||
linkWin[data.key].show()
|
||||
|
|
|
@ -23,7 +23,9 @@ const defaultData = {
|
|||
curNode: null, // 当前选中的节点
|
||||
defaultExpandedKeys: [], //展开的节点
|
||||
subjectTree: [] // "树结构" 章节
|
||||
}
|
||||
},
|
||||
env: {}, // 不走同步 Pinia - 变量
|
||||
curr: {} // 不走同步 Pinia - 当前信息
|
||||
},
|
||||
local: { // 本地(永久localStorage)
|
||||
},
|
||||
|
|
|
@ -213,7 +213,7 @@ const delStudent = (index) => {
|
|||
const onSubmit = (formEl) => {
|
||||
if (!formEl) return
|
||||
// 课堂id
|
||||
const classRoomId = sessionStore.get('curClassRoom.id')
|
||||
const classRoomId = sessionStore.get('curr.curClassRoom.id')
|
||||
formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,7 @@ import _ from 'lodash'
|
|||
// import { diff } from 'jsondiffpatch'
|
||||
// const Remote = isNode?require('@electron/remote'):{} // 远程模块
|
||||
|
||||
const exArrs = ['subject'] // 不需要同步key-排除
|
||||
const exArrs = ['subject','env','curr'] // 不需要同步key-排除
|
||||
|
||||
export function shareStorePlugin({store}) {
|
||||
store.$subscribe((mutation, state) => { // 自动同步
|
||||
|
@ -60,7 +60,7 @@ function stateSyncWatch(storeName, newState) {
|
|||
const diffData = findDifferences(oldState, newState)
|
||||
if(!_.keys(diffData).length) return // 没有变化就终止执行
|
||||
// 数据处理: 找出差异
|
||||
// console.log('state-change-diffData', diffData)
|
||||
// console.log('state-change-diffData', diffData, newState)
|
||||
try {
|
||||
let pinaValue = {} // store pina状态管理需要的数据格式
|
||||
// 数据转换处理
|
||||
|
@ -83,7 +83,7 @@ function stateSyncWatch(storeName, newState) {
|
|||
// 没变化也终止执行
|
||||
if (_.isEqual(oldValAll, newValAll)) return
|
||||
// 更新本地数据-session
|
||||
sessionStore.set(key, newValAll)
|
||||
sessionStore.set(key, newValAll || null)
|
||||
|
||||
// 数据处理: pina-store
|
||||
const jsonStr = JSON.stringify(pinaValue) // 从新组装-json数据
|
||||
|
|
|
@ -6,7 +6,7 @@ import { sessionStore } from '@/utils/store'
|
|||
|
||||
// 默认数据
|
||||
const defData = sessionStore.store || {}
|
||||
const exArrs = ['subject']
|
||||
const exArrs = ['subject','env','curr']
|
||||
exArrs.forEach(k => Object.keys(defData).includes(k) && (delete defData[k]))
|
||||
|
||||
// 延时
|
||||
|
|
|
@ -200,6 +200,25 @@ export const createWindow = async (type, data) => {
|
|||
eventHandles(type, winChild) // 事件监听处理
|
||||
return winChild
|
||||
}
|
||||
case 'open-win': { // 创建-新窗口
|
||||
const option = data.option||{}
|
||||
const defOption = {
|
||||
show: false,
|
||||
frame: true, // 无边框
|
||||
autoHideMenuBar: true,
|
||||
maximizable: false,
|
||||
}
|
||||
data.isConsole = true // 是否开启控制台
|
||||
data.option = {...defOption, ...option}
|
||||
const win = await toolWindow(type, data)
|
||||
win.type = type // 唯一标识
|
||||
win.show()
|
||||
win.maximize();
|
||||
// win.setFullScreen(true) // 设置窗口为全屏
|
||||
if (import.meta.env.VITE_SHOW_DEV_TOOLS === 'true') win.webContents.openDevTools() // 打开调试工具
|
||||
eventHandles(type, win) // 事件监听处理
|
||||
break
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -360,6 +379,18 @@ const eventHandles = (type, win) => {
|
|||
publicMethods(on) // 加载公共方法
|
||||
break;
|
||||
}
|
||||
case 'open-win': { // 打开新窗口
|
||||
// 监听窗口关闭事件
|
||||
win.on('closed', function () {
|
||||
win&&win.destroy()
|
||||
});
|
||||
const on = {
|
||||
onClosed: () => {
|
||||
}
|
||||
}
|
||||
publicMethods(on) // 加载公共方法
|
||||
break
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
|
@ -18,7 +18,10 @@ const loadPdfAnimation = (path) => {
|
|||
},2000)
|
||||
}
|
||||
onMounted(() => {
|
||||
const bookpath = localStorage.getItem('PDF-LOCAL-PATH')
|
||||
const pdfUrl1 = localStorage.getItem('PDF-TOOL-PATH')
|
||||
const pdfUrl2 = localStorage.getItem('PDF-LOCAL-PATH')
|
||||
console.log('tool-pdf 地址: ',pdfUrl1, pdfUrl2)
|
||||
const bookpath = pdfUrl1 || pdfUrl2
|
||||
// const filepath = import.meta.env.VITE_APP_RES_FILE_PATH + bookpath
|
||||
// const isDev = process.env.NODE_ENV == 'development'
|
||||
// if (isDev)
|
||||
|
@ -28,7 +31,7 @@ onMounted(() => {
|
|||
// const newpath = getStaticUrl(bookpath, 'user', 'selfFile', true)
|
||||
loadPdfAnimation(bookpath)
|
||||
// pdfUrl.value = filepath
|
||||
// console.log('课件路径',newpath);
|
||||
// console.log('课件路径',bookpath);
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -636,6 +636,10 @@ export default {
|
|||
const path = await this.getBookPathFromServer(data.textBook.curBookPath)
|
||||
const localpath = getAppInstallUrl('pdfjs-dist/web/viewer.html', 'user', '\\out\\renderer', true) + "?file="
|
||||
localStorage.setItem('PDF-LOCAL-PATH',localpath + encodeURIComponent(import.meta.env.VITE_APP_RES_FILE_PATH + path))
|
||||
// 相关数据存储session中
|
||||
sessionStore.set('curr.textBook', data.textBook)
|
||||
sessionStore.set('env.pdfBasePath', localpath)
|
||||
sessionStore.set('env.fileBasePath', import.meta.env.VITE_APP_RES_FILE_PATH)
|
||||
this.checkFileList = []
|
||||
this.currentWorkList = []
|
||||
let cata = parseCataByNode(data.node)
|
||||
|
|
|
@ -129,7 +129,7 @@ const sendHomework = (row,type) => {
|
|||
}
|
||||
//
|
||||
const closeHomework = async() => {
|
||||
ipcMsgSend('tool-sphere:set:ignore', true)
|
||||
// ipcMsgSend('tool-sphere:set:ignore', true)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,23 @@
|
|||
<div class="content" v-if="isVisible">
|
||||
<slot name="content">
|
||||
<homework v-if="activeObj?.prop === 'resource'" :curNode="curNode" @closeActive="closeActive" />
|
||||
<template v-else-if="activeObj?.prop === 'book'">
|
||||
<div class="item">
|
||||
<div class="item-title">
|
||||
<h3>{{ curNode.label }}</h3>
|
||||
<span class="sub">{{ curNode.edusubject }}</span>
|
||||
</div>
|
||||
<div class="item-content" v-loading="loading">
|
||||
<el-scrollbar height="300px">
|
||||
<div class="item-content-item" v-for="item in cData">
|
||||
<el-tag effect="dark">{{ item.tag }}</el-tag>
|
||||
<span>{{ item.name }}</span>
|
||||
<el-button :color="item.color||'#349d44'" size="small" @click="openFile(item)">打开</el-button>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<span v-else style="color:red;">{{activeObj}}</span>
|
||||
</slot>
|
||||
</div>
|
||||
|
@ -37,6 +54,8 @@
|
|||
import { computed, defineProps, ref, reactive, watchEffect, onMounted} from 'vue'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import homework from './homework.vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { toRoter, createWindow } from '@/utils/tool' // 相关工具
|
||||
|
||||
// 功能说明:侧边-工具栏
|
||||
const colors = ['#409EFF','#00f389', '#ff7f00', '#ffff00', '#00baff', '#13b189', '#F56C6C']
|
||||
|
@ -49,7 +68,7 @@ const props = defineProps({
|
|||
data: { // 数据
|
||||
type: Array,
|
||||
default: () => [
|
||||
{ label: '课件', prop: 'book', isExtra: true, icon: 'icon--kejian' },
|
||||
{ label: '资源', prop: 'book', icon: 'icon--kejian' },
|
||||
{ label: '活动', prop: 'resource', icon: 'icon-kechengziyuan1' },
|
||||
// { label: '互动', prop: 'interact', icon: 'icon-hudong' },
|
||||
// { label: '窗口', prop: 'win', icon: 'icon-tubiaozhizuomobanyihuifu-' },
|
||||
|
@ -61,10 +80,11 @@ const isVisible = ref(false) // 是否显示内容
|
|||
const activeObj = ref(null) // 当前激活的按钮
|
||||
const btnRef = ref(null) // 按钮元素-ref
|
||||
const topPos = ref(30) // 顶部距离-内容的距离
|
||||
const hPost = ref(0) // 顶部距离-内容的距离
|
||||
const isFold = ref(false) // 是否折叠
|
||||
const hPost = ref(0) // 顶部距离-内容的距离
|
||||
const isFold = ref(false) // 是否折叠
|
||||
const cData = ref(null) // 内容数据
|
||||
const loading = ref(false) // 加载中
|
||||
let posBtnAll = {} // 存储位置
|
||||
|
||||
let curNode = null // 当前节点(作业需要)
|
||||
// === 计算属性 ===
|
||||
const list = computed(() => props.data.map((o,i) => {
|
||||
|
@ -74,6 +94,7 @@ const list = computed(() => props.data.map((o,i) => {
|
|||
onMounted(() => {
|
||||
posBtnAll = btnRef.value.getBoundingClientRect()
|
||||
hPost.value = Math.round(posBtnAll.height)
|
||||
// btnRef.value.style.marginTop = -hPost.value / 2 + 'px'
|
||||
curNode = sessionStore?.get?.('subject.curNode')
|
||||
})
|
||||
// === 方法 ===
|
||||
|
@ -88,7 +109,16 @@ const getStyle = (style,index) => {
|
|||
return `${style}${style.endsWith(';')?'':';'}color:${color};`
|
||||
}
|
||||
}
|
||||
// 事件
|
||||
// 获取内容数据
|
||||
const getContent = o => {
|
||||
loading.value = true
|
||||
const { roottitle, edustage, edusubject } = curNode
|
||||
const textbook = { type: 'book', tag: '教材', name: roottitle }
|
||||
const course = { type: 'course', tag: '课标', name: `${edustage}-${edusubject}-课标` }
|
||||
cData.value = [textbook, course]
|
||||
loading.value = false
|
||||
}
|
||||
// 回调: 菜单点击
|
||||
const clickHandel = (o, e) => {
|
||||
if (!o.isExtra) { // 忽略其他操作: 打开内容窗口,指示器指向当前
|
||||
const node = e.target.parentNode.getBoundingClientRect()
|
||||
|
@ -97,12 +127,42 @@ const clickHandel = (o, e) => {
|
|||
activeObj.value = o
|
||||
const nodeH = parseInt(node.height / 2) // 高度的一半
|
||||
topPos.value = Math.round(parseInt(node.top) - posBtnAll.top + nodeH)
|
||||
|
||||
// 获取内容数据
|
||||
if (['book'].includes(o.prop)) getContent(o)
|
||||
}
|
||||
emit('change', o)
|
||||
}
|
||||
const closeActive = () =>{
|
||||
isVisible.value = false
|
||||
// 回调: 打开文件
|
||||
const openFile = item => {
|
||||
if (['book', 'course'].includes(item.type)) {
|
||||
const isBool = sessionStore.has('curr.textBook')
|
||||
if (!isBool) return ElMessage.error('打开失败,请重试!')
|
||||
const textBook = sessionStore.get('curr.textBook')
|
||||
const pdfBasePath = sessionStore.get('env.pdfBasePath')
|
||||
const fileBasePath = sessionStore.get('env.fileBasePath')
|
||||
let path = ''
|
||||
if (item.type == 'book') path = (textBook.curBookPath||'').replace('.txt', '.pdf')
|
||||
else path = textBook.curBookPath.replace(/([^-]*)$/, '课标.pdf')
|
||||
const url = pdfBasePath + encodeURIComponent(`${fileBasePath}${path}`)
|
||||
console.log(url)
|
||||
localStorage.setItem('PDF-TOOL-PATH', url)
|
||||
// 打开新窗口
|
||||
// toRoter(`${process.env['ELECTRON_RENDERER_URL']}/#/fullscreenpdf`)
|
||||
console.log('pdf_old:' + localStorage.getItem('PDF-LOCAL-PATH'))
|
||||
console.log('pdf_new:' + localStorage.getItem('PDF-TOOL-PATH'))
|
||||
// emit('change', { prop: 'bookOpen' })
|
||||
createWindow('open-win', {url: '/fullscreenpdf'})
|
||||
}
|
||||
}
|
||||
// 回调: 关闭事件
|
||||
const closeActive = () =>{
|
||||
if (isVisible.value) { // 打开状态,关闭
|
||||
isVisible.value = false
|
||||
emit('change', { prop: 'close' })
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({closeActive})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
@ -111,8 +171,8 @@ defineExpose({closeActive})
|
|||
position: fixed;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
z-index: 1;
|
||||
right: 10px;
|
||||
//min-height: 40vh;
|
||||
min-width: 4em;
|
||||
border-radius: 4em;
|
||||
background-color: rgba(18,18,18,0.3);
|
||||
|
@ -173,5 +233,33 @@ defineExpose({closeActive})
|
|||
top: var(--top);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.content{
|
||||
// 每个菜单
|
||||
.item{
|
||||
margin: 0 15px;
|
||||
&-title{
|
||||
margin-bottom: 20px;
|
||||
h3{
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
}
|
||||
.sub{
|
||||
color: #cecece;
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
&-content-item{
|
||||
display: flex;
|
||||
background-color: #384342;
|
||||
padding: 15px 10px;
|
||||
margin-bottom: 10px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<template>
|
||||
<div class="warp-all">
|
||||
<!-- 遮罩层 -->
|
||||
<div class="mask" v-show="isMask" @click="maskChange(true)"></div>
|
||||
<!-- 画板 -->
|
||||
<board-vue v-model="tabActive" v-show="isShow" ref="boardVueRef"></board-vue>
|
||||
|
||||
|
@ -62,7 +64,8 @@ const isDrag = ref(false) // 开始拖拽
|
|||
const dragtime = ref(0) // 拖拽时间-计算点击还是拖动
|
||||
const isShow = ref(false) // 是否显示-画板
|
||||
const isOver = ref(false) // 是否下课
|
||||
const isOpenBook = ref(false)
|
||||
const isOpenBook = ref(false) // 是否打开pdf课本
|
||||
const isMask = ref(false) // 是否显示遮罩层
|
||||
const toolStore = useToolState() // 状态管理
|
||||
const boardVueRef=ref(null) // 画板ref
|
||||
const upvoteRef = ref(null) // 点赞 ref
|
||||
|
@ -93,7 +96,6 @@ onMounted(async() => {
|
|||
// window.test1 = toolStore
|
||||
getClassInfo() // 获取课堂详情 ex3
|
||||
resetStatus() // 开启重置状态-监听
|
||||
|
||||
})
|
||||
|
||||
// ==== 方法 ===
|
||||
|
@ -101,7 +103,7 @@ onMounted(async() => {
|
|||
const getClassInfo = async () => {
|
||||
const { data } = await classManageApi.getClassInfo(classObj.id)
|
||||
classObj.data = data
|
||||
sessionStore.set('curClassRoom', classObj) // 课堂信息-缓存
|
||||
sessionStore.set('curr.curClassRoom', classObj) // 课堂信息-缓存
|
||||
// 群id
|
||||
let timGroupId = data?.ex3 || ''
|
||||
console.log('获取群ID:', timGroupId)
|
||||
|
@ -143,7 +145,7 @@ const logoHandle = (e,t) => {
|
|||
// 底部工具栏:移入移出-是否穿透
|
||||
const mouseChange = (bool) => {
|
||||
let resBool = false
|
||||
console.log('mouseChange:', bool, resBool)
|
||||
// console.log('mouseChange:', bool, resBool)
|
||||
if (!bool) return setIgnore(resBool) // 移入不穿透
|
||||
if (tabActive.value == 'select') resBool = !!bool
|
||||
else {
|
||||
|
@ -152,12 +154,10 @@ const mouseChange = (bool) => {
|
|||
const isPdf = !resBool && toolStore.isPdfWin
|
||||
if (isPdf) resBool = true
|
||||
}
|
||||
console.log('mouseChange:', bool, resBool)
|
||||
// console.log('mouseChange:', bool, resBool)
|
||||
setIgnore(resBool)
|
||||
}
|
||||
const touchChange = (e) => {
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
// im-chat: 聊天事件 {type, data}
|
||||
const chatChange = (type, data, ...args) => {
|
||||
if (type == 'createGroup') { // 创建群-监听
|
||||
|
@ -189,14 +189,6 @@ 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)
|
||||
// mouseChange(1)
|
||||
// }, 500)
|
||||
// })
|
||||
toolStore.isToolWin = true // 标记状态
|
||||
}
|
||||
// 侧边工具栏: 移入移出
|
||||
|
@ -206,21 +198,16 @@ const sideMouse = e => {
|
|||
setIgnore(false) // 关闭窗口鼠标-穿透
|
||||
return
|
||||
}
|
||||
mouseChange(type == 'mouseleave')
|
||||
// // 关闭侧边工具内容窗口
|
||||
// if (type == 'mouseleave') {
|
||||
// timingSide = setTimeout(() => {
|
||||
// sideVueRef.value.closeActive()
|
||||
// }, 500)
|
||||
// } else { // 移入
|
||||
// if (!!timingSide) clearTimeout(timingSide)
|
||||
// }
|
||||
// 打开内容且触发移出事件时
|
||||
const bool = isMask.value && type =='mouseleave'
|
||||
if (bool) mouseChange(false) // 不穿透
|
||||
else mouseChange(type == 'mouseleave')
|
||||
}
|
||||
// 侧边工具栏: 操作变化
|
||||
const sideChange = async o => {
|
||||
// console.log(o)
|
||||
switch(o.prop) {
|
||||
case 'book':
|
||||
case 'bookOpen':
|
||||
if(isOpenBook.value) {
|
||||
isOpenBook.value = false
|
||||
ElMessage.info('已经打开课本了哦')
|
||||
|
@ -230,7 +217,14 @@ const sideChange = async o => {
|
|||
isOpenBook.value = true
|
||||
}
|
||||
break
|
||||
case 'book':
|
||||
isMask.value = !isMask.value
|
||||
break
|
||||
case 'close': // 关闭
|
||||
maskChange(false)
|
||||
break
|
||||
case 'resource': // 资源
|
||||
isMask.value = !isMask.value
|
||||
break
|
||||
case 'interact': // 互动
|
||||
break
|
||||
|
@ -267,6 +261,13 @@ const sideChange = async o => {
|
|||
}
|
||||
}
|
||||
|
||||
// 遮罩层-触发事件
|
||||
const maskChange = (bool) => {
|
||||
isMask.value = false
|
||||
bool && sideVueRef.value.closeActive() // 关闭侧边栏内容窗口
|
||||
mouseChange(true) // 允许穿透
|
||||
}
|
||||
|
||||
// === 监听器 ===
|
||||
watchEffect(() => {
|
||||
if (isOver.value) return // 下课, 不往下执行
|
||||
|
@ -286,6 +287,12 @@ watchEffect(() => {
|
|||
.warp-all{
|
||||
position: relative;
|
||||
}
|
||||
// 遮罩层
|
||||
.mask{
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(1, 1, 1, 0.3);
|
||||
}
|
||||
// 底部工具栏
|
||||
.tool-bottom-all{
|
||||
// width: 45vw;
|
||||
|
@ -328,6 +335,7 @@ watchEffect(() => {
|
|||
}
|
||||
}
|
||||
}
|
||||
// 底部动画
|
||||
.a-fade-leave-active,.a-fade-enter-active{
|
||||
transition: all .3s;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue