修复前端打包问题
提取基础接口为配置
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import axios, { AxiosError } from 'axios'
|
||||
import router from '../router'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { ADMIN_API_BASE_URL } from '../config/api'
|
||||
|
||||
// 防重复提示标志
|
||||
let lastErrorTime = 0
|
||||
@@ -8,7 +9,7 @@ let lastErrorMessage = ''
|
||||
const ERROR_DEBOUNCE_TIME = 1000 // 1秒内不重复显示相同错误
|
||||
|
||||
const adminApi = axios.create({
|
||||
baseURL: 'http://wcy111.top:8088/admin/api',
|
||||
baseURL: ADMIN_API_BASE_URL,
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -210,6 +211,9 @@ export const adminCouponApi = {
|
||||
},
|
||||
deleteCoupon: (id: number) => {
|
||||
return adminApi.delete<boolean>(`/coupon/delete/${id}`)
|
||||
},
|
||||
distributeCoupon: (data: any) => {
|
||||
return adminApi.post<boolean>('/coupon/distribute', data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +327,7 @@ export interface PageResult<T> {
|
||||
}
|
||||
|
||||
export const adminUserApi = {
|
||||
listUsers: (params: { page: number; size: number; keyword?: string; type?: number; shopId?: number }) => {
|
||||
listUsers: (params: { page: number; size: number; keyword?: string; type?: number; shopId?: number; status?: number }) => {
|
||||
return adminApi.get<PageResult<UserVO>>('/user/list', { params })
|
||||
},
|
||||
listAllUsers: () => {
|
||||
@@ -392,6 +396,7 @@ export interface RecentActivityVO {
|
||||
type: string
|
||||
description: string
|
||||
time: string
|
||||
color?: string
|
||||
}
|
||||
|
||||
export interface DashboardStats {
|
||||
|
||||
@@ -4,11 +4,13 @@ export interface LoginRequest {
|
||||
account: string
|
||||
password: string
|
||||
rememberMe?: boolean
|
||||
shopId?: number
|
||||
}
|
||||
|
||||
export interface PhoneLoginRequest {
|
||||
phone: string
|
||||
verificationCode: string
|
||||
shopId?: number
|
||||
}
|
||||
|
||||
export interface RegisterRequest {
|
||||
@@ -16,6 +18,8 @@ export interface RegisterRequest {
|
||||
password: string
|
||||
nickname: string
|
||||
shopId?: number
|
||||
phone?: string
|
||||
verificationCode?: string
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface Coupon {
|
||||
endTime: string
|
||||
status: number
|
||||
statusName: string
|
||||
shopId?: number
|
||||
availableTags: Tag[]
|
||||
unavailableTags: Tag[]
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { authApi } from './auth'
|
||||
import { wishlistApi } from './wishlist'
|
||||
import router from '../router'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { API_BASE_URL } from '../config/api'
|
||||
|
||||
// 防重复提示标志
|
||||
let lastErrorTime = 0
|
||||
@@ -10,7 +11,7 @@ let lastErrorMessage = ''
|
||||
const ERROR_DEBOUNCE_TIME = 1000 // 1秒内不重复显示相同错误
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: 'http://wcy111.top:8088/api',
|
||||
baseURL: API_BASE_URL,
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
|
||||
@@ -62,23 +62,23 @@ export interface UpdateProductRequest {
|
||||
|
||||
export const productApi = {
|
||||
getAllProducts: async (): Promise<ProductVO[]> => {
|
||||
return await api.get<ProductVO[]>('/product/list/all')
|
||||
return await api.get<ProductVO[]>('/product/list/all') as unknown as ProductVO[]
|
||||
},
|
||||
|
||||
getProductById: async (id: number): Promise<ProductVO> => {
|
||||
return await api.get<ProductVO>(`/product/get/${id}`)
|
||||
return await api.get<ProductVO>(`/product/get/${id}`) as unknown as ProductVO
|
||||
},
|
||||
|
||||
getProductsByTag: async (tag: string): Promise<ProductVO[]> => {
|
||||
return await api.get<ProductVO[]>(`/product/list/tag/${tag}`)
|
||||
return await api.get<ProductVO[]>(`/product/list/tag/${tag}`) as unknown as ProductVO[]
|
||||
},
|
||||
|
||||
likeProduct: async (productId: number): Promise<boolean> => {
|
||||
return await api.post<boolean>(`/product/like/${productId}`)
|
||||
return await api.post<boolean>(`/product/like/${productId}`) as unknown as boolean
|
||||
},
|
||||
|
||||
unlikeProduct: async (productId: number): Promise<boolean> => {
|
||||
return await api.post<boolean>(`/product/unlike/${productId}`)
|
||||
return await api.post<boolean>(`/product/unlike/${productId}`) as unknown as boolean
|
||||
},
|
||||
|
||||
searchProducts: async (keyword: string): Promise<ProductVO[]> => {
|
||||
@@ -86,6 +86,6 @@ export const productApi = {
|
||||
params: {
|
||||
keyword: keyword
|
||||
}
|
||||
})
|
||||
}) as unknown as ProductVO[]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ export interface ListUsersParams {
|
||||
size: number
|
||||
keyword?: string
|
||||
shopId?: number
|
||||
status?: number
|
||||
}
|
||||
|
||||
export interface CreateUserRequest {
|
||||
|
||||
Reference in New Issue
Block a user