This commit is contained in:
18631081161 2026-01-14 23:36:11 +08:00
commit bc21eb16ef
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 FROM node:20-alpine AS build
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm ci RUN rm -f package-lock.json && npm install
COPY . . COPY . .
RUN npm run build RUN npm run build

View File

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

View File

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

View File

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

View File

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