完成JC-ArtList与JC-Salon端侧清理和统一命名

This commit is contained in:
2026-08-25 16:21:05 +08:00
parent aa93695704
commit abce4a2787
1839 changed files with 653 additions and 50415 deletions
@@ -0,0 +1,11 @@
import { describe, expect, it } from 'vitest'
import { adminNavigationItems, adminPermissionRouteMap, findAdminNavigationItemByPath, ADMIN_DASHBOARD_PATH } from './admin-navigation'
describe('admin-navigation', () => {
it('keeps dashboard landing and permission routes aligned', () => {
expect(ADMIN_DASHBOARD_PATH).toBe('/admin/dashboard')
expect(findAdminNavigationItemByPath('/admin/products')?.label).toBe('作品管理')
expect(adminPermissionRouteMap.some(item => item.code === 'shop:view' && item.path === '/admin/shops')).toBe(true)
expect(adminNavigationItems[0]?.path).toBe('/admin')
})
})
@@ -0,0 +1,56 @@
export type AdminNavIconKey =
| 'home'
| 'dashboard'
| 'user'
| 'shop'
| 'gift'
| 'message'
| 'security'
| 'tag'
| 'shopping'
| 'calendar'
| 'tool'
| 'team'
export interface AdminNavigationItem {
path: string
iconKey: AdminNavIconKey
label: string
permissionCode: string
}
export const ADMIN_HOME_PATH = '/admin'
export const ADMIN_DASHBOARD_PATH = '/admin/dashboard'
export const adminNavigationItems: AdminNavigationItem[] = [
{ path: ADMIN_HOME_PATH, iconKey: 'home', label: '首页', permissionCode: '' },
{ path: ADMIN_DASHBOARD_PATH, iconKey: 'dashboard', label: '仪表盘', permissionCode: 'dashboard:view' },
{ path: '/admin/users', iconKey: 'user', label: '用户管理', permissionCode: 'user:view' },
{ path: '/admin/products', iconKey: 'shop', label: '作品管理', permissionCode: 'product:view' },
{ path: '/admin/coupons', iconKey: 'gift', label: '优惠券管理', permissionCode: 'coupon:view' },
{ path: '/admin/comments', iconKey: 'message', label: '评论管理', permissionCode: 'comment:view' },
{ path: '/admin/shops', iconKey: 'home', label: '店铺管理', permissionCode: 'shop:view' },
{ path: '/admin/permissions', iconKey: 'security', label: '权限管理', permissionCode: 'permission:view' },
{ path: '/admin/tags', iconKey: 'tag', label: '标签管理', permissionCode: 'tag:view' },
{ path: '/admin/orders', iconKey: 'shopping', label: '订单管理', permissionCode: 'order:view' },
{ path: '/admin/schedules', iconKey: 'calendar', label: '排班管理', permissionCode: 'schedule:view' },
{ path: '/admin/after-sales', iconKey: 'message', label: '售后处理', permissionCode: 'after_sale:view' },
{ path: '/admin/inventory', iconKey: 'tool', label: '库存管理', permissionCode: 'inventory:view' },
{ path: '/admin/campaigns', iconKey: 'gift', label: '活动管理', permissionCode: 'campaign:view' },
{ path: '/admin/nail-artists', iconKey: 'team', label: '美甲师管理', permissionCode: 'nail_artist:view' },
{ path: '/admin/messages', iconKey: 'message', label: '消息发布', permissionCode: 'message:view' },
{ path: '/admin/announcements', iconKey: 'message', label: '公告管理', permissionCode: 'announcement:view' },
{ path: '/admin/vip-recharge-plans', iconKey: 'gift', label: 'VIP充值配置', permissionCode: 'user:vip:manage' },
{ path: '/admin/messagehub-push-configs', iconKey: 'message', label: '参数管理', permissionCode: 'messagehub:config:manage' },
{ path: '/admin/legal-agreements', iconKey: 'security', label: '协议管理', permissionCode: 'legal_agreement:manage' }
]
export const adminPermissionRouteMap = adminNavigationItems
.filter(item => item.permissionCode)
.map(item => ({
code: item.permissionCode,
path: item.path
}))
export const findAdminNavigationItemByPath = (path: string) =>
adminNavigationItems.find(item => item.path === path)
@@ -0,0 +1,58 @@
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 = {
...zhCN,
Modal: {
...zhCN.Modal,
okText: '确认',
cancelText: zhCN.Modal?.cancelText || '取消',
justOkText: zhCN.Modal?.justOkText || '知道了'
},
Popconfirm: {
...zhCN.Popconfirm,
okText: '确认',
cancelText: zhCN.Popconfirm?.cancelText || '取消'
},
Calendar: {
...baseCalendar,
lang: {
...baseCalendar.lang,
ok: '确认',
now: '现在时间'
}
},
DatePicker: {
...baseDatePicker,
lang: {
...baseDatePicker.lang,
ok: '确认',
now: '现在时间'
},
timePickerLocale: {
...baseDatePicker.timePickerLocale,
now: '现在时间'
}
},
TimePicker: {
...baseTimePicker,
now: '现在时间'
}
}
export default antdLocale
+40
View File
@@ -0,0 +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
@@ -0,0 +1,12 @@
function normalizeBrandValue(value: string | undefined, fallbackValue: string): string {
const target = String(value || fallbackValue).trim()
return target || fallbackValue
}
export const BRAND_CONFIG = {
appName: normalizeBrandValue(import.meta.env.VITE_APP_NAME, '甲屿设计师'),
appNameEn: normalizeBrandValue(import.meta.env.VITE_APP_NAME_EN, 'Jiayu Designer'),
appTitle: normalizeBrandValue(import.meta.env.VITE_APP_TITLE, '甲屿设计师'),
adminAppName: normalizeBrandValue(import.meta.env.VITE_ADMIN_APP_NAME, '甲屿设计师管理台'),
appShortName: normalizeBrandValue(import.meta.env.VITE_APP_SHORT_NAME, 'YN')
}