修复前端打包问题

提取基础接口为配置
This commit is contained in:
xiaowang
2026-03-10 23:23:15 +08:00
parent 191c558049
commit 580a89c64d
27 changed files with 257 additions and 222 deletions
+20 -21
View File
@@ -265,8 +265,7 @@ import { orderApi } from '../api/order'
import { fileApi } from '../api/index'
import { couponApi, type UserCoupon } from '../api/coupon'
import { userApi } from '../api/user'
import { adminTagApi, type Tag } from '../api/admin'
import { tagApi } from '../api/tag'
import { tagApi, type TagVO } from '../api/tag'
import api from '../api'
// 注入更新购物车数量的方法
@@ -333,14 +332,14 @@ const loadProductImages = async (items: CartItem[]) => {
try {
const response = await fileApi.getSignedUrl(Number(imageId)) as any
imageIdCache.value[imageId] = response
item.productImage = imageIdCache.value[imageId]
item.productImage = imageIdCache.value[imageId] || ''
} catch (error) {
// 静默处理404错误,不显示错误信息
console.log('图片不存在或无法获取签名URL:', imageId)
item.productImage = ''
}
} else {
item.productImage = imageIdCache.value[imageId]
item.productImage = imageIdCache.value[imageId] || ''
}
} catch (error) {
console.error('处理图片时出错:', error)
@@ -520,13 +519,13 @@ const showArtistModal = ref(false)
const selectedArtist = ref<{id: number, name: string, avatar?: string, signature?: string, shopName?: string, status?: number, experience?: number, skills?: string, rating?: number} | null>(null)
const availableArtists = ref<{id: number, name: string, avatar?: string, signature?: string, shopName?: string, status?: number, experience?: number, skills?: string, rating?: number}[]>([])
// 标签列表
const tagList = ref<Tag[]>([])
const tagList = ref<TagVO[]>([])
// 加载标签列表
const loadTagList = async () => {
try {
// 使用前台API获取标签列表
const tags = await tagApi.getAllTags()
const tags = await tagApi.getAllTags() as unknown as TagVO[]
tagList.value = tags || []
} catch (error) {
console.error('获取标签列表失败:', error)
@@ -548,7 +547,7 @@ const loadAvailableArtists = async () => {
users.map(async (user: any) => {
try {
// 调用前台美甲师信息API获取详细信息
const nailArtistInfo = await api.get(`/nail-artist/get/${user.id}`)
const nailArtistInfo = await api.get(`/nail-artist/get/${user.id}`) as any
return {
id: user.id,
name: user.nickname,
@@ -636,27 +635,27 @@ const getArtistAvatar = (artist: any) => {
}
// 生成基于ID的随机头像
const colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD']
const color = colors[artist.id % colors.length]
const color = colors[artist.id % colors.length] || '#FF6B6B'
return `https://api.dicebear.com/7.x/avataaars/svg?seed=${artist.id}&backgroundColor=${color.replace('#', '')}`
}
// 获取随机评分
const getRandomRating = () => {
return (4 + Math.random()).toFixed(1)
}
// const _getRandomRating = () => {
// return (4 + Math.random()).toFixed(1)
// }
// 获取随机经验
const getRandomExperience = () => {
return Math.floor(1 + Math.random() * 5)
}
// const _getRandomExperience = () => {
// return Math.floor(1 + Math.random() * 5)
// }
// 获取随机技能标签
const getRandomSkills = () => {
const allSkills = ['手绘', '雕花', '水晶甲', '光疗甲', '渐变', '法式', '钻饰', '创意美甲']
const skillsCount = 2 + Math.floor(Math.random() * 3)
const shuffled = allSkills.sort(() => 0.5 - Math.random())
return shuffled.slice(0, skillsCount)
}
// const _getRandomSkills = () => {
// const allSkills = ['手绘', '雕花', '水晶甲', '光疗甲', '渐变', '法式', '钻饰', '创意美甲']
// const skillsCount = 2 + Math.floor(Math.random() * 3)
// const shuffled = allSkills.sort(() => 0.5 - Math.random())
// return shuffled.slice(0, skillsCount)
// }
// 获取美甲师的技能标签
const getArtistSkills = (artist: any) => {
@@ -666,7 +665,7 @@ const getArtistSkills = (artist: any) => {
const skillIds = artist.skills.split(',').filter((id: string) => id)
return skillIds.map((id: string) => {
const tag = tagList.value.find(t => t.id.toString() === id)
const tag = tagList.value.find((t: any) => t.id.toString() === id)
return tag ? tag.tagName : id
})
}