修复bug-画笔 #174
|
@ -100,14 +100,14 @@ const renderPage = async (canvasobj) => {
|
|||
})
|
||||
}
|
||||
// 保存数据
|
||||
const savaDataStore = (type) => {
|
||||
const savaDataStore = async (type) => {
|
||||
if(!toolState.isToolWin){
|
||||
toolState.isPdfWin = false
|
||||
nextTick(() => {
|
||||
await sleep(20) // 延时
|
||||
toolState.showBoardAll = true //恢复默认值
|
||||
})
|
||||
await sleep(50) // 延时
|
||||
if(type=='rest'){
|
||||
ipcRenderer.invoke('tool-sphere:reset') //重置tool状态
|
||||
// ipcRenderer.invoke('tool-sphere:reset') //重置tool状态-废弃
|
||||
ipcRenderer.send('open-PDF:close')
|
||||
}else{
|
||||
ipcRenderer.invoke('open-PDF:minimize')
|
||||
|
@ -143,22 +143,24 @@ const savaDataStore = (type) => {
|
|||
|
||||
}
|
||||
})
|
||||
Promise.all(promises).then(res=>{
|
||||
Promise.all(promises).then(async res=>{
|
||||
toolState.isPdfWin=false
|
||||
nextTick(() => {
|
||||
await sleep(20) // 延时
|
||||
toolState.showBoardAll=true //恢复默认值
|
||||
})
|
||||
await sleep(50) // 延时
|
||||
// ipcRenderer.send('open-PDF:minimize')
|
||||
if(type=='rest'){
|
||||
ipcRenderer.invoke('tool-sphere:reset') //重置tool状态
|
||||
// ipcRenderer.invoke('tool-sphere:reset') //重置tool状态-废弃
|
||||
ipcRenderer.send('open-PDF:close')
|
||||
}else{
|
||||
ipcRenderer.send('open-PDF:minimize')
|
||||
ipcRenderer.invoke('open-PDF:minimize')
|
||||
}
|
||||
// ipcRenderer.send('open-PDF:close')
|
||||
|
||||
})
|
||||
}
|
||||
// 延时
|
||||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||
const updatePage = (canvasobj) => {
|
||||
renderPage(canvasobj)
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ export function shareStorePlugin({store}) {
|
|||
|
||||
// 同步数据-发送给主线程-单独
|
||||
function stateSync(storeName, key, value, state) {
|
||||
// console.log('state-change', storeName, key, value)
|
||||
console.log('state-change', storeName, key, value)
|
||||
try {
|
||||
const { data, keystr } = filterByKey(state, key, value)
|
||||
const jsonStr = JSON.stringify(data) // 从新组装-json数据
|
||||
|
@ -85,7 +85,7 @@ function stateChange(store) {
|
|||
const storeName = store.$id
|
||||
ipcRenderer?.on('pinia-state-set', (e, sName, jsonStr) => {
|
||||
if (sName == storeName) { // 更新对应数据
|
||||
// console.log('state-set', jsonStr, sName)
|
||||
console.log('state-set', jsonStr, sName)
|
||||
const curJson = circularSafeStringify(store.$state) // 当前数据
|
||||
const isUp = curJson != jsonStr // 不同的时候才写入,不然会导致触发数据变化监听,导致死循环
|
||||
if (!isUp) return
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
<script setup>
|
||||
// 功能说明:electron 悬浮球
|
||||
import { onMounted, ref, reactive, watchEffect } from 'vue'
|
||||
import { onMounted, ref, reactive, watchEffect, nextTick } from 'vue'
|
||||
import { useRoute } from 'vue-router';
|
||||
import { ElMessageBox, ElMessage, ElLoading } from 'element-plus'
|
||||
import * as classManageApi from '@/api/classManage'
|
||||
|
@ -83,8 +83,8 @@ const btnList = [ // 工具栏按钮列表
|
|||
// === 页面加载完毕 ===
|
||||
onMounted(async() => {
|
||||
if (!electron) return // 浏览器端
|
||||
// window.test = sessionStore
|
||||
// window.test1 = toolStore
|
||||
window.test = sessionStore
|
||||
window.test1 = toolStore
|
||||
getClassInfo() // 获取课堂详情 ex3
|
||||
resetStatus() // 开启重置状态-监听
|
||||
})
|
||||
|
@ -135,6 +135,7 @@ const logoHandle = (e,t) => {
|
|||
// 底部工具栏:移入移出-是否穿透
|
||||
const mouseChange = (bool) => {
|
||||
let resBool = false
|
||||
if (bool == 0) return setIgnore(resBool) // 移入不穿透
|
||||
if (tabActive.value == 'select') resBool = !!bool
|
||||
else {
|
||||
if (!isShow.value) resBool = !!bool
|
||||
|
@ -176,15 +177,15 @@ 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)
|
||||
})
|
||||
// 以下代码废弃-暂时无用
|
||||
// ipcMain?.removeHandler('tool-sphere:reset') // 避免已绑定,先移除在绑定
|
||||
// ipcMain?.handle?.('tool-sphere:reset', () => {
|
||||
// setTimeout(() => {
|
||||
// boardVueRef.value.handleMode(tabActive.value)
|
||||
// mouseChange(1)
|
||||
// }, 500)
|
||||
// })
|
||||
toolStore.isToolWin = true // 标记状态
|
||||
|
||||
}
|
||||
// 侧边工具栏: 移入移出
|
||||
const sideMouse = e => {
|
||||
|
@ -240,6 +241,12 @@ watchEffect(() => {
|
|||
// 不同的时候, 更新值: 是否显示-画板
|
||||
const show = !toolStore.isPdfWin && toolStore.showBoardAll
|
||||
if (show != isShow.value) isShow.value = show
|
||||
if (isShow.value) {
|
||||
nextTick(() => {
|
||||
mouseChange(1) // 移除工具栏
|
||||
boardVueRef.value.handleMode(tabActive.value)
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue