功能:完善 YumiNail 全栈修复与打包

This commit is contained in:
xiaowang
2026-05-15 21:10:41 +08:00
parent 3d0a859980
commit 1f05e0ab44
42 changed files with 768 additions and 316 deletions
+28 -2
View File
@@ -6,6 +6,7 @@ import { message } from 'ant-design-vue'
import { API_BASE_URL } from '../config/api'
import type { IdType } from '@/utils/id'
import { clearAdminSessionStorage } from '@/utils/admin-session'
import { attachRequestSignature } from '@/utils/request-signature'
// 防重复提示标志
let lastErrorTime = 0
@@ -47,6 +48,29 @@ const showError = (msg: string) => {
}
}
const isAuthFreePath = (url?: string) => {
return [
'/user/login',
'/user/register',
'/user/check/',
'/user/refresh-token',
'/user/send-verification-code',
'/user/phone-login',
'/user/wechat-mini/',
'/user/reset-password-by-phone',
'/product/get/',
'/product/list/',
'/shop/get/',
'/shop/list/public',
'/shop/list/simple',
'/tag/list/all',
'/file/get-signed-url/',
'/admin/auth/login',
'/admin/auth/login-shops/',
'/admin/auth/refresh'
].some(path => String(url || '').includes(path))
}
const handleTokenExpired = (isAdmin = false) => {
// 清理token和用户信息
if (isAdmin) {
@@ -76,7 +100,7 @@ const handleTokenExpired = (isAdmin = false) => {
}
api.interceptors.request.use(
config => {
async config => {
let token = localStorage.getItem('accessToken')
if (!token) {
token = sessionStorage.getItem('accessToken')
@@ -93,7 +117,9 @@ api.interceptors.request.use(
if (token) {
config.headers.Authorization = `Bearer ${token}`
}
return config
return attachRequestSignature(config, token, {
authFree: isAuthFreePath(config.url)
})
},
error => {
return Promise.reject(error)