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
+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() {