123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532 |
- import { config } from '@/config/axios/config'
- import { MockMethod } from 'vite-plugin-mock'
- const { result_code } = config
- const timeout = 1000
- const adminList = [
- {
- path: '/dashboard',
- component: '#',
- redirect: '/dashboard/analysis',
- name: 'Dashboard',
- meta: {
- title: 'router.dashboard',
- icon: 'ant-design:dashboard-filled',
- alwaysShow: true
- },
- children: [
- {
- path: 'analysis',
- component: 'views/Dashboard/Analysis',
- name: 'Analysis',
- meta: {
- title: 'router.analysis',
- noCache: true
- }
- },
- {
- path: 'workplace',
- component: 'views/Dashboard/Workplace',
- name: 'Workplace',
- meta: {
- title: 'router.workplace',
- noCache: true
- }
- }
- ]
- },
- {
- path: '/external-link',
- component: '#',
- meta: {},
- name: 'ExternalLink',
- children: [
- {
- path: 'https://element-plus-admin-doc.cn/',
- name: 'DocumentLink',
- meta: {
- title: 'router.document',
- icon: 'clarity:document-solid'
- }
- }
- ]
- },
- {
- path: '/guide',
- component: '#',
- name: 'Guide',
- meta: {},
- children: [
- {
- path: 'index',
- component: 'views/Guide/Guide',
- name: 'GuideDemo',
- meta: {
- title: 'router.guide',
- icon: 'cib:telegram-plane'
- }
- }
- ]
- },
- {
- path: '/components',
- component: '#',
- redirect: '/components/icon',
- name: 'ComponentsDemo',
- meta: {
- title: 'router.component',
- icon: 'bx:bxs-component',
- alwaysShow: true
- },
- children: [
- {
- path: 'form',
- component: '##',
- name: 'Form',
- meta: {
- title: 'router.form',
- alwaysShow: true
- },
- children: [
- {
- path: 'default-form',
- component: 'views/Components/Form/DefaultForm',
- name: 'DefaultForm',
- meta: {
- title: 'router.defaultForm'
- }
- },
- {
- path: 'use-form',
- component: 'views/Components/Form/UseFormDemo',
- name: 'UseForm',
- meta: {
- title: 'UseForm'
- }
- },
- {
- path: 'ref-form',
- component: 'views/Components/Form/RefForm',
- name: 'RefForm',
- meta: {
- title: 'RefForm'
- }
- }
- ]
- },
- {
- path: 'table',
- component: '##',
- name: 'TableDemo',
- meta: {
- title: 'router.table',
- alwaysShow: true
- },
- children: [
- {
- path: 'default-table',
- component: 'views/Components/Table/DefaultTable',
- name: 'DefaultTable',
- meta: {
- title: 'router.defaultTable'
- }
- },
- {
- path: 'use-table',
- component: 'views/Components/Table/UseTableDemo',
- name: 'UseTable',
- meta: {
- title: 'UseTable'
- }
- },
- {
- path: 'ref-table',
- component: 'views/Components/Table/RefTable',
- name: 'RefTable',
- meta: {
- title: 'RefTable'
- }
- }
- ]
- },
- {
- path: 'editor-demo',
- component: '##',
- name: 'EditorDemo',
- meta: {
- title: 'router.editor',
- alwaysShow: true
- },
- children: [
- {
- path: 'editor',
- component: 'views/Components/Editor/Editor',
- name: 'Editor',
- meta: {
- title: 'router.richText'
- }
- }
- ]
- },
- {
- path: 'search',
- component: 'views/Components/Search',
- name: 'Search',
- meta: {
- title: 'router.search'
- }
- },
- {
- path: 'descriptions',
- component: 'views/Components/Descriptions',
- name: 'Descriptions',
- meta: {
- title: 'router.descriptions'
- }
- },
- {
- path: 'image-viewer',
- component: 'views/Components/ImageViewer',
- name: 'ImageViewer',
- meta: {
- title: 'router.imageViewer'
- }
- },
- {
- path: 'dialog',
- component: 'views/Components/Dialog',
- name: 'Dialog',
- meta: {
- title: 'router.dialog'
- }
- },
- {
- path: 'icon',
- component: 'views/Components/Icon',
- name: 'Icon',
- meta: {
- title: 'router.icon'
- }
- },
- {
- path: 'echart',
- component: 'views/Components/Echart',
- name: 'Echart',
- meta: {
- title: 'router.echart'
- }
- },
- {
- path: 'count-to',
- component: 'views/Components/CountTo',
- name: 'CountTo',
- meta: {
- title: 'router.countTo'
- }
- },
- {
- path: 'qrcode',
- component: 'views/Components/Qrcode',
- name: 'Qrcode',
- meta: {
- title: 'router.qrcode'
- }
- },
- {
- path: 'highlight',
- component: 'views/Components/Highlight',
- name: 'Highlight',
- meta: {
- title: 'router.highlight'
- }
- },
- {
- path: 'infotip',
- component: 'views/Components/Infotip',
- name: 'Infotip',
- meta: {
- title: 'router.infotip'
- }
- },
- {
- path: 'input-password',
- component: 'views/Components/InputPassword',
- name: 'InputPassword',
- meta: {
- title: 'router.inputPassword'
- }
- },
- {
- path: 'sticky',
- component: 'views/Components/Sticky',
- name: 'Sticky',
- meta: {
- title: 'router.sticky'
- }
- }
- ]
- },
- {
- path: '/hooks',
- component: '#',
- redirect: '/hooks/useWatermark',
- name: 'Hooks',
- meta: {
- title: 'hooks',
- icon: 'ic:outline-webhook',
- alwaysShow: true
- },
- children: [
- {
- path: 'useWatermark',
- component: 'views/hooks/useWatermark',
- name: 'UseWatermark',
- meta: {
- title: 'useWatermark'
- }
- },
- {
- path: 'useCrudSchemas',
- component: 'views/hooks/useCrudSchemas',
- name: 'UseCrudSchemas',
- meta: {
- title: 'useCrudSchemas'
- }
- }
- ]
- },
- {
- path: '/level',
- component: '#',
- redirect: '/level/menu1/menu1-1/menu1-1-1',
- name: 'Level',
- meta: {
- title: 'router.level',
- icon: 'carbon:skill-level-advanced'
- },
- children: [
- {
- path: 'menu1',
- name: 'Menu1',
- component: '##',
- redirect: '/level/menu1/menu1-1/menu1-1-1',
- meta: {
- title: 'router.menu1'
- },
- children: [
- {
- path: 'menu1-1',
- name: 'Menu11',
- component: '##',
- redirect: '/level/menu1/menu1-1/menu1-1-1',
- meta: {
- title: 'router.menu11',
- alwaysShow: true
- },
- children: [
- {
- path: 'menu1-1-1',
- name: 'Menu111',
- component: 'views/Level/Menu111',
- meta: {
- title: 'router.menu111'
- }
- }
- ]
- },
- {
- path: 'menu1-2',
- name: 'Menu12',
- component: 'views/Level/Menu12',
- meta: {
- title: 'router.menu12'
- }
- }
- ]
- },
- {
- path: 'menu2',
- name: 'Menu2Demo',
- component: 'views/Level/Menu2',
- meta: {
- title: 'router.menu2'
- }
- }
- ]
- },
- {
- path: '/example',
- component: '#',
- redirect: '/example/example-dialog',
- name: 'Example',
- meta: {
- title: 'router.example',
- icon: 'ep:management',
- alwaysShow: true
- },
- children: [
- {
- path: 'example-dialog',
- component: 'views/Example/Dialog/ExampleDialog',
- name: 'ExampleDialog',
- meta: {
- title: 'router.exampleDialog'
- }
- },
- {
- path: 'example-page',
- component: 'views/Example/Page/ExamplePage',
- name: 'ExamplePage',
- meta: {
- title: 'router.examplePage'
- }
- },
- {
- path: 'example-add',
- component: 'views/Example/Page/ExampleAdd',
- name: 'ExampleAdd',
- meta: {
- title: 'router.exampleAdd',
- noTagsView: true,
- noCache: true,
- hidden: true,
- showMainRoute: true,
- activeMenu: '/example/example-page'
- }
- },
- {
- path: 'example-edit',
- component: 'views/Example/Page/ExampleEdit',
- name: 'ExampleEdit',
- meta: {
- title: 'router.exampleEdit',
- noTagsView: true,
- noCache: true,
- hidden: true,
- showMainRoute: true,
- activeMenu: '/example/example-page'
- }
- },
- {
- path: 'example-detail',
- component: 'views/Example/Page/ExampleDetail',
- name: 'ExampleDetail',
- meta: {
- title: 'router.exampleDetail',
- noTagsView: true,
- noCache: true,
- hidden: true,
- showMainRoute: true,
- activeMenu: '/example/example-page'
- }
- }
- ]
- },
- {
- path: '/error',
- component: '#',
- redirect: '/error/404',
- name: 'Error',
- meta: {
- title: 'router.errorPage',
- icon: 'ci:error',
- alwaysShow: true
- },
- children: [
- {
- path: '404-demo',
- component: 'views/Error/404',
- name: '404Demo',
- meta: {
- title: '404'
- }
- },
- {
- path: '403-demo',
- component: 'views/Error/403',
- name: '403Demo',
- meta: {
- title: '403'
- }
- },
- {
- path: '500-demo',
- component: 'views/Error/500',
- name: '500Demo',
- meta: {
- title: '500'
- }
- }
- ]
- }
- ]
- const testList: string[] = [
- '/dashboard',
- '/dashboard/analysis',
- '/dashboard/workplace',
- 'external-link',
- 'https://element-plus-admin-doc.cn/',
- '/guide',
- '/guide/index',
- '/components',
- '/components/form',
- '/components/form/default-form',
- '/components/form/use-form',
- '/components/form/ref-form',
- '/components/table',
- '/components/table/default-table',
- '/components/table/use-table',
- '/components/table/ref-table',
- '/components/editor-demo',
- '/components/editor-demo/editor',
- '/components/search',
- '/components/descriptions',
- '/components/image-viewer',
- '/components/dialog',
- '/components/icon',
- '/components/echart',
- '/components/count-to',
- '/components/qrcode',
- '/components/highlight',
- '/components/infotip',
- '/Components/InputPassword',
- '/Components/Sticky',
- '/hooks',
- '/hooks/useWatermark',
- '/hooks/useCrudSchemas',
- '/level',
- '/level/menu1',
- '/level/menu1/menu1-1',
- '/level/menu1/menu1-1/menu1-1-1',
- '/level/menu1/menu1-2',
- '/level/menu2',
- '/example',
- '/example/example-dialog',
- '/example/example-page',
- '/example/example-add',
- '/example/example-edit',
- '/example/example-detail',
- '/error',
- '/error/404-demo',
- '/error/403-demo',
- '/error/500-demo'
- ]
- export default [
- // 列表接口
- {
- url: '/role/list',
- method: 'get',
- timeout,
- response: ({ query }) => {
- const { roleName } = query
- return {
- code: result_code,
- data: roleName === 'admin' ? adminList : testList
- }
- }
- }
- ] as MockMethod[]
|