This commit is contained in:
2026-08-25 19:56:47 +08:00
parent 248247ea37
commit 67ad2ed825
5 changed files with 17 additions and 4 deletions
+3
View File
@@ -1,2 +1,5 @@
VITE_AUTH_API_BASE_URL=/api
VITE_OVERSEAS_API_BASE_URL=/api/overseas
# 仅开发服务器自动预填;请在不提交的 .env.local 中填写真实开发账号。
VITE_PDA_DEV_USERNAME=
VITE_PDA_DEV_PASSWORD=
+2
View File
@@ -14,6 +14,8 @@ npm test
npm run dev:h5
```
开发环境可在不提交的 `.env.local` 中配置 `VITE_PDA_DEV_USERNAME`、`VITE_PDA_DEV_PASSWORD`,登录页会自动预填;生产 App 构建始终忽略这两个值,账号必须具备 `WAREHOUSE_PICKER`、`lastleg:pda:operate` 和有效海外仓绑定。
生产编译:
```powershell
+5
View File
@@ -1,6 +1,11 @@
const runtimeEnvironment = import.meta.env || {}
const configuredAuthApiRoot = runtimeEnvironment.VITE_AUTH_API_BASE_URL || ''
const configuredOverseasApiRoot = runtimeEnvironment.VITE_OVERSEAS_API_BASE_URL || ''
const development = Boolean(runtimeEnvironment.DEV)
export const API_ROOT = String(configuredAuthApiRoot || '/api').replace(/\/$/, '')
export const OVERSEAS_API_ROOT = String(configuredOverseasApiRoot || '/api/overseas').replace(/\/$/, '')
export const DEV_LOGIN = Object.freeze({
username: development ? String(runtimeEnvironment.VITE_PDA_DEV_USERNAME || '') : '',
password: development ? String(runtimeEnvironment.VITE_PDA_DEV_PASSWORD || '') : ''
})
+2 -1
View File
@@ -15,10 +15,11 @@
<script>
import { login as loginRequest } from '@/api/auth.js'
import { DEV_LOGIN } from '@/config/runtime.js'
import { session, restoreSession, signInWithTokens } from '@/stores/session.js'
import { requireOnline } from '@/utils/network.js'
export default {
data() { return { form: { userId: '', password: '' }, error: '', submitting: false } },
data() { return { form: { userId: DEV_LOGIN.username, password: DEV_LOGIN.password }, error: '', submitting: false } },
onLoad() { if (session.currentUser || restoreSession()) uni.reLaunch({ url: '/pages/home/home' }) },
methods: {
async login() {
+5 -3
View File
@@ -26,12 +26,14 @@ test('overseas workbench contains only confirmed inbound and in-warehouse domain
})
test('login has no committed demo credentials and inbound operation implements the locked container flow', async () => {
const [login, operation, inbound, adapter, overseas] = await Promise.all([
read('../src/pages/login/login.vue'), read('../src/pages/operation/operation.vue'),
read('../src/api/inbound.js'), read('../src/api/receiving-adapter.js'), read('../src/api/overseas.js')
const [login, runtime, operation, inbound, adapter, overseas] = await Promise.all([
read('../src/pages/login/login.vue'), read('../src/config/runtime.js'),
read('../src/pages/operation/operation.vue'), read('../src/api/inbound.js'), read('../src/api/receiving-adapter.js'), read('../src/api/overseas.js')
])
assert.match(login, /柏悦物流海外版/)
assert.doesNotMatch(login, /ChangeMe|platform_admin/)
assert.match(login, /DEV_LOGIN\.username|DEV_LOGIN\.password/)
assert.match(runtime, /runtimeEnvironment\.DEV|VITE_PDA_DEV_USERNAME|VITE_PDA_DEV_PASSWORD/)
assert.match(operation, /startScanBroadcast/)
for (const action of ['prepareReceivingContainer', 'getCurrentReceiving', 'resolveCurrentSku', 'resolveCurrentCarton', 'resolveCurrentPallet', 'receiveCurrentBulk', 'receiveCurrentCarton', 'completeCurrentReceiving']) assert.match(operation, new RegExp(action))
for (const path of ['/candidates', '/prepare', '/unload-photos/files', '/sign', '/skus/resolve', '/cartons/resolve', '/pallets/resolve', '/receipts/bulk', '/receipts/carton', '/complete']) assert.match(inbound, new RegExp(path.replaceAll('/', '\\/')))