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