This commit is contained in:
code@server 2026-01-14 22:51:09 +08:00
parent e1da1f9ae7
commit 1034ff82e4
6 changed files with 12 additions and 5 deletions

View File

@ -0,0 +1,2 @@
# API 地址配置
VITE_API_BASE_URL=https://app.zpc-xy.com/corps/api/api/admin

View File

@ -2,7 +2,7 @@
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
RUN rm -f package-lock.json && npm install
COPY . .
RUN npm run build

View File

@ -2,7 +2,7 @@ import axios, { AxiosInstance, AxiosError, InternalAxiosRequestConfig } from 'ax
import { ElMessage } from 'element-plus'
const apiClient: AxiosInstance = axios.create({
baseURL: '/api/admin',
baseURL: import.meta.env.VITE_API_BASE_URL || '/api/admin',
timeout: 30000,
headers: {
'Content-Type': 'application/json'

View File

@ -105,7 +105,7 @@ const routes: RouteRecordRaw[] = [
]
const router = createRouter({
history: createWebHistory(),
history: createWebHistory('/corps/web/'),
routes
})

View File

@ -85,8 +85,12 @@ async function handleLogin() {
if (success) {
ElMessage.success('登录成功')
const redirect = route.query.redirect as string || '/dashboard'
router.push(redirect)
const redirect = route.query.redirect as string
if (redirect) {
router.push(redirect)
} else {
router.push({ name: 'Dashboard' })
}
} else {
ElMessage.error('用户名或密码错误')
}

View File

@ -4,6 +4,7 @@ import { resolve } from 'path'
import { fileURLToPath, URL } from 'node:url'
export default defineConfig({
base: '/corps/web/',
plugins: [vue()],
resolve: {
alias: {