杂务:新增声明级注释覆盖率

This commit is contained in:
xiaowang
2026-05-23 18:44:57 +08:00
parent 8f038894e7
commit 844516988b
234 changed files with 8356 additions and 0 deletions
+28
View File
@@ -27,15 +27,31 @@ import { CheckOutlined } from '@ant-design/icons-vue'
import BottomNav from './components/BottomNav.vue'
import SystemMessageCard from './components/SystemMessageCard.vue'
import { cartApi } from './api/cart'
/**
* Purpose: SystemMessageVO supports App.vue by holding or executing the system message vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type SystemMessageVO } from './api/user'
import antdLocale from './config/antdv-locale'
import { useGlobalConfirmEnter } from './composables/useConfirmEnter'
import { useShopTheme } from './composables/useShopTheme'
/**
* Purpose: route supports App.vue by holding or executing the route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const route = useRoute()
/**
* Purpose: router supports App.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { currentTheme, refreshShopTheme, resetShopTheme, setupShopThemeSync } = useShopTheme()
useGlobalConfirmEnter()
/**
* Purpose: ButtonPropsWithClass supports App.vue by holding or executing the button props with class page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
type ButtonPropsWithClass = ButtonProps & { class?: string }
const popupMessageOkButtonProps: ButtonPropsWithClass = { class: 'popup-message-ok-button' }
/** routerReady is a reactive state variable used by the template and event handlers. */
@@ -55,6 +71,10 @@ const isHiddenNav = computed(() => {
return route.matched.some(r => r.meta.hideNav) || route.matched.some(r => r.meta.isAdmin)
})
/**
* Purpose: antdTheme supports App.vue by holding or executing the antd theme page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const antdTheme = computed<ThemeConfig>(() => ({
token: {
colorPrimary: currentTheme.value.primaryColor,
@@ -110,6 +130,10 @@ const updateCartCount = async () => {
await loadCartCount()
}
/**
* Purpose: resolveSystemMessageActionPath supports App.vue by holding or executing the resolve system message action path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resolveSystemMessageActionPath = (item: SystemMessageVO) => {
const actionPath = String(item.actionPath || '').trim()
if (!actionPath || !actionPath.startsWith('/') || actionPath.startsWith('//')) {
@@ -118,6 +142,10 @@ const resolveSystemMessageActionPath = (item: SystemMessageVO) => {
return actionPath
}
/**
* Purpose: openSystemMessageAction supports App.vue by holding or executing the open system message action page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openSystemMessageAction = async (item: SystemMessageVO) => {
const actionPath = resolveSystemMessageActionPath(item)
if (!actionPath) {
+232
View File
@@ -10,10 +10,26 @@ import { clearAdminSessionStorage } from '@/utils/admin-session'
import { attachRequestSignature } from '@/utils/request-signature'
import { isAdminApiAuthFreePath } from './auth-free-paths'
/**
* Purpose: lastErrorTime supports admin.ts by holding or executing the last error time page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let lastErrorTime = 0
/**
* Purpose: lastErrorMessage supports admin.ts by holding or executing the last error message page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let lastErrorMessage = ''
/**
* Purpose: ERROR_DEBOUNCE_TIME supports admin.ts by holding or executing the error debounce time page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const ERROR_DEBOUNCE_TIME = 1000
/**
* Purpose: adminApi supports admin.ts by holding or executing the admin api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const adminApi = axios.create({
baseURL: ADMIN_API_BASE_URL,
timeout: 10000,
@@ -22,12 +38,20 @@ const adminApi = axios.create({
}
})
/**
* Purpose: isRefreshing supports admin.ts by holding or executing the is refreshing page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let isRefreshing = false
let failedQueue: Array<{
resolve: (value?: any) => void
reject: (reason?: any) => void
}> = []
/**
* Purpose: processQueue supports admin.ts by holding or executing the process queue page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const processQueue = (error: any, token: string | null = null) => {
failedQueue.forEach(prom => {
if (error) {
@@ -39,10 +63,18 @@ const processQueue = (error: any, token: string | null = null) => {
failedQueue = []
}
/**
* Purpose: getStoredAdminAccessToken supports admin.ts by holding or executing the get stored admin access token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getStoredAdminAccessToken = () => {
return localStorage.getItem('adminAccessToken') || sessionStorage.getItem('adminAccessToken')
}
/**
* Purpose: getRequestToken supports admin.ts by holding or executing the get request token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getRequestToken = (request: any) => {
if (request?._authToken) {
return request._authToken as string
@@ -54,10 +86,18 @@ const getRequestToken = (request: any) => {
return authHeader.startsWith('Bearer ') ? authHeader.slice('Bearer '.length) : null
}
/**
* Purpose: isCurrentStoredAdminToken supports admin.ts by holding or executing the is current stored admin token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isCurrentStoredAdminToken = (token: string | null) => {
return Boolean(token && token === getStoredAdminAccessToken())
}
/**
* Purpose: showError supports admin.ts by holding or executing the show error page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const showError = (msg: string) => {
const now = Date.now()
if (now - lastErrorTime > ERROR_DEBOUNCE_TIME || msg !== lastErrorMessage) {
@@ -67,10 +107,18 @@ const showError = (msg: string) => {
}
}
/**
* Purpose: isAuthFreePath supports admin.ts by holding or executing the is auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isAuthFreePath = (url?: string) => {
return isAdminApiAuthFreePath(url)
}
/**
* Purpose: handleAdminTokenExpired supports admin.ts by holding or executing the handle admin token expired page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleAdminTokenExpired = (failedToken: string | null = null) => {
if (!isCurrentStoredAdminToken(failedToken)) {
return
@@ -192,18 +240,30 @@ adminApi.interceptors.response.use(
}
)
/**
* Purpose: AdminLoginRequest supports admin.ts by holding or executing the admin login request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminLoginRequest {
account: string
password: string
shopId?: IdType
}
/**
* Purpose: AdminLoginResponse supports admin.ts by holding or executing the admin login response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminLoginResponse {
accessToken: string
refreshToken: string
userInfo: any
}
/**
* Purpose: LoginShopSelectionResponse supports admin.ts by holding or executing the login shop selection response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LoginShopSelectionResponse {
allowShoplessLogin: boolean
message: string
@@ -213,6 +273,10 @@ export interface LoginShopSelectionResponse {
}>
}
/**
* Purpose: LegalAgreementAdminVO supports admin.ts by holding or executing the legal agreement admin vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LegalAgreementAdminVO {
id: IdType
agreementType: 'USER_TERMS' | 'PRIVACY_POLICY'
@@ -227,6 +291,10 @@ export interface LegalAgreementAdminVO {
updateTime?: string
}
/**
* Purpose: LegalAgreementAdminRequest supports admin.ts by holding or executing the legal agreement admin request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LegalAgreementAdminRequest {
agreementType: 'USER_TERMS' | 'PRIVACY_POLICY'
title: string
@@ -280,6 +348,10 @@ export const adminAuthApi = {
}
}
/**
* Purpose: adminLegalAgreementApi supports admin.ts by holding or executing the admin legal agreement api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const adminLegalAgreementApi = {
list: () => adminApi.get<LegalAgreementAdminVO[]>('/legal-agreement/list'),
create: (data: LegalAgreementAdminRequest) => adminApi.post<IdType>('/legal-agreement/create', data),
@@ -288,6 +360,10 @@ export const adminLegalAgreementApi = {
disable: (id: IdType) => adminApi.put<boolean>(`/legal-agreement/${id}/disable`)
}
/**
* Purpose: ObjectStorageFileVO supports admin.ts by holding or executing the object storage file vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ObjectStorageFileVO {
id: IdType
fileName: string
@@ -296,6 +372,10 @@ export interface ObjectStorageFileVO {
createTime: string
}
/**
* Purpose: ChunkUploadInitRequest supports admin.ts by holding or executing the chunk upload init request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadInitRequest {
fileName: string
fileSize: number
@@ -304,6 +384,10 @@ export interface ChunkUploadInitRequest {
scene: string
}
/**
* Purpose: ChunkUploadSessionVO supports admin.ts by holding or executing the chunk upload session vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadSessionVO {
uploadId: string
chunkSize: number
@@ -339,6 +423,10 @@ export const adminFileApi = {
return adminApi.post<ChunkUploadSessionVO>('/object-storage-file/upload/init', data) as unknown as Promise<ChunkUploadSessionVO>
},
uploadChunk: (
/**
* Purpose: data supports admin.ts by holding or executing the data page or API role.
* Usage: import, call, read, or update this page-data from the owning page/module while preserving the surrounding loading and permission flow.
*/
data: { uploadId: string; chunkIndex: number; totalChunks: number; chunk: Blob },
config?: { signal?: AbortSignal; onUploadProgress?: (event: AxiosProgressEvent) => void }
) => {
@@ -348,10 +436,22 @@ export const adminFileApi = {
formData.append('totalChunks', String(data.totalChunks))
formData.append('chunk', data.chunk)
return adminApi.post<boolean>('/object-storage-file/upload/chunk', formData, {
/**
* Purpose: headers supports admin.ts by holding or executing the headers page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
headers: {
'Content-Type': 'multipart/form-data'
},
/**
* Purpose: signal supports admin.ts by holding or executing the signal page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
signal: config?.signal,
/**
* Purpose: onUploadProgress supports admin.ts by holding or executing the on upload progress page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
onUploadProgress: config?.onUploadProgress
})
},
@@ -381,6 +481,10 @@ export const adminFileApi = {
}
}
/**
* Purpose: Tag supports admin.ts by holding or executing the tag page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Tag {
id: IdType
tagName: string
@@ -442,6 +546,10 @@ export const adminTagApi = {
}
}
/**
* Purpose: Artist supports admin.ts by holding or executing the artist page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Artist {
id: IdType
nickname: string
@@ -472,6 +580,10 @@ export const adminArtistApi = {
}
}
/**
* Purpose: Coupon supports admin.ts by holding or executing the coupon page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Coupon {
id: IdType
couponCode?: string
@@ -548,6 +660,10 @@ export const adminCouponApi = {
}
}
/**
* Purpose: AdminCommentVO supports admin.ts by holding or executing the admin comment vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminCommentVO {
id: IdType
userId: IdType
@@ -585,6 +701,10 @@ export const adminCommentApi = {
}
}
/**
* Purpose: Product supports admin.ts by holding or executing the product page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Product {
id: IdType
shopId: IdType
@@ -653,6 +773,10 @@ export const adminProductApi = {
}
}
/**
* Purpose: Shop supports admin.ts by holding or executing the shop page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Shop {
id: IdType
shopName: string
@@ -682,6 +806,10 @@ export interface Shop {
updateTime: string
}
/**
* Purpose: ShopListResponse supports admin.ts by holding or executing the shop list response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ShopListResponse {
list: Shop[]
total: number
@@ -689,6 +817,10 @@ export interface ShopListResponse {
size: number
}
/**
* Purpose: CreateShopRequest supports admin.ts by holding or executing the create shop request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface CreateShopRequest {
shopName: string
description: string
@@ -759,6 +891,10 @@ export const adminShopApi = {
}
}
/**
* Purpose: UserVO supports admin.ts by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserVO {
id: IdType
shopId?: IdType
@@ -780,6 +916,10 @@ export interface UserVO {
status?: number
}
/**
* Purpose: UserRelationVO supports admin.ts by holding or executing the user relation vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserRelationVO {
userId: IdType
shopId?: IdType
@@ -792,6 +932,10 @@ export interface UserRelationVO {
sourceTypeName?: string
}
/**
* Purpose: UserStatisticsVO supports admin.ts by holding or executing the user statistics vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserStatisticsVO {
totalUserCount: number
normalUserCount: number
@@ -805,6 +949,10 @@ export interface UserStatisticsVO {
byParent?: Record<string, number>
}
/**
* Purpose: PageResult supports admin.ts by holding or executing the page result page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface PageResult<T> {
list: T[]
total: number
@@ -960,6 +1108,10 @@ export const adminUserApi = {
}
}
/**
* Purpose: UserAssetVO supports admin.ts by holding or executing the user asset vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserAssetVO {
userId: IdType
nickname: string
@@ -975,6 +1127,10 @@ export interface UserAssetVO {
vipExpireTime?: string
}
/**
* Purpose: UserBalanceHistoryItem supports admin.ts by holding or executing the user balance history item page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserBalanceHistoryItem {
id: IdType
userId: IdType
@@ -993,6 +1149,10 @@ export interface UserBalanceHistoryItem {
changeTime: string
}
/**
* Purpose: AdminUserBalanceChangeRequest supports admin.ts by holding or executing the admin user balance change request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminUserBalanceChangeRequest {
amount: number
changeScene: string
@@ -1001,13 +1161,25 @@ export interface AdminUserBalanceChangeRequest {
remark?: string
}
/**
* Purpose: AdminUserVipOverrideRequest supports admin.ts by holding or executing the admin user vip override request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminUserVipOverrideRequest {
vipLevel: string
remark?: string
}
/**
* Purpose: userApi supports admin.ts by holding or executing the user api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const userApi = adminUserApi
/**
* Purpose: OrderVO supports admin.ts by holding or executing the order vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface OrderVO {
id: IdType
orderNo: string
@@ -1067,6 +1239,10 @@ export const adminOrderApi = {
}
}
/**
* Purpose: HotProductVO supports admin.ts by holding or executing the hot product vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface HotProductVO {
id: IdType
title: string
@@ -1075,6 +1251,10 @@ export interface HotProductVO {
collectCount: number
}
/**
* Purpose: RecentActivityVO supports admin.ts by holding or executing the recent activity vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface RecentActivityVO {
id: IdType
type: string
@@ -1084,6 +1264,10 @@ export interface RecentActivityVO {
color?: string
}
/**
* Purpose: DashboardStats supports admin.ts by holding or executing the dashboard stats page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface DashboardStats {
totalUsers: number
totalProducts: number
@@ -1117,6 +1301,10 @@ export const adminDashboardApi = {
}
}
/**
* Purpose: NailArtistInfoVO supports admin.ts by holding or executing the nail artist info vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface NailArtistInfoVO {
id: IdType
userId: IdType
@@ -1166,6 +1354,10 @@ export const adminNailArtistApi = {
}
}
/**
* Purpose: SystemMessageVO supports admin.ts by holding or executing the system message vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface SystemMessageVO {
id: IdType
title: string
@@ -1186,11 +1378,19 @@ export interface SystemMessageVO {
readStatus?: number
}
/**
* Purpose: MessageTargetOptionsVO supports admin.ts by holding or executing the message target options vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface MessageTargetOptionsVO {
shops: Array<{ id: IdType; shopName: string }>
users: Array<{ id: IdType; nickname: string; account: string; shopId?: IdType; shopName?: string; type?: number }>
}
/**
* Purpose: SystemMessageCreateRequest supports admin.ts by holding or executing the system message create request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface SystemMessageCreateRequest {
title: string
content: string
@@ -1240,6 +1440,10 @@ export const adminSystemMessageApi = {
}
}
/**
* Purpose: AnnouncementVO supports admin.ts by holding or executing the announcement vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AnnouncementVO {
id: IdType
title: string
@@ -1256,6 +1460,10 @@ export interface AnnouncementVO {
createTime?: string
}
/**
* Purpose: AnnouncementCreateRequest supports admin.ts by holding or executing the announcement create request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AnnouncementCreateRequest {
title: string
content: string
@@ -1303,6 +1511,10 @@ export const adminAnnouncementApi = {
}
}
/**
* Purpose: VipRechargePlanVO supports admin.ts by holding or executing the vip recharge plan vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface VipRechargePlanVO {
id: IdType
shopId: IdType
@@ -1318,6 +1530,10 @@ export interface VipRechargePlanVO {
updateTime?: string
}
/**
* Purpose: VipRechargePlanRequest supports admin.ts by holding or executing the vip recharge plan request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface VipRechargePlanRequest {
shopId?: IdType
title: string
@@ -1380,6 +1596,10 @@ export const adminVipRechargePlanApi = {
}
}
/**
* Purpose: MessageHubPushConfigVO supports admin.ts by holding or executing the message hub push config vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface MessageHubPushConfigVO {
id: IdType
sceneCode: string
@@ -1397,6 +1617,10 @@ export interface MessageHubPushConfigVO {
updateTime?: string
}
/**
* Purpose: MessageHubPushConfigRequest supports admin.ts by holding or executing the message hub push config request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface MessageHubPushConfigRequest {
sceneCode: string
sceneName: string
@@ -1460,6 +1684,10 @@ export const adminMessageHubPushConfigApi = {
}
}
/**
* Purpose: SystemParameterConfigVO supports admin.ts by holding or executing the system parameter config vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface SystemParameterConfigVO {
id?: IdType
configGroup: string
@@ -1472,6 +1700,10 @@ export interface SystemParameterConfigVO {
updateTime?: string
}
/**
* Purpose: adminSystemParameterConfigApi supports admin.ts by holding or executing the admin system parameter config api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const adminSystemParameterConfigApi = {
listConfigs: (configGroup?: string) => {
return adminApi.get<SystemParameterConfigVO[]>('/system-parameter-config/admin/list', { params: { configGroup } }) as unknown as Promise<SystemParameterConfigVO[]>
@@ -1,3 +1,7 @@
/**
* Purpose: WEB_API_AUTH_FREE_PATHS supports auth-free-paths.ts by holding or executing the web api auth free paths page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const WEB_API_AUTH_FREE_PATHS = [
'/user/login',
'/user/register',
@@ -22,12 +26,20 @@ export const WEB_API_AUTH_FREE_PATHS = [
'/admin/auth/refresh'
] as const
/**
* Purpose: ADMIN_API_AUTH_FREE_PATHS supports auth-free-paths.ts by holding or executing the admin api auth free paths page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const ADMIN_API_AUTH_FREE_PATHS = [
'/auth/login',
'/auth/login-shops/',
'/auth/refresh'
] as const
/**
* Purpose: normalizePathname supports auth-free-paths.ts by holding or executing the normalize pathname page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizePathname = (url?: string) => {
const raw = String(url || '')
const withoutHash = raw.split('#')[0] || ''
@@ -39,6 +51,10 @@ const normalizePathname = (url?: string) => {
}
}
/**
* Purpose: matchesAuthFreePath supports auth-free-paths.ts by holding or executing the matches auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchesAuthFreePath = (url: string | undefined, path: string) => {
const pathname = normalizePathname(url)
if (path.endsWith('/')) {
@@ -47,10 +63,18 @@ const matchesAuthFreePath = (url: string | undefined, path: string) => {
return pathname === path
}
/**
* Purpose: isApiAuthFreePath supports auth-free-paths.ts by holding or executing the is api auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const isApiAuthFreePath = (url?: string) => {
return WEB_API_AUTH_FREE_PATHS.some(path => matchesAuthFreePath(url, path))
}
/**
* Purpose: isAdminApiAuthFreePath supports auth-free-paths.ts by holding or executing the is admin api auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const isAdminApiAuthFreePath = (url?: string) => {
return ADMIN_API_AUTH_FREE_PATHS.some(path => matchesAuthFreePath(url, path))
}
+48
View File
@@ -5,11 +5,19 @@
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: SendVerificationCodeRequest supports auth.ts by holding or executing the send verification code request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface SendVerificationCodeRequest {
phone: string
sceneCode?: string
}
/**
* Purpose: LoginRequest supports auth.ts by holding or executing the login request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LoginRequest {
account: string
password: string
@@ -20,6 +28,10 @@ export interface LoginRequest {
clientType?: string
}
/**
* Purpose: PhoneLoginRequest supports auth.ts by holding or executing the phone login request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface PhoneLoginRequest {
phone: string
verificationCode: string
@@ -29,6 +41,10 @@ export interface PhoneLoginRequest {
clientType?: string
}
/**
* Purpose: RegisterRequest supports auth.ts by holding or executing the register request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface RegisterRequest {
account: string
password: string
@@ -42,6 +58,10 @@ export interface RegisterRequest {
clientType?: string
}
/**
* Purpose: LegalAgreement supports auth.ts by holding or executing the legal agreement page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LegalAgreement {
id: IdType
agreementType: 'USER_TERMS' | 'PRIVACY_POLICY'
@@ -54,12 +74,20 @@ export interface LegalAgreement {
effectiveTime?: string
}
/**
* Purpose: LoginResponse supports auth.ts by holding or executing the login response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LoginResponse {
accessToken: string
refreshToken: string
userInfo: UserInfo
}
/**
* Purpose: UserInfo supports auth.ts by holding or executing the user info page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserInfo {
id: IdType
account: string
@@ -77,21 +105,37 @@ export interface UserInfo {
updateTime?: string
}
/**
* Purpose: RefreshTokenRequest supports auth.ts by holding or executing the refresh token request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface RefreshTokenRequest {
refreshToken: string
}
/**
* Purpose: RefreshTokenResponse supports auth.ts by holding or executing the refresh token response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface RefreshTokenResponse {
accessToken: string
refreshToken: string
}
/**
* Purpose: ResetPasswordRequest supports auth.ts by holding or executing the reset password request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ResetPasswordRequest {
phone: string
verificationCode: string
newPassword: string
}
/**
* Purpose: SwitchShopRequest supports auth.ts by holding or executing the switch shop request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface SwitchShopRequest {
shopId?: string | number
}
@@ -190,6 +234,10 @@ export const authApi = {
}
}
/**
* Purpose: legalAgreementApi supports auth.ts by holding or executing the legal agreement api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const legalAgreementApi = {
listCurrent: () => {
return api.get<LegalAgreement[]>('/legal-agreement/current')
+4
View File
@@ -5,6 +5,10 @@
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: CartItem supports cart.ts by holding or executing the cart item page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface CartItem {
productId: IdType
quantity: number
+4
View File
@@ -5,6 +5,10 @@
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: CommentVO supports comment.ts by holding or executing the comment vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface CommentVO {
id: IdType
userId: IdType
+20
View File
@@ -5,6 +5,10 @@
import request from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: Coupon supports coupon.ts by holding or executing the coupon page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Coupon {
id: IdType
couponCode: string
@@ -29,11 +33,19 @@ export interface Coupon {
unavailableTags: Tag[]
}
/**
* Purpose: Tag supports coupon.ts by holding or executing the tag page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface Tag {
id: IdType
tagName?: string
}
/**
* Purpose: UserCoupon supports coupon.ts by holding or executing the user coupon page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserCoupon {
id: IdType
couponId: IdType
@@ -54,6 +66,10 @@ export interface UserCoupon {
autoMatched?: boolean
}
/**
* Purpose: CreateCouponRequest supports coupon.ts by holding or executing the create coupon request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface CreateCouponRequest {
couponCode: string
couponName: string
@@ -71,6 +87,10 @@ export interface CreateCouponRequest {
unavailableTagIds: IdType[]
}
/**
* Purpose: CouponListResponse supports coupon.ts by holding or executing the coupon list response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface CouponListResponse {
list: Coupon[]
total: number
+28
View File
@@ -6,6 +6,10 @@ import type { AxiosProgressEvent } from 'axios'
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: ChunkUploadInitRequest supports file.ts by holding or executing the chunk upload init request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadInitRequest {
fileName: string
fileSize: number
@@ -14,6 +18,10 @@ export interface ChunkUploadInitRequest {
scene: string
}
/**
* Purpose: ChunkUploadSessionVO supports file.ts by holding or executing the chunk upload session vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadSessionVO {
uploadId: string
chunkSize: number
@@ -49,6 +57,10 @@ export const fileApi = {
return api.post<ChunkUploadSessionVO>('/user/upload-avatar/init', data) as unknown as Promise<ChunkUploadSessionVO>
},
uploadAvatarChunk: (
/**
* Purpose: data supports file.ts by holding or executing the data page or API role.
* Usage: import, call, read, or update this page-data from the owning page/module while preserving the surrounding loading and permission flow.
*/
data: { uploadId: string; chunkIndex: number; totalChunks: number; chunk: Blob },
config?: { signal?: AbortSignal; onUploadProgress?: (event: AxiosProgressEvent) => void }
) => {
@@ -58,10 +70,22 @@ export const fileApi = {
formData.append('totalChunks', String(data.totalChunks))
formData.append('chunk', data.chunk)
return api.post<boolean>('/user/upload-avatar/chunk', formData, {
/**
* Purpose: headers supports file.ts by holding or executing the headers page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
headers: {
'Content-Type': 'multipart/form-data'
},
/**
* Purpose: signal supports file.ts by holding or executing the signal page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
signal: config?.signal,
/**
* Purpose: onUploadProgress supports file.ts by holding or executing the on upload progress page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
onUploadProgress: config?.onUploadProgress
})
},
@@ -90,6 +114,10 @@ export const fileApi = {
*/
getSignedUrl: (fileId: IdType, expiryTimeInMinutes?: number) => {
return api.get<string>(`/file/get-signed-url/${fileId}`, {
/**
* Purpose: params supports file.ts by holding or executing the params page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
params: { expiryTimeInMinutes }
})
}
+52
View File
@@ -15,9 +15,21 @@ import { isApiAuthFreePath } from './auth-free-paths'
// 防重复提示标志
let lastErrorTime = 0
/**
* Purpose: lastErrorMessage supports index.ts by holding or executing the last error message page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let lastErrorMessage = ''
/**
* Purpose: ERROR_DEBOUNCE_TIME supports index.ts by holding or executing the error debounce time page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const ERROR_DEBOUNCE_TIME = 1000 // 1秒内不重复显示相同错误
/**
* Purpose: api supports index.ts by holding or executing the api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const api = axios.create({
baseURL: API_BASE_URL,
timeout: 10000,
@@ -26,24 +38,40 @@ const api = axios.create({
}
})
/**
* Purpose: isRefreshing supports index.ts by holding or executing the is refreshing page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let isRefreshing = false
let failedQueue: Array<{
resolve: (value?: any) => void
reject: (reason?: any) => void
}> = []
/**
* Purpose: getStoredAccessToken supports index.ts by holding or executing the get stored access token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getStoredAccessToken = (isAdmin = false) => {
return isAdmin
? (localStorage.getItem('adminAccessToken') || sessionStorage.getItem('adminAccessToken'))
: (localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken'))
}
/**
* Purpose: getStoredRefreshToken supports index.ts by holding or executing the get stored refresh token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getStoredRefreshToken = (isAdmin = false) => {
return isAdmin
? (localStorage.getItem('adminRefreshToken') || sessionStorage.getItem('adminRefreshToken'))
: (localStorage.getItem('refreshToken') || sessionStorage.getItem('refreshToken'))
}
/**
* Purpose: getRequestToken supports index.ts by holding or executing the get request token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getRequestToken = (request: any) => {
if (request?._authToken) {
return request._authToken as string
@@ -57,14 +85,26 @@ const getRequestToken = (request: any) => {
return authHeader.startsWith('Bearer ') ? authHeader.slice('Bearer '.length) : null
}
/**
* Purpose: isCurrentStoredToken supports index.ts by holding or executing the is current stored token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isCurrentStoredToken = (token: string | null, isAdmin = false) => {
return Boolean(token && token === getStoredAccessToken(isAdmin))
}
/**
* Purpose: getResponseMessage supports index.ts by holding or executing the get response message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getResponseMessage = (error: AxiosError) => {
return (error.response?.data as any)?.message || error.message || '请求失败'
}
/**
* Purpose: isTokenExpiredResponse supports index.ts by holding or executing the is token expired response page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isTokenExpiredResponse = (error: AxiosError, requestToken: string | null) => {
const messageText = getResponseMessage(error)
return Boolean(
@@ -81,6 +121,10 @@ const isTokenExpiredResponse = (error: AxiosError, requestToken: string | null)
)
}
/**
* Purpose: processQueue supports index.ts by holding or executing the process queue page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const processQueue = (error: any, token: string | null = null) => {
failedQueue.forEach(prom => {
if (error) {
@@ -102,10 +146,18 @@ const showError = (msg: string) => {
}
}
/**
* Purpose: isAuthFreePath supports index.ts by holding or executing the is auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isAuthFreePath = (url?: string) => {
return isApiAuthFreePath(url)
}
/**
* Purpose: handleTokenExpired supports index.ts by holding or executing the handle token expired page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleTokenExpired = (isAdmin = false, failedToken: string | null = null) => {
if (!isCurrentStoredToken(failedToken, isAdmin)) {
return
+36
View File
@@ -5,6 +5,10 @@
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: OrderItem supports order.ts by holding or executing the order item page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface OrderItem {
productId: IdType
quantity: number
@@ -12,12 +16,20 @@ interface OrderItem {
appointmentTime?: string
}
/**
* Purpose: CreateOrderRequest supports order.ts by holding or executing the create order request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface CreateOrderRequest {
couponId?: IdType
couponSourceType?: string
items: OrderItem[]
}
/**
* Purpose: ArtistCalendarAppointment supports order.ts by holding or executing the artist calendar appointment page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ArtistCalendarAppointment {
orderId: IdType
orderNo: string
@@ -40,6 +52,10 @@ export interface ArtistCalendarAppointment {
durationMinutes: number
}
/**
* Purpose: OrderArtistReviewVO supports order.ts by holding or executing the order artist review vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface OrderArtistReviewVO {
id: IdType
orderId: IdType
@@ -59,12 +75,20 @@ export interface OrderArtistReviewVO {
createTime?: string
}
/**
* Purpose: OrderArtistReviewSubmitRequest supports order.ts by holding or executing the order artist review submit request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface OrderArtistReviewSubmitRequest {
rating: number
content?: string
imageFileIds: IdType[]
}
/**
* Purpose: OrderArtistChangeOptionsVO supports order.ts by holding or executing the order artist change options vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface OrderArtistChangeOptionsVO {
orderId: IdType
orderItemId: IdType
@@ -79,6 +103,10 @@ export interface OrderArtistChangeOptionsVO {
}>
}
/**
* Purpose: OrderArtistChangeRequestVO supports order.ts by holding or executing the order artist change request vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface OrderArtistChangeRequestVO {
id: IdType
orderId: IdType
@@ -100,6 +128,10 @@ export interface OrderArtistChangeRequestVO {
createTime?: string
}
/**
* Purpose: OrderArtistChangeRequestSubmitRequest supports order.ts by holding or executing the order artist change request submit request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface OrderArtistChangeRequestSubmitRequest {
orderId: IdType
orderItemId: IdType
@@ -107,6 +139,10 @@ export interface OrderArtistChangeRequestSubmitRequest {
reason: string
}
/**
* Purpose: OrderArtistChangeRejectRequest supports order.ts by holding or executing the order artist change reject request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface OrderArtistChangeRejectRequest {
rejectReason?: string
}
+12
View File
@@ -5,6 +5,10 @@
import { adminApi } from './admin'
import type { IdType } from '@/utils/id'
/**
* Purpose: PermissionVO supports permission.ts by holding or executing the permission vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface PermissionVO {
id: IdType
permissionCode: string
@@ -15,6 +19,10 @@ export interface PermissionVO {
updateTime: string
}
/**
* Purpose: CreatePermissionRequest supports permission.ts by holding or executing the create permission request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface CreatePermissionRequest {
permissionCode: string
permissionName: string
@@ -22,6 +30,10 @@ export interface CreatePermissionRequest {
description: string
}
/**
* Purpose: UpdatePermissionRequest supports permission.ts by holding or executing the update permission request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UpdatePermissionRequest {
permissionCode?: string
permissionName?: string
+20
View File
@@ -5,6 +5,10 @@
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: ProductVO supports product.ts by holding or executing the product vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ProductVO {
id: IdType
shopId: IdType | null
@@ -33,6 +37,10 @@ export interface ProductVO {
updateTime: string
}
/**
* Purpose: TagInfo supports product.ts by holding or executing the tag info page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface TagInfo {
id: IdType
tagName: string
@@ -41,12 +49,20 @@ export interface TagInfo {
borderColor?: string
}
/**
* Purpose: ListProductsParams supports product.ts by holding or executing the list products params page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ListProductsParams {
page: number
size: number
keyword?: string
}
/**
* Purpose: CreateProductRequest supports product.ts by holding or executing the create product request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface CreateProductRequest {
name: string
description: string
@@ -58,6 +74,10 @@ export interface CreateProductRequest {
shopId: IdType | null
}
/**
* Purpose: UpdateProductRequest supports product.ts by holding or executing the update product request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UpdateProductRequest {
name?: string
description?: string
+20
View File
@@ -5,6 +5,10 @@
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: ShopVO supports shop.ts by holding or executing the shop vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ShopVO {
id: IdType
shopName: string
@@ -35,18 +39,30 @@ export interface ShopVO {
updateTime: string
}
/**
* Purpose: ShopSimpleVO supports shop.ts by holding or executing the shop simple vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ShopSimpleVO {
id: string | number
shopName?: string
name?: string
}
/**
* Purpose: ListShopsParams supports shop.ts by holding or executing the list shops params page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ListShopsParams {
page: number
size: number
keyword?: string
}
/**
* Purpose: CreateShopRequest supports shop.ts by holding or executing the create shop request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface CreateShopRequest {
name: string
description: string
@@ -66,6 +82,10 @@ export interface CreateShopRequest {
themeBackgroundImageFileId?: string
}
/**
* Purpose: UpdateShopRequest supports shop.ts by holding or executing the update shop request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UpdateShopRequest {
name?: string
description?: string
+8
View File
@@ -5,6 +5,10 @@
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: TagVO supports tag.ts by holding or executing the tag vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface TagVO {
id: IdType
tagName: string
@@ -15,6 +19,10 @@ export interface TagVO {
updateTime: string
}
/**
* Purpose: TagDTO supports tag.ts by holding or executing the tag dto page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface TagDTO {
tagName: string
textColor: string
+76
View File
@@ -6,6 +6,10 @@ import api from './index'
import type { UserInfo } from './auth'
import type { IdType } from '@/utils/id'
/**
* Purpose: UserVO supports user.ts by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserVO extends UserInfo {
id: IdType
shopId?: IdType
@@ -34,12 +38,20 @@ export interface UserVO extends UserInfo {
relationSourceType?: string
}
/**
* Purpose: UpdateUserInfoRequest supports user.ts by holding or executing the update user info request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UpdateUserInfoRequest {
nickname?: string
avatar?: string
signature?: string
}
/**
* Purpose: ListUsersParams supports user.ts by holding or executing the list users params page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ListUsersParams {
page: number
size: number
@@ -48,6 +60,10 @@ export interface ListUsersParams {
status?: number
}
/**
* Purpose: CreateUserRequest supports user.ts by holding or executing the create user request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface CreateUserRequest {
account: string
nickname: string
@@ -58,6 +74,10 @@ export interface CreateUserRequest {
shopIds?: IdType[]
}
/**
* Purpose: UpdateUserRequest supports user.ts by holding or executing the update user request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UpdateUserRequest {
account?: string
nickname?: string
@@ -67,27 +87,47 @@ export interface UpdateUserRequest {
shopIds?: IdType[]
}
/**
* Purpose: UpdatePasswordRequest supports user.ts by holding or executing the update password request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UpdatePasswordRequest {
password: string
verificationCode: string
}
/**
* Purpose: BindPhoneRequest supports user.ts by holding or executing the bind phone request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface BindPhoneRequest {
phone: string
verificationCode: string
}
/**
* Purpose: AvailabilityCheckResponse supports user.ts by holding or executing the availability check response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AvailabilityCheckResponse {
available: boolean
message: string
}
/**
* Purpose: LoginAccountCheckResponse supports user.ts by holding or executing the login account check response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LoginAccountCheckResponse {
exists: boolean
nickname?: string
message: string
}
/**
* Purpose: LoginShopSelectionResponse supports user.ts by holding or executing the login shop selection response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LoginShopSelectionResponse {
allowShoplessLogin: boolean
message: string
@@ -97,6 +137,10 @@ export interface LoginShopSelectionResponse {
}>
}
/**
* Purpose: UserRelationVO supports user.ts by holding or executing the user relation vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserRelationVO {
userId: IdType
shopId?: IdType
@@ -109,6 +153,10 @@ export interface UserRelationVO {
sourceTypeName?: string
}
/**
* Purpose: NailArtistInfoVO supports user.ts by holding or executing the nail artist info vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface NailArtistInfoVO {
userId?: IdType
userType?: number
@@ -133,12 +181,20 @@ export interface InviteCodeVO {
createTime?: string
}
/**
* Purpose: UpdatePhoneRequest supports user.ts by holding or executing the update phone request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UpdatePhoneRequest {
oldPhone: string
newPhone: string
verificationCode: string
}
/**
* Purpose: UserAssetVO supports user.ts by holding or executing the user asset vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface UserAssetVO {
userId: IdType
nickname: string
@@ -154,6 +210,10 @@ export interface UserAssetVO {
vipExpireTime?: string
}
/**
* Purpose: BalanceHistoryItem supports user.ts by holding or executing the balance history item page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface BalanceHistoryItem {
id: IdType
userId: IdType
@@ -171,6 +231,10 @@ export interface BalanceHistoryItem {
changeTime?: string
}
/**
* Purpose: SystemMessageVO supports user.ts by holding or executing the system message vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface SystemMessageVO {
id: IdType
title: string
@@ -190,6 +254,10 @@ export interface SystemMessageVO {
createTime?: string
}
/**
* Purpose: AnnouncementVO supports user.ts by holding or executing the announcement vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AnnouncementVO {
id: IdType
title: string
@@ -201,6 +269,10 @@ export interface AnnouncementVO {
publishTime?: string
}
/**
* Purpose: VipRechargePlanVO supports user.ts by holding or executing the vip recharge plan vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface VipRechargePlanVO {
id: IdType
shopId: IdType
@@ -214,6 +286,10 @@ export interface VipRechargePlanVO {
status: number
}
/**
* Purpose: ContactInfoVO supports user.ts by holding or executing the contact info vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ContactInfoVO {
contactUserId?: IdType
contactName?: string
+4
View File
@@ -5,6 +5,10 @@
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: WishlistItem supports wishlist.ts by holding or executing the wishlist item page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface WishlistItem {
id: IdType
userId: IdType
@@ -53,7 +53,15 @@ import { computed, inject, onMounted, ref } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { HomeOutlined, ShoppingOutlined, ShoppingCartOutlined, UserOutlined } from '@ant-design/icons-vue'
/**
* Purpose: router supports BottomNav.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: route supports BottomNav.vue by holding or executing the route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const route = useRoute()
// 注入全局购物车数量状态
@@ -24,6 +24,10 @@
*/
import { computed } from 'vue'
/**
* Purpose: props supports DraftActions.vue by holding or executing the props page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const props = withDefaults(defineProps<{
savedAt?: number | null
disabled?: boolean
@@ -2,6 +2,10 @@
import { computed } from 'vue'
import { BellOutlined, ClockCircleOutlined } from '@ant-design/icons-vue'
/**
* Purpose: props supports SystemMessageCard.vue by holding or executing the props page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const props = withDefaults(defineProps<{
title?: string
content?: string
@@ -24,8 +28,20 @@ const props = withDefaults(defineProps<{
footerAlign: 'between'
})
/**
* Purpose: hasImage supports SystemMessageCard.vue by holding or executing the has image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const hasImage = computed(() => Boolean(props.imageUrl))
/**
* Purpose: displayTitle supports SystemMessageCard.vue by holding or executing the display title page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const displayTitle = computed(() => props.title?.trim() || '系统消息')
/**
* Purpose: displayContent supports SystemMessageCard.vue by holding or executing the display content page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const displayContent = computed(() => props.content?.trim() || (hasImage.value ? '' : '你收到了一条新的系统消息。'))
</script>
@@ -14,6 +14,10 @@
*/
import { computed } from 'vue'
/**
* Purpose: props supports TableEllipsisText.vue by holding or executing the props page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const props = withDefaults(defineProps<{
text?: string | number | null
lines?: 1 | 2 | 3
@@ -29,8 +29,16 @@ import { computed, useAttrs } from 'vue'
import { useAdminViewport } from '@/composables/useAdminViewport'
import { CONFIRM_ENTER_DISABLED_CLASS } from '@/composables/useConfirmEnter'
/**
* Purpose: modalInstanceSeed supports AdminResponsiveModal.vue by holding or executing the modal instance seed page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let modalInstanceSeed = 0
/**
* Purpose: props supports AdminResponsiveModal.vue by holding or executing the props page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const props = withDefaults(defineProps<{
open: boolean
title?: string
@@ -44,6 +52,10 @@ const props = withDefaults(defineProps<{
confirmOnEnter: true
})
/**
* Purpose: emit supports AdminResponsiveModal.vue by holding or executing the emit page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const emit = defineEmits<{
(event: 'update:open', value: boolean): void
(event: 'cancel', value?: unknown): void
@@ -51,7 +63,15 @@ const emit = defineEmits<{
}>()
const { isMobile } = useAdminViewport()
/**
* Purpose: attrs supports AdminResponsiveModal.vue by holding or executing the attrs page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const attrs = useAttrs()
/**
* Purpose: modalInstanceClass supports AdminResponsiveModal.vue by holding or executing the modal instance class page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const modalInstanceClass = `admin-responsive-modal-${modalInstanceSeed++}`
/** mergedWidth is a reactive state variable used by the template and event handlers. */
@@ -66,6 +86,10 @@ const mergedStyle = computed(() => (
}
: undefined
))
/**
* Purpose: mergedWrapClassName supports AdminResponsiveModal.vue by holding or executing the merged wrap class name page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mergedWrapClassName = computed(() => (
[
attrs.wrapClassName || attrs['wrap-class-name'],
@@ -1,13 +1,29 @@
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
/**
* Purpose: ADMIN_MOBILE_BREAKPOINT supports useAdminViewport.ts by holding or executing the admin mobile breakpoint page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const ADMIN_MOBILE_BREAKPOINT = 960
/**
* Purpose: viewportWidth supports useAdminViewport.ts by holding or executing the viewport width page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewportWidth = ref(
typeof window !== 'undefined' ? window.innerWidth : ADMIN_MOBILE_BREAKPOINT + 1
)
/**
* Purpose: listenerCount supports useAdminViewport.ts by holding or executing the listener count page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let listenerCount = 0
/**
* Purpose: updateViewportWidth supports useAdminViewport.ts by holding or executing the update viewport width page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const updateViewportWidth = () => {
if (typeof window === 'undefined') {
return
@@ -15,6 +31,10 @@ const updateViewportWidth = () => {
viewportWidth.value = window.innerWidth
}
/**
* Purpose: bindViewportListener supports useAdminViewport.ts by holding or executing the bind viewport listener page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const bindViewportListener = () => {
if (typeof window === 'undefined') {
return
@@ -25,6 +45,10 @@ const bindViewportListener = () => {
listenerCount += 1
}
/**
* Purpose: unbindViewportListener supports useAdminViewport.ts by holding or executing the unbind viewport listener page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const unbindViewportListener = () => {
if (typeof window === 'undefined') {
return
@@ -35,6 +59,10 @@ const unbindViewportListener = () => {
}
}
/**
* Purpose: useAdminViewport supports useAdminViewport.ts by holding or executing the use admin viewport page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const useAdminViewport = () => {
onMounted(() => {
updateViewportWidth()
@@ -2,6 +2,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { createApp } from 'vue'
import { useGlobalConfirmEnter } from './useConfirmEnter'
/**
* Purpose: visibleRects supports useConfirmEnter.test.ts by holding or executing the visible rects page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const visibleRects = [{
bottom: 100,
height: 100,
@@ -14,10 +18,18 @@ const visibleRects = [{
toJSON: () => ({})
}] as DOMRect[]
/**
* Purpose: makeVisible supports useConfirmEnter.test.ts by holding or executing the make visible page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const makeVisible = (element: HTMLElement) => {
vi.spyOn(element, 'getClientRects').mockReturnValue(visibleRects as unknown as DOMRectList)
}
/**
* Purpose: setDesktopViewport supports useConfirmEnter.test.ts by holding or executing the set desktop viewport page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const setDesktopViewport = () => {
Object.defineProperty(window, 'innerWidth', {
configurable: true,
@@ -35,6 +47,10 @@ const setDesktopViewport = () => {
}))
}
/**
* Purpose: setMobileViewport supports useConfirmEnter.test.ts by holding or executing the set mobile viewport page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const setMobileViewport = () => {
Object.defineProperty(window, 'innerWidth', {
configurable: true,
@@ -42,6 +58,10 @@ const setMobileViewport = () => {
})
}
/**
* Purpose: setCoarsePointer supports useConfirmEnter.test.ts by holding or executing the set coarse pointer page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const setCoarsePointer = () => {
Object.defineProperty(window, 'innerWidth', {
configurable: true,
@@ -59,6 +79,10 @@ const setCoarsePointer = () => {
}))
}
/**
* Purpose: mountGlobalConfirmEnter supports useConfirmEnter.test.ts by holding or executing the mount global confirm enter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mountGlobalConfirmEnter = () => {
const host = document.createElement('div')
document.body.appendChild(host)
@@ -78,6 +102,10 @@ const mountGlobalConfirmEnter = () => {
}
}
/**
* Purpose: createModal supports useConfirmEnter.test.ts by holding or executing the create modal page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createModal = ({
zIndex = 1000,
buttonClass = '',
@@ -119,12 +147,20 @@ const createModal = ({
return { wrap, button, click, onClick }
}
/**
* Purpose: createKeyboardEvent supports useConfirmEnter.test.ts by holding or executing the create keyboard event page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createKeyboardEvent = () => new KeyboardEvent('keydown', {
key: 'Enter',
bubbles: true,
cancelable: true
})
/**
* Purpose: pressEnter supports useConfirmEnter.test.ts by holding or executing the press enter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pressEnter = (target: EventTarget = document) => {
const event = createKeyboardEvent()
target.dispatchEvent(event)
@@ -1,5 +1,13 @@
/**
* Purpose: ComputedRef supports useConfirmEnter.ts by holding or executing the computed ref page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { computed, onBeforeUnmount, onMounted, type ComputedRef } from 'vue'
/**
* Purpose: UseConfirmEnterOptions supports useConfirmEnter.ts by holding or executing the use confirm enter options page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface UseConfirmEnterOptions {
enabled: ComputedRef<boolean>
onConfirm: (event: KeyboardEvent) => void
@@ -7,9 +15,21 @@ interface UseConfirmEnterOptions {
isTopLayer?: () => boolean
}
/**
* Purpose: CONFIRM_ENTER_DISABLED_CLASS supports useConfirmEnter.ts by holding or executing the confirm enter disabled class page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const CONFIRM_ENTER_DISABLED_CLASS = 'confirm-enter-disabled'
/**
* Purpose: DESKTOP_MIN_WIDTH supports useConfirmEnter.ts by holding or executing the desktop min width page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DESKTOP_MIN_WIDTH = 960
/**
* Purpose: isEditableTarget supports useConfirmEnter.ts by holding or executing the is editable target page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isEditableTarget = (target: EventTarget | null) => {
if (!(target instanceof HTMLElement)) {
return false
@@ -22,6 +42,10 @@ const isEditableTarget = (target: EventTarget | null) => {
return target.tagName.toLowerCase() === 'textarea' || Boolean(target.closest('[contenteditable="true"]'))
}
/**
* Purpose: hasOpenPickerOrDropdown supports useConfirmEnter.ts by holding or executing the has open picker or dropdown page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const hasOpenPickerOrDropdown = () => {
return Boolean(document.querySelector([
'.ant-select-dropdown:not(.ant-select-dropdown-hidden)',
@@ -32,6 +56,10 @@ const hasOpenPickerOrDropdown = () => {
].join(',')))
}
/**
* Purpose: isDesktopViewport supports useConfirmEnter.ts by holding or executing the is desktop viewport page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isDesktopViewport = () => {
if (typeof window === 'undefined') {
return false
@@ -41,6 +69,10 @@ const isDesktopViewport = () => {
return window.innerWidth > DESKTOP_MIN_WIDTH && !coarsePointer
}
/**
* Purpose: isVisibleElement supports useConfirmEnter.ts by holding or executing the is visible element page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isVisibleElement = (element: Element) => {
if (!(element instanceof HTMLElement)) {
return false
@@ -53,6 +85,10 @@ const isVisibleElement = (element: Element) => {
&& element.getClientRects().length > 0
}
/**
* Purpose: isDisabledButton supports useConfirmEnter.ts by holding or executing the is disabled button page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isDisabledButton = (button: HTMLButtonElement) => {
return button.disabled
|| button.getAttribute('aria-disabled') === 'true'
@@ -60,6 +96,10 @@ const isDisabledButton = (button: HTMLButtonElement) => {
|| button.classList.contains('ant-btn-disabled')
}
/**
* Purpose: getTopModalWrap supports useConfirmEnter.ts by holding or executing the get top modal wrap page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getTopModalWrap = () => {
const modals = Array.from(document.querySelectorAll<HTMLElement>('.ant-modal-wrap'))
.filter(isVisibleElement)
@@ -82,6 +122,10 @@ const getTopModalWrap = () => {
return sortedModals[sortedModals.length - 1]?.modal ?? null
}
/**
* Purpose: getTopModalConfirmButton supports useConfirmEnter.ts by holding or executing the get top modal confirm button page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getTopModalConfirmButton = () => {
const topModal = getTopModalWrap()
if (!topModal || topModal.classList.contains(CONFIRM_ENTER_DISABLED_CLASS)) {
@@ -100,6 +144,10 @@ const getTopModalConfirmButton = () => {
return button
}
/**
* Purpose: useConfirmEnter supports useConfirmEnter.ts by holding or executing the use confirm enter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const useConfirmEnter = ({
enabled,
onConfirm,
@@ -141,6 +189,10 @@ export const useConfirmEnter = ({
})
}
/**
* Purpose: useGlobalConfirmEnter supports useConfirmEnter.ts by holding or executing the use global confirm enter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const useGlobalConfirmEnter = () => {
const handleKeydown = (event: KeyboardEvent) => {
if (
@@ -1,5 +1,9 @@
import { readonly, shallowRef } from 'vue'
import { fileApi } from '@/api/file'
/**
* Purpose: ShopVO supports useShopTheme.ts by holding or executing the shop vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { shopApi, type ShopVO } from '@/api/shop'
import {
applyShopTheme,
@@ -9,10 +13,22 @@ import {
type ResolvedShopTheme
} from '@/utils/shop-theme'
/**
* Purpose: currentTheme supports useShopTheme.ts by holding or executing the current theme page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentTheme = shallowRef<ResolvedShopTheme>(DEFAULT_SHOP_THEME)
let cleanupThemeSync: (() => void) | undefined
/**
* Purpose: refreshSequence supports useShopTheme.ts by holding or executing the refresh sequence page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let refreshSequence = 0
/**
* Purpose: useShopTheme supports useShopTheme.ts by holding or executing the use shop theme page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
export function useShopTheme() {
return {
currentTheme: readonly(currentTheme),
@@ -22,6 +38,10 @@ export function useShopTheme() {
}
}
/**
* Purpose: refreshShopTheme supports useShopTheme.ts by holding or executing the refresh shop theme page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
async function refreshShopTheme() {
const token = readToken()
const userInfo = readStoredUserInfo()
@@ -46,12 +66,20 @@ async function refreshShopTheme() {
}
}
/**
* Purpose: resetShopTheme supports useShopTheme.ts by holding or executing the reset shop theme page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function resetShopTheme() {
refreshSequence += 1
currentTheme.value = DEFAULT_SHOP_THEME
applyShopTheme(DEFAULT_SHOP_THEME)
}
/**
* Purpose: setupShopThemeSync supports useShopTheme.ts by holding or executing the setup shop theme sync page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function setupShopThemeSync() {
if (cleanupThemeSync || typeof window === 'undefined') {
return cleanupThemeSync || (() => {})
@@ -79,6 +107,10 @@ function setupShopThemeSync() {
return cleanupThemeSync
}
/**
* Purpose: applyThemeFromShop supports useShopTheme.ts by holding or executing the apply theme from shop page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
async function applyThemeFromShop(shop: ShopVO) {
const theme = resolveShopTheme(shop)
currentTheme.value = theme
@@ -86,6 +118,10 @@ async function applyThemeFromShop(shop: ShopVO) {
applyShopTheme(theme, backgroundImageUrl)
}
/**
* Purpose: resolveBackgroundImageUrl supports useShopTheme.ts by holding or executing the resolve background image url page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
async function resolveBackgroundImageUrl(fileId?: string) {
if (!fileId) {
return null
@@ -97,6 +133,10 @@ async function resolveBackgroundImageUrl(fileId?: string) {
}
}
/**
* Purpose: readToken supports useShopTheme.ts by holding or executing the read token page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function readToken() {
if (typeof window === 'undefined') {
return ''
@@ -104,6 +144,10 @@ function readToken() {
return localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken') || ''
}
/**
* Purpose: readStoredUserInfo supports useShopTheme.ts by holding or executing the read stored user info page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function readStoredUserInfo(): { shopId?: string | number } | null {
if (typeof window === 'undefined') {
return null
@@ -1,7 +1,19 @@
import zhCN from 'ant-design-vue/es/locale/zh_CN'
/**
* Purpose: baseCalendar supports antdv-locale.ts by holding or executing the base calendar page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const baseCalendar = (zhCN.Calendar || { lang: {} }) as any
/**
* Purpose: baseDatePicker supports antdv-locale.ts by holding or executing the base date picker page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const baseDatePicker = (zhCN.DatePicker || { lang: {}, timePickerLocale: {} }) as any
/**
* Purpose: baseTimePicker supports antdv-locale.ts by holding or executing the base time picker page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const baseTimePicker = (zhCN.TimePicker || {}) as any
const antdLocale: any = {
+24
View File
@@ -1,16 +1,40 @@
/**
* Purpose: normalizeBaseUrl supports api.ts by holding or executing the normalize base url page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function normalizeBaseUrl(value: string | undefined, fallbackValue: string) {
const target = String(value || fallbackValue).trim()
return target.replace(/\/+$/, '')
}
/**
* Purpose: DEFAULT_API_BASE_URL supports api.ts by holding or executing the default api base url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEFAULT_API_BASE_URL = import.meta.env.DEV ? '/api' : 'https://yunail.art/api'
/**
* Purpose: DEFAULT_ADMIN_API_BASE_URL supports api.ts by holding or executing the default admin api base url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEFAULT_ADMIN_API_BASE_URL = import.meta.env.DEV ? '/admin/api' : 'https://yunail.art/admin/api'
/**
* Purpose: API_CONFIG supports api.ts by holding or executing the api config page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const API_CONFIG = {
mode: import.meta.env.MODE,
apiBaseUrl: normalizeBaseUrl(import.meta.env.VITE_API_BASE_URL, DEFAULT_API_BASE_URL),
adminApiBaseUrl: normalizeBaseUrl(import.meta.env.VITE_ADMIN_API_BASE_URL, DEFAULT_ADMIN_API_BASE_URL)
}
/**
* Purpose: API_BASE_URL supports api.ts by holding or executing the api base url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const API_BASE_URL = API_CONFIG.apiBaseUrl
/**
* Purpose: ADMIN_API_BASE_URL supports api.ts by holding or executing the admin api base url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const ADMIN_API_BASE_URL = API_CONFIG.adminApiBaseUrl
+12
View File
@@ -1,3 +1,15 @@
/**
* Purpose: DEFAULT_AVATAR supports index.ts by holding or executing the default avatar page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const DEFAULT_AVATAR = 'https://api.dicebear.com/7.x/avataaars/svg?seed=default'
/**
* Purpose: DEFAULT_PRODUCT_IMAGE supports index.ts by holding or executing the default product image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const DEFAULT_PRODUCT_IMAGE = '/assets/images/default-product.png'
/**
* Purpose: DEFAULT_SHOP_IMAGE supports index.ts by holding or executing the default shop image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const DEFAULT_SHOP_IMAGE = '/assets/images/default-shop.png'
+8
View File
@@ -5,7 +5,15 @@ import './styles/admin-mobile.css'
import App from './App.vue'
import router from './router'
/**
* Purpose: app supports main.ts by holding or executing the app page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const app = createApp(App)
/**
* Purpose: pinia supports main.ts by holding or executing the pinia page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pinia = createPinia()
app.use(pinia)
+4
View File
@@ -7,6 +7,10 @@ import {
resolveAdminLandingPath,
} from '@/utils/admin-auth-bootstrap'
/**
* Purpose: router supports index.ts by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
+16
View File
@@ -1,6 +1,22 @@
/**
* Purpose: ACCOUNT_REGEX supports account.ts by holding or executing the account regex page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const ACCOUNT_REGEX = /^[A-Za-z0-9]+$/
/**
* Purpose: ACCOUNT_SANITIZE_REGEX supports account.ts by holding or executing the account sanitize regex page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const ACCOUNT_SANITIZE_REGEX = /[^A-Za-z0-9]/g
/**
* Purpose: ACCOUNT_RULE_MESSAGE supports account.ts by holding or executing the account rule message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const ACCOUNT_RULE_MESSAGE = '账号只能包含字母和数字'
/**
* Purpose: sanitizeAccountInput supports account.ts by holding or executing the sanitize account input page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const sanitizeAccountInput = (value: string) => (value || '').replace(ACCOUNT_SANITIZE_REGEX, '')
@@ -1,14 +1,30 @@
/**
* Purpose: LoadingInstance supports action-loading.ts by holding or executing the loading instance page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { ElLoading, type LoadingInstance } from 'element-plus'
import 'element-plus/es/components/loading/style/css'
/**
* Purpose: GlobalLoadingOptions supports action-loading.ts by holding or executing the global loading options page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface GlobalLoadingOptions {
text?: string
lock?: boolean
}
/**
* Purpose: activeLoadingCount supports action-loading.ts by holding or executing the active loading count page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let activeLoadingCount = 0
let loadingInstance: LoadingInstance | null = null
/**
* Purpose: openGlobalLoading supports action-loading.ts by holding or executing the open global loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openGlobalLoading = (options?: GlobalLoadingOptions) => {
activeLoadingCount += 1
@@ -23,6 +39,10 @@ const openGlobalLoading = (options?: GlobalLoadingOptions) => {
})
}
/**
* Purpose: closeGlobalLoading supports action-loading.ts by holding or executing the close global loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const closeGlobalLoading = () => {
activeLoadingCount = Math.max(0, activeLoadingCount - 1)
@@ -34,6 +54,10 @@ const closeGlobalLoading = () => {
loadingInstance = null
}
/**
* Purpose: runWithGlobalLoading supports action-loading.ts by holding or executing the run with global loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const runWithGlobalLoading = async <T>(
task: (() => Promise<T>) | Promise<T>,
options?: GlobalLoadingOptions
@@ -12,8 +12,16 @@ import {
getStoredUserPermissions,
} from '@/utils/permission'
/**
* Purpose: AuthBootstrapState supports admin-auth-bootstrap.ts by holding or executing the auth bootstrap state page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
export type AuthBootstrapState = 'pending' | 'ready' | 'invalid'
/**
* Purpose: adminBootstrapState supports admin-auth-bootstrap.ts by holding or executing the admin bootstrap state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const adminBootstrapState = ref<AuthBootstrapState>('pending')
let bootstrapPromise: Promise<AuthBootstrapState> | null = null
@@ -35,13 +43,25 @@ const ADMIN_PERMISSION_ROUTE_MAP: Array<{ code: string; path: string }> = [
{ code: 'legal_agreement:manage', path: '/admin/legal-agreements' },
]
/**
* Purpose: useAdminBootstrapState supports admin-auth-bootstrap.ts by holding or executing the use admin bootstrap state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const useAdminBootstrapState = () => computed(() => adminBootstrapState.value)
/**
* Purpose: invalidateAdminBootstrap supports admin-auth-bootstrap.ts by holding or executing the invalidate admin bootstrap page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const invalidateAdminBootstrap = () => {
adminBootstrapState.value = 'pending'
bootstrapPromise = null
}
/**
* Purpose: clearAdminBootstrapSession supports admin-auth-bootstrap.ts by holding or executing the clear admin bootstrap session page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const clearAdminBootstrapSession = () => {
clearAdminSessionStorage()
clearStoredPermissions()
@@ -49,6 +69,10 @@ export const clearAdminBootstrapSession = () => {
bootstrapPromise = null
}
/**
* Purpose: getAdminBootstrapSnapshot supports admin-auth-bootstrap.ts by holding or executing the get admin bootstrap snapshot page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const getAdminBootstrapSnapshot = () => {
const userInfo = loadCachedAdminUserInfo()
return {
@@ -60,6 +84,10 @@ export const getAdminBootstrapSnapshot = () => {
}
}
/**
* Purpose: hasAdminPermission supports admin-auth-bootstrap.ts by holding or executing the has admin permission page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const hasAdminPermission = (permissionCode?: string) => {
if (!permissionCode) {
return true
@@ -73,6 +101,10 @@ export const hasAdminPermission = (permissionCode?: string) => {
return snapshot.permissions.includes(permissionCode)
}
/**
* Purpose: resolveAdminLandingPath supports admin-auth-bootstrap.ts by holding or executing the resolve admin landing path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const resolveAdminLandingPath = () => {
const snapshot = getAdminBootstrapSnapshot()
if (snapshot.userInfo?.shopAuthorizationExpired && snapshot.userInfo?.type !== 4) {
@@ -86,6 +118,10 @@ export const resolveAdminLandingPath = () => {
return matchedRoute?.path || '/admin'
}
/**
* Purpose: canAccessAdminRoute supports admin-auth-bootstrap.ts by holding or executing the can access admin route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const canAccessAdminRoute = (path: string, permissionCode?: string) => {
const snapshot = getAdminBootstrapSnapshot()
if (snapshot.userInfo?.shopAuthorizationExpired && snapshot.userInfo?.type !== 4) {
@@ -98,6 +134,10 @@ export const canAccessAdminRoute = (path: string, permissionCode?: string) => {
return hasAdminPermission(permissionCode)
}
/**
* Purpose: ensureAdminAuthBootstrap supports admin-auth-bootstrap.ts by holding or executing the ensure admin auth bootstrap page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const ensureAdminAuthBootstrap = async (force = false): Promise<AuthBootstrapState> => {
const snapshot = getAdminBootstrapSnapshot()
if (!snapshot.token || !snapshot.userInfo) {
@@ -1,5 +1,9 @@
import type { IdType } from '@/utils/id'
/**
* Purpose: AdminCachedUserInfo supports admin-session.ts by holding or executing the admin cached user info page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface AdminCachedUserInfo {
id?: IdType
type?: number
@@ -14,12 +18,24 @@ export interface AdminCachedUserInfo {
shopNames?: string[]
}
/**
* Purpose: getAdminAccessToken supports admin-session.ts by holding or executing the get admin access token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const getAdminAccessToken = () =>
localStorage.getItem('adminAccessToken') || sessionStorage.getItem('adminAccessToken')
/**
* Purpose: getAdminRefreshToken supports admin-session.ts by holding or executing the get admin refresh token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const getAdminRefreshToken = () =>
localStorage.getItem('adminRefreshToken') || sessionStorage.getItem('adminRefreshToken')
/**
* Purpose: loadCachedAdminUserInfo supports admin-session.ts by holding or executing the load cached admin user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const loadCachedAdminUserInfo = (): AdminCachedUserInfo | null => {
const raw = localStorage.getItem('adminUserInfo')
if (!raw) {
@@ -35,11 +51,23 @@ export const loadCachedAdminUserInfo = (): AdminCachedUserInfo | null => {
}
}
/**
* Purpose: isBootstrapAdminUser supports admin-session.ts by holding or executing the is bootstrap admin user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const isBootstrapAdminUser = (userInfo?: AdminCachedUserInfo | null) =>
userInfo?.type === 4 && !userInfo?.shopId
/**
* Purpose: isPlatformOverviewAdminUser supports admin-session.ts by holding or executing the is platform overview admin user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const isPlatformOverviewAdminUser = isBootstrapAdminUser
/**
* Purpose: clearAdminSessionStorage supports admin-session.ts by holding or executing the clear admin session storage page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const clearAdminSessionStorage = () => {
localStorage.removeItem('adminAccessToken')
localStorage.removeItem('adminRefreshToken')
+12
View File
@@ -1,6 +1,10 @@
import { cartApi } from '@/api/cart'
import { toOptionalIdString } from '@/utils/id'
/**
* Purpose: fetchCartProductIdSet supports cart-state.ts by holding or executing the fetch cart product id set page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const fetchCartProductIdSet = async () => {
try {
const response = await cartApi.getCartList() as unknown as Array<{ productId?: string | number }>
@@ -14,11 +18,19 @@ export const fetchCartProductIdSet = async () => {
}
}
/**
* Purpose: hasCartProduct supports cart-state.ts by holding or executing the has cart product page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const hasCartProduct = (cartProductIdSet: Set<string>, productId: unknown) => {
const normalizedId = toOptionalIdString(productId)
return Boolean(normalizedId && cartProductIdSet.has(normalizedId))
}
/**
* Purpose: withAddedCartProduct supports cart-state.ts by holding or executing the with added cart product page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const withAddedCartProduct = (cartProductIdSet: Set<string>, productId: unknown) => {
const next = new Set(cartProductIdSet || [])
const normalizedId = toOptionalIdString(productId)
@@ -1,5 +1,9 @@
import type { AxiosProgressEvent } from 'axios'
/**
* Purpose: ChunkUploadSession supports chunk-upload.ts by holding or executing the chunk upload session page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadSession {
uploadId: string
chunkSize: number
@@ -7,6 +11,10 @@ export interface ChunkUploadSession {
uploadedChunks: number[]
}
/**
* Purpose: ChunkUploadInitRequest supports chunk-upload.ts by holding or executing the chunk upload init request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadInitRequest {
fileName: string
fileSize: number
@@ -15,6 +23,10 @@ export interface ChunkUploadInitRequest {
scene: string
}
/**
* Purpose: ChunkUploadApi supports chunk-upload.ts by holding or executing the chunk upload api page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadApi<TResponse> {
initUpload: (payload: ChunkUploadInitRequest) => Promise<ChunkUploadSession>
uploadChunk: (
@@ -25,6 +37,10 @@ export interface ChunkUploadApi<TResponse> {
cancelUpload?: (uploadId: string) => Promise<unknown>
}
/**
* Purpose: ChunkUploadOptions supports chunk-upload.ts by holding or executing the chunk upload options page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadOptions<TResponse> {
file: File
scene: string
@@ -33,18 +49,30 @@ export interface ChunkUploadOptions<TResponse> {
onProgress?: (percent: number) => void
}
/**
* Purpose: ChunkUploadResult supports chunk-upload.ts by holding or executing the chunk upload result page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadResult<TResponse> {
response: TResponse
uploadId: string
processedFile: File
}
/**
* Purpose: ChunkUploadTask supports chunk-upload.ts by holding or executing the chunk upload task page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ChunkUploadTask<TResponse> {
promise: Promise<ChunkUploadResult<TResponse>>
cancel: () => void
getUploadId: () => string
}
/**
* Purpose: computeFileFingerprint supports chunk-upload.ts by holding or executing the compute file fingerprint page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const computeFileFingerprint = async (file: File) => {
const fingerprintSeed = `${file.name}|${file.size}|${file.lastModified}|${file.type}`
if (!window.crypto?.subtle) {
@@ -56,16 +84,28 @@ const computeFileFingerprint = async (file: File) => {
return hashArray.map(byte => byte.toString(16).padStart(2, '0')).join('')
}
/**
* Purpose: getChunkSizeByIndex supports chunk-upload.ts by holding or executing the get chunk size by index page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getChunkSizeByIndex = (fileSize: number, chunkSize: number, chunkIndex: number) => {
const start = chunkIndex * chunkSize
const end = Math.min(start + chunkSize, fileSize)
return Math.max(end - start, 0)
}
/**
* Purpose: calculateUploadedBytes supports chunk-upload.ts by holding or executing the calculate uploaded bytes page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const calculateUploadedBytes = (fileSize: number, chunkSize: number, uploadedChunks: number[]) => {
return uploadedChunks.reduce((total, chunkIndex) => total + getChunkSizeByIndex(fileSize, chunkSize, chunkIndex), 0)
}
/**
* Purpose: createChunkUploadTask supports chunk-upload.ts by holding or executing the create chunk upload task page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const createChunkUploadTask = <TResponse>(options: ChunkUploadOptions<TResponse>): ChunkUploadTask<TResponse> => {
const abortController = new AbortController()
let uploadId = ''
+28
View File
@@ -1,12 +1,28 @@
/**
* Purpose: DraftStorageMode supports form-draft.ts by holding or executing the draft storage mode page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
export type DraftStorageMode = 'local' | 'session'
/**
* Purpose: DraftRecord supports form-draft.ts by holding or executing the draft record page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface DraftRecord<T> {
savedAt: number
payload: T
}
/**
* Purpose: getStorage supports form-draft.ts by holding or executing the get storage page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getStorage = (mode: DraftStorageMode) => (mode === 'session' ? window.sessionStorage : window.localStorage)
/**
* Purpose: buildDraftStorageKey supports form-draft.ts by holding or executing the build draft storage key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const buildDraftStorageKey = (...parts: Array<string | number | undefined | null>) => {
const normalizedParts = parts
.filter((part): part is string | number => part !== undefined && part !== null && String(part).trim().length > 0)
@@ -14,6 +30,10 @@ export const buildDraftStorageKey = (...parts: Array<string | number | undefined
return `yuminail:draft:${normalizedParts.join(':')}`
}
/**
* Purpose: saveDraftRecord supports form-draft.ts by holding or executing the save draft record page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const saveDraftRecord = <T>(key: string, payload: T, mode: DraftStorageMode = 'local') => {
const record: DraftRecord<T> = {
savedAt: Date.now(),
@@ -23,6 +43,10 @@ export const saveDraftRecord = <T>(key: string, payload: T, mode: DraftStorageMo
return record
}
/**
* Purpose: loadDraftRecord supports form-draft.ts by holding or executing the load draft record page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const loadDraftRecord = <T>(key: string, mode: DraftStorageMode = 'local') => {
const rawValue = getStorage(mode).getItem(key)
if (!rawValue) {
@@ -37,6 +61,10 @@ export const loadDraftRecord = <T>(key: string, mode: DraftStorageMode = 'local'
}
}
/**
* Purpose: clearDraftRecord supports form-draft.ts by holding or executing the clear draft record page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const clearDraftRecord = (key: string, mode: DraftStorageMode = 'local') => {
getStorage(mode).removeItem(key)
}
+12
View File
@@ -1,9 +1,21 @@
/**
* Purpose: IdType supports id.ts by holding or executing the id type page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
export type IdType = string | number
/**
* Purpose: isEmptyId supports id.ts by holding or executing the is empty id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const isEmptyId = (value: unknown): value is undefined | null | '' => {
return value === undefined || value === null || `${value}`.trim() === ''
}
/**
* Purpose: toIdString supports id.ts by holding or executing the to id string page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const toIdString = (value: IdType) => String(value)
// 前端统一把雪花 ID 视为字符串语义处理,避免任何 Number 转换带来的精度污染。
@@ -1,6 +1,18 @@
/**
* Purpose: DEFAULT_MAX_IMAGE_SIZE supports image-upload.ts by holding or executing the default max image size page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEFAULT_MAX_IMAGE_SIZE = 5 * 1024 * 1024
/**
* Purpose: AUTO_COMPRESS_TYPES supports image-upload.ts by holding or executing the auto compress types page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const AUTO_COMPRESS_TYPES = new Set(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])
/**
* Purpose: inferImageMimeType supports image-upload.ts by holding or executing the infer image mime type page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const inferImageMimeType = (file: File) => {
if (file.type) return file.type.toLowerCase()
const name = file.name.toLowerCase().split(/[?#]/)[0] || ''
@@ -11,6 +23,10 @@ const inferImageMimeType = (file: File) => {
return ''
}
/**
* Purpose: ImageCompressionResult supports image-upload.ts by holding or executing the image compression result page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ImageCompressionResult {
file: File
originalSize: number
@@ -20,9 +36,21 @@ export interface ImageCompressionResult {
skippedReason?: string
}
/**
* Purpose: QUALITY_STEPS supports image-upload.ts by holding or executing the quality steps page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const QUALITY_STEPS = [0.92, 0.84, 0.76, 0.68, 0.6, 0.52]
/**
* Purpose: SCALE_STEPS supports image-upload.ts by holding or executing the scale steps page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const SCALE_STEPS = [1, 0.9, 0.8, 0.7, 0.6, 0.5]
/**
* Purpose: loadImageElement supports image-upload.ts by holding or executing the load image element page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadImageElement = (file: File) => {
return new Promise<HTMLImageElement>((resolve, reject) => {
const image = new Image()
@@ -42,6 +70,10 @@ const loadImageElement = (file: File) => {
})
}
/**
* Purpose: canvasToBlob supports image-upload.ts by holding or executing the canvas to blob page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const canvasToBlob = (canvas: HTMLCanvasElement, type: string, quality?: number) => {
return new Promise<Blob>((resolve, reject) => {
canvas.toBlob(
@@ -58,6 +90,10 @@ const canvasToBlob = (canvas: HTMLCanvasElement, type: string, quality?: number)
})
}
/**
* Purpose: getOutputExtension supports image-upload.ts by holding or executing the get output extension page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getOutputExtension = (type: string) => {
if (type === 'image/png') {
return '.png'
@@ -68,6 +104,10 @@ const getOutputExtension = (type: string) => {
return '.jpg'
}
/**
* Purpose: buildOutputName supports image-upload.ts by holding or executing the build output name page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const buildOutputName = (fileName: string, type: string) => {
const extension = getOutputExtension(type)
const dotIndex = fileName.lastIndexOf('.')
@@ -75,6 +115,10 @@ const buildOutputName = (fileName: string, type: string) => {
return `${baseName}${extension}`
}
/**
* Purpose: drawImageToCanvas supports image-upload.ts by holding or executing the draw image to canvas page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const drawImageToCanvas = (image: HTMLImageElement, width: number, height: number, mimeType: string) => {
const canvas = document.createElement('canvas')
canvas.width = width
@@ -94,6 +138,10 @@ const drawImageToCanvas = (image: HTMLImageElement, width: number, height: numbe
return canvas
}
/**
* Purpose: toCompressedFile supports image-upload.ts by holding or executing the to compressed file page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const toCompressedFile = (blob: Blob, sourceFile: File, mimeType: string) => {
return new File([blob], buildOutputName(sourceFile.name, mimeType), {
type: mimeType,
@@ -101,6 +149,10 @@ const toCompressedFile = (blob: Blob, sourceFile: File, mimeType: string) => {
})
}
/**
* Purpose: getPreferredMimeTypes supports image-upload.ts by holding or executing the get preferred mime types page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getPreferredMimeTypes = (file: File) => {
if (file.type === 'image/png') {
return ['image/png', 'image/jpeg']
@@ -111,6 +163,10 @@ const getPreferredMimeTypes = (file: File) => {
return ['image/jpeg']
}
/**
* Purpose: formatFileSize supports image-upload.ts by holding or executing the format file size page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const formatFileSize = (bytes: number) => {
if (bytes >= 1024 * 1024) {
return `${(bytes / 1024 / 1024).toFixed(2)}MB`
@@ -118,6 +174,10 @@ export const formatFileSize = (bytes: number) => {
return `${(bytes / 1024).toFixed(0)}KB`
}
/**
* Purpose: compressImageIfNeeded supports image-upload.ts by holding or executing the compress image if needed page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const compressImageIfNeeded = async (
file: File,
maxSize = DEFAULT_MAX_IMAGE_SIZE
@@ -204,4 +264,8 @@ export const compressImageIfNeeded = async (
}
}
/**
* Purpose: MAX_IMAGE_UPLOAD_SIZE supports image-upload.ts by holding or executing the max image upload size page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const MAX_IMAGE_UPLOAD_SIZE = DEFAULT_MAX_IMAGE_SIZE
+40
View File
@@ -3,8 +3,16 @@ import { computed, ref } from 'vue'
import { isBootstrapAdminUser, loadCachedAdminUserInfo } from '@/utils/admin-session'
import { isAllowedForShoplessPlatformAdmin } from '@/utils/platform-admin-permissions'
/**
* Purpose: USER_PERMISSIONS_STORAGE_KEY supports permission.ts by holding or executing the user permissions storage key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const USER_PERMISSIONS_STORAGE_KEY = 'userPermissions'
/**
* Purpose: readPermissionsFromStorage supports permission.ts by holding or executing the read permissions from storage page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const readPermissionsFromStorage = () => {
const raw = localStorage.getItem(USER_PERMISSIONS_STORAGE_KEY)
if (!raw) {
@@ -21,24 +29,52 @@ const readPermissionsFromStorage = () => {
}
}
/**
* Purpose: userPermissions supports permission.ts by holding or executing the user permissions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userPermissions = ref<string[]>(readPermissionsFromStorage() || [])
/**
* Purpose: loadingPermissions supports permission.ts by holding or executing the loading permissions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadingPermissions = ref(false)
/**
* Purpose: isPlatformAdminUser supports permission.ts by holding or executing the is platform admin user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isPlatformAdminUser = () => Number(loadCachedAdminUserInfo()?.type) === 4
/**
* Purpose: getStoredUserPermissions supports permission.ts by holding or executing the get stored user permissions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const getStoredUserPermissions = () => readPermissionsFromStorage()
/**
* Purpose: setStoredUserPermissions supports permission.ts by holding or executing the set stored user permissions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const setStoredUserPermissions = (permissions: string[]) => {
userPermissions.value = Array.from(new Set((permissions || []).map(code => String(code))))
localStorage.setItem(USER_PERMISSIONS_STORAGE_KEY, JSON.stringify(userPermissions.value))
return userPermissions.value
}
/**
* Purpose: clearStoredPermissions supports permission.ts by holding or executing the clear stored permissions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const clearStoredPermissions = () => {
userPermissions.value = []
localStorage.removeItem(USER_PERMISSIONS_STORAGE_KEY)
}
/**
* Purpose: fetchUserPermissionsStrict supports permission.ts by holding or executing the fetch user permissions strict page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const fetchUserPermissionsStrict = async () => {
loadingPermissions.value = true
try {
@@ -53,6 +89,10 @@ export const fetchUserPermissionsStrict = async () => {
}
}
/**
* Purpose: usePermission supports permission.ts by holding or executing the use permission page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const usePermission = () => {
const hasPermission = (permissionCode: string) => {
if (isBootstrapAdminUser(loadCachedAdminUserInfo())) {
@@ -1,9 +1,21 @@
/**
* Purpose: SHOPLESS_ADMIN_ALLOWED_PREFIXES supports platform-admin-permissions.ts by holding or executing the shopless admin allowed prefixes page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const SHOPLESS_ADMIN_ALLOWED_PREFIXES = ['user:', 'shop:', 'permission:', 'message:', 'announcement:']
/**
* Purpose: SHOPLESS_ADMIN_ALLOWED_PERMISSIONS supports platform-admin-permissions.ts by holding or executing the shopless admin allowed permissions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const SHOPLESS_ADMIN_ALLOWED_PERMISSIONS = [
'messagehub:config:manage',
'legal_agreement:manage'
]
/**
* Purpose: isAllowedForShoplessPlatformAdmin supports platform-admin-permissions.ts by holding or executing the is allowed for shopless platform admin page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const isAllowedForShoplessPlatformAdmin = (permissionCode: string) =>
permissionCode === 'dashboard:view'
|| permissionCode.endsWith(':view')
@@ -1,37 +1,89 @@
import type { InternalAxiosRequestConfig } from 'axios'
/**
* Purpose: HEADER_TIMESTAMP supports request-signature.ts by holding or executing the header timestamp page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const HEADER_TIMESTAMP = 'X-Timestamp'
/**
* Purpose: HEADER_NONCE supports request-signature.ts by holding or executing the header nonce page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const HEADER_NONCE = 'X-Nonce'
/**
* Purpose: HEADER_SIGNATURE supports request-signature.ts by holding or executing the header signature page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const HEADER_SIGNATURE = 'X-Signature'
/**
* Purpose: HEADER_SIGNATURE_VERSION supports request-signature.ts by holding or executing the header signature version page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const HEADER_SIGNATURE_VERSION = 'X-Sign-Version'
/**
* Purpose: DEVICE_ID_HEADER supports request-signature.ts by holding or executing the device id header page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEVICE_ID_HEADER = 'X-Device-Id'
/**
* Purpose: DEVICE_ID_STORAGE_KEY supports request-signature.ts by holding or executing the device id storage key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEVICE_ID_STORAGE_KEY = 'yuminail-device-id'
/**
* Purpose: SIGNATURE_VERSION supports request-signature.ts by holding or executing the signature version page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const SIGNATURE_VERSION = 'v1'
/**
* Purpose: HeaderContainer supports request-signature.ts by holding or executing the header container page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
type HeaderContainer = Record<string, unknown> & {
set?: (name: string, value: string) => void
get?: (name: string) => unknown
}
/**
* Purpose: RequestSignatureOptions supports request-signature.ts by holding or executing the request signature options page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface RequestSignatureOptions {
authFree?: boolean
}
/**
* Purpose: isSafeMethod supports request-signature.ts by holding or executing the is safe method page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function isSafeMethod(method?: string) {
return ['GET', 'HEAD', 'OPTIONS'].includes(String(method || 'GET').toUpperCase())
}
/**
* Purpose: toHex supports request-signature.ts by holding or executing the to hex page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function toHex(bytes: ArrayBuffer) {
return Array.from(new Uint8Array(bytes))
.map(byte => byte.toString(16).padStart(2, '0'))
.join('')
}
/**
* Purpose: sha256Hex supports request-signature.ts by holding or executing the sha256 hex page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
async function sha256Hex(text: string) {
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text))
return toHex(digest)
}
/**
* Purpose: hmacSha256Hex supports request-signature.ts by holding or executing the hmac sha256 hex page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
async function hmacSha256Hex(secret: string, message: string) {
const key = await crypto.subtle.importKey(
'raw',
@@ -44,6 +96,10 @@ async function hmacSha256Hex(secret: string, message: string) {
return toHex(signature)
}
/**
* Purpose: randomNonce supports request-signature.ts by holding or executing the random nonce page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function randomNonce() {
if (typeof crypto.randomUUID === 'function') {
return `${Date.now()}-${crypto.randomUUID()}`
@@ -51,6 +107,10 @@ function randomNonce() {
return `${Date.now()}-${Math.random().toString(36).slice(2, 12)}`
}
/**
* Purpose: getDeviceId supports request-signature.ts by holding or executing the get device id page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
export function getDeviceId() {
try {
const stored = localStorage.getItem(DEVICE_ID_STORAGE_KEY)
@@ -65,6 +125,10 @@ export function getDeviceId() {
}
}
/**
* Purpose: setHeader supports request-signature.ts by holding or executing the set header page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function setHeader(config: InternalAxiosRequestConfig, name: string, value: string) {
const headers = config.headers as HeaderContainer | undefined
if (headers && typeof headers.set === 'function') {
@@ -77,6 +141,10 @@ function setHeader(config: InternalAxiosRequestConfig, name: string, value: stri
} as InternalAxiosRequestConfig['headers']
}
/**
* Purpose: getHeader supports request-signature.ts by holding or executing the get header page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function getHeader(config: InternalAxiosRequestConfig, name: string) {
const headers = config.headers as HeaderContainer | undefined
if (!headers) {
@@ -91,6 +159,10 @@ function getHeader(config: InternalAxiosRequestConfig, name: string) {
return String(headers[name] || headers[name.toLowerCase()] || '')
}
/**
* Purpose: extractPath supports request-signature.ts by holding or executing the extract path page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function extractPath(value?: string) {
if (!value) {
return ''
@@ -102,6 +174,10 @@ function extractPath(value?: string) {
}
}
/**
* Purpose: joinAxiosPath supports request-signature.ts by holding or executing the join axios path page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function joinAxiosPath(baseUrl?: string, requestUrl?: string) {
if (requestUrl && /^[a-z][a-z\d+\-.]*:\/\//i.test(requestUrl)) {
return extractPath(requestUrl)
@@ -113,6 +189,10 @@ function joinAxiosPath(baseUrl?: string, requestUrl?: string) {
return joined ? `/${joined}` : '/'
}
/**
* Purpose: toBackendRequestPath supports request-signature.ts by holding or executing the to backend request path page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function toBackendRequestPath(baseUrl?: string, requestUrl?: string) {
const path = joinAxiosPath(baseUrl, requestUrl)
if (path === '/admin/api') {
@@ -136,6 +216,10 @@ function toBackendRequestPath(baseUrl?: string, requestUrl?: string) {
return path
}
/**
* Purpose: appendParam supports request-signature.ts by holding or executing the append param page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function appendParam(target: Record<string, unknown[]>, key: string, value: unknown) {
if (value === undefined || value === null || value === '') {
return
@@ -150,6 +234,10 @@ function appendParam(target: Record<string, unknown[]>, key: string, value: unkn
target[key].push(value)
}
/**
* Purpose: collectParams supports request-signature.ts by holding or executing the collect params page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function collectParams(source: unknown, target: Record<string, unknown[]>) {
if (!source) {
return
@@ -171,6 +259,10 @@ function collectParams(source: unknown, target: Record<string, unknown[]>) {
}
}
/**
* Purpose: buildCanonicalParams supports request-signature.ts by holding or executing the build canonical params page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function buildCanonicalParams(...sources: unknown[]) {
const params: Record<string, unknown[]> = {}
sources.forEach(source => collectParams(source, params))
@@ -186,6 +278,10 @@ function buildCanonicalParams(...sources: unknown[]) {
.join('&')
}
/**
* Purpose: buildJsonPayload supports request-signature.ts by holding or executing the build json payload page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function buildJsonPayload(data: unknown) {
if (data === undefined || data === null || data === '') {
return ''
@@ -196,6 +292,10 @@ function buildJsonPayload(data: unknown) {
return JSON.stringify(data)
}
/**
* Purpose: resolvePayload supports request-signature.ts by holding or executing the resolve payload page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function resolvePayload(config: InternalAxiosRequestConfig) {
const contentType = getHeader(config, 'Content-Type').toLowerCase()
const jsonPayload = contentType.includes('application/json') ? buildJsonPayload(config.data) : ''
@@ -205,6 +305,10 @@ function resolvePayload(config: InternalAxiosRequestConfig) {
return buildCanonicalParams(config.params, config.data)
}
/**
* Purpose: attachRequestSignature supports request-signature.ts by holding or executing the attach request signature page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
export async function attachRequestSignature(
config: InternalAxiosRequestConfig,
accessToken?: string | null,
+68
View File
@@ -1,5 +1,13 @@
/**
* Purpose: SHOP_THEME_CHANGED_EVENT supports shop-theme.ts by holding or executing the shop theme changed event page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const SHOP_THEME_CHANGED_EVENT = 'yumi-shop-theme-updated'
/**
* Purpose: ShopThemeSource supports shop-theme.ts by holding or executing the shop theme source page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ShopThemeSource {
themePrimaryColor?: string | null
themeSecondaryColor?: string | null
@@ -9,6 +17,10 @@ export interface ShopThemeSource {
themeBackgroundImageFileId?: string | number | null
}
/**
* Purpose: ResolvedShopTheme supports shop-theme.ts by holding or executing the resolved shop theme page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface ResolvedShopTheme {
primaryColor: string
secondaryColor: string
@@ -25,14 +37,26 @@ export interface ResolvedShopTheme {
cssVars: Record<string, string>
}
/**
* Purpose: HEX_COLOR_PATTERN supports shop-theme.ts by holding or executing the hex color pattern page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/
export const DEFAULT_SHOP_THEME: ResolvedShopTheme = resolveShopThemeSource()
/**
* Purpose: resolveShopTheme supports shop-theme.ts by holding or executing the resolve shop theme page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
export function resolveShopTheme(source?: ShopThemeSource | null): ResolvedShopTheme {
return resolveShopThemeSource(source)
}
/**
* Purpose: applyShopTheme supports shop-theme.ts by holding or executing the apply shop theme page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
export function applyShopTheme(theme: ResolvedShopTheme, backgroundImageUrl?: string | null) {
if (typeof document === 'undefined') {
return
@@ -44,6 +68,10 @@ export function applyShopTheme(theme: ResolvedShopTheme, backgroundImageUrl?: st
root.style.setProperty('--theme-background-image', backgroundImageUrl ? `url("${backgroundImageUrl}")` : 'none')
}
/**
* Purpose: notifyShopThemeChanged supports shop-theme.ts by holding or executing the notify shop theme changed page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
export function notifyShopThemeChanged() {
if (typeof window === 'undefined') {
return
@@ -51,6 +79,10 @@ export function notifyShopThemeChanged() {
window.dispatchEvent(new Event(SHOP_THEME_CHANGED_EVENT))
}
/**
* Purpose: resolveShopThemeSource supports shop-theme.ts by holding or executing the resolve shop theme source page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function resolveShopThemeSource(source?: ShopThemeSource | null): ResolvedShopTheme {
const normalizedPrimaryColor = normalizeHexColor(source?.themePrimaryColor)
const primaryColor = normalizedPrimaryColor || '#C6597D'
@@ -107,6 +139,10 @@ function resolveShopThemeSource(source?: ShopThemeSource | null): ResolvedShopTh
}
}
/**
* Purpose: normalizeHexColor supports shop-theme.ts by holding or executing the normalize hex color page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function normalizeHexColor(value?: string | null): string | undefined {
if (!value) {
return undefined
@@ -115,6 +151,10 @@ function normalizeHexColor(value?: string | null): string | undefined {
return HEX_COLOR_PATTERN.test(normalized) ? normalized.toUpperCase() : undefined
}
/**
* Purpose: mixColor supports shop-theme.ts by holding or executing the mix color page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function mixColor(foreground: string, background: string, backgroundWeight: number): string {
const fg = hexToRgb(foreground)
const bg = hexToRgb(background)
@@ -126,15 +166,27 @@ function mixColor(foreground: string, background: string, backgroundWeight: numb
})
}
/**
* Purpose: readableTextColor supports shop-theme.ts by holding or executing the readable text color page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function readableTextColor(background: string, preferred: string): string {
return relativeLuminance(hexToRgb(background)) > 0.48 ? preferred : '#FFFFFF'
}
/**
* Purpose: rgba supports shop-theme.ts by holding or executing the rgba page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function rgba(color: string, alpha: number): string {
const rgb = hexToRgb(color)
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${clamp(alpha, 0, 1)})`
}
/**
* Purpose: relativeLuminance supports shop-theme.ts by holding or executing the relative luminance page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function relativeLuminance(rgb: { r: number; g: number; b: number }): number {
const toLinearChannel = (value: number) => {
const channel = value / 255
@@ -146,6 +198,10 @@ function relativeLuminance(rgb: { r: number; g: number; b: number }): number {
return 0.2126 * r + 0.7152 * g + 0.0722 * b
}
/**
* Purpose: hexToRgb supports shop-theme.ts by holding or executing the hex to rgb page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function hexToRgb(color: string): { r: number; g: number; b: number } {
const value = color.replace('#', '')
return {
@@ -155,14 +211,26 @@ function hexToRgb(color: string): { r: number; g: number; b: number } {
}
}
/**
* Purpose: rgbToHex supports shop-theme.ts by holding or executing the rgb to hex page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function rgbToHex(rgb: { r: number; g: number; b: number }): string {
return `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`
}
/**
* Purpose: toHex supports shop-theme.ts by holding or executing the to hex page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function toHex(value: number): string {
return clamp(value, 0, 255).toString(16).padStart(2, '0').toUpperCase()
}
/**
* Purpose: clamp supports shop-theme.ts by holding or executing the clamp page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function clamp(value: number, min: number, max: number): number {
return Math.min(max, Math.max(min, value))
}
@@ -188,6 +188,10 @@ import type { UserVO } from '@/api/user'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { runWithGlobalLoading } from '@/utils/action-loading'
/**
* Purpose: router supports AccountSettingsView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
// 用户信息
@@ -213,7 +217,15 @@ const hasPhone = ref(false)
const bindPhoneModalVisible = ref(false)
/** bindPhoneLoading is a reactive state variable used by the template and event handlers. */
const bindPhoneLoading = ref(false)
/**
* Purpose: bindPhoneDraftSavedAt supports AccountSettingsView.vue by holding or executing the bind phone draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const bindPhoneDraftSavedAt = ref<number | null>(null)
/**
* Purpose: bindPhoneForm supports AccountSettingsView.vue by holding or executing the bind phone form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const bindPhoneForm = reactive({
phone: '',
verificationCode: ''
@@ -224,7 +236,15 @@ const bindPhoneForm = reactive({
const changePhoneModalVisible = ref(false)
/** changePhoneLoading is a reactive state variable used by the template and event handlers. */
const changePhoneLoading = ref(false)
/**
* Purpose: changePhoneDraftSavedAt supports AccountSettingsView.vue by holding or executing the change phone draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const changePhoneDraftSavedAt = ref<number | null>(null)
/**
* Purpose: changePhoneForm supports AccountSettingsView.vue by holding or executing the change phone form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const changePhoneForm = reactive({
newPhone: '',
verificationCode: ''
@@ -235,13 +255,25 @@ const changePhoneForm = reactive({
const changePasswordModalVisible = ref(false)
/** changePasswordLoading is a reactive state variable used by the template and event handlers. */
const changePasswordLoading = ref(false)
/**
* Purpose: changePasswordDraftSavedAt supports AccountSettingsView.vue by holding or executing the change password draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const changePasswordDraftSavedAt = ref<number | null>(null)
/**
* Purpose: changePasswordForm supports AccountSettingsView.vue by holding or executing the change password form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const changePasswordForm = reactive({
verificationCode: '',
password: '',
confirmPassword: ''
})
/**
* Purpose: restoreSessionDraft supports AccountSettingsView.vue by holding or executing the restore session draft page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const restoreSessionDraft = <T extends Record<string, any>>(key: string, target: T, savedAtRef: typeof bindPhoneDraftSavedAt) => {
const draft = loadDraftRecord<T>(key, 'session')
if (!draft) {
@@ -253,6 +285,10 @@ const restoreSessionDraft = <T extends Record<string, any>>(key: string, target:
message.success('已恢复暂存内容')
}
/**
* Purpose: saveSessionDraft supports AccountSettingsView.vue by holding or executing the save session draft page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const saveSessionDraft = <T>(key: string, payload: T, savedAtRef: typeof bindPhoneDraftSavedAt, successMessage = '已暂存到当前会话') => {
const draft = saveDraftRecord(key, payload, 'session')
savedAtRef.value = draft.savedAt
@@ -268,8 +304,20 @@ const clearSessionDraft = (key: string, savedAtRef: typeof bindPhoneDraftSavedAt
}
}
/**
* Purpose: bindPhoneDraftKey supports AccountSettingsView.vue by holding or executing the bind phone draft key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const bindPhoneDraftKey = buildDraftStorageKey('account-settings', 'bind-phone')
/**
* Purpose: changePhoneDraftKey supports AccountSettingsView.vue by holding or executing the change phone draft key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const changePhoneDraftKey = buildDraftStorageKey('account-settings', 'change-phone')
/**
* Purpose: changePasswordDraftKey supports AccountSettingsView.vue by holding or executing the change password draft key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const changePasswordDraftKey = buildDraftStorageKey('account-settings', 'change-password')
/** handleSaveBindPhoneDraft is a local helper used by this page script. */
@@ -108,19 +108,39 @@ import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { LeftOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
/**
* Purpose: ArtistCalendarAppointment supports ArtistCalendarView.vue by holding or executing the artist calendar appointment page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { orderApi, type ArtistCalendarAppointment } from '@/api/order'
import { runWithGlobalLoading } from '@/utils/action-loading'
/**
* Purpose: router supports ArtistCalendarView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/** completing is a reactive state variable used by the template and event handlers. */
const completing = ref(false)
/**
* Purpose: appointments supports ArtistCalendarView.vue by holding or executing the appointments page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const appointments = ref<ArtistCalendarAppointment[]>([])
/**
* Purpose: selected supports ArtistCalendarView.vue by holding or executing the selected page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selected = ref<ArtistCalendarAppointment | null>(null)
/** detailOpen is a reactive state variable used by the template and event handlers. */
const detailOpen = ref(false)
/**
* Purpose: todayKey supports ArtistCalendarView.vue by holding or executing the today key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const todayKey = localDateKey(new Date())
/** todayCount is a reactive state variable used by the template and event handlers. */
const todayCount = computed(() => appointments.value.filter(item => dateKey(item.appointmentStartTime) === todayKey).length)
@@ -203,6 +223,10 @@ const openSelectedOrder = () => {
/** dateKey is a local helper used by this page script. */
const dateKey = (value: string) => value ? value.slice(0, 10) : ''
/**
* Purpose: localDateKey supports ArtistCalendarView.vue by holding or executing the local date key page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function localDateKey(value: Date) {
const month = String(value.getMonth() + 1).padStart(2, '0')
const day = String(value.getDate()).padStart(2, '0')
@@ -144,19 +144,75 @@ import type { OrderArtistChangeOptionsVO, OrderArtistChangeRequestVO } from '../
import type { IdType } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
/**
* Purpose: router supports ArtistOrderView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: route supports ArtistOrderView.vue by holding or executing the route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const route = useRoute()
/**
* Purpose: orders supports ArtistOrderView.vue by holding or executing the orders page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const orders = ref<any[]>([])
/**
* Purpose: imageIdCache supports ArtistOrderView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: orderRefs supports ArtistOrderView.vue by holding or executing the order refs page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const orderRefs = ref<Record<string, any>>({})
/**
* Purpose: showCalendarEntry supports ArtistOrderView.vue by holding or executing the show calendar entry page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const showCalendarEntry = ref(false)
/**
* Purpose: currentUserId supports ArtistOrderView.vue by holding or executing the current user id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUserId = ref<IdType>()
/**
* Purpose: artistChangeModalOpen supports ArtistOrderView.vue by holding or executing the artist change modal open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const artistChangeModalOpen = ref(false)
/**
* Purpose: artistChangeSubmitting supports ArtistOrderView.vue by holding or executing the artist change submitting page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const artistChangeSubmitting = ref(false)
/**
* Purpose: artistChangeOptionsLoading supports ArtistOrderView.vue by holding or executing the artist change options loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const artistChangeOptionsLoading = ref(false)
/**
* Purpose: artistChangeOptions supports ArtistOrderView.vue by holding or executing the artist change options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const artistChangeOptions = ref<OrderArtistChangeOptionsVO | null>(null)
/**
* Purpose: activeArtistChangeOrder supports ArtistOrderView.vue by holding or executing the active artist change order page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const activeArtistChangeOrder = ref<any | null>(null)
/**
* Purpose: activeArtistChangeItem supports ArtistOrderView.vue by holding or executing the active artist change item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const activeArtistChangeItem = ref<any | null>(null)
/**
* Purpose: filters supports ArtistOrderView.vue by holding or executing the filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const filters = reactive({
keyword: '',
source: 'all',
@@ -165,6 +221,10 @@ const filters = reactive({
minAmount: undefined as number | undefined,
maxAmount: undefined as number | undefined
})
/**
* Purpose: artistChangeForm supports ArtistOrderView.vue by holding or executing the artist change form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const artistChangeForm = reactive({
requestedArtistId: undefined as IdType | undefined,
reason: ''
@@ -233,10 +293,18 @@ const sourceClass = (source?: string) => {
return 'source-service'
}
/**
* Purpose: sameId supports ArtistOrderView.vue by holding or executing the same id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const sameId = (left: unknown, right: unknown) => {
return left !== undefined && left !== null && right !== undefined && right !== null && String(left) === String(right)
}
/**
* Purpose: pendingArtistChangeForItem supports ArtistOrderView.vue by holding or executing the pending artist change for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pendingArtistChangeForItem = (order: any, item: any): OrderArtistChangeRequestVO | undefined => {
const itemValue = item?.pendingArtistChangeRequest as OrderArtistChangeRequestVO | undefined
if (itemValue) return itemValue
@@ -250,11 +318,19 @@ const canComplete = (order: any) => {
return order.status === 1 && order.artistOrderSource !== 'SELF'
}
/**
* Purpose: canRequestArtistChange supports ArtistOrderView.vue by holding or executing the can request artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const canRequestArtistChange = (order: any, item: any) => {
const assignedToCurrentUser = !currentUserId.value || !item.artistId || sameId(item.artistId, currentUserId.value)
return order.status === 1 && item.id && assignedToCurrentUser && !pendingArtistChangeForItem(order, item)
}
/**
* Purpose: selectableArtistOptions supports ArtistOrderView.vue by holding or executing the selectable artist options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectableArtistOptions = computed(() => {
const options = artistChangeOptions.value?.artists || []
return options.filter(artist => !sameId(artist.artistId, artistChangeOptions.value?.currentArtistId))
@@ -318,6 +394,10 @@ const handleRefreshClick = async () => {
await runWithGlobalLoading(() => loadOrders())
}
/**
* Purpose: openArtistChangeModal supports ArtistOrderView.vue by holding or executing the open artist change modal page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openArtistChangeModal = async (order: any, item: any) => {
if (!canRequestArtistChange(order, item)) return
activeArtistChangeOrder.value = order
@@ -340,6 +420,10 @@ const openArtistChangeModal = async (order: any, item: any) => {
}
}
/**
* Purpose: closeArtistChangeModal supports ArtistOrderView.vue by holding or executing the close artist change modal page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const closeArtistChangeModal = () => {
artistChangeModalOpen.value = false
activeArtistChangeOrder.value = null
@@ -349,6 +433,10 @@ const closeArtistChangeModal = () => {
artistChangeForm.reason = ''
}
/**
* Purpose: submitArtistChangeRequest supports ArtistOrderView.vue by holding or executing the submit artist change request page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const submitArtistChangeRequest = async () => {
if (!activeArtistChangeOrder.value || !activeArtistChangeItem.value) return
if (!artistChangeForm.requestedArtistId) {
+92
View File
@@ -423,6 +423,10 @@ import { useRouter } from 'vue-router'
import { InfoCircleOutlined, LockOutlined, UserOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import type { Rule } from 'ant-design-vue/es/form'
/**
* Purpose: LegalAgreement supports AuthView.vue by holding or executing the legal agreement page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { authApi, legalAgreementApi, type LegalAgreement } from '@/api/auth'
import { shopApi } from '@/api/shop'
import { ACCOUNT_REGEX, ACCOUNT_RULE_MESSAGE, sanitizeAccountInput } from '@/utils/account'
@@ -436,20 +440,52 @@ import {
} from '@/api/user'
import type { IdType } from '@/utils/id'
/**
* Purpose: router supports AuthView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: activeTab supports AuthView.vue by holding or executing the active tab page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const activeTab = ref<'login' | 'register'>('login')
/**
* Purpose: loginType supports AuthView.vue by holding or executing the login type page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loginType = ref<'password' | 'phone'>('password')
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/** loadingShops is a reactive state variable used by the template and event handlers. */
const loadingShops = ref(false)
/**
* Purpose: shops supports AuthView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<any[]>([])
/**
* Purpose: loginShops supports AuthView.vue by holding or executing the login shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loginShops = ref<Array<{ id: IdType; shopName: string }>>([])
/** countdown is a reactive state variable used by the template and event handlers. */
const countdown = ref(0)
/**
* Purpose: loginAccountStatus supports AuthView.vue by holding or executing the login account status page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loginAccountStatus = ref<LoginAccountCheckResponse | null>(null)
/**
* Purpose: registerAccountStatus supports AuthView.vue by holding or executing the register account status page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const registerAccountStatus = ref<AvailabilityCheckResponse | null>(null)
/**
* Purpose: registerPhoneStatus supports AuthView.vue by holding or executing the register phone status page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const registerPhoneStatus = ref<AvailabilityCheckResponse | null>(null)
/** loginShopMessage is a reactive state variable used by the template and event handlers. */
const loginShopMessage = ref('')
@@ -462,17 +498,41 @@ const forgotPasswordVisible = ref(false)
const forgotCountdown = ref(0)
/** resettingPassword is a reactive state variable used by the template and event handlers. */
const resettingPassword = ref(false)
/**
* Purpose: agreementAccepted supports AuthView.vue by holding or executing the agreement accepted page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const agreementAccepted = ref(false)
/**
* Purpose: agreements supports AuthView.vue by holding or executing the agreements page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const agreements = ref<LegalAgreement[]>([])
/**
* Purpose: agreementModalOpen supports AuthView.vue by holding or executing the agreement modal open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const agreementModalOpen = ref(false)
/**
* Purpose: selectedAgreement supports AuthView.vue by holding or executing the selected agreement page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedAgreement = ref<LegalAgreement | null>(null)
/**
* Purpose: forgotPasswordForm supports AuthView.vue by holding or executing the forgot password form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const forgotPasswordForm = reactive({
phone: '',
verificationCode: '',
newPassword: ''
})
/**
* Purpose: formData supports AuthView.vue by holding or executing the form data page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formData = reactive({
account: '',
password: '',
@@ -485,6 +545,10 @@ const formData = reactive({
rememberMe: false
})
/**
* Purpose: agreementVersions supports AuthView.vue by holding or executing the agreement versions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const agreementVersions = computed<Record<string, string>>(() => {
return agreements.value.reduce((result, agreement) => {
result[agreement.agreementType] = agreement.version
@@ -492,6 +556,10 @@ const agreementVersions = computed<Record<string, string>>(() => {
}, {} as Record<string, string>)
})
/**
* Purpose: agreementPayload supports AuthView.vue by holding or executing the agreement payload page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const agreementPayload = () => ({
agreementAccepted: agreementAccepted.value,
agreementVersions: agreementVersions.value,
@@ -501,8 +569,20 @@ const agreementPayload = () => ({
let loginAccountCheckTimer: number | undefined
let loginPhoneShopCheckTimer: number | undefined
/**
* Purpose: phoneRegex supports AuthView.vue by holding or executing the phone regex page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const phoneRegex = /^1[3-9]\d{9}$/
/**
* Purpose: verificationCodeRegex supports AuthView.vue by holding or executing the verification code regex page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const verificationCodeRegex = /^\d{6}$/
/**
* Purpose: loginShopUnsupportedMessage supports AuthView.vue by holding or executing the login shop unsupported message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loginShopUnsupportedMessage = '可直接登录;如账号绑定多家门店,登录后可在个人中心切换当前门店。'
/** loginShopPlaceholder is a reactive state variable used by the template and event handlers. */
const loginShopPlaceholder = computed(() => {
@@ -636,6 +716,10 @@ const forgotPasswordRules: Record<string, Rule[]> = {
]
}
/**
* Purpose: currentRules supports AuthView.vue by holding or executing the current rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentRules = computed<Record<string, Rule[]>>(() => {
if (activeTab.value === 'register') {
return registerRules
@@ -861,6 +945,10 @@ const checkRegisterPhoneAvailability = async (showWarning = true) => {
return response.available
}
/**
* Purpose: loadAgreements supports AuthView.vue by holding or executing the load agreements page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadAgreements = async () => {
try {
agreements.value = await legalAgreementApi.listCurrent() as unknown as LegalAgreement[]
@@ -870,6 +958,10 @@ const loadAgreements = async () => {
}
}
/**
* Purpose: openAgreement supports AuthView.vue by holding or executing the open agreement page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openAgreement = async (type: 'USER_TERMS' | 'PRIVACY_POLICY') => {
const cached = agreements.value.find(item => item.agreementType === type)
if (cached) {
+64
View File
@@ -245,6 +245,10 @@ import { DeleteOutlined, RightOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import type { ButtonProps } from 'ant-design-vue/es/button/buttonTypes'
import { cartApi } from '../api/cart'
/**
* Purpose: UserCoupon supports CartView.vue by holding or executing the user coupon page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { couponApi, type UserCoupon } from '../api/coupon'
import { fileApi } from '../api/index'
import { orderApi } from '../api/order'
@@ -253,14 +257,34 @@ import type { IdType } from '@/utils/id'
import { sameId, toOptionalIdString } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
/**
* Purpose: router supports CartView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: updateCartCount supports CartView.vue by holding or executing the update cart count page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const updateCartCount = inject<() => Promise<void>>('updateCartCount', async () => {})
/**
* Purpose: NO_COUPON_KEY supports CartView.vue by holding or executing the no coupon key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const NO_COUPON_KEY = 'NONE'
/**
* Purpose: ButtonPropsWithClass supports CartView.vue by holding or executing the button props with class page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
type ButtonPropsWithClass = ButtonProps & { class?: string }
const couponModalOkButtonProps: ButtonPropsWithClass = { class: 'cart-coupon-modal__ok' }
const couponModalCancelButtonProps: ButtonPropsWithClass = { class: 'cart-coupon-modal__cancel' }
/**
* Purpose: ArtistOption supports CartView.vue by holding or executing the artist option page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface ArtistOption {
id: IdType
name: string
@@ -270,6 +294,10 @@ interface ArtistOption {
participateProduction?: boolean
}
/**
* Purpose: CartItem supports CartView.vue by holding or executing the cart item page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface CartItem {
id: IdType
productId: IdType
@@ -293,16 +321,40 @@ interface CartItem {
artist?: ArtistOption
}
/**
* Purpose: CheckoutIssue supports CartView.vue by holding or executing the checkout issue page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface CheckoutIssue {
key: string
message: string
itemId?: IdType
}
/**
* Purpose: cartItems supports CartView.vue by holding or executing the cart items page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const cartItems = ref<CartItem[]>([])
/**
* Purpose: imageIdCache supports CartView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: itemRefs supports CartView.vue by holding or executing the item refs page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const itemRefs = ref<Record<string, HTMLElement>>({})
/**
* Purpose: availableCoupons supports CartView.vue by holding or executing the available coupons page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const availableCoupons = ref<UserCoupon[]>([])
/**
* Purpose: selectedCoupon supports CartView.vue by holding or executing the selected coupon page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedCoupon = ref<UserCoupon | null>(null)
/** couponSelectionKey is a reactive state variable used by the template and event handlers. */
const couponSelectionKey = ref(NO_COUPON_KEY)
@@ -312,8 +364,20 @@ const couponSelectionTouched = ref(false)
const showCouponModal = ref(false)
/** showBookingModal is a reactive state variable used by the template and event handlers. */
const showBookingModal = ref(false)
/**
* Purpose: currentItem supports CartView.vue by holding or executing the current item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentItem = ref<CartItem | null>(null)
/**
* Purpose: availableArtists supports CartView.vue by holding or executing the available artists page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const availableArtists = ref<ArtistOption[]>([])
/**
* Purpose: draftArtistId supports CartView.vue by holding or executing the draft artist id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftArtistId = ref<IdType>()
/** draftAppointmentTime is a reactive state variable used by the template and event handlers. */
const draftAppointmentTime = ref('')
@@ -68,14 +68,26 @@ import { LeftOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { couponApi } from '@/api/coupon'
/**
* Purpose: router supports CouponView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/**
* Purpose: coupons supports CouponView.vue by holding or executing the coupons page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const coupons = ref<any[]>([])
/** activeFilter is a reactive state variable used by the template and event handlers. */
const activeFilter = ref('all')
/**
* Purpose: filterOptions supports CouponView.vue by holding or executing the filter options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const filterOptions = [
{ label: '全部', value: 'all' },
{ label: '未使用', value: 'available' },
+76
View File
@@ -168,13 +168,29 @@
import { computed, onMounted, onUnmounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
/**
* Purpose: AnnouncementVO supports HomeView.vue by holding or executing the announcement vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type AnnouncementVO, type UserVO } from '../api/user'
/**
* Purpose: ProductVO supports HomeView.vue by holding or executing the product vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { productApi, type ProductVO } from '../api/product'
/**
* Purpose: ShopVO supports HomeView.vue by holding or executing the shop vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { shopApi, type ShopVO } from '../api/shop'
import { fileApi } from '../api/file'
import { DEFAULT_AVATAR, DEFAULT_PRODUCT_IMAGE } from '@/constants'
import type { IdType } from '@/utils/id'
/**
* Purpose: BannerImage supports HomeView.vue by holding or executing the banner image page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface BannerImage {
id: string
shopId: IdType
@@ -183,6 +199,10 @@ interface BannerImage {
url: string
}
/**
* Purpose: ProductCardItem supports HomeView.vue by holding or executing the product card item page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface ProductCardItem {
id: IdType
name: string
@@ -193,17 +213,61 @@ interface ProductCardItem {
bgColor: string
}
/**
* Purpose: router supports HomeView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: userInfo supports HomeView.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO | null>(null)
/**
* Purpose: publicShops supports HomeView.vue by holding or executing the public shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const publicShops = ref<ShopVO[]>([])
/**
* Purpose: bannerImages supports HomeView.vue by holding or executing the banner images page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const bannerImages = ref<BannerImage[]>([])
/**
* Purpose: featuredItems supports HomeView.vue by holding or executing the featured items page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const featuredItems = ref<ProductCardItem[]>([])
/**
* Purpose: popularSource supports HomeView.vue by holding or executing the popular source page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const popularSource = ref<ProductCardItem[]>([])
/**
* Purpose: popularItems supports HomeView.vue by holding or executing the popular items page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const popularItems = ref<ProductCardItem[]>([])
/**
* Purpose: announcements supports HomeView.vue by holding or executing the announcements page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const announcements = ref<AnnouncementVO[]>([])
/**
* Purpose: selectedAnnouncement supports HomeView.vue by holding or executing the selected announcement page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedAnnouncement = ref<AnnouncementVO | null>(null)
/**
* Purpose: announcementDetailOpen supports HomeView.vue by holding or executing the announcement detail open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const announcementDetailOpen = ref(false)
/**
* Purpose: productImageCache supports HomeView.vue by holding or executing the product image cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const productImageCache = ref<Record<string, string>>({})
/** searchQuery is a reactive state variable used by the template and event handlers. */
const searchQuery = ref('')
@@ -213,6 +277,10 @@ const loading = ref(false)
const hasMore = ref(true)
/** page is a reactive state variable used by the template and event handlers. */
const page = ref(1)
/**
* Purpose: pageSize supports HomeView.vue by holding or executing the page size page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pageSize = 8
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
@@ -224,11 +292,19 @@ const displayName = computed(() => userInfo.value?.nickname || (isLoggedIn.value
/** announcementLoop is a reactive state variable used by the template and event handlers. */
const announcementLoop = computed(() => [...announcements.value, ...announcements.value].map((item, index) => ({ ...item, loopKey: index })))
/**
* Purpose: openAnnouncementDetail supports HomeView.vue by holding or executing the open announcement detail page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openAnnouncementDetail = (item: AnnouncementVO) => {
selectedAnnouncement.value = item
announcementDetailOpen.value = true
}
/**
* Purpose: formatAnnouncementTime supports HomeView.vue by holding or executing the format announcement time page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formatAnnouncementTime = (value?: string) => {
if (!value) return ''
return value.replace('T', ' ').slice(0, 16)
@@ -20,6 +20,10 @@
import { ref, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
/**
* Purpose: router supports NotFoundView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/** countdown is a reactive state variable used by the template and event handlers. */
const countdown = ref(5)
@@ -44,18 +44,38 @@
import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
/**
* Purpose: SystemMessageVO supports NotificationsView.vue by holding or executing the system message vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type SystemMessageVO } from '@/api/user'
/**
* Purpose: router supports NotificationsView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/**
* Purpose: messages supports NotificationsView.vue by holding or executing the messages page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const messages = ref<SystemMessageVO[]>([])
/** detailVisible is a reactive state variable used by the template and event handlers. */
const detailVisible = ref(false)
/**
* Purpose: currentMessage supports NotificationsView.vue by holding or executing the current message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentMessage = ref<SystemMessageVO | null>(null)
/** unreadCount is a reactive state variable used by the template and event handlers. */
const unreadCount = computed(() => messages.value.filter(item => item.readStatus !== 1).length)
/**
* Purpose: resolveSystemMessageActionPath supports NotificationsView.vue by holding or executing the resolve system message action path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resolveSystemMessageActionPath = (item: SystemMessageVO) => {
const actionPath = String(item.actionPath || '').trim()
if (!actionPath || !actionPath.startsWith('/') || actionPath.startsWith('//')) {
@@ -64,6 +84,10 @@ const resolveSystemMessageActionPath = (item: SystemMessageVO) => {
return actionPath
}
/**
* Purpose: markMessageReadIfNeeded supports NotificationsView.vue by holding or executing the mark message read if needed page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const markMessageReadIfNeeded = async (item: SystemMessageVO) => {
if (item.readStatus === 1) {
return
+132
View File
@@ -141,18 +141,70 @@ import { userApi } from '@/api/user'
import type { IdType } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
/**
* Purpose: router supports OrderView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: orders supports OrderView.vue by holding or executing the orders page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const orders = ref<any[]>([])
/**
* Purpose: imageIdCache supports OrderView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: pendingReviews supports OrderView.vue by holding or executing the pending reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pendingReviews = ref<OrderArtistReviewVO[]>([])
/**
* Purpose: orderReviews supports OrderView.vue by holding or executing the order reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const orderReviews = ref<Record<string, OrderArtistReviewVO[]>>({})
/**
* Purpose: pendingChangeRequests supports OrderView.vue by holding or executing the pending change requests page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pendingChangeRequests = ref<OrderArtistChangeRequestVO[]>([])
/**
* Purpose: reviewModalOpen supports OrderView.vue by holding or executing the review modal open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const reviewModalOpen = ref(false)
/**
* Purpose: reviewSubmitting supports OrderView.vue by holding or executing the review submitting page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const reviewSubmitting = ref(false)
/**
* Purpose: activeReview supports OrderView.vue by holding or executing the active review page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const activeReview = ref<OrderArtistReviewVO | null>(null)
/**
* Purpose: rejectModalOpen supports OrderView.vue by holding or executing the reject modal open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const rejectModalOpen = ref(false)
/**
* Purpose: changeProcessing supports OrderView.vue by holding or executing the change processing page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const changeProcessing = ref(false)
/**
* Purpose: activeChangeRequest supports OrderView.vue by holding or executing the active change request page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const activeChangeRequest = ref<OrderArtistChangeRequestVO | null>(null)
/**
* Purpose: filters supports OrderView.vue by holding or executing the filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const filters = reactive({
keyword: '',
status: 'all' as 'all' | number,
@@ -160,10 +212,18 @@ const filters = reactive({
minAmount: undefined as number | undefined,
maxAmount: undefined as number | undefined
})
/**
* Purpose: reviewForm supports OrderView.vue by holding or executing the review form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const reviewForm = reactive({
rating: undefined as number | undefined,
content: ''
})
/**
* Purpose: rejectForm supports OrderView.vue by holding or executing the reject form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const rejectForm = reactive({
rejectReason: ''
})
@@ -201,10 +261,18 @@ const statusClass = (status: number) => {
return 'cancelled'
}
/**
* Purpose: sameId supports OrderView.vue by holding or executing the same id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const sameId = (left: unknown, right: unknown) => {
return left !== undefined && left !== null && right !== undefined && right !== null && String(left) === String(right)
}
/**
* Purpose: embeddedForItem supports OrderView.vue by holding or executing the embedded for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const embeddedForItem = <T extends { orderItemId?: IdType }>(order: any, item: any, field: string): T | undefined => {
const itemValue = item?.[field] as T | undefined
if (itemValue) return itemValue
@@ -213,24 +281,40 @@ const embeddedForItem = <T extends { orderItemId?: IdType }>(order: any, item: a
return sameId(orderValue.orderItemId, item.id) || (order.items || []).length === 1 ? orderValue : undefined
}
/**
* Purpose: pendingReviewForItem supports OrderView.vue by holding or executing the pending review for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pendingReviewForItem = (order: any, item: any): OrderArtistReviewVO | undefined => {
const embedded = embeddedForItem<OrderArtistReviewVO>(order, item, 'pendingReview')
if (embedded) return embedded
return pendingReviews.value.find(review => sameId(review.orderId, order.id) && sameId(review.orderItemId, item.id))
}
/**
* Purpose: submittedReviewForItem supports OrderView.vue by holding or executing the submitted review for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const submittedReviewForItem = (order: any, item: any): OrderArtistReviewVO | undefined => {
const embedded = embeddedForItem<OrderArtistReviewVO>(order, item, 'reviewSummary')
if (embedded) return embedded
return (orderReviews.value[String(order.id)] || []).find(review => sameId(review.orderItemId, item.id) && Number(review.status) === 1)
}
/**
* Purpose: pendingChangeRequestForItem supports OrderView.vue by holding or executing the pending change request for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pendingChangeRequestForItem = (order: any, item: any): OrderArtistChangeRequestVO | undefined => {
const embedded = embeddedForItem<OrderArtistChangeRequestVO>(order, item, 'pendingArtistChangeRequest')
if (embedded) return embedded
return pendingChangeRequests.value.find(request => sameId(request.orderId, order.id) && sameId(request.orderItemId, item.id))
}
/**
* Purpose: formatRating supports OrderView.vue by holding or executing the format rating page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formatRating = (rating?: number) => {
return Number(rating || 0).toFixed(1)
}
@@ -244,6 +328,10 @@ const resetFilters = () => {
filters.maxAmount = undefined
}
/**
* Purpose: copyOrderNo supports OrderView.vue by holding or executing the copy order no page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const copyOrderNo = async (orderNo: string) => {
try {
await navigator.clipboard.writeText(orderNo)
@@ -253,6 +341,10 @@ const copyOrderNo = async (orderNo: string) => {
}
}
/**
* Purpose: loadPendingReviews supports OrderView.vue by holding or executing the load pending reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadPendingReviews = async () => {
try {
pendingReviews.value = (await orderApi.getMyPendingReviews()) || []
@@ -261,6 +353,10 @@ const loadPendingReviews = async () => {
}
}
/**
* Purpose: loadOrderReviews supports OrderView.vue by holding or executing the load order reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadOrderReviews = async () => {
const orderIds = orders.value.map(order => order.id).filter(Boolean)
const entries = await Promise.all(orderIds.map(async (orderId) => {
@@ -273,6 +369,10 @@ const loadOrderReviews = async () => {
orderReviews.value = Object.fromEntries(entries)
}
/**
* Purpose: loadPendingArtistChangeRequests supports OrderView.vue by holding or executing the load pending artist change requests page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadPendingArtistChangeRequests = async () => {
try {
pendingChangeRequests.value = (await orderApi.getMyPendingArtistChangeRequests()) || []
@@ -281,6 +381,10 @@ const loadPendingArtistChangeRequests = async () => {
}
}
/**
* Purpose: refreshOrderExtensions supports OrderView.vue by holding or executing the refresh order extensions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const refreshOrderExtensions = async () => {
await Promise.all([
loadPendingReviews(),
@@ -319,6 +423,10 @@ const loadOrders = async () => {
}
}
/**
* Purpose: openReviewModal supports OrderView.vue by holding or executing the open review modal page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openReviewModal = (review?: OrderArtistReviewVO) => {
if (!review) return
activeReview.value = review
@@ -327,6 +435,10 @@ const openReviewModal = (review?: OrderArtistReviewVO) => {
reviewModalOpen.value = true
}
/**
* Purpose: closeReviewModal supports OrderView.vue by holding or executing the close review modal page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const closeReviewModal = () => {
reviewModalOpen.value = false
activeReview.value = null
@@ -334,6 +446,10 @@ const closeReviewModal = () => {
reviewForm.content = ''
}
/**
* Purpose: submitReview supports OrderView.vue by holding or executing the submit review page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const submitReview = async () => {
if (!activeReview.value) return
const rating = Number(reviewForm.rating)
@@ -363,6 +479,10 @@ const submitReview = async () => {
}
}
/**
* Purpose: approveArtistChange supports OrderView.vue by holding or executing the approve artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const approveArtistChange = (request?: OrderArtistChangeRequestVO) => {
if (!request) return
Modal.confirm({
@@ -382,6 +502,10 @@ const approveArtistChange = (request?: OrderArtistChangeRequestVO) => {
})
}
/**
* Purpose: openRejectArtistChange supports OrderView.vue by holding or executing the open reject artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openRejectArtistChange = (request?: OrderArtistChangeRequestVO) => {
if (!request) return
activeChangeRequest.value = request
@@ -389,12 +513,20 @@ const openRejectArtistChange = (request?: OrderArtistChangeRequestVO) => {
rejectModalOpen.value = true
}
/**
* Purpose: closeRejectArtistChange supports OrderView.vue by holding or executing the close reject artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const closeRejectArtistChange = () => {
rejectModalOpen.value = false
activeChangeRequest.value = null
rejectForm.rejectReason = ''
}
/**
* Purpose: submitRejectArtistChange supports OrderView.vue by holding or executing the submit reject artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const submitRejectArtistChange = async () => {
if (!activeChangeRequest.value) return
changeProcessing.value = true
@@ -106,22 +106,46 @@ import { userApi } from '@/api/user'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { runWithGlobalLoading } from '@/utils/action-loading'
/**
* Purpose: router supports PasswordSettingsView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: formRef supports PasswordSettingsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/** countdown is a reactive state variable used by the template and event handlers. */
const countdown = ref(0)
/**
* Purpose: userInfo supports PasswordSettingsView.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<{ phone?: string } | null>(null)
/**
* Purpose: draftSavedAt supports PasswordSettingsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
let countdownTimer: ReturnType<typeof setInterval> | null = null
/**
* Purpose: formState supports PasswordSettingsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
verificationCode: '',
password: '',
confirmPassword: ''
})
/**
* Purpose: draftKey supports PasswordSettingsView.vue by holding or executing the draft key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftKey = buildDraftStorageKey('password-settings', 'set-password')
/** restoreDraft is a local helper used by this page script. */
@@ -141,10 +141,22 @@ import {
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { cartApi } from '@/api/cart'
/**
* Purpose: CommentVO supports ProductDetailView.vue by holding or executing the comment vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { commentApi, type CommentVO } from '@/api/comment'
import { fileApi } from '@/api/file'
/**
* Purpose: ProductVO supports ProductDetailView.vue by holding or executing the product vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { productApi, type ProductVO } from '@/api/product'
import { productLikeApi } from '@/api/productLike'
/**
* Purpose: ShopVO supports ProductDetailView.vue by holding or executing the shop vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { shopApi, type ShopVO } from '@/api/shop'
import { wishlistApi } from '@/api/wishlist'
import { DEFAULT_PRODUCT_IMAGE } from '@/constants'
@@ -152,17 +164,53 @@ import type { IdType } from '@/utils/id'
import { toOptionalIdString } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
/**
* Purpose: route supports ProductDetailView.vue by holding or executing the route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const route = useRoute()
/**
* Purpose: router supports ProductDetailView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: updateCartCount supports ProductDetailView.vue by holding or executing the update cart count page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const updateCartCount = inject<() => Promise<void>>('updateCartCount', async () => {})
/**
* Purpose: product supports ProductDetailView.vue by holding or executing the product page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const product = ref<ProductVO>({} as ProductVO)
/**
* Purpose: shopInfo supports ProductDetailView.vue by holding or executing the shop info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopInfo = ref<ShopVO | null>(null)
/**
* Purpose: productImages supports ProductDetailView.vue by holding or executing the product images page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const productImages = ref<string[]>([])
/**
* Purpose: imageIdCache supports ProductDetailView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: comments supports ProductDetailView.vue by holding or executing the comments page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const comments = ref<CommentVO[]>([])
/** commentText is a reactive state variable used by the template and event handlers. */
const commentText = ref('')
/**
* Purpose: replyTarget supports ProductDetailView.vue by holding or executing the reply target page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const replyTarget = ref<CommentVO | null>(null)
/** submittingComment is a reactive state variable used by the template and event handlers. */
const submittingComment = ref(false)
@@ -187,6 +235,10 @@ const artistCountText = computed(() => artistCount.value > 0 ? `${artistCount.va
/** earliestBookableText is a reactive state variable used by the template and event handlers. */
const earliestBookableText = computed(() => shopInfo.value?.businessHours || '以门店安排为准')
/**
* Purpose: copyShareLink supports ProductDetailView.vue by holding or executing the copy share link page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const copyShareLink = async () => {
const url = `${window.location.origin}/product/${route.params.id}`
try {
@@ -137,25 +137,61 @@ import { onMounted, ref, watch, inject, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { CheckOutlined, LeftOutlined, SearchOutlined, ShoppingCartOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
/**
* Purpose: ProductVO supports ProductListView.vue by holding or executing the product vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { productApi, type ProductVO } from '@/api/product'
/**
* Purpose: TagVO supports ProductListView.vue by holding or executing the tag vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { tagApi, type TagVO } from '@/api/tag'
import { cartApi } from '@/api/cart'
import { fileApi } from '@/api/file'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { fetchCartProductIdSet, hasCartProduct, withAddedCartProduct } from '@/utils/cart-state'
/**
* Purpose: ProductListItem supports ProductListView.vue by holding or executing the product list item page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
type ProductListItem = ProductVO & {
inCart?: boolean
}
/**
* Purpose: router supports ProductListView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: route supports ProductListView.vue by holding or executing the route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const route = useRoute()
/**
* Purpose: updateCartCount supports ProductListView.vue by holding or executing the update cart count page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const updateCartCount = inject<() => Promise<void>>('updateCartCount', async () => {})
/**
* Purpose: allTags supports ProductListView.vue by holding or executing the all tags page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const allTags = ref<TagVO[]>([])
/**
* Purpose: categories supports ProductListView.vue by holding or executing the categories page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const categories = ref<string[]>(['全部'])
/** selectedCategory is a reactive state variable used by the template and event handlers. */
const selectedCategory = ref('全部')
/**
* Purpose: products supports ProductListView.vue by holding or executing the products page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const products = ref<ProductListItem[]>([])
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
@@ -163,10 +199,22 @@ const loading = ref(false)
const showSearch = ref(false)
/** searchKeyword is a reactive state variable used by the template and event handlers. */
const searchKeyword = ref('')
/**
* Purpose: imageIdCache supports ProductListView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: imageUrls supports ProductListView.vue by holding or executing the image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageUrls = ref<Record<string, string[]>>({})
/** cartProductIdSet is a reactive state variable used by the template and event handlers. */
const cartProductIdSet = ref(new Set<string>())
/**
* Purpose: useGlobalLoadingForNextRouteSync supports ProductListView.vue by holding or executing the use global loading for next route sync page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let useGlobalLoadingForNextRouteSync = false
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
@@ -182,6 +230,10 @@ const activeBannerText = computed(() => {
return ''
})
/**
* Purpose: DEFAULT_PRODUCT_IMAGE supports ProductListView.vue by holding or executing the default product image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEFAULT_PRODUCT_IMAGE = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCBmaWxsPSIjZjVmNWY1IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIvPjx0ZXh0IHg9IjUwJSIgeT0iNTAlIiBmaWxsPSIjYmZiZmJmIiBmb250LXNpemU9IjI0IiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBkeT0iLjNlbSI+YWFhPC90ZXh0Pjwvc3ZnPg=='
/** ensureLoginForAction is a local helper used by this page script. */
@@ -213,7 +213,15 @@ import { authApi } from '@/api/auth'
import { couponApi } from '@/api/coupon'
import { fileApi } from '@/api/file'
import { orderApi } from '@/api/order'
/**
* Purpose: UserVO supports ProfileView.vue by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type UserVO } from '@/api/user'
/**
* Purpose: ChunkUploadTask supports ProfileView.vue by holding or executing the chunk upload task page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-upload'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { wishlistApi } from '@/api/wishlist'
@@ -221,8 +229,16 @@ import { DEFAULT_AVATAR } from '@/constants'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { notifyShopThemeChanged } from '@/utils/shop-theme'
/**
* Purpose: router supports ProfileView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: userInfo supports ProfileView.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO>({
id: 0,
nickname: '',
@@ -256,14 +272,26 @@ const artistCalendarAccessible = ref(false)
const shopSwitchVisible = ref(false)
/** shopSwitchLoading is a reactive state variable used by the template and event handlers. */
const shopSwitchLoading = ref(false)
/**
* Purpose: selectedShopId supports ProfileView.vue by holding or executing the selected shop id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedShopId = ref<string>()
/** avatarUploadProgress is a reactive state variable used by the template and event handlers. */
const avatarUploadProgress = ref(0)
/** avatarUploadPending is a reactive state variable used by the template and event handlers. */
const avatarUploadPending = ref(false)
let avatarUploadTask: ChunkUploadTask<string> | null = null
/**
* Purpose: draftSavedAt supports ProfileView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: editForm supports ProfileView.vue by holding or executing the edit form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const editForm = reactive({
nickname: '',
avatar: '',
@@ -335,6 +363,10 @@ const shopSwitchTip = computed(() => {
return '当前暂无可用门店'
})
/**
* Purpose: coreMenuItems supports ProfileView.vue by holding or executing the core menu items page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const coreMenuItems = [
{
key: 'orders',
@@ -401,6 +433,10 @@ const canViewArtistCalendar = computed(() => {
return userType === 3 || (userType === 2 && artistCalendarAccessible.value)
})
/**
* Purpose: profileMenuItems supports ProfileView.vue by holding or executing the profile menu items page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const profileMenuItems = computed(() => {
return coreMenuItems.filter((item: any) => !item.serviceOnly || canViewArtistCalendar.value)
})
@@ -58,6 +58,10 @@ import {
RightOutlined,
} from '@ant-design/icons-vue'
/**
* Purpose: router supports SettingsView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/** settingsSections is a reactive state variable used by the template and event handlers. */
@@ -101,13 +101,33 @@ import { useRoute, useRouter } from 'vue-router'
import { CopyOutlined, LeftOutlined, ShopOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { fileApi } from '@/api/file'
/**
* Purpose: ShopVO supports ShopDetailView.vue by holding or executing the shop vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { shopApi, type ShopVO } from '@/api/shop'
/**
* Purpose: ContactInfoVO supports ShopDetailView.vue by holding or executing the contact info vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type ContactInfoVO } from '@/api/user'
import { toOptionalIdString } from '@/utils/id'
/**
* Purpose: router supports ShopDetailView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: route supports ShopDetailView.vue by holding or executing the route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const route = useRoute()
/**
* Purpose: shopInfo supports ShopDetailView.vue by holding or executing the shop info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopInfo = ref<ShopVO>({
id: '',
shopName: '',
@@ -122,31 +142,83 @@ const shopInfo = ref<ShopVO>({
updateTime: ''
})
/**
* Purpose: shopImages supports ShopDetailView.vue by holding or executing the shop images page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopImages = ref<string[]>([])
/**
* Purpose: imageModalVisible supports ShopDetailView.vue by holding or executing the image modal visible page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageModalVisible = ref(false)
/**
* Purpose: selectedImage supports ShopDetailView.vue by holding or executing the selected image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedImage = ref('')
/**
* Purpose: contactOpen supports ShopDetailView.vue by holding or executing the contact open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const contactOpen = ref(false)
/**
* Purpose: contactInfo supports ShopDetailView.vue by holding or executing the contact info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const contactInfo = ref<ContactInfoVO>({})
/**
* Purpose: mapOpen supports ShopDetailView.vue by holding or executing the map open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapOpen = ref(false)
/**
* Purpose: distanceText supports ShopDetailView.vue by holding or executing the distance text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const distanceText = ref('')
/**
* Purpose: hasLocation supports ShopDetailView.vue by holding or executing the has location page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const hasLocation = computed(() => Boolean(shopInfo.value.longitude && shopInfo.value.latitude))
/**
* Purpose: mapPreviewUrl supports ShopDetailView.vue by holding or executing the map preview url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPreviewUrl = computed(() => shopInfo.value.navigationUrls?.BROWSER || shopInfo.value.navigationUrls?.TENCENT || '')
/**
* Purpose: handleBackClick supports ShopDetailView.vue by holding or executing the handle back click page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleBackClick = () => {
router.back()
}
/**
* Purpose: showImageModal supports ShopDetailView.vue by holding or executing the show image modal page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const showImageModal = (imageUrl: string) => {
selectedImage.value = imageUrl
imageModalVisible.value = true
}
/**
* Purpose: handleImageCancel supports ShopDetailView.vue by holding or executing the handle image cancel page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleImageCancel = () => {
imageModalVisible.value = false
selectedImage.value = ''
}
/**
* Purpose: openManagerContact supports ShopDetailView.vue by holding or executing the open manager contact page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openManagerContact = async () => {
try {
contactInfo.value = await userApi.getShopManagerContact(shopInfo.value.id)
@@ -156,6 +228,10 @@ const openManagerContact = async () => {
}
}
/**
* Purpose: openMapPreview supports ShopDetailView.vue by holding or executing the open map preview page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openMapPreview = () => {
if (!mapPreviewUrl.value) {
message.warning('店铺暂未设置地图位置')
@@ -164,6 +240,10 @@ const openMapPreview = () => {
mapOpen.value = true
}
/**
* Purpose: openNavigation supports ShopDetailView.vue by holding or executing the open navigation page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openNavigation = (provider: 'TENCENT' | 'AMAP') => {
const url = shopInfo.value.navigationUrls?.[provider]
if (!url) {
@@ -173,6 +253,10 @@ const openNavigation = (provider: 'TENCENT' | 'AMAP') => {
window.open(url, '_blank')
}
/**
* Purpose: calculateDistanceText supports ShopDetailView.vue by holding or executing the calculate distance text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const calculateDistanceText = (currentLat: number, currentLng: number) => {
const shopLat = Number(shopInfo.value.latitude)
const shopLng = Number(shopInfo.value.longitude)
@@ -190,6 +274,10 @@ const calculateDistanceText = (currentLat: number, currentLng: number) => {
distanceText.value = meters >= 1000 ? `距你约 ${(meters / 1000).toFixed(1)} km` : `距你约 ${Math.round(meters)} m`
}
/**
* Purpose: loadCurrentDistance supports ShopDetailView.vue by holding or executing the load current distance page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadCurrentDistance = () => {
if (!hasLocation.value || !navigator.geolocation) return
navigator.geolocation.getCurrentPosition(
@@ -201,6 +289,10 @@ const loadCurrentDistance = () => {
)
}
/**
* Purpose: copyToClipboard supports ShopDetailView.vue by holding or executing the copy to clipboard page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const copyToClipboard = async (text: string, type: string) => {
if (!text) return
try {
@@ -211,6 +303,10 @@ const copyToClipboard = async (text: string, type: string) => {
}
}
/**
* Purpose: loadShopImages supports ShopDetailView.vue by holding or executing the load shop images page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadShopImages = async () => {
try {
const imageFileIds = shopInfo.value.imageFileIds
@@ -226,6 +322,10 @@ const loadShopImages = async () => {
}
}
/**
* Purpose: fetchShopDetail supports ShopDetailView.vue by holding or executing the fetch shop detail page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const fetchShopDetail = async () => {
try {
const shopId = toOptionalIdString(route.params.id || localStorage.getItem('userShopId'))
@@ -91,13 +91,33 @@
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
/**
* Purpose: BalanceHistoryItem supports VipCenterView.vue by holding or executing the balance history item page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type BalanceHistoryItem, type UserAssetVO, type VipRechargePlanVO } from '@/api/user'
/**
* Purpose: router supports VipCenterView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/**
* Purpose: asset supports VipCenterView.vue by holding or executing the asset page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const asset = ref<UserAssetVO | null>(null)
/**
* Purpose: history supports VipCenterView.vue by holding or executing the history page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const history = ref<BalanceHistoryItem[]>([])
/**
* Purpose: plans supports VipCenterView.vue by holding or executing the plans page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const plans = ref<VipRechargePlanVO[]>([])
/** rechargeOpen is a reactive state variable used by the template and event handlers. */
const rechargeOpen = ref(false)
@@ -57,6 +57,10 @@ import { ArrowLeft, Delete, StarFilled } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import 'element-plus/es/components/message/style/css'
/**
* Purpose: WishlistItem supports WishlistView.vue by holding or executing the wishlist item page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { wishlistApi, type WishlistItem } from '@/api/wishlist'
import { cartApi } from '@/api/cart'
import { fileApi } from '@/api/file'
@@ -65,14 +69,38 @@ import { sameId } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { fetchCartProductIdSet, hasCartProduct, withAddedCartProduct } from '@/utils/cart-state'
/**
* Purpose: router supports WishlistView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: updateCartCount supports WishlistView.vue by holding or executing the update cart count page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const updateCartCount = inject<() => Promise<void>>('updateCartCount', async () => {})
/**
* Purpose: wishlistItems supports WishlistView.vue by holding or executing the wishlist items page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const wishlistItems = ref<WishlistItem[]>([])
/**
* Purpose: imageIdCache supports WishlistView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: imageUrls supports WishlistView.vue by holding or executing the image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageUrls = ref<Record<string, string[]>>({})
/** cartProductIdSet is a reactive state variable used by the template and event handlers. */
const cartProductIdSet = ref(new Set<string>())
/**
* Purpose: DEFAULT_PRODUCT_IMAGE supports WishlistView.vue by holding or executing the default product image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEFAULT_PRODUCT_IMAGE = 'data:image/svg+xml;base64,PHN2ZyB3aW0dPSJodHRwOi8vd3d3Lm9yZy8yMDAwL3N2ZyI+Pjwvc3ZnPg=='
/** handleBackClick is a local helper used by this page script. */
@@ -233,6 +233,10 @@ import {
UserOutlined
} from '@ant-design/icons-vue'
import { message, Modal } from 'ant-design-vue'
/**
* Purpose: UserVO supports AdminLayout.vue by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminAuthApi, type UserVO } from '@/api/admin'
import { DEFAULT_AVATAR } from '@/constants'
import { usePermission } from '@/utils/permission'
@@ -246,6 +250,10 @@ import {
isBootstrapAdminUser
} from './admin-helpers'
/**
* Purpose: AdminMenuItem supports AdminLayout.vue by holding or executing the admin menu item page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
type AdminMenuItem = {
key: string
icon: any
@@ -253,7 +261,15 @@ type AdminMenuItem = {
permissionCode: string
}
/**
* Purpose: router supports AdminLayout.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: route supports AdminLayout.vue by holding or executing the route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const route = useRoute()
const { isMobile } = useAdminViewport()
@@ -261,8 +277,20 @@ const { isMobile } = useAdminViewport()
const collapsed = ref(false)
/** mobileDrawerOpen is a reactive state variable used by the template and event handlers. */
const mobileDrawerOpen = ref(false)
/**
* Purpose: userInfo supports AdminLayout.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO | null>(null)
/**
* Purpose: selectedKeys supports AdminLayout.vue by holding or executing the selected keys page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedKeys = ref<string[]>([route.path])
/**
* Purpose: selectedShopId supports AdminLayout.vue by holding or executing the selected shop id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedShopId = ref<string>()
/** shopSwitchLoading is a reactive state variable used by the template and event handlers. */
const shopSwitchLoading = ref(false)
@@ -288,6 +316,10 @@ const menuItems: AdminMenuItem[] = [
{ key: '/admin/legal-agreements', icon: SafetyCertificateOutlined, label: '协议管理', permissionCode: 'legal_agreement:manage' }
]
/**
* Purpose: mobileTabs supports AdminLayout.vue by holding or executing the mobile tabs page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mobileTabs = [
{ key: 'workbench', label: '工作台', path: '/admin', icon: HomeOutlined },
{ key: 'orders', label: '订单', path: '/admin/orders', icon: ShoppingOutlined },
@@ -86,18 +86,34 @@ import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import { UserOutlined, LockOutlined } from '@ant-design/icons-vue'
/**
* Purpose: LoginShopSelectionResponse supports AdminLoginView.vue by holding or executing the login shop selection response page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminAuthApi, type LoginShopSelectionResponse } from '@/api/admin'
import { ACCOUNT_REGEX, ACCOUNT_RULE_MESSAGE, sanitizeAccountInput } from '@/utils/account'
import type { IdType } from '@/utils/id'
import { usePermission } from '@/utils/permission'
import { runWithGlobalLoading } from '@/utils/action-loading'
/**
* Purpose: router supports AdminLoginView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: formRef supports AdminLoginView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/** shopLoading is a reactive state variable used by the template and event handlers. */
const shopLoading = ref(false)
/**
* Purpose: shops supports AdminLoginView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<Array<{ id: IdType; shopName: string }>>([])
/** allowShoplessLogin is a reactive state variable used by the template and event handlers. */
const allowShoplessLogin = ref(false)
@@ -105,6 +121,10 @@ const allowShoplessLogin = ref(false)
const loginShopMessage = ref('')
const { loadUserPermissions } = usePermission()
/**
* Purpose: formState supports AdminLoginView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
account: '',
password: '',
@@ -150,6 +170,10 @@ const shopPlaceholder = computed(() => {
return '请先输入账号'
})
/**
* Purpose: formRules supports AdminLoginView.vue by holding or executing the form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRules = {
account: [
{ required: true, message: '请输入用户名', trigger: 'blur' },
@@ -57,6 +57,10 @@
*/
import { computed, onMounted, reactive, ref } from 'vue'
import { message, Modal } from 'ant-design-vue'
/**
* Purpose: AnnouncementVO supports AnnouncementsView.vue by holding or executing the announcement vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminAnnouncementApi, type AnnouncementVO, type MessageTargetOptionsVO } from '@/api/admin'
/** loading is a reactive state variable used by the template and event handlers. */
@@ -65,10 +69,26 @@ const loading = ref(false)
const saving = ref(false)
/** formOpen is a reactive state variable used by the template and event handlers. */
const formOpen = ref(false)
/**
* Purpose: announcements supports AnnouncementsView.vue by holding or executing the announcements page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const announcements = ref<AnnouncementVO[]>([])
/**
* Purpose: options supports AnnouncementsView.vue by holding or executing the options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const options = ref<MessageTargetOptionsVO>({ shops: [], users: [] })
/**
* Purpose: form supports AnnouncementsView.vue by holding or executing the form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const form = reactive<any>({ title: '', content: '', targetType: 'PLATFORM_ALL', shopIds: [], userIds: [], sortOrder: 0 })
/**
* Purpose: columns supports AnnouncementsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '标题', dataIndex: 'title', key: 'title' },
{ title: '内容', dataIndex: 'content', key: 'content' },
@@ -79,6 +99,10 @@ const columns = [
{ title: '操作', key: 'action', width: 150 }
]
/**
* Purpose: targetOptions supports AnnouncementsView.vue by holding or executing the target options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const targetOptions = [
{ label: '全平台', value: 'PLATFORM_ALL' },
{ label: '当前门店全部用户', value: 'CURRENT_SHOP_ALL' },
@@ -43,17 +43,53 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { message } from 'ant-design-vue'
/**
* Purpose: AdminCommentVO supports CommentsView.vue by holding or executing the admin comment vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminCommentApi, type AdminCommentVO } from '@/api/admin'
import type { IdType } from '@/utils/id'
/**
* Purpose: loading supports CommentsView.vue by holding or executing the loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loading = ref(false)
/**
* Purpose: keyword supports CommentsView.vue by holding or executing the keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const keyword = ref('')
/**
* Purpose: shopKeyword supports CommentsView.vue by holding or executing the shop keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopKeyword = ref('')
/**
* Purpose: productKeyword supports CommentsView.vue by holding or executing the product keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const productKeyword = ref('')
/**
* Purpose: userKeyword supports CommentsView.vue by holding or executing the user keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userKeyword = ref('')
/**
* Purpose: createdRange supports CommentsView.vue by holding or executing the created range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createdRange = ref<[string, string] | undefined>()
/**
* Purpose: comments supports CommentsView.vue by holding or executing the comments page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const comments = ref<AdminCommentVO[]>([])
/**
* Purpose: columns supports CommentsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '评论内容', dataIndex: 'commentContent', key: 'commentContent' },
{ title: '用户', dataIndex: 'userNickname', key: 'userNickname', width: 140 },
@@ -63,6 +99,10 @@ const columns = [
{ title: '操作', key: 'action', width: 100 }
]
/**
* Purpose: filteredComments supports CommentsView.vue by holding or executing the filtered comments page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const filteredComments = computed(() => comments.value.filter(comment => {
if (!matchText(shopKeyword.value, [comment.shopName, comment.shopId])) return false
if (!matchText(productKeyword.value, [comment.productTitle, comment.productId])) return false
@@ -70,12 +110,20 @@ const filteredComments = computed(() => comments.value.filter(comment => {
return matchRange(comment.createTime, createdRange.value)
}))
/**
* Purpose: matchText supports CommentsView.vue by holding or executing the match text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchText = (needle: string, values: any[]) => {
const normalized = needle.trim().toLowerCase()
if (!normalized) return true
return values.some(value => String(value ?? '').toLowerCase().includes(normalized))
}
/**
* Purpose: matchRange supports CommentsView.vue by holding or executing the match range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchRange = (value?: string, range?: [string, string]) => {
if (!range?.length) return true
if (!value) return false
@@ -83,6 +131,10 @@ const matchRange = (value?: string, range?: [string, string]) => {
return time >= new Date(range[0]).getTime() && time <= new Date(range[1]).getTime()
}
/**
* Purpose: loadComments supports CommentsView.vue by holding or executing the load comments page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadComments = async () => {
loading.value = true
try {
@@ -94,12 +146,20 @@ const loadComments = async () => {
}
}
/**
* Purpose: deleteComment supports CommentsView.vue by holding or executing the delete comment page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const deleteComment = async (id: IdType) => {
await adminCommentApi.deleteComment(id)
message.success('评论已删除')
await loadComments()
}
/**
* Purpose: resetFilters supports CommentsView.vue by holding or executing the reset filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetFilters = () => {
keyword.value = ''
shopKeyword.value = ''
@@ -338,6 +338,10 @@ import { message, Modal } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import { PlusOutlined } from '@ant-design/icons-vue'
import DraftActions from '@/components/DraftActions.vue'
/**
* Purpose: Dayjs supports CouponsView.vue by holding or executing the dayjs page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import dayjs, { type Dayjs } from 'dayjs'
import {
adminCouponApi,
@@ -372,6 +376,10 @@ const currentUserInfo = (() => {
}
})()
/**
* Purpose: CouponFormState supports CouponsView.vue by holding or executing the coupon form state page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface CouponFormState {
couponCode: string
couponName: string
@@ -404,22 +412,66 @@ const modalLoading = ref(false)
const isEdit = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: formRef supports CouponsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/**
* Purpose: distributeFormRef supports CouponsView.vue by holding or executing the distribute form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const distributeFormRef = ref<FormInstance>()
/**
* Purpose: currentCoupon supports CouponsView.vue by holding or executing the current coupon page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentCoupon = ref<Coupon | null>(null)
/**
* Purpose: draftSavedAt supports CouponsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: couponList supports CouponsView.vue by holding or executing the coupon list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const couponList = ref<Coupon[]>([])
/**
* Purpose: tagList supports CouponsView.vue by holding or executing the tag list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const tagList = ref<Tag[]>([])
/**
* Purpose: userList supports CouponsView.vue by holding or executing the user list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userList = ref<UserVO[]>([])
/**
* Purpose: shops supports CouponsView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<Shop[]>([])
/**
* Purpose: vipLevelOptions supports CouponsView.vue by holding or executing the vip level options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipLevelOptions = ref<string[]>(['普通', '青铜', '白银', '黄金'])
/** distributeModalVisible is a reactive state variable used by the template and event handlers. */
const distributeModalVisible = ref(false)
/** distributeLoading is a reactive state variable used by the template and event handlers. */
const distributeLoading = ref(false)
/**
* Purpose: currentDistributeCoupon supports CouponsView.vue by holding or executing the current distribute coupon page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentDistributeCoupon = ref<Coupon | null>(null)
/**
* Purpose: pagination supports CouponsView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -429,6 +481,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports CouponsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive<CouponFormState>({
couponCode: '',
couponName: '',
@@ -447,12 +503,20 @@ const formState = reactive<CouponFormState>({
autoMatch: 0
})
/**
* Purpose: distributeFormState supports CouponsView.vue by holding or executing the distribute form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const distributeFormState = reactive({
couponName: '',
userIds: [] as number[],
quantity: 1
})
/**
* Purpose: formRules supports CouponsView.vue by holding or executing the form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRules = {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'blur' }],
couponType: [{ required: true, message: '请选择优惠券类型', trigger: 'change' }],
@@ -464,11 +528,19 @@ const formRules = {
shopId: [{ required: true, message: '请选择所属店铺', trigger: 'change' }]
} as any
/**
* Purpose: distributeFormRules supports CouponsView.vue by holding or executing the distribute form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const distributeFormRules = {
userIds: [{ required: true, message: '请选择要发放的用户', trigger: 'change' }],
quantity: [{ required: true, message: '请输入发放数量', trigger: 'blur' }]
} as any
/**
* Purpose: columns supports CouponsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '优惠券名称', dataIndex: 'couponName', key: 'couponName' },
{ title: '所属店铺', key: 'shop', width: 140 },
@@ -597,9 +669,17 @@ const handleClearDraft = (showMessage = true) => {
}
}
/**
* Purpose: isSameTagSelection supports CouponsView.vue by holding or executing the is same tag selection page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isSameTagSelection = (left: number[], right: number[]) =>
left.length === right.length && left.every((id, index) => Number(id) === Number(right[index]))
/**
* Purpose: removeSelectedTags supports CouponsView.vue by holding or executing the remove selected tags page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const removeSelectedTags = (target: number[], selected: number[]) => {
const selectedIds = new Set(selected.map(Number))
return target.filter(id => !selectedIds.has(Number(id)))
@@ -878,6 +958,10 @@ const handleDistributeCancel = () => {
distributeFormRef.value?.resetFields()
}
/**
* Purpose: fetchVipLevelOptions supports CouponsView.vue by holding or executing the fetch vip level options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const fetchVipLevelOptions = async () => {
try {
const levels = await adminVipRechargePlanApi.listVipLevelOptions(currentUserInfo?.shopId)
@@ -111,13 +111,29 @@ import {
TeamOutlined,
UserOutlined
} from '@ant-design/icons-vue'
/**
* Purpose: DashboardStats supports DashboardView.vue by holding or executing the dashboard stats page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminDashboardApi, type DashboardStats } from '@/api/admin'
import { useAdminViewport } from '@/composables/useAdminViewport'
/**
* Purpose: router supports DashboardView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { isMobile } = useAdminViewport()
/**
* Purpose: loading supports DashboardView.vue by holding or executing the loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loading = ref(false)
/**
* Purpose: stats supports DashboardView.vue by holding or executing the stats page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const stats = reactive<DashboardStats>({
totalUsers: 0,
totalProducts: 0,
@@ -137,6 +153,10 @@ const stats = reactive<DashboardStats>({
recentActivities: []
})
/**
* Purpose: getCurrentUserInfo supports DashboardView.vue by holding or executing the get current user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getCurrentUserInfo = () => {
try {
const cache = localStorage.getItem('adminUserInfo')
@@ -147,8 +167,20 @@ const getCurrentUserInfo = () => {
}
}
/**
* Purpose: currentUser supports DashboardView.vue by holding or executing the current user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUser = computed(() => getCurrentUserInfo())
/**
* Purpose: isAdmin supports DashboardView.vue by holding or executing the is admin page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isAdmin = computed(() => currentUser.value?.type === 4)
/**
* Purpose: pageSubtitle supports DashboardView.vue by holding or executing the page subtitle page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pageSubtitle = computed(() => {
if (isAdmin.value) {
return '查看全平台经营情况、订单增长与待处理事项'
@@ -156,9 +188,21 @@ const pageSubtitle = computed(() => {
return currentUser.value?.shopName ? `当前店铺:${currentUser.value.shopName}` : '查看当前账号可管理范围内的经营情况'
})
/**
* Purpose: money supports DashboardView.vue by holding or executing the money page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const money = (value?: number) => Number(value || 0)
/**
* Purpose: numberText supports DashboardView.vue by holding or executing the number text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const numberText = (value?: number) => String(Number(value || 0))
/**
* Purpose: primaryStats supports DashboardView.vue by holding or executing the primary stats page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const primaryStats = computed(() => [
{ key: 'amount', title: '订单总额', value: money(stats.totalOrderAmount), precision: 2, suffix: '元', icon: ShoppingOutlined },
{ key: 'todayAmount', title: '今日订单额', value: money(stats.todayOrderAmount), precision: 2, suffix: '元', icon: ShoppingOutlined },
@@ -166,6 +210,10 @@ const primaryStats = computed(() => [
{ key: 'artists', title: '美甲师数量', value: stats.totalArtists || 0, icon: TeamOutlined }
])
/**
* Purpose: overviewItems supports DashboardView.vue by holding or executing the overview items page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const overviewItems = computed(() => [
{ label: '近 7 日订单额', value: `¥${money(stats.weekOrderAmount).toFixed(2)}` },
{ label: '今日订单数', value: numberText(stats.todayOrders) },
@@ -177,6 +225,10 @@ const overviewItems = computed(() => [
{ label: isAdmin.value ? '店铺数量' : '作品数量', value: numberText(isAdmin.value ? stats.totalShops : stats.totalProducts) }
])
/**
* Purpose: quickLinks supports DashboardView.vue by holding or executing the quick links page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const quickLinks = computed(() => [
{ label: '订单管理', path: '/admin/orders', icon: ShoppingOutlined },
{ label: '用户管理', path: '/admin/users', icon: UserOutlined },
@@ -186,6 +238,10 @@ const quickLinks = computed(() => [
{ label: isAdmin.value ? '店铺管理' : '美甲师管理', path: isAdmin.value ? '/admin/shops' : '/admin/nail-artists', icon: HomeOutlined }
])
/**
* Purpose: formatTime supports DashboardView.vue by holding or executing the format time page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formatTime = (timeStr: string) => {
if (!timeStr) return ''
const time = new Date(timeStr)
@@ -201,6 +257,10 @@ const formatTime = (timeStr: string) => {
return time.toLocaleDateString('zh-CN')
}
/**
* Purpose: fetchStats supports DashboardView.vue by holding or executing the fetch stats page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const fetchStats = async () => {
loading.value = true
try {
@@ -169,7 +169,15 @@ import {
TeamOutlined,
UserOutlined
} from '@ant-design/icons-vue'
/**
* Purpose: UserVO supports HomeView.vue by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type UserVO } from '@/api/admin'
/**
* Purpose: PermissionVO supports HomeView.vue by holding or executing the permission vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { permissionApi, type PermissionVO } from '@/api/permission'
import { DEFAULT_AVATAR } from '@/constants'
import { message } from 'ant-design-vue'
@@ -177,11 +185,23 @@ import { useAdminViewport } from '@/composables/useAdminViewport'
import { isBootstrapAdminUser } from './admin-helpers'
import { isAllowedForShoplessPlatformAdmin } from '@/utils/platform-admin-permissions'
/**
* Purpose: router supports HomeView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { isMobile } = useAdminViewport()
/** currentTime is a reactive state variable used by the template and event handlers. */
const currentTime = ref('')
/**
* Purpose: userInfo supports HomeView.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO | null>(null)
/**
* Purpose: userPermissions supports HomeView.vue by holding or executing the user permissions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userPermissions = ref<PermissionVO[]>([])
let timer: number | null = null
@@ -54,14 +54,42 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import { message } from 'ant-design-vue'
/**
* Purpose: LegalAgreementAdminVO supports LegalAgreementsView.vue by holding or executing the legal agreement admin vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminLegalAgreementApi, type LegalAgreementAdminVO } from '@/api/admin'
import type { IdType } from '@/utils/id'
/**
* Purpose: loading supports LegalAgreementsView.vue by holding or executing the loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loading = ref(false)
/**
* Purpose: saving supports LegalAgreementsView.vue by holding or executing the saving page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const saving = ref(false)
/**
* Purpose: modalOpen supports LegalAgreementsView.vue by holding or executing the modal open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const modalOpen = ref(false)
/**
* Purpose: editingId supports LegalAgreementsView.vue by holding or executing the editing id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const editingId = ref<IdType | null>(null)
/**
* Purpose: agreements supports LegalAgreementsView.vue by holding or executing the agreements page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const agreements = ref<LegalAgreementAdminVO[]>([])
/**
* Purpose: form supports LegalAgreementsView.vue by holding or executing the form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const form = reactive({
agreementType: 'USER_TERMS' as 'USER_TERMS' | 'PRIVACY_POLICY',
title: '',
@@ -69,6 +97,10 @@ const form = reactive({
content: ''
})
/**
* Purpose: columns supports LegalAgreementsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '类型', dataIndex: 'agreementTypeName', key: 'agreementTypeName' },
{ title: '标题', dataIndex: 'title', key: 'title' },
@@ -78,6 +110,10 @@ const columns = [
{ title: '操作', key: 'action', width: 220 }
]
/**
* Purpose: loadAgreements supports LegalAgreementsView.vue by holding or executing the load agreements page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadAgreements = async () => {
loading.value = true
try {
@@ -87,6 +123,10 @@ const loadAgreements = async () => {
}
}
/**
* Purpose: resetForm supports LegalAgreementsView.vue by holding or executing the reset form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetForm = () => {
editingId.value = null
form.agreementType = 'USER_TERMS'
@@ -95,11 +135,19 @@ const resetForm = () => {
form.content = ''
}
/**
* Purpose: openCreate supports LegalAgreementsView.vue by holding or executing the open create page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openCreate = () => {
resetForm()
modalOpen.value = true
}
/**
* Purpose: openEdit supports LegalAgreementsView.vue by holding or executing the open edit page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openEdit = (record: Record<string, any>) => {
const agreement = record as LegalAgreementAdminVO
editingId.value = agreement.id
@@ -110,6 +158,10 @@ const openEdit = (record: Record<string, any>) => {
modalOpen.value = true
}
/**
* Purpose: saveAgreement supports LegalAgreementsView.vue by holding or executing the save agreement page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const saveAgreement = async () => {
if (!form.title || !form.version || !form.content) {
message.warning('请填写完整协议信息')
@@ -130,12 +182,20 @@ const saveAgreement = async () => {
}
}
/**
* Purpose: publishAgreement supports LegalAgreementsView.vue by holding or executing the publish agreement page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const publishAgreement = async (id: IdType) => {
await adminLegalAgreementApi.publish(id)
message.success('发布成功')
await loadAgreements()
}
/**
* Purpose: disableAgreement supports LegalAgreementsView.vue by holding or executing the disable agreement page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const disableAgreement = async (id: IdType) => {
await adminLegalAgreementApi.disable(id)
message.success('已停用')
@@ -68,6 +68,10 @@ import {
loadCachedAdminUserInfo
} from './admin-helpers'
/**
* Purpose: router supports ManageView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { hasPermission, loadUserPermissions } = usePermission()
@@ -115,6 +115,10 @@
*/
import { onMounted, reactive, ref } from 'vue'
import { message } from 'ant-design-vue'
/**
* Purpose: MessageHubPushConfigVO supports MessageHubPushConfigsView.vue by holding or executing the message hub push config vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminMessageHubPushConfigApi, adminSystemParameterConfigApi, type MessageHubPushConfigVO } from '@/api/admin'
/** loading is a reactive state variable used by the template and event handlers. */
@@ -127,15 +131,47 @@ const testing = ref(false)
const formOpen = ref(false)
/** testOpen is a reactive state variable used by the template and event handlers. */
const testOpen = ref(false)
/**
* Purpose: editingId supports MessageHubPushConfigsView.vue by holding or executing the editing id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const editingId = ref<any>()
/**
* Purpose: testingId supports MessageHubPushConfigsView.vue by holding or executing the testing id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const testingId = ref<any>()
/** testPhone is a reactive state variable used by the template and event handlers. */
const testPhone = ref('')
/**
* Purpose: configs supports MessageHubPushConfigsView.vue by holding or executing the configs page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const configs = ref<MessageHubPushConfigVO[]>([])
/**
* Purpose: savingMap supports MessageHubPushConfigsView.vue by holding or executing the saving map page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const savingMap = ref(false)
/**
* Purpose: mapEnabled supports MessageHubPushConfigsView.vue by holding or executing the map enabled page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapEnabled = ref(true)
/**
* Purpose: mapProvider supports MessageHubPushConfigsView.vue by holding or executing the map provider page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapProvider = ref<'TENCENT' | 'AMAP'>('TENCENT')
/**
* Purpose: mapRemark supports MessageHubPushConfigsView.vue by holding or executing the map remark page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapRemark = ref('地图渠道由平台管理员选择;高德 Web Key 与高德小程序 Key 分开填写。')
/**
* Purpose: createMapForm supports MessageHubPushConfigsView.vue by holding or executing the create map form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createMapForm = (configKey: string, configName: string, remark: string) => ({
configGroup: 'MAP',
configKey,
@@ -144,6 +180,10 @@ const createMapForm = (configKey: string, configName: string, remark: string) =>
enabled: 1,
remark
})
/**
* Purpose: mapForms supports MessageHubPushConfigsView.vue by holding or executing the map forms page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapForms = reactive({
provider: createMapForm('MAP_PROVIDER', '当前地图渠道', 'TENCENT 或 AMAP;决定后台店铺选点默认使用哪个地图渠道'),
tencentWeb: createMapForm('TENCENT_MAP_KEY', '腾讯 Web Key', '用于后台腾讯地图选点和 Web 展示'),
@@ -151,6 +191,10 @@ const mapForms = reactive({
amapMini: createMapForm('AMAP_MINI_KEY', '高德小程序 Key', '用于后续小程序端高德 SDK / API 调用')
})
/**
* Purpose: sceneOptions supports MessageHubPushConfigsView.vue by holding or executing the scene options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const sceneOptions = [
{ label: '用户注册验证码', value: 'USER_REGISTER_SMS_CODE' },
{ label: '手机号登录验证码', value: 'USER_LOGIN_SMS_CODE' },
@@ -160,11 +204,19 @@ const sceneOptions = [
{ label: '修改密码验证码', value: 'USER_CHANGE_PASSWORD_SMS_CODE' }
]
/**
* Purpose: sendMethodOptions supports MessageHubPushConfigsView.vue by holding or executing the send method options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const sendMethodOptions = [
{ label: 'SPUG', value: 'SPUG' },
{ label: 'OTHER', value: 'OTHER' }
]
/**
* Purpose: form supports MessageHubPushConfigsView.vue by holding or executing the form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const form = reactive<any>({
sceneCode: 'USER_LOGIN_SMS_CODE',
sceneName: '手机号登录验证码',
@@ -179,6 +231,10 @@ const form = reactive<any>({
remark: ''
})
/**
* Purpose: columns supports MessageHubPushConfigsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '业务场景', key: 'scene' },
{ title: 'MessageHub', key: 'messagehub' },
@@ -214,6 +270,10 @@ const load = async () => {
}
}
/**
* Purpose: saveMapConfig supports MessageHubPushConfigsView.vue by holding or executing the save map config page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const saveMapConfig = async () => {
savingMap.value = true
try {
@@ -259,8 +259,20 @@ import { ref, reactive, onMounted } from 'vue'
import { message } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import DraftActions from '@/components/DraftActions.vue'
/**
* Purpose: NailArtistInfoVO supports NailArtistsView.vue by holding or executing the nail artist info vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminNailArtistApi, type NailArtistInfoVO } from '@/api/admin'
/**
* Purpose: Tag supports NailArtistsView.vue by holding or executing the tag page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminTagApi, type Tag } from '@/api/admin'
/**
* Purpose: Product supports NailArtistsView.vue by holding or executing the product page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminProductApi, type Product } from '@/api/admin'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { usePermission } from '@/utils/permission'
@@ -296,8 +308,20 @@ const tagLoading = ref(false)
const productLoading = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: nailArtistList supports NailArtistsView.vue by holding or executing the nail artist list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const nailArtistList = ref<NailArtistInfoVO[]>([])
/**
* Purpose: tagList supports NailArtistsView.vue by holding or executing the tag list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const tagList = ref<Tag[]>([])
/**
* Purpose: productList supports NailArtistsView.vue by holding or executing the product list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const productList = ref<Product[]>([])
/** modalVisible is a reactive state variable used by the template and event handlers. */
const modalVisible = ref(false)
@@ -309,11 +333,31 @@ const viewModalVisible = ref(false)
const isAdmin = ref(false)
/** isShopOwner is a reactive state variable used by the template and event handlers. */
const isShopOwner = ref(false)
/**
* Purpose: formRef supports NailArtistsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/**
* Purpose: currentNailArtist supports NailArtistsView.vue by holding or executing the current nail artist page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentNailArtist = ref<NailArtistInfoVO | null>(null)
/**
* Purpose: currentUserInfo supports NailArtistsView.vue by holding or executing the current user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUserInfo = getCurrentUserInfo()
/**
* Purpose: draftSavedAt supports NailArtistsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: viewFormState supports NailArtistsView.vue by holding or executing the view form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewFormState = reactive({
nickname: '',
shopName: '',
@@ -327,6 +371,10 @@ const viewFormState = reactive({
portfolioText: ''
})
/**
* Purpose: pagination supports NailArtistsView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -336,6 +384,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports NailArtistsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
userId: 0,
identity: '',
@@ -406,6 +458,10 @@ const handleClearDraft = (showMessage = true) => {
}
}
/**
* Purpose: formRules supports NailArtistsView.vue by holding or executing the form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRules = {
identity: [{ required: true, message: '请输入身份', trigger: 'blur' }],
experience: [{ required: true, message: '请输入从业年限', trigger: 'blur' }],
@@ -414,6 +470,10 @@ const formRules = {
portfolio: [{ required: true, message: '请选择作品作品', trigger: 'change' }]
} as any
/**
* Purpose: columns supports NailArtistsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '美甲师姓名', dataIndex: 'nickname', key: 'nickname' },
{ title: '所属店铺', dataIndex: 'shopName', key: 'shopName' },
@@ -219,6 +219,10 @@
*/
import { computed, onMounted, ref } from 'vue'
import { message } from 'ant-design-vue'
/**
* Purpose: Shop supports OrdersView.vue by holding or executing the shop page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminOrderApi, adminShopApi, type Shop } from '@/api/admin'
import { usePermission } from '@/utils/permission'
import type { IdType } from '@/utils/id'
@@ -229,12 +233,32 @@ import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
const { isMobile } = useAdminViewport()
/**
* Purpose: orders supports OrdersView.vue by holding or executing the orders page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const orders = ref<any[]>([])
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/**
* Purpose: shopLoading supports OrdersView.vue by holding or executing the shop loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopLoading = ref(false)
/**
* Purpose: currentOrder supports OrdersView.vue by holding or executing the current order page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentOrder = ref<any | null>(null)
/**
* Purpose: currentUserType supports OrdersView.vue by holding or executing the current user type page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUserType = ref<number | null>(null)
/**
* Purpose: currentUserInfo supports OrdersView.vue by holding or executing the current user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUserInfo = (() => {
try {
const cached = localStorage.getItem('adminUserInfo') || sessionStorage.getItem('adminUserInfo')
@@ -246,14 +270,50 @@ const currentUserInfo = (() => {
})()
/** keyword is a reactive state variable used by the template and event handlers. */
const keyword = ref('')
/**
* Purpose: statusFilter supports OrdersView.vue by holding or executing the status filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const statusFilter = ref<'all' | string>('all')
/**
* Purpose: shopList supports OrdersView.vue by holding or executing the shop list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopList = ref<Shop[]>([])
/**
* Purpose: shopFilter supports OrdersView.vue by holding or executing the shop filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopFilter = ref<string | undefined>()
/**
* Purpose: artistKeyword supports OrdersView.vue by holding or executing the artist keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const artistKeyword = ref('')
/**
* Purpose: userKeyword supports OrdersView.vue by holding or executing the user keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userKeyword = ref('')
/**
* Purpose: createRange supports OrdersView.vue by holding or executing the create range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createRange = ref<[string, string] | undefined>()
/**
* Purpose: appointmentRange supports OrdersView.vue by holding or executing the appointment range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const appointmentRange = ref<[string, string] | undefined>()
/**
* Purpose: minAmount supports OrdersView.vue by holding or executing the min amount page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const minAmount = ref<number | undefined>()
/**
* Purpose: maxAmount supports OrdersView.vue by holding or executing the max amount page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const maxAmount = ref<number | undefined>()
const { hasPermission, loadUserPermissions } = usePermission()
@@ -266,6 +326,10 @@ const detailVisible = computed({
const canProcessOrders = computed(() => hasPermission('order:process'))
/** isArtist is a reactive state variable used by the template and event handlers. */
const isArtist = computed(() => currentUserType.value === 3)
/**
* Purpose: statusOptions supports OrdersView.vue by holding or executing the status options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const statusOptions = [
{ label: '全部状态', value: 'all' },
{ label: '待处理', value: '1' },
@@ -301,12 +365,20 @@ const filteredOrders = computed(() => {
})
})
/**
* Purpose: matchText supports OrdersView.vue by holding or executing the match text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchText = (needle: string, values: any[]) => {
const normalized = needle.trim().toLowerCase()
if (!normalized) return true
return values.some(value => String(value ?? '').toLowerCase().includes(normalized))
}
/**
* Purpose: matchRange supports OrdersView.vue by holding or executing the match range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchRange = (value: string | undefined, range?: [string, string], candidates?: string[]) => {
if (!range?.length) return true
const values = candidates?.length ? candidates : [value]
@@ -319,6 +391,10 @@ const matchRange = (value: string | undefined, range?: [string, string], candida
})
}
/**
* Purpose: resetFilters supports OrdersView.vue by holding or executing the reset filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetFilters = () => {
keyword.value = ''
statusFilter.value = 'all'
@@ -332,6 +408,10 @@ const resetFilters = () => {
void loadOrders()
}
/**
* Purpose: columns supports OrdersView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '订单编号', dataIndex: 'orderNo', key: 'orderNo' },
{ title: '用户ID', dataIndex: 'userId', key: 'userId', width: 100 },
@@ -343,6 +423,10 @@ const columns = [
{ title: '操作', key: 'actions', width: 180 }
]
/**
* Purpose: itemColumns supports OrdersView.vue by holding or executing the item columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const itemColumns = [
{ title: '商品ID', dataIndex: 'productId', key: 'productId', width: 100 },
{ title: '商品名称', dataIndex: 'productTitle', key: 'productTitle' },
@@ -361,6 +445,10 @@ const statusColor = (status: number) => {
return 'default'
}
/**
* Purpose: normalizeUserType supports OrdersView.vue by holding or executing the normalize user type page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizeUserType = (value: unknown) => {
const type = Number(value)
return Number.isFinite(type) ? type : null
@@ -371,6 +459,10 @@ const resolveCurrentUserType = () => {
currentUserType.value = normalizeUserType(currentUserInfo?.type)
}
/**
* Purpose: normalizeShopId supports OrdersView.vue by holding or executing the normalize shop id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizeShopId = (value: unknown) => {
if (value === undefined || value === null || value === '') {
return undefined
@@ -378,8 +470,16 @@ const normalizeShopId = (value: unknown) => {
return String(value)
}
/**
* Purpose: getShopOptionValue supports OrdersView.vue by holding or executing the get shop option value page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getShopOptionValue = (shop: Shop) => normalizeShopId((shop as any).id) || ''
/**
* Purpose: loadShopOptions supports OrdersView.vue by holding or executing the load shop options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadShopOptions = async () => {
shopLoading.value = true
try {
@@ -343,7 +343,15 @@ import { PlusOutlined } from '@ant-design/icons-vue'
import DraftActions from '@/components/DraftActions.vue'
import TableEllipsisText from '@/components/TableEllipsisText.vue'
import { DEFAULT_AVATAR } from '@/constants'
/**
* Purpose: UserVO supports PermissionsView.vue by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type UserVO } from '@/api/admin'
/**
* Purpose: PermissionVO supports PermissionsView.vue by holding or executing the permission vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { permissionApi, type PermissionVO } from '@/api/permission'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { usePermission } from '@/utils/permission'
@@ -362,6 +370,10 @@ const { isMobile } = useAdminViewport()
const activeTab = ref('permissions')
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/**
* Purpose: permissionList supports PermissionsView.vue by holding or executing the permission list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionList = ref<PermissionVO[]>([])
/** permissionModalVisible is a reactive state variable used by the template and event handlers. */
const permissionModalVisible = ref(false)
@@ -369,10 +381,26 @@ const permissionModalVisible = ref(false)
const permissionModalLoading = ref(false)
/** isEditPermission is a reactive state variable used by the template and event handlers. */
const isEditPermission = ref(false)
/**
* Purpose: permissionFormRef supports PermissionsView.vue by holding or executing the permission form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionFormRef = ref<FormInstance>()
/**
* Purpose: currentPermission supports PermissionsView.vue by holding or executing the current permission page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentPermission = ref<PermissionVO | null>(null)
/**
* Purpose: draftSavedAt supports PermissionsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: permissionPagination supports PermissionsView.vue by holding or executing the permission pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionPagination = reactive({
current: 1,
pageSize: 20,
@@ -382,6 +410,10 @@ const permissionPagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: permissionFormState supports PermissionsView.vue by holding or executing the permission form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionFormState = reactive({
permissionCode: '',
permissionName: '',
@@ -435,6 +467,10 @@ const permissionFormRules: Record<string, Rule[]> = {
description: [{ required: true, message: '请输入权限描述', trigger: 'blur' }]
}
/**
* Purpose: permissionColumns supports PermissionsView.vue by holding or executing the permission columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionColumns = [
{ title: '权限编码', dataIndex: 'permissionCode', key: 'permissionCode' },
{ title: '权限名称', dataIndex: 'permissionName', key: 'permissionName' },
@@ -448,14 +484,42 @@ const permissionColumns = [
const userLoading = ref(false)
/** userSearchText is a reactive state variable used by the template and event handlers. */
const userSearchText = ref('')
/**
* Purpose: userList supports PermissionsView.vue by holding or executing the user list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userList = ref<UserVO[]>([])
/**
* Purpose: selectedUser supports PermissionsView.vue by holding or executing the selected user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedUser = ref<UserVO | null>(null)
/** assignLoading is a reactive state variable used by the template and event handlers. */
const assignLoading = ref(false)
/**
* Purpose: selectedPermissions supports PermissionsView.vue by holding or executing the selected permissions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedPermissions = ref<IdType[]>([])
/**
* Purpose: assignablePermissionIds supports PermissionsView.vue by holding or executing the assignable permission ids page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const assignablePermissionIds = ref<IdType[]>([])
/**
* Purpose: activeCollapseKeys supports PermissionsView.vue by holding or executing the active collapse keys page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const activeCollapseKeys = ref<string[]>(['作品管理', '店铺管理', '用户管理', '权限管理'])
/**
* Purpose: currentLoginUser supports PermissionsView.vue by holding or executing the current login user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentLoginUser = ref<UserVO | null>(null)
/**
* Purpose: mobilePermissionStep supports PermissionsView.vue by holding or executing the mobile permission step page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mobilePermissionStep = ref<'users' | 'assign'>('users')
// 权限 ID 同样可能以字符串形式返回,所以这里统一转成字符串集合做包含判断。
@@ -512,7 +512,15 @@ import { PlusOutlined } from '@ant-design/icons-vue'
import DraftActions from '@/components/DraftActions.vue'
import TableEllipsisText from '@/components/TableEllipsisText.vue'
import { DEFAULT_PRODUCT_IMAGE } from '@/constants'
/**
* Purpose: Product supports ProductsView.vue by holding or executing the product page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminProductApi, type Product, adminShopApi, type Shop, adminFileApi, adminTagApi, adminArtistApi, adminCouponApi } from '@/api/admin'
/**
* Purpose: ChunkUploadTask supports ProductsView.vue by holding or executing the chunk upload task page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-upload'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { usePermission } from '@/utils/permission'
@@ -531,11 +539,35 @@ const { isMobile } = useAdminViewport()
const loading = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: shopFilter supports ProductsView.vue by holding or executing the shop filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopFilter = ref<IdType | undefined>()
/**
* Purpose: tagFilter supports ProductsView.vue by holding or executing the tag filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const tagFilter = ref<IdType | undefined>()
/**
* Purpose: minPriceFilter supports ProductsView.vue by holding or executing the min price filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const minPriceFilter = ref<number | undefined>()
/**
* Purpose: maxPriceFilter supports ProductsView.vue by holding or executing the max price filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const maxPriceFilter = ref<number | undefined>()
/**
* Purpose: createdRange supports ProductsView.vue by holding or executing the created range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createdRange = ref<[string, string] | undefined>()
/**
* Purpose: productList supports ProductsView.vue by holding or executing the product list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const productList = ref<Product[]>([])
/** modalVisible is a reactive state variable used by the template and event handlers. */
const modalVisible = ref(false)
@@ -545,16 +577,36 @@ const viewModalVisible = ref(false)
const modalLoading = ref(false)
/** isEdit is a reactive state variable used by the template and event handlers. */
const isEdit = ref(false)
/**
* Purpose: currentProduct supports ProductsView.vue by holding or executing the current product page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentProduct = ref<Product | null>(null)
/**
* Purpose: shops supports ProductsView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<Shop[]>([])
/** loadingShops is a reactive state variable used by the template and event handlers. */
const loadingShops = ref(false)
/**
* Purpose: tags supports ProductsView.vue by holding or executing the tags page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const tags = ref<any[]>([])
/** loadingTags is a reactive state variable used by the template and event handlers. */
const loadingTags = ref(false)
/**
* Purpose: artists supports ProductsView.vue by holding or executing the artists page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const artists = ref<any[]>([])
/** loadingArtists is a reactive state variable used by the template and event handlers. */
const loadingArtists = ref(false)
/**
* Purpose: coupons supports ProductsView.vue by holding or executing the coupons page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const coupons = ref<any[]>([])
/** loadingCoupons is a reactive state variable used by the template and event handlers. */
const loadingCoupons = ref(false)
@@ -562,20 +614,56 @@ const loadingCoupons = ref(false)
const previewVisible = ref(false)
/** previewImage is a reactive state variable used by the template and event handlers. */
const previewImage = ref('')
/**
* Purpose: imageFileList supports ProductsView.vue by holding or executing the image file list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageFileList = ref<any[]>([])
/**
* Purpose: uploadedFileIds supports ProductsView.vue by holding or executing the uploaded file ids page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadedFileIds = ref<string[]>([])
/**
* Purpose: imageUrls supports ProductsView.vue by holding or executing the image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageUrls = ref<Record<string, string[]>>({})
/**
* Purpose: viewImageUrls supports ProductsView.vue by holding or executing the view image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewImageUrls = ref<string[]>([])
/**
* Purpose: imageIdCache supports ProductsView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/** isAdmin is a reactive state variable used by the template and event handlers. */
const isAdmin = ref(false)
/**
* Purpose: formRef supports ProductsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<any>(null)
/**
* Purpose: uploadTaskMap supports ProductsView.vue by holding or executing the upload task map page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadTaskMap = new Map<string, ChunkUploadTask<any>>()
/** activeUploadCount is a reactive state variable used by the template and event handlers. */
const activeUploadCount = ref(0)
/** isUploadPending is a reactive state variable used by the template and event handlers. */
const isUploadPending = computed(() => activeUploadCount.value > 0)
/**
* Purpose: draftSavedAt supports ProductsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: requestTokens supports ProductsView.vue by holding or executing the request tokens page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const requestTokens = reactive({
shops: 0,
tags: 0,
@@ -602,6 +690,10 @@ const formatDuration = (value?: string | number | null) => {
return text.includes('分钟') ? text : `${text}分钟`
}
/**
* Purpose: viewFormState supports ProductsView.vue by holding or executing the view form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewFormState = reactive({
shopId: undefined,
title: '',
@@ -616,6 +708,10 @@ const viewFormState = reactive({
availableCoupons: [] as string[]
})
/**
* Purpose: pagination supports ProductsView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -625,6 +721,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports ProductsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
shopId: undefined,
title: '',
@@ -661,6 +761,10 @@ const formRules: any = {
bookableArtists: [{ required: true, message: '请选择美甲师', trigger: 'change' }]
}
/**
* Purpose: columns supports ProductsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '图片', key: 'image', width: 150 },
{ title: '作品名称', dataIndex: 'title', key: 'title' },
@@ -892,6 +996,10 @@ const fetchProductList = async () => {
}
}
/**
* Purpose: resetFilters supports ProductsView.vue by holding or executing the reset filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetFilters = () => {
searchText.value = ''
shopFilter.value = undefined
@@ -96,6 +96,10 @@ import {
loadCachedAdminUserInfo
} from './admin-helpers'
/**
* Purpose: router supports ProfileView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { userPermissions, loadUserPermissions, clearPermissions } = usePermission()
@@ -108,6 +112,10 @@ const shopSwitchLoading = ref(false)
/** currentShopName is a reactive state variable used by the template and event handlers. */
const currentShopName = computed(() => getAdminCurrentShopName(userInfo.value))
/**
* Purpose: isPlatformOverview supports ProfileView.vue by holding or executing the is platform overview page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isPlatformOverview = computed(() => isBootstrapAdminUser(userInfo.value))
/** roleLabel is a reactive state variable used by the template and event handlers. */
const roleLabel = computed(() => getAdminRoleLabel(userInfo.value?.type))
@@ -587,7 +587,15 @@ import { PlusOutlined } from '@ant-design/icons-vue'
import DraftActions from '@/components/DraftActions.vue'
import TableEllipsisText from '@/components/TableEllipsisText.vue'
import { DEFAULT_SHOP_IMAGE } from '@/constants'
/**
* Purpose: Shop supports ShopsView.vue by holding or executing the shop page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminShopApi, adminFileApi, adminSystemParameterConfigApi, type Shop } from '@/api/admin'
/**
* Purpose: ChunkUploadTask supports ShopsView.vue by holding or executing the chunk upload task page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-upload'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { usePermission } from '@/utils/permission'
@@ -601,6 +609,10 @@ import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
const { hasPermission, loadUserPermissions } = usePermission()
const { isMobile } = useAdminViewport()
/**
* Purpose: ShopThemeTemplateColors supports ShopsView.vue by holding or executing the shop theme template colors page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface ShopThemeTemplateColors {
themePrimaryColor: string
themeSecondaryColor: string
@@ -609,6 +621,10 @@ interface ShopThemeTemplateColors {
themeCardBgColor: string
}
/**
* Purpose: ShopThemeTemplate supports ShopsView.vue by holding or executing the shop theme template page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface ShopThemeTemplate extends ShopThemeTemplateColors {
id: string
name: string
@@ -616,7 +632,15 @@ interface ShopThemeTemplate extends ShopThemeTemplateColors {
createdAt?: number
}
/**
* Purpose: CUSTOM_THEME_TEMPLATE_STORAGE_KEY supports ShopsView.vue by holding or executing the custom theme template storage key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const CUSTOM_THEME_TEMPLATE_STORAGE_KEY = 'yuminail:admin:shop-theme-templates'
/**
* Purpose: CUSTOM_THEME_TEMPLATE_LIMIT supports ShopsView.vue by holding or executing the custom theme template limit page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const CUSTOM_THEME_TEMPLATE_LIMIT = 20
const PRESET_THEME_TEMPLATES: ShopThemeTemplate[] = [
@@ -726,6 +750,10 @@ const PRESET_THEME_TEMPLATES: ShopThemeTemplate[] = [
const loading = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: shopList supports ShopsView.vue by holding or executing the shop list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopList = ref<Shop[]>([])
/** modalVisible is a reactive state variable used by the template and event handlers. */
const modalVisible = ref(false)
@@ -735,18 +763,50 @@ const viewModalVisible = ref(false)
const modalLoading = ref(false)
/** isEdit is a reactive state variable used by the template and event handlers. */
const isEdit = ref(false)
/**
* Purpose: mapPickerVisible supports ShopsView.vue by holding or executing the map picker visible page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPickerVisible = ref(false)
/**
* Purpose: mapPickerKey supports ShopsView.vue by holding or executing the map picker key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPickerKey = ref('')
/**
* Purpose: mapPickerUrl supports ShopsView.vue by holding or executing the map picker url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPickerUrl = ref('')
/**
* Purpose: mapPickerProvider supports ShopsView.vue by holding or executing the map picker provider page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPickerProvider = ref<'TENCENT' | 'AMAP'>('TENCENT')
/**
* Purpose: locating supports ShopsView.vue by holding or executing the locating page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const locating = ref(false)
/**
* Purpose: formRef supports ShopsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/**
* Purpose: currentShop supports ShopsView.vue by holding or executing the current shop page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentShop = ref<Shop | null>(null)
/** isAdmin is a reactive state variable used by the template and event handlers. */
const isAdmin = ref(false)
// Banner图片相关
const bannerFileList = ref<any[]>([])
/**
* Purpose: uploadedBannerIds supports ShopsView.vue by holding or executing the uploaded banner ids page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadedBannerIds = ref<string[]>([])
/** bannerPreviewVisible is a reactive state variable used by the template and event handlers. */
const bannerPreviewVisible = ref(false)
@@ -755,13 +815,45 @@ const bannerPreviewImage = ref('')
// 店铺图片相关
const imageFileList = ref<any[]>([])
/**
* Purpose: uploadedFileIds supports ShopsView.vue by holding or executing the uploaded file ids page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadedFileIds = ref<string[]>([])
/**
* Purpose: themeBackgroundFileList supports ShopsView.vue by holding or executing the theme background file list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themeBackgroundFileList = ref<any[]>([])
/**
* Purpose: uploadedThemeBackgroundId supports ShopsView.vue by holding or executing the uploaded theme background id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadedThemeBackgroundId = ref('')
/**
* Purpose: imageIdCache supports ShopsView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: shopImageUrls supports ShopsView.vue by holding or executing the shop image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopImageUrls = ref<Record<string, string[]>>({})
/**
* Purpose: shopBannerUrls supports ShopsView.vue by holding or executing the shop banner urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopBannerUrls = ref<Record<string, string[]>>({})
/**
* Purpose: viewImageUrls supports ShopsView.vue by holding or executing the view image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewImageUrls = ref<string[]>([])
/**
* Purpose: viewBannerUrls supports ShopsView.vue by holding or executing the view banner urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewBannerUrls = ref<string[]>([])
/** previewVisible is a reactive state variable used by the template and event handlers. */
const previewVisible = ref(false)
@@ -771,14 +863,34 @@ const previewImage = ref('')
const businessStartTime = ref('')
/** businessEndTime is a reactive state variable used by the template and event handlers. */
const businessEndTime = ref('')
/**
* Purpose: uploadTaskMap supports ShopsView.vue by holding or executing the upload task map page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadTaskMap = new Map<string, ChunkUploadTask<any>>()
/** activeUploadCount is a reactive state variable used by the template and event handlers. */
const activeUploadCount = ref(0)
/** isUploadPending is a reactive state variable used by the template and event handlers. */
const isUploadPending = computed(() => activeUploadCount.value > 0)
/**
* Purpose: draftSavedAt supports ShopsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: customThemeTemplates supports ShopsView.vue by holding or executing the custom theme templates page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const customThemeTemplates = ref<ShopThemeTemplate[]>([])
/**
* Purpose: themeTemplateSaveVisible supports ShopsView.vue by holding or executing the theme template save visible page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themeTemplateSaveVisible = ref(false)
/**
* Purpose: themeTemplateName supports ShopsView.vue by holding or executing the theme template name page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themeTemplateName = ref('')
// 查看店铺相关状态
@@ -805,6 +917,10 @@ const viewFormState = reactive({
themeBackgroundImageFileId: ''
})
/**
* Purpose: pagination supports ShopsView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -814,6 +930,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports ShopsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
shopName: '',
description: '',
@@ -836,19 +956,35 @@ const formState = reactive({
themeBackgroundImageFileId: ''
})
/**
* Purpose: selectedLocationText supports ShopsView.vue by holding or executing the selected location text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedLocationText = computed(() => {
if (formState.address) return formState.address
if (formState.longitude && formState.latitude) return '已选择地图位置'
return '暂未选择地图位置'
})
/**
* Purpose: selectedCoordinateText supports ShopsView.vue by holding or executing the selected coordinate text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedCoordinateText = computed(() => {
if (!formState.longitude || !formState.latitude) return '点击“地图选点”搜索店铺名称或地址'
return '已选择地图位置,可重新选点'
})
/**
* Purpose: mapPickerTitle supports ShopsView.vue by holding or executing the map picker title page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPickerTitle = computed(() => mapPickerProvider.value === 'AMAP' ? '高德地图选点' : '腾讯地图选点')
/**
* Purpose: computedAuthorizationExpireTime supports ShopsView.vue by holding or executing the computed authorization expire time page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const computedAuthorizationExpireTime = computed(() => {
if (!formState.authorizationStartDate || !formState.authorizationDays || formState.authorizationDays <= 0) {
return formState.authorizationExpireTime || ''
@@ -861,29 +997,69 @@ const computedAuthorizationExpireTime = computed(() => {
return `${yyyy}-${mm}-${dd} 23:59:59`
})
/**
* Purpose: computedAuthorizationExpireTimeText supports ShopsView.vue by holding or executing the computed authorization expire time text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const computedAuthorizationExpireTimeText = computed(() => formatAuthorizationExpireTime(computedAuthorizationExpireTime.value))
/**
* Purpose: themePreview supports ShopsView.vue by holding or executing the theme preview page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themePreview = computed(() => resolveShopTheme(formState))
/**
* Purpose: viewThemePreview supports ShopsView.vue by holding or executing the view theme preview page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewThemePreview = computed(() => resolveShopTheme(viewFormState))
/**
* Purpose: themePreviewStyle supports ShopsView.vue by holding or executing the theme preview style page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themePreviewStyle = computed(() => ({
color: themePreview.value.textPrimary,
borderColor: themePreview.value.borderColor,
background: themePreview.value.softGradient
}))
/**
* Purpose: themePreviewButtonStyle supports ShopsView.vue by holding or executing the theme preview button style page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themePreviewButtonStyle = computed(() => ({
color: '#ffffff',
background: themePreview.value.gradient,
boxShadow: themePreview.value.cssVars['--theme-button-shadow']
}))
/**
* Purpose: themeTemplates supports ShopsView.vue by holding or executing the theme templates page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themeTemplates = computed(() => [...PRESET_THEME_TEMPLATES, ...customThemeTemplates.value])
/**
* Purpose: currentThemeTemplateColors supports ShopsView.vue by holding or executing the current theme template colors page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentThemeTemplateColors = computed(() => buildThemeTemplateColors(formState))
/**
* Purpose: currentThemeTemplateSwatches supports ShopsView.vue by holding or executing the current theme template swatches page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentThemeTemplateSwatches = computed(() => getThemeTemplateSwatches(currentThemeTemplateColors.value))
/**
* Purpose: normalizeTemplateColor supports ShopsView.vue by holding or executing the normalize template color page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizeTemplateColor = (value?: string) => {
const normalized = String(value || '').trim().toUpperCase()
return /^#[0-9A-F]{6}$/.test(normalized) ? normalized : ''
}
/**
* Purpose: buildThemeTemplateColors supports ShopsView.vue by holding or executing the build theme template colors page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const buildThemeTemplateColors = (source: Record<string, any>): ShopThemeTemplateColors => {
const resolvedTheme = resolveShopTheme(source)
return {
@@ -895,6 +1071,10 @@ const buildThemeTemplateColors = (source: Record<string, any>): ShopThemeTemplat
}
}
/**
* Purpose: getThemeTemplateSwatches supports ShopsView.vue by holding or executing the get theme template swatches page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getThemeTemplateSwatches = (template: ShopThemeTemplateColors) => [
template.themePrimaryColor,
template.themeSecondaryColor,
@@ -903,6 +1083,10 @@ const getThemeTemplateSwatches = (template: ShopThemeTemplateColors) => [
template.themeCardBgColor
]
/**
* Purpose: normalizeThemeTemplate supports ShopsView.vue by holding or executing the normalize theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizeThemeTemplate = (value: any): ShopThemeTemplate | null => {
if (!value || typeof value !== 'object') {
return null
@@ -927,6 +1111,10 @@ const normalizeThemeTemplate = (value: any): ShopThemeTemplate | null => {
}
}
/**
* Purpose: persistCustomThemeTemplates supports ShopsView.vue by holding or executing the persist custom theme templates page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const persistCustomThemeTemplates = () => {
if (typeof window === 'undefined') {
return
@@ -934,6 +1122,10 @@ const persistCustomThemeTemplates = () => {
window.localStorage.setItem(getThemeTemplateStorageKey(), JSON.stringify(customThemeTemplates.value))
}
/**
* Purpose: loadCustomThemeTemplates supports ShopsView.vue by holding or executing the load custom theme templates page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadCustomThemeTemplates = () => {
if (typeof window === 'undefined') {
return
@@ -949,11 +1141,19 @@ const loadCustomThemeTemplates = () => {
}
}
/**
* Purpose: isThemeTemplateActive supports ShopsView.vue by holding or executing the is theme template active page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isThemeTemplateActive = (template: ShopThemeTemplateColors) => {
const currentColors = currentThemeTemplateColors.value
return getThemeTemplateSwatches(template).every((color, index) => color === getThemeTemplateSwatches(currentColors)[index])
}
/**
* Purpose: themeColorValidator supports ShopsView.vue by holding or executing the theme color validator page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themeColorValidator = async (_rule: any, value?: string) => {
if (!value) {
return Promise.resolve()
@@ -996,6 +1196,10 @@ const formRules: any = {
themeCardBgColor: [{ validator: themeColorValidator, trigger: 'blur' }]
}
/**
* Purpose: columns supports ShopsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '图片', key: 'image', width: 150 },
{ title: 'Banner', key: 'banner', width: 200 },
@@ -1025,6 +1229,10 @@ const getCurrentUserInfo = () => {
return null
}
/**
* Purpose: getThemeTemplateStorageKey supports ShopsView.vue by holding or executing the get theme template storage key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getThemeTemplateStorageKey = () => {
const currentUser = getCurrentUserInfo()
const userKey = currentUser?.id ?? currentUser?.userId ?? currentUser?.account ?? currentUser?.username ?? 'default'
@@ -1122,12 +1330,20 @@ const formatAuthorizationExpireTime = (value?: string) => {
return value.replace('T', ' ').slice(0, 16)
}
/**
* Purpose: formatLocation supports ShopsView.vue by holding or executing the format location page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formatLocation = (shop?: Partial<Shop> | Record<string, any>) => {
const locationName = shop?.address || shop?.shopName || ''
if (!locationName) return '未设置地图位置'
return locationName || '未设置地图位置'
}
/**
* Purpose: buildTencentLocationPickerUrl supports ShopsView.vue by holding or executing the build tencent location picker url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const buildTencentLocationPickerUrl = (options: { latitude?: string | number; longitude?: string | number } = {}) => {
const params = new URLSearchParams({
search: '1',
@@ -1144,6 +1360,10 @@ const buildTencentLocationPickerUrl = (options: { latitude?: string | number; lo
return `https://apis.map.qq.com/tools/locpicker?${params.toString()}`
}
/**
* Purpose: buildAmapLocationPickerUrl supports ShopsView.vue by holding or executing the build amap location picker url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const buildAmapLocationPickerUrl = (options: { latitude?: string | number; longitude?: string | number } = {}) => {
const params = new URLSearchParams({
key: mapPickerKey.value,
@@ -1158,19 +1378,35 @@ const buildAmapLocationPickerUrl = (options: { latitude?: string | number; longi
return `https://m.amap.com/picker/?${params.toString()}`
}
/**
* Purpose: buildMapLocationPickerUrl supports ShopsView.vue by holding or executing the build map location picker url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const buildMapLocationPickerUrl = (options: { latitude?: string | number; longitude?: string | number } = {}) => {
return mapPickerProvider.value === 'AMAP'
? buildAmapLocationPickerUrl(options)
: buildTencentLocationPickerUrl(options)
}
/**
* Purpose: closeTencentLocationPicker supports ShopsView.vue by holding or executing the close tencent location picker page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const closeTencentLocationPicker = () => {
mapPickerVisible.value = false
window.removeEventListener('message', handleMapLocationMessage)
}
/**
* Purpose: closeMapLocationPicker supports ShopsView.vue by holding or executing the close map location picker page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const closeMapLocationPicker = closeTencentLocationPicker
/**
* Purpose: applyTencentLocation supports ShopsView.vue by holding or executing the apply tencent location page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const applyTencentLocation = (data: any) => {
const location = data.loclatlng || data.latlng || data.location
if (!location) return
@@ -1194,6 +1430,10 @@ const applyTencentLocation = (data: any) => {
closeTencentLocationPicker()
}
/**
* Purpose: applyAmapLocation supports ShopsView.vue by holding or executing the apply amap location page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const applyAmapLocation = (data: any) => {
const rawLocation = data.location || data.lnglat || data.position
let longitude = ''
@@ -1227,6 +1467,10 @@ const applyAmapLocation = (data: any) => {
closeTencentLocationPicker()
}
/**
* Purpose: handleMapLocationMessage supports ShopsView.vue by holding or executing the handle map location message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleMapLocationMessage = (event: MessageEvent) => {
const data = event.data || {}
if (!data || typeof data !== 'object') return
@@ -1239,6 +1483,10 @@ const handleMapLocationMessage = (event: MessageEvent) => {
}
}
/**
* Purpose: openMapLocationPicker supports ShopsView.vue by holding or executing the open map location picker page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openMapLocationPicker = async () => {
const response = await adminSystemParameterConfigApi.getMapConfig()
const provider = response?.provider === 'AMAP' ? 'AMAP' : 'TENCENT'
@@ -1258,10 +1506,18 @@ const openMapLocationPicker = async () => {
window.addEventListener('message', handleMapLocationMessage)
}
/**
* Purpose: handleMapPickerFrameLoad supports ShopsView.vue by holding or executing the handle map picker frame load page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleMapPickerFrameLoad = () => {
// 高德/腾讯选点页均通过 postMessage 回传结果,此处保留钩子便于后续接入加载态。
}
/**
* Purpose: useCurrentLocation supports ShopsView.vue by holding or executing the use current location page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const useCurrentLocation = () => {
if (!navigator.geolocation) {
message.warning('当前浏览器不支持定位')
@@ -1937,6 +2193,10 @@ const syncUploadedThemeBackgroundId = (fileId: string) => {
}
}
/**
* Purpose: handleResetTheme supports ShopsView.vue by holding or executing the handle reset theme page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleResetTheme = () => {
Object.assign(formState, {
themePrimaryColor: '',
@@ -1950,6 +2210,10 @@ const handleResetTheme = () => {
syncUploadedThemeBackgroundId('')
}
/**
* Purpose: applyThemeTemplate supports ShopsView.vue by holding or executing the apply theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const applyThemeTemplate = (template: ShopThemeTemplate) => {
Object.assign(formState, {
themePrimaryColor: template.themePrimaryColor,
@@ -1961,16 +2225,28 @@ const applyThemeTemplate = (template: ShopThemeTemplate) => {
message.success(`已应用「${template.name}」配色`)
}
/**
* Purpose: openSaveThemeTemplate supports ShopsView.vue by holding or executing the open save theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openSaveThemeTemplate = () => {
themeTemplateName.value = formState.shopName ? `${formState.shopName}主题` : '我的配色模板'
themeTemplateSaveVisible.value = true
}
/**
* Purpose: handleCancelSaveThemeTemplate supports ShopsView.vue by holding or executing the handle cancel save theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleCancelSaveThemeTemplate = () => {
themeTemplateSaveVisible.value = false
themeTemplateName.value = ''
}
/**
* Purpose: handleConfirmSaveThemeTemplate supports ShopsView.vue by holding or executing the handle confirm save theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleConfirmSaveThemeTemplate = () => {
const name = themeTemplateName.value.trim()
if (!name) {
@@ -2000,6 +2276,10 @@ const handleConfirmSaveThemeTemplate = () => {
message.success(existedIndex >= 0 ? '已更新同名配色模板' : '已保存配色模板')
}
/**
* Purpose: handleDeleteCustomThemeTemplate supports ShopsView.vue by holding or executing the handle delete custom theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleDeleteCustomThemeTemplate = (id: string) => {
customThemeTemplates.value = customThemeTemplates.value.filter(template => template.id !== id)
persistCustomThemeTemplates()
@@ -164,19 +164,63 @@ import {
SendOutlined
} from '@ant-design/icons-vue'
import SystemMessageCard from '@/components/SystemMessageCard.vue'
/**
* Purpose: SystemMessageCreateRequest supports SystemMessagesView.vue by holding or executing the system message create request page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminFileApi, adminSystemMessageApi, type SystemMessageCreateRequest, type SystemMessageVO } from '@/api/admin'
import type { IdType } from '@/utils/id'
/**
* Purpose: loading supports SystemMessagesView.vue by holding or executing the loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loading = ref(false)
/**
* Purpose: saving supports SystemMessagesView.vue by holding or executing the saving page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const saving = ref(false)
/**
* Purpose: imageUploading supports SystemMessagesView.vue by holding or executing the image uploading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageUploading = ref(false)
/**
* Purpose: messages supports SystemMessagesView.vue by holding or executing the messages page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const messages = ref<SystemMessageVO[]>([])
/**
* Purpose: targetOptions supports SystemMessagesView.vue by holding or executing the target options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const targetOptions = ref({ shops: [] as any[], users: [] as any[] })
/**
* Purpose: popupEnabled supports SystemMessagesView.vue by holding or executing the popup enabled page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const popupEnabled = ref(true)
/**
* Purpose: previewVisible supports SystemMessagesView.vue by holding or executing the preview visible page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const previewVisible = ref(false)
/**
* Purpose: currentMessage supports SystemMessagesView.vue by holding or executing the current message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentMessage = ref<SystemMessageVO | null>(null)
/**
* Purpose: imagePreviewUrl supports SystemMessagesView.vue by holding or executing the image preview url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imagePreviewUrl = ref('')
/**
* Purpose: form supports SystemMessagesView.vue by holding or executing the form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const form = reactive<SystemMessageCreateRequest>({
title: '',
content: '',
@@ -187,6 +231,10 @@ const form = reactive<SystemMessageCreateRequest>({
popupEnabled: 1
})
/**
* Purpose: currentAdminUser supports SystemMessagesView.vue by holding or executing the current admin user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentAdminUser = computed(() => {
try {
const cache = localStorage.getItem('adminUserInfo') || sessionStorage.getItem('adminUserInfo')
@@ -195,21 +243,57 @@ const currentAdminUser = computed(() => {
return null
}
})
/**
* Purpose: isPlatformAdmin supports SystemMessagesView.vue by holding or executing the is platform admin page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isPlatformAdmin = computed(() => Number(currentAdminUser.value?.type) === 4)
/**
* Purpose: targetTypes supports SystemMessagesView.vue by holding or executing the target types page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const targetTypes = computed(() => [
...(isPlatformAdmin.value ? [{ label: '全平台', value: 'PLATFORM_ALL' }] : []),
{ label: isPlatformAdmin.value ? '指定店铺全员' : '本店全员', value: isPlatformAdmin.value ? 'SELECTED_SHOPS' : 'CURRENT_SHOP_ALL' },
{ label: '指定用户', value: 'SELECTED_USERS' }
])
/**
* Purpose: needsShopSelection supports SystemMessagesView.vue by holding or executing the needs shop selection page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const needsShopSelection = computed(() => form.targetType === 'SELECTED_SHOPS' || form.targetType === 'SHOP_ALL')
/**
* Purpose: shopOptions supports SystemMessagesView.vue by holding or executing the shop options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopOptions = computed(() => targetOptions.value.shops.map(shop => ({ label: shop.shopName, value: shop.id })))
/**
* Purpose: userOptions supports SystemMessagesView.vue by holding or executing the user options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userOptions = computed(() => targetOptions.value.users.map(user => ({
label: `${user.nickname || user.account} ${user.shopName ? `(${user.shopName})` : ''}`,
value: user.id
})))
/**
* Purpose: previewTitle supports SystemMessagesView.vue by holding or executing the preview title page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const previewTitle = computed(() => form.title.trim() || '消息标题预览')
/**
* Purpose: previewContent supports SystemMessagesView.vue by holding or executing the preview content page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const previewContent = computed(() => form.content.trim() || (imagePreviewUrl.value ? '' : '这里会显示消息正文。支持纯文本,也可以配合一张图片展示给用户。'))
/**
* Purpose: previewMeta supports SystemMessagesView.vue by holding or executing the preview meta page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const previewMeta = computed(() => `系统消息 · ${popupEnabled.value ? '弹窗预览' : '列表预览'}`)
/**
* Purpose: currentMessageMeta supports SystemMessagesView.vue by holding or executing the current message meta page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentMessageMeta = computed(() => {
if (!currentMessage.value) return ''
return [
@@ -218,6 +302,10 @@ const currentMessageMeta = computed(() => {
].filter(Boolean).join(' · ')
})
/**
* Purpose: columns supports SystemMessagesView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '标题', dataIndex: 'title', key: 'title' },
{ title: '图片', key: 'image', width: 84 },
@@ -229,6 +317,10 @@ const columns = [
{ title: '操作', key: 'action', width: 120 }
]
/**
* Purpose: syncDefaultTargetType supports SystemMessagesView.vue by holding or executing the sync default target type page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const syncDefaultTargetType = () => {
if (isPlatformAdmin.value && form.targetType === 'CURRENT_SHOP_ALL') {
form.targetType = 'PLATFORM_ALL'
@@ -238,6 +330,10 @@ const syncDefaultTargetType = () => {
}
}
/**
* Purpose: loadData supports SystemMessagesView.vue by holding or executing the load data page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadData = async () => {
loading.value = true
try {
@@ -255,16 +351,28 @@ const loadData = async () => {
}
}
/**
* Purpose: handleTargetTypeChange supports SystemMessagesView.vue by holding or executing the handle target type change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleTargetTypeChange = () => {
form.shopIds = []
form.userIds = []
}
/**
* Purpose: removeImage supports SystemMessagesView.vue by holding or executing the remove image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const removeImage = () => {
form.imageFileId = undefined
imagePreviewUrl.value = ''
}
/**
* Purpose: resetForm supports SystemMessagesView.vue by holding or executing the reset form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetForm = () => {
form.title = ''
form.content = ''
@@ -276,6 +384,10 @@ const resetForm = () => {
imagePreviewUrl.value = ''
}
/**
* Purpose: handleImageUpload supports SystemMessagesView.vue by holding or executing the handle image upload page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleImageUpload = async (options: any) => {
const file = options.file as File
if (!file?.type?.startsWith('image/')) {
@@ -302,6 +414,10 @@ const handleImageUpload = async (options: any) => {
}
}
/**
* Purpose: handlePublish supports SystemMessagesView.vue by holding or executing the handle publish page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handlePublish = async () => {
if (!form.title.trim()) return message.warning('请填写消息标题')
if (!form.content.trim() && !form.imageFileId) return message.warning('请填写消息内容或上传消息图片')
@@ -321,12 +437,20 @@ const handlePublish = async () => {
}
}
/**
* Purpose: handleRevoke supports SystemMessagesView.vue by holding or executing the handle revoke page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleRevoke = async (id: IdType) => {
await adminSystemMessageApi.revokeMessage(id)
message.success('消息已撤回')
await loadData()
}
/**
* Purpose: previewMessage supports SystemMessagesView.vue by holding or executing the preview message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const previewMessage = (record: SystemMessageVO) => {
currentMessage.value = record
previewVisible.value = true
@@ -243,6 +243,10 @@ import { message, Modal } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import { PlusOutlined } from '@ant-design/icons-vue'
import DraftActions from '@/components/DraftActions.vue'
/**
* Purpose: Shop supports TagsView.vue by holding or executing the shop page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminTagApi, adminShopApi, type Shop } from '@/api/admin'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import type { IdType } from '@/utils/id'
@@ -282,8 +286,20 @@ const modalLoading = ref(false)
const isEdit = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: formRef supports TagsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/**
* Purpose: currentTag supports TagsView.vue by holding or executing the current tag page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentTag = ref<any>(null)
/**
* Purpose: draftSavedAt supports TagsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
// 查看标签相关状态
@@ -295,11 +311,23 @@ const viewFormState = reactive({
borderColor: '#E5E5E5'
})
/**
* Purpose: tagList supports TagsView.vue by holding or executing the tag list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const tagList = ref<any[]>([])
/**
* Purpose: shops supports TagsView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<Shop[]>([])
/** loadingShops is a reactive state variable used by the template and event handlers. */
const loadingShops = ref(false)
/**
* Purpose: pagination supports TagsView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -309,6 +337,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports TagsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
tagName: '',
shopId: undefined as number | undefined,
@@ -357,11 +389,19 @@ const handleClearDraft = (showMessage = true) => {
}
}
/**
* Purpose: formRules supports TagsView.vue by holding or executing the form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRules = {
tagName: [{ required: true, message: '请输入标签名称', trigger: 'blur' }],
shopId: [{ required: true, message: '请选择所属店铺', trigger: 'change' }]
} as any
/**
* Purpose: columns supports TagsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '标签名称', dataIndex: 'tagName', key: 'tagName' },
{ title: '所属店铺', key: 'shop', width: 150 },
@@ -497,6 +497,10 @@ import DraftActions from '@/components/DraftActions.vue'
import { DEFAULT_AVATAR } from '@/constants'
import { ACCOUNT_REGEX, ACCOUNT_RULE_MESSAGE, sanitizeAccountInput } from '@/utils/account'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
/**
* Purpose: AvailabilityCheckResponse supports UsersView.vue by holding or executing the availability check response page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type AvailabilityCheckResponse } from '@/api/user'
import {
adminShopApi,
@@ -552,19 +556,75 @@ const viewModalVisible = ref(false)
const isEdit = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: shopFilter supports UsersView.vue by holding or executing the shop filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopFilter = ref<string | undefined>()
/**
* Purpose: typeFilter supports UsersView.vue by holding or executing the type filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const typeFilter = ref<number | undefined>()
/**
* Purpose: vipLevelFilter supports UsersView.vue by holding or executing the vip level filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipLevelFilter = ref<string | undefined>()
/**
* Purpose: statusFilter supports UsersView.vue by holding or executing the status filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const statusFilter = ref<number | undefined>()
/**
* Purpose: createdRange supports UsersView.vue by holding or executing the created range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createdRange = ref<[string, string] | undefined>()
/**
* Purpose: hasPhoneFilter supports UsersView.vue by holding or executing the has phone filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const hasPhoneFilter = ref<'true' | 'false' | undefined>()
/**
* Purpose: hasOrderFilter supports UsersView.vue by holding or executing the has order filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const hasOrderFilter = ref<'true' | 'false' | undefined>()
/**
* Purpose: formRef supports UsersView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/**
* Purpose: userList supports UsersView.vue by holding or executing the user list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userList = ref<UserVO[]>([])
/**
* Purpose: shopList supports UsersView.vue by holding or executing the shop list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopList = ref<Shop[]>([])
/**
* Purpose: vipLevelOptions supports UsersView.vue by holding or executing the vip level options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipLevelOptions = ref<string[]>(['普通', '青铜', '白银', '黄金'])
/**
* Purpose: currentUser supports UsersView.vue by holding or executing the current user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUser = ref<UserVO | null>(null)
/**
* Purpose: viewRecord supports UsersView.vue by holding or executing the view record page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewRecord = ref<UserVO | null>(null)
/**
* Purpose: draftSavedAt supports UsersView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/** assetModalVisible is a reactive state variable used by the template and event handlers. */
@@ -573,10 +633,30 @@ const assetModalVisible = ref(false)
const assetLoading = ref(false)
/** assetSaving is a reactive state variable used by the template and event handlers. */
const assetSaving = ref(false)
/**
* Purpose: assetTargetUser supports UsersView.vue by holding or executing the asset target user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const assetTargetUser = ref<UserVO | null>(null)
/**
* Purpose: assetData supports UsersView.vue by holding or executing the asset data page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const assetData = ref<UserAssetVO | null>(null)
/**
* Purpose: balanceHistory supports UsersView.vue by holding or executing the balance history page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const balanceHistory = ref<UserBalanceHistoryItem[]>([])
/**
* Purpose: balanceDraftSavedAt supports UsersView.vue by holding or executing the balance draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const balanceDraftSavedAt = ref<number | null>(null)
/**
* Purpose: vipDraftSavedAt supports UsersView.vue by holding or executing the vip draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipDraftSavedAt = ref<number | null>(null)
/** canOpenAssetPanel is a reactive state variable used by the template and event handlers. */
@@ -620,8 +700,16 @@ const canDeleteUser = computed(() =>
const canUnbindUser = computed(() =>
hasPermission('user:unbind')
)
/**
* Purpose: PHONE_REGEX supports UsersView.vue by holding or executing the phone regex page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const PHONE_REGEX = /^1[3-9]\d{9}$/
/**
* Purpose: pagination supports UsersView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -631,6 +719,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports UsersView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
account: '',
nickname: '',
@@ -681,6 +773,10 @@ const validatePhoneUniqueness = async (value: string) => {
}
}
/**
* Purpose: balanceForm supports UsersView.vue by holding or executing the balance form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const balanceForm = reactive<AdminUserBalanceChangeRequest>({
changeScene: 'RECHARGE',
amount: undefined as unknown as number,
@@ -689,6 +785,10 @@ const balanceForm = reactive<AdminUserBalanceChangeRequest>({
remark: ''
})
/**
* Purpose: vipForm supports UsersView.vue by holding or executing the vip form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipForm = reactive<AdminUserVipOverrideRequest>({
vipLevel: '普通',
remark: ''
@@ -773,6 +873,10 @@ const handleClearVipDraft = (showMessage = true) => {
}
}
/**
* Purpose: formRules supports UsersView.vue by holding or executing the form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRules = {
account: [
{ required: true, message: '请输入账号', trigger: 'blur' },
@@ -808,6 +912,10 @@ const formRules = {
type: [{ required: true, message: '请选择用户类型', trigger: 'change' }]
} as any
/**
* Purpose: columns supports UsersView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '头像', key: 'avatar', width: 80 },
{ title: '账号', dataIndex: 'account', key: 'account' },
@@ -821,6 +929,10 @@ const columns = [
{ title: '操作', key: 'actions', width: 280, fixed: 'right' as const }
]
/**
* Purpose: historyColumns supports UsersView.vue by holding or executing the history columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const historyColumns = [
{ title: '场景', key: 'changeScene', width: 120 },
{ title: '金额', key: 'amount', width: 110 },
@@ -1032,6 +1144,10 @@ const fetchUserList = async () => {
}
}
/**
* Purpose: resetFilters supports UsersView.vue by holding or executing the reset filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetFilters = () => {
searchText.value = ''
shopFilter.value = currentUserType.value !== 4 ? normalizeShopId(currentUserInfo?.shopId) : undefined
@@ -1465,6 +1581,10 @@ const handleVipRecalculate = () => {
})
}
/**
* Purpose: fetchVipLevelOptions supports UsersView.vue by holding or executing the fetch vip level options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const fetchVipLevelOptions = async () => {
try {
const levels = await adminVipRechargePlanApi.listVipLevelOptions(currentUserInfo?.shopId)
@@ -60,6 +60,10 @@
*/
import { onMounted, reactive, ref } from 'vue'
import { message } from 'ant-design-vue'
/**
* Purpose: Shop supports VipRechargePlansView.vue by holding or executing the shop page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminShopApi, adminVipRechargePlanApi, type Shop, type VipRechargePlanVO } from '@/api/admin'
/** loading is a reactive state variable used by the template and event handlers. */
@@ -68,12 +72,36 @@ const loading = ref(false)
const saving = ref(false)
/** formOpen is a reactive state variable used by the template and event handlers. */
const formOpen = ref(false)
/**
* Purpose: editingId supports VipRechargePlansView.vue by holding or executing the editing id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const editingId = ref<any>()
/**
* Purpose: plans supports VipRechargePlansView.vue by holding or executing the plans page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const plans = ref<VipRechargePlanVO[]>([])
/**
* Purpose: shops supports VipRechargePlansView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<Shop[]>([])
/**
* Purpose: vipLevelOptions supports VipRechargePlansView.vue by holding or executing the vip level options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipLevelOptions = ref<string[]>(['普通', '青铜', '白银', '黄金'])
/**
* Purpose: form supports VipRechargePlansView.vue by holding or executing the form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const form = reactive<any>({ shopId: undefined, title: '', rechargeAmount: 0, giftAmount: 0, vipLevel: '', description: '', sortOrder: 0, status: 1 })
/**
* Purpose: columns supports VipRechargePlansView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '标题', dataIndex: 'title', key: 'title' },
{ title: '店铺', dataIndex: 'shopName', key: 'shopName' },
@@ -84,6 +112,10 @@ const columns = [
{ title: '操作', key: 'action', width: 100 }
]
/**
* Purpose: shopOptions supports VipRechargePlansView.vue by holding or executing the shop options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopOptions = ref<Array<{ label: string; value: any }>>([])
/** money is a local helper used by this page script. */
const money = (value: number | string) => Number(value || 0).toFixed(2)
@@ -1,8 +1,16 @@
/**
* Purpose: AdminCachedUserInfo supports admin-helpers.ts by holding or executing the admin cached user info page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { loadCachedAdminUserInfo, isBootstrapAdminUser, type AdminCachedUserInfo } from '@/utils/admin-session'
export { loadCachedAdminUserInfo, isBootstrapAdminUser }
export type { AdminCachedUserInfo }
/**
* Purpose: getAdminRoleLabel supports admin-helpers.ts by holding or executing the get admin role label page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const getAdminRoleLabel = (type?: number) => {
switch (type) {
case 4:
@@ -16,6 +24,10 @@ export const getAdminRoleLabel = (type?: number) => {
}
}
/**
* Purpose: getAdminShopOptions supports admin-helpers.ts by holding or executing the get admin shop options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const getAdminShopOptions = (userInfo?: AdminCachedUserInfo | null) => {
const ids = userInfo?.shopIds || []
const names = userInfo?.shopNames || []
@@ -25,5 +37,9 @@ export const getAdminShopOptions = (userInfo?: AdminCachedUserInfo | null) => {
}))
}
/**
* Purpose: getAdminCurrentShopName supports admin-helpers.ts by holding or executing the get admin current shop name page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const getAdminCurrentShopName = (userInfo?: AdminCachedUserInfo | null) =>
userInfo?.shopName || (isBootstrapAdminUser(userInfo) ? '平台总览模式' : '游客模式')