修复winIp无法自启的bug

This commit is contained in:
黑先森
2024-11-11 16:50:18 +08:00
parent 7a181200f3
commit c7545bb2b6
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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();
}
};
+1 -1
View File
@@ -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(() => {