功能:完善门店能力与用户安全配置

This commit is contained in:
xiaowang
2026-05-18 10:04:57 +08:00
parent 4563dd2538
commit 3797938616
356 changed files with 24983 additions and 1858 deletions
File diff suppressed because it is too large Load Diff
+93
View File
@@ -1,8 +1,13 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
export interface SendVerificationCodeRequest {
phone: string
sceneCode?: string
}
export interface LoginRequest {
@@ -10,12 +15,18 @@ export interface LoginRequest {
password: string
rememberMe?: boolean
shopId?: string | number
agreementAccepted?: boolean
agreementVersions?: Record<string, string>
clientType?: string
}
export interface PhoneLoginRequest {
phone: string
verificationCode: string
shopId?: string | number
agreementAccepted?: boolean
agreementVersions?: Record<string, string>
clientType?: string
}
export interface RegisterRequest {
@@ -23,8 +34,24 @@ export interface RegisterRequest {
password: string
nickname: string
shopId?: string | number
inviteCode?: string
phone?: string
verificationCode?: string
agreementAccepted?: boolean
agreementVersions?: Record<string, string>
clientType?: string
}
export interface LegalAgreement {
id: IdType
agreementType: 'USER_TERMS' | 'PRIVACY_POLICY'
agreementTypeName: string
title: string
version: string
content: string
status: number
statusText?: string
effectiveTime?: string
}
export interface LoginResponse {
@@ -42,6 +69,8 @@ export interface UserInfo {
type?: number
shopId?: IdType
shopName?: string
shopAuthorizationExpireTime?: string
shopAuthorizationExpired?: boolean
shopIds?: IdType[]
shopNames?: string[]
createTime: string
@@ -67,44 +96,108 @@ export interface SwitchShopRequest {
shopId?: string | number
}
/**
* authApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const authApi = {
/**
* `sendVerificationCode` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: SendVerificationCodeRequest caller-supplied value for `data: SendVerificationCodeRequest`
*/
sendVerificationCode: (data: SendVerificationCodeRequest) => {
return api.post('/user/send-verification-code', data)
},
/**
* `login` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: LoginRequest caller-supplied value for `data: LoginRequest`
*/
login: (data: LoginRequest) => {
return api.post<LoginResponse>('/user/login', data)
},
/**
* `phoneLogin` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: PhoneLoginRequest caller-supplied value for `data: PhoneLoginRequest`
*/
phoneLogin: (data: PhoneLoginRequest) => {
return api.post<LoginResponse>('/user/phone-login', data)
},
/**
* `adminLogin` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: LoginRequest caller-supplied value for `data: LoginRequest`
*/
adminLogin: (data: LoginRequest) => {
return api.post<LoginResponse>('/admin/auth/login', data)
},
/**
* `register` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: RegisterRequest caller-supplied value for `data: RegisterRequest`
*/
register: (data: RegisterRequest) => {
return api.post('/user/register', data)
},
/**
* `refreshToken` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: RefreshTokenRequest caller-supplied value for `data: RefreshTokenRequest`
*/
refreshToken: (data: RefreshTokenRequest) => {
return api.post<RefreshTokenResponse>('/user/refresh-token', data)
},
/**
* `logout` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
logout: () => {
return api.post('/user/logout')
},
/**
* `switchShop` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: SwitchShopRequest caller-supplied value for `data: SwitchShopRequest`
*/
switchShop: (data: SwitchShopRequest) => {
return api.post<LoginResponse>('/user/switch-shop', data)
},
/**
* `getUserInfo` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
getUserInfo: () => {
return api.get<UserInfo>('/user/info')
},
/**
* `resetPasswordByPhone` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: ResetPasswordRequest caller-supplied value for `data: ResetPasswordRequest`
*/
resetPasswordByPhone: (data: ResetPasswordRequest) => {
return api.post('/user/reset-password-by-phone', data)
}
}
export const legalAgreementApi = {
listCurrent: () => {
return api.get<LegalAgreement[]>('/legal-agreement/current')
},
getCurrent: (type: 'USER_TERMS' | 'PRIVACY_POLICY') => {
return api.get<LegalAgreement>(`/legal-agreement/current/${type}`)
},
getMyConsent: () => {
return api.get<{ consentVersions: Record<string, string> }>('/user/agreement-consent/me')
}
}
+36
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
@@ -6,33 +10,65 @@ interface CartItem {
quantity: number
}
/**
* cartApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const cartApi = {
// 添加作品到购物车
/**
* `addToCart` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param item: CartItem caller-supplied value for `item: CartItem`
*/
addToCart: (item: CartItem) => {
return api.post('/cart/add', item)
},
// 从购物车移除作品
/**
* `removeFromCart` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param productId: IdType caller-supplied value for `productId: IdType`
*/
removeFromCart: (productId: IdType) => {
return api.delete(`/cart/remove/${productId}`)
},
// 批量从购物车移除作品
/**
* `batchRemoveFromCart` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param cartItemIds: IdType[] caller-supplied value for `cartItemIds: IdType[]`
*/
batchRemoveFromCart: (cartItemIds: IdType[]) => {
return api.post('/cart/batch-remove', cartItemIds)
},
// 更新购物车作品数量
/**
* `updateCartQuantity` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param item: CartItem caller-supplied value for `item: CartItem`
*/
updateCartQuantity: (item: CartItem) => {
return api.put('/cart/update', item)
},
// 获取购物车列表
/**
* `getCartList` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
getCartList: () => {
return api.get('/cart/list')
},
// 清空购物车
/**
* `clearCart` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
clearCart: () => {
return api.delete('/cart/clear')
}
+23
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
@@ -18,13 +22,32 @@ export interface CommentVO {
replies?: CommentVO[]
}
/**
* commentApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const commentApi = {
/**
* `listByProduct` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param productId: IdType caller-supplied value for `productId: IdType`
*/
listByProduct: (productId: IdType) => {
return api.get<CommentVO[]>(`/comment/list/product/${productId}`) as unknown as Promise<CommentVO[]>
},
/**
* `create` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string } caller-supplied value for `data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }`
*/
create: (data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }) => {
return api.post<IdType>('/comment/create', data) as unknown as Promise<IdType>
},
/**
* `delete` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
delete: (id: IdType) => {
return api.delete<boolean>(`/comment/delete/${id}`) as unknown as Promise<boolean>
}
+45
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import request from './index'
import type { IdType } from '@/utils/id'
@@ -74,8 +78,17 @@ export interface CouponListResponse {
size: number
}
/**
* couponApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const couponApi = {
// 创建优惠券
/**
* `createCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: CreateCouponRequest caller-supplied value for `data: CreateCouponRequest`
*/
createCoupon: (data: CreateCouponRequest) => {
return request({
url: '/coupon/create',
@@ -85,6 +98,12 @@ export const couponApi = {
},
// 更新优惠券
/**
* `updateCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: CreateCouponRequest caller-supplied value for `data: CreateCouponRequest`
*/
updateCoupon: (id: IdType, data: CreateCouponRequest) => {
return request({
url: `/coupon/update/${id}`,
@@ -94,6 +113,11 @@ export const couponApi = {
},
// 删除优惠券
/**
* `deleteCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
deleteCoupon: (id: IdType) => {
return request({
url: `/coupon/delete/${id}`,
@@ -102,6 +126,11 @@ export const couponApi = {
},
// 获取优惠券详情
/**
* `getCouponById` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
getCouponById: (id: IdType) => {
return request({
url: `/coupon/detail/${id}`,
@@ -110,6 +139,11 @@ export const couponApi = {
},
// 获取优惠券列表
/**
* `listCoupons` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param params: { page: number; size: number; shopId?: IdType } caller-supplied value for `params: { page: number; size: number; shopId?: IdType }`
*/
listCoupons: (params: { page: number; size: number; shopId?: IdType }) => {
return request({
url: '/coupon/list',
@@ -119,6 +153,12 @@ export const couponApi = {
},
// 为用户分配优惠券
/**
* `assignCouponToUser` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param userId: IdType caller-supplied value for `userId: IdType`
* @param couponId: IdType caller-supplied value for `couponId: IdType`
*/
assignCouponToUser: (userId: IdType, couponId: IdType) => {
return request({
url: '/coupon/assign',
@@ -137,6 +177,11 @@ export const couponApi = {
},
// 使用优惠券
/**
* `useCoupon` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param userCouponId: IdType caller-supplied value for `userCouponId: IdType`
*/
useCoupon: (userCouponId: IdType) => {
return request({
url: '/coupon/use',
+34
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import type { AxiosProgressEvent } from 'axios'
import api from './index'
import type { IdType } from '@/utils/id'
@@ -17,7 +21,16 @@ export interface ChunkUploadSessionVO {
uploadedChunks: number[]
}
/**
* fileApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const fileApi = {
/**
* `uploadAvatar` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param file: File caller-supplied value for `file: File`
*/
uploadAvatar: (file: File) => {
const formData = new FormData()
formData.append('file', file)
@@ -27,6 +40,11 @@ export const fileApi = {
}
})
},
/**
* `initAvatarChunkUpload` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: ChunkUploadInitRequest caller-supplied value for `data: ChunkUploadInitRequest`
*/
initAvatarChunkUpload: (data: ChunkUploadInitRequest) => {
return api.post<ChunkUploadSessionVO>('/user/upload-avatar/init', data) as unknown as Promise<ChunkUploadSessionVO>
},
@@ -47,13 +65,29 @@ export const fileApi = {
onUploadProgress: config?.onUploadProgress
})
},
/**
* `completeAvatarChunkUpload` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param uploadId: string caller-supplied value for `uploadId: string`
*/
completeAvatarChunkUpload: (uploadId: string) => {
return api.post<string>('/user/upload-avatar/complete', { uploadId }) as unknown as Promise<string>
},
/**
* `cancelAvatarChunkUpload` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param uploadId: string caller-supplied value for `uploadId: string`
*/
cancelAvatarChunkUpload: (uploadId: string) => {
return api.delete<boolean>(`/user/upload-avatar/${uploadId}`)
},
/**
* `getSignedUrl` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param fileId: IdType caller-supplied value for `fileId: IdType`
* @param expiryTimeInMinutes?: number caller-supplied value for `expiryTimeInMinutes?: number`
*/
getSignedUrl: (fileId: IdType, expiryTimeInMinutes?: number) => {
return api.get<string>(`/file/get-signed-url/${fileId}`, {
params: { expiryTimeInMinutes }
+17
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import axios, { AxiosError } from 'axios'
import { authApi } from './auth'
import { adminAuthApi } from './admin'
@@ -58,6 +62,8 @@ const isAuthFreePath = (url?: string) => {
'/user/phone-login',
'/user/wechat-mini/',
'/user/reset-password-by-phone',
'/legal-agreement/current',
'/api/legal-agreement/current',
'/product/get/',
'/product/list/',
'/comment/list/product/',
@@ -149,6 +155,7 @@ api.interceptors.response.use(
url?.includes('/user/refresh-token') ||
url?.includes('/user/send-verification-code') ||
url?.includes('/user/phone-login') ||
url?.includes('/legal-agreement/current') ||
url?.includes('/product/get/') ||
url?.includes('/product/list/') ||
url?.includes('/comment/list/product/') ||
@@ -235,7 +242,17 @@ api.interceptors.response.use(
}
)
/**
* fileApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const fileApi = {
/**
* `getSignedUrl` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param fileId: IdType caller-supplied value for `fileId: IdType`
* @param expiryTimeInMinutes?: number caller-supplied value for `expiryTimeInMinutes?: number`
*/
getSignedUrl: (fileId: IdType, expiryTimeInMinutes?: number) => {
return api.get<string>(`/file/get-signed-url/${fileId}`, {
params: { expiryTimeInMinutes }
+77
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
@@ -14,8 +18,39 @@ interface CreateOrderRequest {
items: OrderItem[]
}
export interface ArtistCalendarAppointment {
orderId: IdType
orderNo: string
totalAmount?: number
actualAmount?: number
orderStatus: number
orderStatusText: string
orderItemId: IdType
productId: IdType
productTitle: string
artistId: IdType
artistName?: string
customerNickname?: string
customerPhoneMasked?: string
shopId?: IdType
shopName?: string
appointmentStartTime: string
appointmentEndTime: string
quantity: number
durationMinutes: number
}
/**
* orderApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const orderApi = {
// 创建订单
/**
* `createOrder` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: CreateOrderRequest caller-supplied value for `data: CreateOrderRequest`
*/
createOrder: (data: CreateOrderRequest) => {
return api.post('/order/create', data)
},
@@ -26,21 +61,41 @@ export const orderApi = {
},
// 获取订单详情
/**
* `getOrderDetail` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param orderId: IdType caller-supplied value for `orderId: IdType`
*/
getOrderDetail: (orderId: IdType) => {
return api.get(`/order/detail/${orderId}`)
},
// 取消订单
/**
* `cancelOrder` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param orderId: IdType caller-supplied value for `orderId: IdType`
*/
cancelOrder: (orderId: IdType) => {
return api.put(`/order/cancel/${orderId}`)
},
// 后台获取所有订单
/**
* `getAllOrders` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
getAllOrders: () => {
return api.get('/order/admin/list')
},
// 后台处理订单
/**
* `processOrder` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param orderId: IdType caller-supplied value for `orderId: IdType`
* @param status: number caller-supplied value for `status: number`
*/
processOrder: (orderId: IdType, status: number) => {
return api.put(`/order/admin/process/${orderId}`, {}, {
params: { status }
@@ -48,11 +103,33 @@ export const orderApi = {
},
// 美甲师查看自己的订单
/**
* `getArtistOrders` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
getArtistOrders: () => {
return api.get('/order/artist/list')
},
// 预约日历:recent 取未来 7 天概览,day 传 yyyy-MM-dd 查某天明细。
/**
* `completeArtistOrder` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param orderId: IdType caller-supplied value for `orderId: IdType`
*/
completeArtistOrder: (orderId: IdType) => {
return api.put(`/order/artist/complete/${orderId}`)
},
getArtistCalendarRecent: async (days = 7): Promise<ArtistCalendarAppointment[]> => {
return await api.get<ArtistCalendarAppointment[]>('/order/artist/calendar/recent', {
params: { days }
}) as unknown as ArtistCalendarAppointment[]
},
getArtistCalendarDay: async (date: string): Promise<ArtistCalendarAppointment[]> => {
return await api.get<ArtistCalendarAppointment[]>('/order/artist/calendar/day', {
params: { date }
}) as unknown as ArtistCalendarAppointment[]
}
}
+44
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import { adminApi } from './admin'
import type { IdType } from '@/utils/id'
@@ -25,7 +29,16 @@ export interface UpdatePermissionRequest {
description?: string
}
/**
* permissionApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const permissionApi = {
/**
* `getUserPermissions` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param userId?: IdType caller-supplied value for `userId?: IdType`
*/
getUserPermissions: (userId?: IdType) => {
if (userId) {
return adminApi.get<PermissionVO[]>(`/permission/user/${userId}`)
@@ -33,26 +46,57 @@ export const permissionApi = {
return adminApi.get<PermissionVO[]>('/permission/user/current')
},
/**
* `getAssignablePermissionIds` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param userId: IdType caller-supplied value for `userId: IdType`
*/
getAssignablePermissionIds: (userId: IdType) => {
return adminApi.get<IdType[]>(`/permission/assignable/${userId}`)
},
/**
* `listAllPermissions` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
listAllPermissions: () => {
return adminApi.get<PermissionVO[]>('/permission/list/all')
},
/**
* `createPermission` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: CreatePermissionRequest caller-supplied value for `data: CreatePermissionRequest`
*/
createPermission: (data: CreatePermissionRequest) => {
return adminApi.post('/permission/create', data)
},
/**
* `updatePermission` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: UpdatePermissionRequest caller-supplied value for `data: UpdatePermissionRequest`
*/
updatePermission: (id: IdType, data: UpdatePermissionRequest) => {
return adminApi.put(`/permission/update/${id}`, data)
},
/**
* `deletePermission` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
deletePermission: (id: IdType) => {
return adminApi.delete(`/permission/delete/${id}`)
},
/**
* `assignUserPermissions` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param userId: IdType caller-supplied value for `userId: IdType`
* @param permissionIds: IdType[] caller-supplied value for `permissionIds: IdType[]`
*/
assignUserPermissions: (userId: IdType, permissionIds: IdType[]) => {
return adminApi.post(`/permission/assign/${userId}`, { permissionIds })
}
+8
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
@@ -65,6 +69,10 @@ export interface UpdateProductRequest {
shopId?: IdType | null
}
/**
* productApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const productApi = {
getAllProducts: async (): Promise<ProductVO[]> => {
return await api.get<ProductVO[]>('/product/list/all') as unknown as ProductVO[]
+23
View File
@@ -1,11 +1,24 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
/**
* productLikeApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const productLikeApi = {
/**
* 点赞作品
* @param productId 作品ID
*/
/**
* `likeProduct` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param productId: IdType caller-supplied value for `productId: IdType`
*/
likeProduct: (productId: IdType) => {
return api.post<boolean>(`/product-like/like/${productId}`)
},
@@ -14,6 +27,11 @@ export const productLikeApi = {
* 取消点赞作品
* @param productId 作品ID
*/
/**
* `unlikeProduct` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param productId: IdType caller-supplied value for `productId: IdType`
*/
unlikeProduct: (productId: IdType) => {
return api.post<boolean>(`/product-like/unlike/${productId}`)
},
@@ -22,6 +40,11 @@ export const productLikeApi = {
* 检查用户是否已点赞作品
* @param productId 作品ID
*/
/**
* `checkLikeStatus` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param productId: IdType caller-supplied value for `productId: IdType`
*/
checkLikeStatus: (productId: IdType) => {
return api.get<boolean>(`/product-like/check/${productId}`)
}
+17
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
@@ -6,8 +10,15 @@ export interface ShopVO {
shopName: string
description: string
address: string
mapProvider?: string
longitude?: number | string
latitude?: number | string
navigationUrls?: Record<string, string>
businessHours: string
status?: number
authorizationExpireTime?: string
authorizationExpired?: boolean
authorizationStatusText?: string
coverImageFileId?: string
coverImageUrls?: string[]
imageFileIds: string
@@ -36,6 +47,7 @@ export interface CreateShopRequest {
address: string
businessHours: string
status: number
authorizationExpireTime?: string
}
export interface UpdateShopRequest {
@@ -46,8 +58,13 @@ export interface UpdateShopRequest {
address?: string
businessHours?: string
status?: number
authorizationExpireTime?: string
}
/**
* shopApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const shopApi = {
getAllShops: async (): Promise<ShopVO[]> => {
return await api.get<ShopVO[]>('/shop/list/all') as unknown as ShopVO[]
+33
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
@@ -18,23 +22,52 @@ export interface TagDTO {
borderColor: string
}
/**
* tagApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const tagApi = {
/**
* `getAllTags` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
getAllTags: () => {
return api.get<TagVO[]>('/tag/list/all')
},
/**
* `getTagById` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
getTagById: (id: IdType) => {
return api.get<TagVO>(`/tag/get/${id}`)
},
/**
* `createTag` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: TagDTO caller-supplied value for `data: TagDTO`
*/
createTag: (data: TagDTO) => {
return api.post<TagVO>('/tag/add', data)
},
/**
* `updateTag` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
* @param data: TagDTO caller-supplied value for `data: TagDTO`
*/
updateTag: (id: IdType, data: TagDTO) => {
return api.put<TagVO>(`/tag/update/${id}`, data)
},
/**
* `deleteTag` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
deleteTag: (id: IdType) => {
return api.delete(`/tag/delete/${id}`)
}
+223 -1
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { UserInfo } from './auth'
import type { IdType } from '@/utils/id'
@@ -19,6 +23,15 @@ export interface UserVO extends UserInfo {
updateTime: string
status: number
phone?: string
email?: string
maskedPhone?: string
maskedEmail?: string
shopRoleId?: IdType
shopRoleName?: string
parentUserId?: IdType
parentUserName?: string
parentUserTypeName?: string
relationSourceType?: string
}
export interface UpdateUserInfoRequest {
@@ -84,25 +97,160 @@ export interface LoginShopSelectionResponse {
}>
}
export interface UserRelationVO {
userId: IdType
shopId?: IdType
shopName?: string
parentUserId?: IdType
parentUserName?: string
parentRoleType?: number
parentRoleTypeName?: string
sourceType?: string
sourceTypeName?: string
}
// 用户端常用接口约定:
// - relation 表示当前用户的门店和直属上级归属;
// - announcement 只用于首页滚动公告,不进入消息通知历史;
// - system-message 才是站内消息,popup/read 分开记录。
export interface InviteCodeVO {
id: IdType
inviteCode: string
ownerUserId?: IdType
ownerUserName?: string
shopId?: IdType
shopName?: string
status?: number
useCount?: number
expireTime?: string
createTime?: string
}
export interface UpdatePhoneRequest {
oldPhone: string
newPhone: string
verificationCode: string
}
export interface UserAssetVO {
userId: IdType
nickname: string
balance: number
totalRechargeAmount: number
lastRechargeTime?: string
vipInfoId?: IdType
vipLevel: string
benefitId?: IdType
benefitInfo?: string
manualOverride?: boolean
vipStartTime?: string
vipExpireTime?: string
}
export interface BalanceHistoryItem {
id: IdType
userId: IdType
userNickname?: string
amount: number
type?: string
currentBalance?: number
beforeBalance?: number
afterBalance?: number
changeScene?: string
relatedOrderId?: IdType
relatedOrderNo?: string
externalOrderNo?: string
remark?: string
changeTime?: string
}
export interface SystemMessageVO {
id: IdType
title: string
content: string
imageFileId?: IdType
imageUrl?: string
publisherName?: string
targetType?: string
targetTypeName?: string
popupEnabled?: number
popupShown?: number
readStatus?: number
publishTime?: string
createTime?: string
}
export interface AnnouncementVO {
id: IdType
title: string
content: string
publisherName?: string
targetType?: string
status?: number
sortOrder?: number
publishTime?: string
}
export interface VipRechargePlanVO {
id: IdType
shopId: IdType
shopName?: string
title: string
rechargeAmount: number
giftAmount: number
vipLevel: string
description?: string
sortOrder?: number
status: number
}
export interface ContactInfoVO {
contactUserId?: IdType
contactName?: string
roleLabel?: string
phone?: string
phoneAvailable?: boolean
platformContactAvailable?: boolean
platformContactText?: string
}
/**
* userApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const userApi = {
getUserInfo: async (): Promise<UserVO> => {
return await api.get<UserVO>('/user/info') as unknown as UserVO
},
/**
* `updateUserInfo` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: UpdateUserInfoRequest caller-supplied value for `data: UpdateUserInfoRequest`
*/
updateUserInfo: (data: UpdateUserInfoRequest) => {
return api.put('/user/update', data)
},
/**
* `updatePassword` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: UpdatePasswordRequest caller-supplied value for `data: UpdatePasswordRequest`
*/
updatePassword: (data: UpdatePasswordRequest) => {
return api.put('/user/password', data)
},
/**
* `bindPhone` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: BindPhoneRequest caller-supplied value for `data: BindPhoneRequest`
*/
bindPhone: (data: BindPhoneRequest) => {
return api.post('/user/bind-phone', data)
},
/**
* `updatePhone` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: UpdatePhoneRequest caller-supplied value for `data: UpdatePhoneRequest`
*/
updatePhone: (data: UpdatePhoneRequest) => {
return api.put('/user/phone', data)
},
@@ -127,12 +275,86 @@ export const userApi = {
listUsersByType: async (type: number): Promise<UserVO[]> => {
return await api.get<UserVO[]>(`/user/list/type/${type}`) as unknown as UserVO[]
},
sendVerificationCode: (data: { phone: string }) => {
/**
* `sendVerificationCode` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param data: { phone: string; sceneCode?: string } caller-supplied value for `data: { phone: string; sceneCode?: string }`
*/
sendVerificationCode: (data: { phone: string; sceneCode?: string }) => {
return api.post('/user/send-verification-code', data)
},
/**
* `switchShop` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param shopId?: string | number caller-supplied value for `shopId?: string | number`
*/
switchShop: (shopId?: string | number) => {
return api.post('/user/switch-shop', { shopId })
},
getMyAsset: async (): Promise<UserAssetVO> => {
return await api.get<UserAssetVO>('/user/asset/me') as unknown as UserAssetVO
},
getMyBalanceHistory: async (): Promise<BalanceHistoryItem[]> => {
return await api.get<BalanceHistoryItem[]>('/user/balance/history/me') as unknown as BalanceHistoryItem[]
},
listMyMessages: async (): Promise<SystemMessageVO[]> => {
return await api.get<SystemMessageVO[]>('/system-message/my/list') as unknown as SystemMessageVO[]
},
listMyPopupMessages: async (): Promise<SystemMessageVO[]> => {
return await api.get<SystemMessageVO[]>('/system-message/my/popup') as unknown as SystemMessageVO[]
},
getMyUnreadMessageCount: async (): Promise<{ unreadCount: number }> => {
return await api.get<{ unreadCount: number }>('/system-message/my/unread-count') as unknown as { unreadCount: number }
},
getMyMessage: async (id: IdType): Promise<SystemMessageVO> => {
return await api.get<SystemMessageVO>(`/system-message/my/${id}`) as unknown as SystemMessageVO
},
/**
* `markMessagePopupShown` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
markMessagePopupShown: (id: IdType) => {
return api.put(`/system-message/my/${id}/popup-shown`, {})
},
/**
* `markMessageRead` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param id: IdType caller-supplied value for `id: IdType`
*/
markMessageRead: (id: IdType) => {
return api.put(`/system-message/my/${id}/read`, {})
},
listMyAnnouncements: async (): Promise<AnnouncementVO[]> => {
return await api.get<AnnouncementVO[]>('/announcement/my/list') as unknown as AnnouncementVO[]
},
listMyVipRechargePlans: async (): Promise<VipRechargePlanVO[]> => {
return await api.get<VipRechargePlanVO[]>('/vip-recharge-plan/my/list') as unknown as VipRechargePlanVO[]
},
getMyRelation: async (): Promise<UserRelationVO> => {
return await api.get<UserRelationVO>('/user/relation/me') as unknown as UserRelationVO
},
// 注册页输入邀请码时先解析,给用户展示“将归属到谁/哪个店铺”。
resolveInviteCode: async (code: string): Promise<InviteCodeVO> => {
return await api.get<InviteCodeVO>('/user/invite-code/resolve', { params: { code } }) as unknown as InviteCodeVO
},
getShopManagerContact: async (shopId: IdType): Promise<ContactInfoVO> => {
return await api.get<ContactInfoVO>(`/contact-info/shop/${shopId}/manager`) as unknown as ContactInfoVO
},
getProductArtistContact: async (productId: IdType, artistId: IdType): Promise<ContactInfoVO> => {
return await api.get<ContactInfoVO>(`/contact-info/product/${productId}/artist/${artistId}`) as unknown as ContactInfoVO
},
getOrderArtistContact: async (orderId: IdType, artistId?: IdType): Promise<ContactInfoVO> => {
const params = artistId ? { artistId } : {}
return await api.get<ContactInfoVO>(`/contact-info/order/${orderId}/artist`, { params }) as unknown as ContactInfoVO
},
getPlatformContact: async (): Promise<ContactInfoVO> => {
return await api.get<ContactInfoVO>('/contact-info/platform') as unknown as ContactInfoVO
},
/**
* `deactivateAccount` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
deactivateAccount: () => {
return api.delete('/user/deactivate')
}
+8
View File
@@ -1,3 +1,7 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
@@ -27,6 +31,10 @@ export interface WishlistItem {
}
}
/**
* wishlistApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const wishlistApi = {
addToWishlist: async (productId: IdType): Promise<boolean> => {
return await api.post<boolean>('/wishlist/add', { productId }) as unknown as boolean