fix: run.bat 错误分支加 pause;前端生产用 window.location.origin

- run.bat: :error 分支加 pause,避免创建 venv/装依赖失败时窗口一闪即关
- frontend app store: 开发用 127.0.0.1:8775,生产回落到 window.location.origin,跟后端同源直取

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
shijing 2026-07-10 15:48:58 +08:00
parent 49f1fb6089
commit 6eb91076c5
2 changed files with 4 additions and 2 deletions

View File

@ -18,6 +18,7 @@ goto :end
:error
echo [backend] 启动失败
pause
exit /b 1
:end

View File

@ -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)
}