From 6eb91076c5527e816f666b3473577decd40659f9 Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 10 Jul 2026 15:48:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20run.bat=20=E9=94=99=E8=AF=AF=E5=88=86?= =?UTF-8?q?=E6=94=AF=E5=8A=A0=20pause=EF=BC=9B=E5=89=8D=E7=AB=AF=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E7=94=A8=20window.location.origin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - run.bat: :error 分支加 pause,避免创建 venv/装依赖失败时窗口一闪即关 - frontend app store: 开发用 127.0.0.1:8775,生产回落到 window.location.origin,跟后端同源直取 Co-Authored-By: Claude Opus 4.7 --- backend/run.bat | 1 + frontend/src/stores/app.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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) }