This commit is contained in:
Donald Zou
2025-09-14 11:01:06 +08:00
parent ccaaa4bd21
commit 628464d2e1
54 changed files with 82 additions and 82 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "app",
"version": "4.3",
"version": "4.3.0",
"private": true,
"type": "module",
"module": "es2022",
@@ -8,7 +8,7 @@
"dev": "vite",
"build": "vite build --emptyOutDir",
"buildcommitpush": "./build.sh",
"build electron": "vite build && vite build --mode electron && cd ../../../../WGDashboard-Desktop && /opt/homebrew/bin/npm run \"electron dist\"",
"build electron": "vite build --emptyOutDir && vite build --mode electron && cd ../../../../WGDashboard-Desktop && /opt/homebrew/bin/npm run \"electron dist\"",
"preview": "vite preview"
},
"dependencies": {

View File

@@ -9,6 +9,15 @@ store.initCrossServerConfiguration();
if (window.IS_WGDASHBOARD_DESKTOP){
store.IsElectronApp = true;
store.CrossServerConfiguration.Enable = true;
if (store.ActiveServerConfiguration){
fetchGet("/api/locale", {}, (res) => {
store.Locale = res.data
})
}
}else{
fetchGet("/api/locale", {}, (res) => {
store.Locale = res.data
})
}
watch(store.CrossServerConfiguration, () => {
store.syncCrossServerConfiguration()
@@ -16,9 +25,7 @@ watch(store.CrossServerConfiguration, () => {
deep: true
});
const route = useRoute()
fetchGet("/api/locale", {}, (res) => {
store.Locale = res.data
})
</script>
<template>

View File

@@ -8,17 +8,9 @@ import {createApp, markRaw} from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router/router.js'
import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js";
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
let Locale;
const app = createApp(App)
// await fetch("/api/locale")
// .then(res => res.json())
// .then(res => Locale = res.data)
// .catch(() => {
// Locale = null
// })
const app = createApp(App)
app.use(router)
const pinia = createPinia();

View File

@@ -57,9 +57,12 @@ export const DashboardConfigurationStore = defineStore('DashboardConfigurationSt
}
return undefined
},
setActiveCrossServer(key){
async setActiveCrossServer(key){
this.ActiveServerConfiguration = key;
localStorage.setItem('ActiveCrossServerConfiguration', key)
await fetchGet("/api/locale", {}, (res) => {
this.Locale = res.data
})
},
removeActiveCrossServer(){
this.ActiveServerConfiguration = undefined;

View File

@@ -1,5 +1,5 @@
import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js";
import router from "@/router/router.js";
const getHeaders = () => {
let headers = {
"Content-Type": "application/json"
@@ -51,7 +51,6 @@ export const fetchGet = async (url, params=undefined, callback=undefined) => {
})
.then(x => callback ? callback(x) : undefined).catch(x => {
console.log("Error:", x)
// store.newMessage("WGDashboard", `Error: ${x}`, "danger")
router.push({path: '/signin'})
})
}
@@ -75,7 +74,6 @@ export const fetchPost = async (url, body, callback) => {
}
}).then(x => callback ? callback(x) : undefined).catch(x => {
console.log("Error:", x)
// store.newMessage("WGDashboard", `Error: ${x}`, "danger")
router.push({path: '/signin'})
})
}