Browse Source

change restart

master
godo 6 months ago
parent
commit
806298207d
  1. 4
      frontend/src/components/chat/ChatMenu.vue
  2. 18
      frontend/src/system/config.ts
  3. 8
      frontend/src/system/index.ts
  4. 19
      frontend/src/util/goutil.ts
  5. 3
      frontend/vite.config.ts

4
frontend/src/components/chat/ChatMenu.vue

@ -51,7 +51,7 @@
</div> </div>
</el-row> </el-row>
<el-row @click="store.setCurrentNavId(2)"> <!-- <el-row @click="store.setCurrentNavId(2)">
<div class="menu-icon-box"> <div class="menu-icon-box">
<el-icon <el-icon
v-if="store.currentNavId === 2" v-if="store.currentNavId === 2"
@ -66,7 +66,7 @@
<Monitor /> <Monitor />
</el-icon> </el-icon>
</div> </div>
</el-row> </el-row> -->
<!-- 设置按钮固定在底部 --> <!-- 设置按钮固定在底部 -->
<el-row <el-row

18
frontend/src/system/config.ts

@ -11,7 +11,7 @@ export const getSystemConfig = (ifset = false) => {
// 从本地存储中尝试获取配置信息,若不存在则使用默认空对象 // 从本地存储中尝试获取配置信息,若不存在则使用默认空对象
const configSetting = localStorage.getItem('GodoOS-config') || '{}'; const configSetting = localStorage.getItem('GodoOS-config') || '{}';
// 解析配置信息为JSON对象 // 解析配置信息为JSON对象
let config:any = JSON.parse(configSetting); let config: any = JSON.parse(configSetting);
// 初始化配置对象的各项属性,若本地存储中已存在则不进行覆盖 // 初始化配置对象的各项属性,若本地存储中已存在则不进行覆盖
if (!config.version) { if (!config.version) {
@ -82,10 +82,10 @@ export const getSystemConfig = (ifset = false) => {
if (!config.storePath) { if (!config.storePath) {
config.storePath = ""; config.storePath = "";
} }
if(!config.netPath) { if (!config.netPath) {
config.netPath = ""; config.netPath = "";
} }
if(!config.netPort) { if (!config.netPort) {
config.netPort = "56780"; config.netPort = "56780";
} }
// 初始化背景设置,若本地存储中已存在则不进行覆盖 // 初始化背景设置,若本地存储中已存在则不进行覆盖
@ -152,7 +152,7 @@ export const getSystemConfig = (ifset = false) => {
'fourthEnd': '254' 'fourthEnd': '254'
} }
} }
// 初始化桌面快捷方式列表,若本地存储中已存在则不进行覆盖 // 初始化桌面快捷方式列表,若本地存储中已存在则不进行覆盖
if (!config.desktopList) { if (!config.desktopList) {
config.desktopList = []; config.desktopList = [];
@ -309,9 +309,13 @@ export const setSystemConfig = (config: any) => {
}; };
export const clearSystemConfig = () => { export const clearSystemConfig = () => {
const storetype = localStorage.getItem('GodoOS-storeType') || 'local'; const config = getSystemConfig();
localStorage.clear()
localStorage.setItem('GodoOS-storeType', storetype) if (config.userType === 'person') {
const storetype = localStorage.getItem('GodoOS-storeType') || 'local';
localStorage.clear()
localStorage.setItem('GodoOS-storeType', storetype)
}
//localStorage.removeItem('GodoOS-config'); //localStorage.removeItem('GodoOS-config');
}; };
// function bin2hex(s: string) { // function bin2hex(s: string) {

8
frontend/src/system/index.ts

@ -123,10 +123,12 @@ export class System {
upgradeStore.onlineMessage(); upgradeStore.onlineMessage();
// upgradeStore.userChatMessage(); // upgradeStore.userChatMessage();
}, 3000); }, 3000);
}else{
setTimeout(() => {
upgradeStore.systemMessage()
}, 6000);
} }
setTimeout(() => {
upgradeStore.systemMessage()
}, 6000);
} }
/** /**

19
frontend/src/util/goutil.ts

@ -1,4 +1,4 @@
import { getSystemKey } from "@/system/config"; import { getSystemConfig } from "@/system/config";
export async function OpenDirDialog() { export async function OpenDirDialog() {
if ((window as any).go) { if ((window as any).go) {
return (window as any)['go']['app']['App']['OpenDirDialog'](); return (window as any)['go']['app']['App']['OpenDirDialog']();
@ -19,12 +19,17 @@ export async function checkUrl(url: string) {
} }
export function RestartApp() { export function RestartApp() {
if (!(window as any).go) { if (!(window as any).go) {
const apiUrl = getSystemKey("apiUrl"); const config = getSystemConfig();
fetch(apiUrl + "/system/restart").then(() => { if (config.userType == 'person') {
setTimeout(() => { fetch(config.apiUrl + "/system/restart").then(() => {
window.location.reload(); setTimeout(() => {
}, 1000); window.location.reload();
}) }, 1000);
})
} else {
window.location.reload();
}
//window.location.reload(); //window.location.reload();
} else { } else {
return (window as any)['go']['app']['App']['RestartApp'](); return (window as any)['go']['app']['App']['RestartApp']();

3
frontend/vite.config.ts

@ -43,5 +43,6 @@ export default defineConfig(async () => ({
} }
}, },
outDir: '../godo/deps/dist', outDir: '../godo/deps/dist',
} },
base: './',
})); }));

Loading…
Cancel
Save