From 580a89c64d56932449abf9e6dde8cf3f1eaea53f Mon Sep 17 00:00:00 2001 From: xiaowang Date: Tue, 10 Mar 2026 23:23:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=89=8D=E7=AB=AF=E6=89=93?= =?UTF-8?q?=E5=8C=85=E9=97=AE=E9=A2=98=20=E6=8F=90=E5=8F=96=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E6=8E=A5=E5=8F=A3=E4=B8=BA=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/src/api/admin.ts | 9 +- Frontend/src/api/auth.ts | 4 + Frontend/src/api/coupon.ts | 1 + Frontend/src/api/index.ts | 3 +- Frontend/src/api/product.ts | 12 +- Frontend/src/api/user.ts | 1 + Frontend/src/router/index.ts | 2 +- Frontend/src/views/AccountSettingsView.vue | 5 +- Frontend/src/views/AuthView.vue | 15 ++- Frontend/src/views/CartView.vue | 41 +++--- Frontend/src/views/HomeView.vue | 19 +-- Frontend/src/views/PasswordSettingsView.vue | 5 +- Frontend/src/views/ProductDetailView.vue | 6 +- Frontend/src/views/WishlistView.vue | 4 +- Frontend/src/views/admin/AdminLayout.vue | 10 +- Frontend/src/views/admin/AdminLoginView.vue | 2 +- Frontend/src/views/admin/CouponsView.vue | 118 ++++++++---------- Frontend/src/views/admin/HomeView.vue | 7 +- Frontend/src/views/admin/NailArtistsView.vue | 35 +++--- Frontend/src/views/admin/OrdersView.vue | 6 +- Frontend/src/views/admin/PermissionsView.vue | 36 +++--- Frontend/src/views/admin/ProductsView.vue | 27 ++-- Frontend/src/views/admin/ShopsView.vue | 46 ++++--- Frontend/src/views/admin/TagsView.vue | 12 +- Frontend/src/views/admin/UsersView.vue | 37 +++--- .../src/main/resources/bootstrap.yaml | 8 +- .../src/main/resources/bootstrap.yaml | 8 +- 27 files changed, 257 insertions(+), 222 deletions(-) diff --git a/Frontend/src/api/admin.ts b/Frontend/src/api/admin.ts index 5c631d30..604c88d5 100644 --- a/Frontend/src/api/admin.ts +++ b/Frontend/src/api/admin.ts @@ -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(`/coupon/delete/${id}`) + }, + distributeCoupon: (data: any) => { + return adminApi.post('/coupon/distribute', data) } } @@ -323,7 +327,7 @@ export interface PageResult { } 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>('/user/list', { params }) }, listAllUsers: () => { @@ -392,6 +396,7 @@ export interface RecentActivityVO { type: string description: string time: string + color?: string } export interface DashboardStats { diff --git a/Frontend/src/api/auth.ts b/Frontend/src/api/auth.ts index 7f9c8bef..85394af7 100644 --- a/Frontend/src/api/auth.ts +++ b/Frontend/src/api/auth.ts @@ -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 { diff --git a/Frontend/src/api/coupon.ts b/Frontend/src/api/coupon.ts index 92388865..29974aa8 100644 --- a/Frontend/src/api/coupon.ts +++ b/Frontend/src/api/coupon.ts @@ -16,6 +16,7 @@ export interface Coupon { endTime: string status: number statusName: string + shopId?: number availableTags: Tag[] unavailableTags: Tag[] } diff --git a/Frontend/src/api/index.ts b/Frontend/src/api/index.ts index 90289f12..907b755d 100644 --- a/Frontend/src/api/index.ts +++ b/Frontend/src/api/index.ts @@ -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' diff --git a/Frontend/src/api/product.ts b/Frontend/src/api/product.ts index 4c066d4c..684e1607 100644 --- a/Frontend/src/api/product.ts +++ b/Frontend/src/api/product.ts @@ -62,23 +62,23 @@ export interface UpdateProductRequest { export const productApi = { getAllProducts: async (): Promise => { - return await api.get('/product/list/all') + return await api.get('/product/list/all') as unknown as ProductVO[] }, getProductById: async (id: number): Promise => { - return await api.get(`/product/get/${id}`) + return await api.get(`/product/get/${id}`) as unknown as ProductVO }, getProductsByTag: async (tag: string): Promise => { - return await api.get(`/product/list/tag/${tag}`) + return await api.get(`/product/list/tag/${tag}`) as unknown as ProductVO[] }, likeProduct: async (productId: number): Promise => { - return await api.post(`/product/like/${productId}`) + return await api.post(`/product/like/${productId}`) as unknown as boolean }, unlikeProduct: async (productId: number): Promise => { - return await api.post(`/product/unlike/${productId}`) + return await api.post(`/product/unlike/${productId}`) as unknown as boolean }, searchProducts: async (keyword: string): Promise => { @@ -86,6 +86,6 @@ export const productApi = { params: { keyword: keyword } - }) + }) as unknown as ProductVO[] } } diff --git a/Frontend/src/api/user.ts b/Frontend/src/api/user.ts index 1be1063f..64cf26ad 100644 --- a/Frontend/src/api/user.ts +++ b/Frontend/src/api/user.ts @@ -30,6 +30,7 @@ export interface ListUsersParams { size: number keyword?: string shopId?: number + status?: number } export interface CreateUserRequest { diff --git a/Frontend/src/router/index.ts b/Frontend/src/router/index.ts index 7829c298..7c9fe685 100644 --- a/Frontend/src/router/index.ts +++ b/Frontend/src/router/index.ts @@ -190,7 +190,7 @@ router.beforeEach((to, _from, next) => { const adminUserInfoStr = localStorage.getItem('adminUserInfo') if (adminUserInfoStr) { try { - const adminUserInfo = JSON.parse(adminUserInfoStr) + JSON.parse(adminUserInfoStr) // 获取用户权限 const userPermissionsStr = localStorage.getItem('userPermissions') if (userPermissionsStr) { diff --git a/Frontend/src/views/AccountSettingsView.vue b/Frontend/src/views/AccountSettingsView.vue index ce5bdd60..d3492d51 100644 --- a/Frontend/src/views/AccountSettingsView.vue +++ b/Frontend/src/views/AccountSettingsView.vue @@ -506,13 +506,12 @@ const handleDeactivateAccount = async () => { try { // 在删除前先重命名账号和手机号,添加删除时间戳 const timestamp = new Date().getTime() - const newAccount = `${userInfo.value.account}_deleted_${timestamp}` const newPhone = `${userInfo.value.phone}_deleted_${timestamp}` try { - await userApi.updateUserInfo({ account: newAccount, phone: newPhone }) + await userApi.updateUserInfo({ phone: newPhone }) } catch (renameError) { - console.error('重命名账号和手机号失败:', renameError) + console.error('重命名手机号失败:', renameError) // 重命名失败也继续删除流程 } diff --git a/Frontend/src/views/AuthView.vue b/Frontend/src/views/AuthView.vue index 2002acc3..495b6304 100644 --- a/Frontend/src/views/AuthView.vue +++ b/Frontend/src/views/AuthView.vue @@ -311,6 +311,7 @@ import { ref, reactive, onMounted } from 'vue' import { useRouter } from 'vue-router' import { UserOutlined, LockOutlined, WechatOutlined, QqOutlined, InfoCircleOutlined } from '@ant-design/icons-vue' import { message } from 'ant-design-vue' +import type { Rule } from 'ant-design-vue/es/form' import { authApi } from '@/api/auth' import { shopApi } from '@/api/shop' import { userApi } from '@/api/user' @@ -354,7 +355,7 @@ const validateConfirmPassword = async (_rule: any, value: string) => { return Promise.resolve() } -const rules = { +const rules: Record = { account: [ { required: true, message: '请输入账号', trigger: 'blur' }, { min: 3, max: 50, message: '账号长度在3到50个字符', trigger: 'blur' }, @@ -488,11 +489,12 @@ const handleAccountBlur = async () => { if (activeTab.value === 'login' && formData.account) { try { const res = await userApi.getUserByAccount(formData.account) - if (res) { + const userData = res as any + if (userData) { accountStatus.value = { exists: true, - nickname: res.nickname, - hasShop: res.shopId && res.shopId > 0 + nickname: userData.nickname, + hasShop: userData.shopId && userData.shopId > 0 } } else { accountStatus.value = { @@ -513,10 +515,11 @@ const handlePhoneBlur = async () => { if (activeTab.value === 'login' && loginType.value === 'phone' && formData.phone) { try { const res = await userApi.getUserByAccount(formData.phone) - if (res) { + const userData = res as any + if (userData) { phoneUserStatus.value = { exists: true, - hasShop: res.shopId && res.shopId > 0 + hasShop: userData.shopId && userData.shopId > 0 } } else { phoneUserStatus.value = { diff --git a/Frontend/src/views/CartView.vue b/Frontend/src/views/CartView.vue index f6f3d1c2..f1da13bb 100644 --- a/Frontend/src/views/CartView.vue +++ b/Frontend/src/views/CartView.vue @@ -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([]) +const tagList = ref([]) // 加载标签列表 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 }) } diff --git a/Frontend/src/views/HomeView.vue b/Frontend/src/views/HomeView.vue index ce4380b3..a1b1d25f 100644 --- a/Frontend/src/views/HomeView.vue +++ b/Frontend/src/views/HomeView.vue @@ -188,19 +188,20 @@ const loadBannerImages = async () => { const fileIdPromises: Promise[] = [] // 从店铺获取图片 - const shops = await shopApi.getAllShops() as ShopVO[] + const shops = await shopApi.getAllShops() as unknown as ShopVO[] // 处理店铺图片 - 只使用coverImageFileId(banner图片) for (const shop of shops) { // 处理coverImageFileId(专门用于banner的图片) - if (shop.coverImageFileId) { - const fileIds = shop.coverImageFileId.split(',').filter(id => id.trim()) + const shopAny = shop as any + if (shopAny.coverImageFileId) { + const fileIds = shopAny.coverImageFileId.split(',').filter((id: string) => id.trim()) for (const idStr of fileIds) { const fileId = parseInt(idStr) if (!isNaN(fileId)) { - const promise = fileApi.getSignedUrl(fileId).catch(err => { + const promise = fileApi.getSignedUrl(fileId).then((response: any) => response as string).catch(err => { console.error('获取店铺banner图签名失败:', err) - return null + return '' }) fileIdPromises.push(promise) } @@ -211,8 +212,8 @@ const loadBannerImages = async () => { // 并行请求所有签名URL const results = await Promise.all(fileIdPromises) - // 过滤掉null值并去除反引号 - const filteredResults = results.filter((url): url is string => url !== null).map(url => url.replace(/[`]/g, '').trim()) + // 过滤掉空值并去除反引号 + const filteredResults = results.filter((url): url is string => url !== '').map(url => url.replace(/[`]/g, '').trim()) // 去重 const uniqueImages = [...new Set(filteredResults)] @@ -328,7 +329,7 @@ const handleNotificationClick = () => { } // 处理搜索输入 -const handleSearch = (e: any) => { +const handleSearch = (_e: any) => { } // 处理筛选按钮点击 @@ -340,7 +341,7 @@ const handleBannerClick = () => { } // 处理查看全部点击 -const handleSeeAll = (type: string) => { +const handleSeeAll = (_type: string) => { router.push('/products') } diff --git a/Frontend/src/views/PasswordSettingsView.vue b/Frontend/src/views/PasswordSettingsView.vue index 98153660..d898c302 100644 --- a/Frontend/src/views/PasswordSettingsView.vue +++ b/Frontend/src/views/PasswordSettingsView.vue @@ -71,6 +71,7 @@ import { useRouter } from 'vue-router' import { LeftOutlined, LockOutlined } from '@ant-design/icons-vue' import { message } from 'ant-design-vue' import type { FormInstance } from 'ant-design-vue' +import type { Rule } from 'ant-design-vue/es/form' import { userApi } from '@/api/user' const router = useRouter() @@ -82,14 +83,14 @@ const formState = reactive({ confirmPassword: '' }) -const validateConfirmPassword = (_, value: string) => { +const validateConfirmPassword = (_rule: any, value: string) => { if (value !== formState.password) { return Promise.reject(new Error('两次输入的密码不一致')) } return Promise.resolve() } -const formRules = { +const formRules: Record = { password: [ { required: true, message: '请输入新密码', trigger: 'blur' }, { min: 8, message: '密码长度至少8位', trigger: 'blur' }, diff --git a/Frontend/src/views/ProductDetailView.vue b/Frontend/src/views/ProductDetailView.vue index 453ebd04..18fb6e6e 100644 --- a/Frontend/src/views/ProductDetailView.vue +++ b/Frontend/src/views/ProductDetailView.vue @@ -31,7 +31,7 @@