zdg #106

Merged
zhengdegang merged 2 commits from zdg into main 2024-08-07 17:06:17 +08:00
4 changed files with 59 additions and 24 deletions
Showing only changes of commit 43afd575de - Show all commits

View File

@ -58,6 +58,12 @@ export function ipcMsgSend(key, data, type) {
return ipcRenderer?.invoke(key, data)
}
}
export function ipcMsgSend2(key, ...args) {
return ipcRenderer?.send(key, ...args)
}
export function ipcMsgInvoke(key, ...args) {
return ipcRenderer?.invoke(key, ...args)
}
/**
* @description 封装ipcRenderer事件监听
* @param {*} fn on once handle invoke
@ -197,9 +203,9 @@ const eventHandles = (type, win) => {
const setIgnore = (_, ignore) => {win.setIgnoreMouseEvents(ignore, {forward: true})}
Remote.ipcMain.handle('tool-sphere:set:ignore', setIgnore) // 异步
// 关闭窗口
Remote.ipcMain.once('tool-sphere:close', () => { win&&win.destroy() })
// 放大监听-测试
Remote.ipcMain.once('maximize-window', () => {win&&win.destroy()})
Remote.ipcMain.handleOnce('tool-sphere:close', () => {win&&win.destroy()})
// // 放大监听-测试
// Remote.ipcMain.once('maximize-window', () => {win&&win.destroy()})
const on = {
onClosed: () => {
Remote.ipcMain.removeHandler('tool-sphere:set:ignore', setIgnore)

View File

@ -38,7 +38,7 @@ const props = defineProps({
{ label: '资源', prop: 'resource', icon: 'icon-hudong' },
{ label: '互动', prop: 'interact', icon: 'icon-hudong' },
{ label: '窗口', prop: 'win', icon: 'icon-hudong' },
{ label: '下课', prop: 'over', icon: 'icon-hudong' },
{ label: '下课', prop: 'over', isExtra: true, icon: 'icon-hudong' },
]
}
})
@ -71,12 +71,14 @@ const getStyle = (style,index) => {
}
//
const clickHandel = (o, e) => {
if (!o.isExtra) { // :
const node = e.target.parentNode.getBoundingClientRect()
const isColse = activeObj.value && activeObj.value.prop === o.prop && isVisible.value
isVisible.value = !isColse //
activeObj.value = o
const nodeH = parseInt(node.height / 2) //
topPos.value = parseInt(node.top) - posBtnAll.top + nodeH
}
emit('change', o)
}
</script>

View File

@ -29,7 +29,8 @@ class Ignore {
})
}
changeHandle(e) {
const customEvent = new CustomEvent('ignore-mounted', {detail:{ignore: this, e}})
const data = {detail:{ignore: this, e, type: e.type}}
const customEvent = new CustomEvent('ignore-mounted', data)
this.el.dispatchEvent(customEvent)
}
}

View File

@ -3,7 +3,7 @@
<!-- 画板 -->
<board-vue v-model="tabActive" v-show="isShow" ref="boardVueRef"></board-vue>
<!-- 侧边工具栏 -->
<side-vue v-ignore></side-vue>
<side-vue v-ignore @ignore-mounted="sideMouse" @change="sideChange"></side-vue>
<!-- 底部工具栏 :style="dataPos.style"-->
<div class="tool-bottom-all" @mouseenter="mouseChange(0)" @mouseleave="mouseChange(1)">
<div v-drag="{handle:'.tool-bottom-all', dragtime}"
@ -36,7 +36,7 @@ import sideVue from './components/side.vue' // 画板-子组件
import vDrag from './directive/drag' // -
import vIgnore from './directive/ignore' // -穿
import { useToolState } from '@/store/modules/tool'
import { ipcMsgSend, ipcHandle, ipcMain } from '@/utils/tool' //
import { ipcMsgSend, ipcHandle, ipcMain, ipcMsgInvoke } from '@/utils/tool' //
const tabActive = ref('select') //
const isFold = ref(false) //
const isDrag = ref(false) //
@ -53,33 +53,38 @@ const btnList = [ // 工具栏按钮列表
// { label: '', value: 'focus', icon: 'icon-jujiao' },
// { label: '', value: 'more', icon: 'icon-xiazai9' },
]
//
// === ===
onMounted(async() => {
resetStatus() // -
})
// const test = (e) => { console.log('test', e) }
// ==== ===
const tabChange = (val) => { // tab-change
// const test = (e) => { console.log('test', e) }
// tab-change
const tabChange = (val) => {
const bool = !toolStore.isPdfWin && !toolStore.showBoardAll
if(bool) toolStore.showBoardAll = true
// ipcMsgSend('tool-sphere:close')
toolStore.model = val // tab
}
const logoHandle = (e,t) => { // logo - |
// logo - |
const logoHandle = (e,t) => {
if (Date.now() - dragtime.value < 200) {
isFold.value = !isFold.value
}
}
const mouseChange = (bool) => { // 穿
// -穿
const mouseChange = (bool) => {
let resBool = false
if (tabActive.value == 'select') resBool = !!bool
if (!isShow.value) resBool = !!bool
setIgnore(resBool)
}
const setIgnore = (bool) => { // 穿
ipcMsgSend('tool-sphere:set:ignore', bool)
}
const resetStatus = () => { //
// 穿
const setIgnore = (bool) => {ipcMsgSend('tool-sphere:set:ignore', bool)}
// : |
const resetStatus = () => {
if (toolStore.isToolWin) return // -
ipcMain?.handle?.('tool-sphere:reset', () => {
setTimeout(() => {
@ -89,8 +94,29 @@ const resetStatus = () => { // 重置状态
})
toolStore.isToolWin = true //
}
// :
const sideMouse = e => {
const {type} = e.detail
mouseChange(type == 'mouseleave')
}
// :
const sideChange = o => {
// console.log(o)
switch(o.prop) {
case 'resource': //
break
case 'interact': //
break
case 'win': //
break
case 'over': //
ipcMsgSend('tool-sphere:close')
break
}
}
watchEffect(() => { //
// === ===
watchEffect(() => {
// , : -
const show = !toolStore.isPdfWin && toolStore.showBoardAll
if (show != isShow.value) isShow.value = show