fix(pda): avoid unsupported URL runtime bootstrap

This commit is contained in:
2026-08-11 20:18:09 +08:00
parent 5f585427d9
commit 687b4e4377
2 changed files with 6 additions and 4 deletions
+1 -3
View File
@@ -1,6 +1,4 @@
const configuredApiRoot = typeof import.meta !== 'undefined'
? import.meta.env?.VITE_API_BASE_URL
: ''
const configuredApiRoot = import.meta.env.VITE_API_BASE_URL || ''
export const API_ROOT = String(configuredApiRoot || '/api').replace(/\/$/, '')
export const PLATFORM_API_ROOT = `${API_ROOT}/platform/v1`
+5 -1
View File
@@ -23,7 +23,9 @@ test('application uses the Vue 3 uni-app entry and no unused Android permissions
})
test('login uses the real auth endpoint and relaunches to the modular workbench', async () => {
const [login, auth, session] = await Promise.all([read('../pages/login/login.vue'), read('../api/auth.js'), read('../stores/session.js')])
const [login, auth, session, runtime] = await Promise.all([
read('../pages/login/login.vue'), read('../api/auth.js'), read('../stores/session.js'), read('../config/runtime.js')
])
for (const text of ['柏悦物流 · PDA作业端', '工号 / 用户名', '登录中']) assert.match(login, new RegExp(text))
assert.doesNotMatch(login, /DEMO_ACCOUNTS|快捷登录|作业仓库/)
assert.match(auth, /\/auth\/login/)
@@ -31,6 +33,8 @@ test('login uses the real auth endpoint and relaunches to the modular workbench'
assert.match(login, /signInWithTokens\(tokens\)/)
assert.match(session, /pda-auth-session/)
assert.match(session, /claims\.app_code !== 'PLATFORM'/)
assert.match(runtime, /import\.meta\.env\.VITE_API_BASE_URL/)
assert.doesNotMatch(runtime, /typeof\s+import\.meta/)
assert.match(login, /uni\.reLaunch\(\{ url: '\/pages\/home\/home' \}\)/)
})