diff --git a/backend/run.bat b/backend/run.bat index eb13812..04de8f3 100644 --- a/backend/run.bat +++ b/backend/run.bat @@ -18,6 +18,7 @@ goto :end :error echo [backend] 启动失败 +pause exit /b 1 :end diff --git a/frontend/src/stores/app.js b/frontend/src/stores/app.js index efe71e3..d8fdf60 100644 --- a/frontend/src/stores/app.js +++ b/frontend/src/stores/app.js @@ -3,7 +3,8 @@ import { computed, ref } from 'vue' import { notify } from '@/utils/notify' export const useAppStore = defineStore('app', () => { - const apiBase = ref(localStorage.getItem('financeAiApiBase') || 'http://127.0.0.1:8775') + const defaultApiBase = import.meta.env.DEV ? 'http://127.0.0.1:8775' : window.location.origin + const apiBase = ref(localStorage.getItem('financeAiApiBase') || defaultApiBase) const token = ref(localStorage.getItem('financeAiToken') || '') const currentUser = ref(null) const healthy = ref(false) @@ -17,7 +18,7 @@ export const useAppStore = defineStore('app', () => { } function setApiBase(value) { - apiBase.value = (value || '').trim() || 'http://127.0.0.1:8775' + apiBase.value = (value || '').trim() || defaultApiBase localStorage.setItem('financeAiApiBase', apiBase.value) }