export const USER_STATUS = { ENABLED: 1, DISABLED: 0, } as const export type UserStatus = (typeof USER_STATUS)[keyof typeof USER_STATUS] export interface MockUser { id: number mini_id: number openid: string union_id: string nickname: string avatar: string status: 0 | 1 created_at: string updated_at: string } export const users: MockUser[] = Array.from({ length: 15 }, (_, index) => { const id = index + 1 return { id, mini_id: (id % 3) + 1, openid: `oABC${String(100000 + id)}`, union_id: id % 2 === 0 ? `uXYZ${id}` : '', nickname: `用户${id}`, avatar: `https://picsum.photos/seed/${id}/80`, status: id % 4 === 0 ? 0 : 1, created_at: new Date(Date.now() - id * 86400000).toISOString(), updated_at: new Date(Date.now() - id * 3600000).toISOString(), } }) export interface MockMiniApp { id: number name: string description: string app_id: string app_secret: string status: 0 | 1 ext: string created_at: string updated_at: string } export const miniApps: MockMiniApp[] = Array.from({ length: 12 }, (_, index) => { const id = index + 1 return { id, name: `小程序${id}`, description: `用于演示的第 ${id} 个小程序`, app_id: `wx${String(1000000000 + id * 137)}`, app_secret: `secret-${id}`, status: id % 3 === 0 ? 0 : 1, ext: '{}', created_at: new Date(Date.now() - id * 86400000).toISOString(), updated_at: new Date(Date.now() - id * 3600000).toISOString(), } }) export interface MockFile { id: number storage_key: string filename: string origin_name: string mime_type: string ext: string size: number uploader_type: 'admin' | 'ma' uploader_id: number url: string created_at: string } const MIME_BY_EXT: Record = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif', pdf: 'application/pdf', docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', txt: 'text/plain', } const MOCK_FILE_SAMPLES = [ { name: '产品截图.png', ext: 'png', size: 245_000 }, { name: '用户头像.jpg', ext: 'jpg', size: 88_400 }, { name: '操作手册.pdf', ext: 'pdf', size: 1_280_000 }, { name: '数据报表.xlsx', ext: 'xlsx', size: 56_200 }, { name: '说明文档.docx', ext: 'docx', size: 33_100 }, { name: '日志备份.txt', ext: 'txt', size: 12_800 }, ] export const files: MockFile[] = Array.from({ length: 18 }, (_, index) => { const id = index + 1 const sample = MOCK_FILE_SAMPLES[index % MOCK_FILE_SAMPLES.length] const rand = Math.random().toString(36).slice(2, 10) return { id, storage_key: `2026/10/27/${rand}.${sample.ext}`, filename: `${rand}.${sample.ext}`, origin_name: sample.name, mime_type: MIME_BY_EXT[sample.ext] ?? 'application/octet-stream', ext: sample.ext, size: sample.size + (id % 7) * 1024, uploader_type: id % 3 === 0 ? 'ma' : 'admin', uploader_id: (id % 3) + 1, url: `/files/static/2026/10/27/${rand}.${sample.ext}`, created_at: new Date(Date.now() - id * 3_600_000).toISOString().slice(0, 19).replace('T', ' '), } }) export const menuRoutes = [ { path: '/system', component: 'Layout', redirect: '/system/user', meta: { title: '系统管理', icon: 'Setting', hidden: false }, children: [ { path: 'user', component: 'system/user/index', name: 'User', meta: { title: '用户管理', icon: 'User', hidden: false }, }, ], }, { path: '/miniapp', component: 'Layout', redirect: '/miniapp/list', meta: { title: '小程序管理', icon: 'Menu', hidden: false }, children: [ { path: 'list', component: 'miniapp/index', name: 'Miniapp', meta: { title: '小程序管理', icon: 'Menu', hidden: false }, }, ], }, ]