From bf1403bf0798ccf37b2f3f451baed574a9b8187c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E5=85=88=E6=A3=AE?= Date: Mon, 11 Nov 2024 16:50:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DwinIp=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=87=AA=E5=90=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composables/netcard.ts | 6 +++--- pages/tool.vue | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composables/netcard.ts b/composables/netcard.ts index 53386fa..27e93b5 100644 --- a/composables/netcard.ts +++ b/composables/netcard.ts @@ -9,10 +9,8 @@ const getWinIpBroadcastPid = async () => { mainStore.winipBcPid = (pid as number) || 0; if (mainStore.winipBcPid && mainStore.winipBcPid > 0) { mainStore.winipBcStart = true; - mainStore.winIpBcAutoStart = true; } else { mainStore.winipBcStart = false; - mainStore.winIpBcAutoStart = false; } }; @@ -25,6 +23,7 @@ export const handleWinipBcStart = async () => { mainStore.winipBcPid = child.pid || 0; if (mainStore.winipBcPid) { mainStore.winipBcStart = true; + mainStore.winIpBcAutoStart = true; } else { ElMessage.error(`启动失败`); } @@ -33,6 +32,7 @@ export const handleWinipBcStart = async () => { console.log(err); } } else { + mainStore.winIpBcAutoStart = false; await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 }); await getWinIpBroadcastPid(); } @@ -42,7 +42,7 @@ export const initStartWinIpBroadcast = async () => { const mainStore = useMainStore(); await getWinIpBroadcastPid(); // console.log(mainStore.winipBcStart, mainStore.winIpBcAutoStart) - if (!mainStore.winipBcStart && mainStore.winIpBcAutoStart) { + if (mainStore.winIpBcAutoStart && !mainStore.winipBcStart) { await handleWinipBcStart(); } }; \ No newline at end of file diff --git a/pages/tool.vue b/pages/tool.vue index 677928b..16abb5b 100644 --- a/pages/tool.vue +++ b/pages/tool.vue @@ -314,7 +314,7 @@ const appWindow = getCurrentWindow(); mainStore.$subscribe((...a) => { // console.log("subscribe", a); - appWindow.emitTo("main", "config", { winIpBcAutoStart: mainStore.winIpBcAutoStart }); + appWindow.emitTo("main", "config", { winIpBcAutoStart: mainStore.winIpBcAutoStart, config: { ...mainStore.config } }); }); onMounted(() => {