美甲师信息管理
This commit is contained in:
@@ -409,5 +409,31 @@ export const adminDashboardApi = {
|
||||
}
|
||||
}
|
||||
|
||||
export interface NailArtistInfoVO {
|
||||
id: number
|
||||
userId: number
|
||||
identity: string
|
||||
experience: number
|
||||
skills: string
|
||||
rating: number
|
||||
status: number
|
||||
portfolio: string
|
||||
nickname: string
|
||||
shopId: number
|
||||
shopName: string
|
||||
}
|
||||
|
||||
export const adminNailArtistApi = {
|
||||
listNailArtists: () => {
|
||||
return adminApi.get<NailArtistInfoVO[]>('/nail-artist/list')
|
||||
},
|
||||
getNailArtistInfo: (userId: number) => {
|
||||
return adminApi.get<NailArtistInfoVO>(`/nail-artist/get/${userId}`)
|
||||
},
|
||||
saveNailArtistInfo: (data: any) => {
|
||||
return adminApi.post<NailArtistInfoVO>('/nail-artist/save', data)
|
||||
}
|
||||
}
|
||||
|
||||
export { adminApi }
|
||||
export default adminApi
|
||||
|
||||
+23
-16
@@ -45,17 +45,30 @@ const showError = (msg: string) => {
|
||||
}
|
||||
|
||||
const handleTokenExpired = (isAdmin = false) => {
|
||||
// 登录过期,只提示一次
|
||||
// 清理token和用户信息
|
||||
if (isAdmin) {
|
||||
// 清理后台管理的token
|
||||
localStorage.removeItem('adminAccessToken')
|
||||
localStorage.removeItem('adminRefreshToken')
|
||||
localStorage.removeItem('adminUserInfo')
|
||||
localStorage.removeItem('userPermissions')
|
||||
sessionStorage.removeItem('adminAccessToken')
|
||||
} else {
|
||||
// 清理前台的token
|
||||
localStorage.removeItem('accessToken')
|
||||
localStorage.removeItem('refreshToken')
|
||||
localStorage.removeItem('userInfo')
|
||||
sessionStorage.removeItem('accessToken')
|
||||
}
|
||||
|
||||
// 显示错误提示
|
||||
if (Date.now() - lastErrorTime > ERROR_DEBOUNCE_TIME || lastErrorMessage !== '登录已过期,请重新登录') {
|
||||
|
||||
showError('登录已过期,请重新登录')
|
||||
}
|
||||
|
||||
// 执行跳转,确保无论如何都会跳转
|
||||
setTimeout(() => {
|
||||
if (isAdmin) {
|
||||
// 清理后台管理的token
|
||||
localStorage.removeItem('adminAccessToken')
|
||||
localStorage.removeItem('adminRefreshToken')
|
||||
localStorage.removeItem('adminUserInfo')
|
||||
localStorage.removeItem('userPermissions')
|
||||
sessionStorage.removeItem('adminAccessToken')
|
||||
showError('登录已过期,请重新登录')
|
||||
try {
|
||||
router.push('/admin/login').catch(() => {
|
||||
window.location.href = '/admin/login'
|
||||
@@ -64,12 +77,6 @@ const handleTokenExpired = (isAdmin = false) => {
|
||||
window.location.href = '/admin/login'
|
||||
}
|
||||
} else {
|
||||
// 清理前台的token
|
||||
localStorage.removeItem('accessToken')
|
||||
localStorage.removeItem('refreshToken')
|
||||
localStorage.removeItem('userInfo')
|
||||
sessionStorage.removeItem('accessToken')
|
||||
showError('登录已过期,请重新登录')
|
||||
try {
|
||||
router.push('/').catch(() => {
|
||||
window.location.href = '/'
|
||||
@@ -78,7 +85,7 @@ const handleTokenExpired = (isAdmin = false) => {
|
||||
window.location.href = '/'
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 500) // 延迟执行,确保错误提示先显示
|
||||
}
|
||||
|
||||
api.interceptors.request.use(
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import api from './index'
|
||||
|
||||
export interface WishlistItem {
|
||||
id: number
|
||||
userId: number
|
||||
productId: number
|
||||
product: {
|
||||
id: number
|
||||
shopId: number | null
|
||||
shopName?: string
|
||||
title: string
|
||||
description: string
|
||||
imageFileIds?: string
|
||||
imageUrls?: string[]
|
||||
price: number
|
||||
tags?: string
|
||||
tagList?: string[]
|
||||
tagInfos?: any[]
|
||||
likeCount?: number
|
||||
collectCount?: number
|
||||
approximateDuration?: string
|
||||
bookableArtists?: string
|
||||
availableCoupons?: string
|
||||
createTime: string
|
||||
updateTime: string
|
||||
}
|
||||
}
|
||||
|
||||
export const wishlistApi = {
|
||||
addToWishlist: (productId: number) => {
|
||||
return api.post('/wishlist/add', { productId })
|
||||
},
|
||||
|
||||
removeFromWishlist: (productId: number) => {
|
||||
return api.post('/wishlist/remove', { productId })
|
||||
},
|
||||
|
||||
checkWishlist: (productId: number) => {
|
||||
return api.get<boolean>(`/wishlist/check?productId=${productId}`)
|
||||
},
|
||||
|
||||
getWishlist: () => {
|
||||
return api.get<WishlistItem[]>('/wishlist/list')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user