Compare commits

...

4 Commits

4 changed files with 43 additions and 24 deletions

View File

@ -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(() => {
toolState.showBoardAll=true //
})
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)
}

View File

@ -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

View File

@ -31,7 +31,8 @@ export const localStore = store.localStore
// 暴露Store存储对象
export const Store = store
// 延时
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
/**
* 获取静态资源开发和生产环境
* @param {*} url
@ -270,6 +271,15 @@ const eventHandles = (type, win) => {
winPdf=null
win&&win.destroy()
})
// 监听窗口的激活事件
win.on('focus', async () => {
toolState.isPdfWin=true
await sleep(20) // 延时
toolState.showBoardAll=false //恢复默认值
await sleep(50) // 延时
});
const on = {
onClosed: () => {
Remote.ipcMain.removeHandler('open-PDF:minimize')

View File

@ -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>