From 806298207d3b851a83025a60224f9cc409a3a5be Mon Sep 17 00:00:00 2001 From: godo Date: Tue, 3 Dec 2024 12:51:47 +0800 Subject: [PATCH] change restart --- frontend/src/components/chat/ChatMenu.vue | 4 ++-- frontend/src/system/config.ts | 18 +++++++++++------- frontend/src/system/index.ts | 8 +++++--- frontend/src/util/goutil.ts | 19 ++++++++++++------- frontend/vite.config.ts | 3 ++- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/frontend/src/components/chat/ChatMenu.vue b/frontend/src/components/chat/ChatMenu.vue index 7dadf44..b499323 100644 --- a/frontend/src/components/chat/ChatMenu.vue +++ b/frontend/src/components/chat/ChatMenu.vue @@ -51,7 +51,7 @@ - + { // 从本地存储中尝试获取配置信息,若不存在则使用默认空对象 const configSetting = localStorage.getItem('GodoOS-config') || '{}'; // 解析配置信息为JSON对象 - let config:any = JSON.parse(configSetting); + let config: any = JSON.parse(configSetting); // 初始化配置对象的各项属性,若本地存储中已存在则不进行覆盖 if (!config.version) { @@ -82,10 +82,10 @@ export const getSystemConfig = (ifset = false) => { if (!config.storePath) { config.storePath = ""; } - if(!config.netPath) { + if (!config.netPath) { config.netPath = ""; } - if(!config.netPort) { + if (!config.netPort) { config.netPort = "56780"; } // 初始化背景设置,若本地存储中已存在则不进行覆盖 @@ -152,7 +152,7 @@ export const getSystemConfig = (ifset = false) => { 'fourthEnd': '254' } } - + // 初始化桌面快捷方式列表,若本地存储中已存在则不进行覆盖 if (!config.desktopList) { config.desktopList = []; @@ -309,9 +309,13 @@ export const setSystemConfig = (config: any) => { }; export const clearSystemConfig = () => { - const storetype = localStorage.getItem('GodoOS-storeType') || 'local'; - localStorage.clear() - localStorage.setItem('GodoOS-storeType', storetype) + const config = getSystemConfig(); + + if (config.userType === 'person') { + const storetype = localStorage.getItem('GodoOS-storeType') || 'local'; + localStorage.clear() + localStorage.setItem('GodoOS-storeType', storetype) + } //localStorage.removeItem('GodoOS-config'); }; // function bin2hex(s: string) { diff --git a/frontend/src/system/index.ts b/frontend/src/system/index.ts index 7d396bf..dbd9df3 100644 --- a/frontend/src/system/index.ts +++ b/frontend/src/system/index.ts @@ -123,10 +123,12 @@ export class System { upgradeStore.onlineMessage(); // upgradeStore.userChatMessage(); }, 3000); + }else{ + setTimeout(() => { + upgradeStore.systemMessage() + }, 6000); } - setTimeout(() => { - upgradeStore.systemMessage() - }, 6000); + } /** diff --git a/frontend/src/util/goutil.ts b/frontend/src/util/goutil.ts index 8a27e0d..597dad5 100644 --- a/frontend/src/util/goutil.ts +++ b/frontend/src/util/goutil.ts @@ -1,4 +1,4 @@ -import { getSystemKey } from "@/system/config"; +import { getSystemConfig } from "@/system/config"; export async function OpenDirDialog() { if ((window as any).go) { return (window as any)['go']['app']['App']['OpenDirDialog'](); @@ -19,12 +19,17 @@ export async function checkUrl(url: string) { } export function RestartApp() { if (!(window as any).go) { - const apiUrl = getSystemKey("apiUrl"); - fetch(apiUrl + "/system/restart").then(() => { - setTimeout(() => { - window.location.reload(); - }, 1000); - }) + const config = getSystemConfig(); + if (config.userType == 'person') { + fetch(config.apiUrl + "/system/restart").then(() => { + setTimeout(() => { + window.location.reload(); + }, 1000); + }) + } else { + window.location.reload(); + } + //window.location.reload(); } else { return (window as any)['go']['app']['App']['RestartApp'](); diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 4c8dc9a..53ba47a 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -43,5 +43,6 @@ export default defineConfig(async () => ({ } }, outDir: '../godo/deps/dist', - } + }, + base: './', }));