33
This commit is contained in:
parent
e1da1f9ae7
commit
1034ff82e4
2
src/frontend/.env.production
Normal file
2
src/frontend/.env.production
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# API 地址配置
|
||||
VITE_API_BASE_URL=https://app.zpc-xy.com/corps/api/api/admin
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ const routes: RouteRecordRaw[] = [
|
|||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
history: createWebHistory('/corps/web/'),
|
||||
routes
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -85,8 +85,12 @@ async function handleLogin() {
|
|||
|
||||
if (success) {
|
||||
ElMessage.success('登录成功')
|
||||
const redirect = route.query.redirect as string || '/dashboard'
|
||||
const redirect = route.query.redirect as string
|
||||
if (redirect) {
|
||||
router.push(redirect)
|
||||
} else {
|
||||
router.push({ name: 'Dashboard' })
|
||||
}
|
||||
} else {
|
||||
ElMessage.error('用户名或密码错误')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { resolve } from 'path'
|
|||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
export default defineConfig({
|
||||
base: '/corps/web/',
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user