import { MockMethod } from 'vite-plugin-mock' import { SUCCESS_CODE } from '@/constants' const timeout = 1000 const adminList = [ { path: '/dashboard', component: '#', redirect: '/dashboard/index', name: 'Dashboard', meta: { title: '工作台', icon: 'ant-design:dashboard-filled' }, children: [ { path: 'index', name: 'dashboard', component: 'views/common/DashboardView', meta: { title: '工作台', icon: 'ant-design:dashboard-filled', affix: true } } ] }, { path: '/content', component: '#', redirect: '/content/dramas', name: 'Content', meta: { title: '内容管理', icon: 'ep:video-camera', alwaysShow: true }, children: [ { path: 'dramas', name: 'dramas', component: 'views/contentManagement/DramaManagementView', meta: { title: '短剧管理' } }, { path: 'episodes', name: 'episodes', component: 'views/contentManagement/EpisodeManagementView', meta: { title: '剧集管理' } } ] }, { path: '/system', component: '#', redirect: '/system/access', name: 'System', meta: { title: '后台管理', icon: 'ep:setting', alwaysShow: true }, children: [ { path: 'access', name: 'access', component: 'views/permission/RoleManagementView', meta: { title: '角色权限配置' } }, { path: 'admin-users', name: 'admin-users', component: 'views/userManagement/AdminUsersView', meta: { title: '管理员用户列表' } }, { path: 'menus', name: 'menus', component: 'views/permission/MenuManagementView', meta: { title: '菜单管理' } }, { path: 'role-categories', name: 'role-categories', component: 'views/permission/RoleCategoriesView', meta: { title: '角色分类' } }, { path: 'settings', name: 'settings', component: 'views/systemManagement/SettingsView', meta: { title: '系统设置' } } ] } ] const testList = adminList.filter((route) => route.path !== '/system') export default [ // 列表接口 { url: '/mock/role/list', method: 'get', timeout, response: ({ query }) => { const { roleName } = query return { code: SUCCESS_CODE, data: roleName === 'admin' ? adminList : testList } } } ] as MockMethod[]