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>
</el-row>
<el-row @click="store.setCurrentNavId(2)">
<!-- <el-row @click="store.setCurrentNavId(2)">
<div class="menu-icon-box">
<el-icon
v-if="store.currentNavId === 2"
@ -66,7 +66,7 @@
<Monitor />
</el-icon>
</div>
</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') || '{}';
// 解析配置信息为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) {

8
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);
}
/**

19
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']();

3
frontend/vite.config.ts

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

Loading…
Cancel
Save