import Layout from '@/layout' import {getInfo} from '../store/modules/user.js' export function getRoutes() { let userInfo ={} if (localStorage.userinfo) { userInfo = JSON.parse(localStorage.userinfo) } console.log(userInfo) let constantRoutes1 = [] if(userInfo.UserId==1){ constantRoutes1 = [{ path: '/login', component: () => import('@/views/login/index'), hidden: true }, { path: '/404', component: () => import('@/views/404'), hidden: true }, { path: '/', component: Layout, redirect: '/dashboard', children: [{ path: 'dashboard', name: '首页', component: () => import('@/views/dashboard/index'), meta: { title: '首页', icon: 'dashboard' } }] }, // { // path: '/example', // component: Layout, // redirect: '/example/table', // name: 'Example', // meta: { // title: '题库管理', // icon: 'el-icon-s-help' // }, // children: [{ // path: 'QuestionBank', // name: 'Table', // component: () => import('@/views/QuestionBank/index'), // meta: { // title: '题库', // icon: 'table' // } // }] // }, { path: '/moduleIndex', component: Layout, redirect: '/module/index', name: 'module', meta: { title: '练习', icon: 'el-icon-s-help' }, children: [{ path: 'recharge', name: 'recharge', component: () => import('@/views/module/index'), meta: { title: '章节练习', icon: 'el-icon-s-operation' } }, { path: 'index', name: 'index', component: () => import('@/views/TestPaper/index'), hidden: true, meta: { title: '试卷维护', icon: 'table' } }, ] }, { path: '/realQuestion', component: Layout, redirect: '/module/realQuestion', name: 'realQuestion', meta: { title: '历年真题', icon: 'el-icon-s-help' }, children: [{ path: 'recharge', name: 'recharge', component: () => import('@/views/module/realQuestion'), meta: { title: '历年真题', icon: 'el-icon-s-management' } }] }, { path: '/simulation', component: Layout, redirect: '/module/simulation', name: 'module', meta: { title: '模拟试卷', icon: 'el-icon-s-help' }, children: [{ path: 'recharge', name: 'recharge', component: () => import('@/views/module/simulation'), meta: { title: '模拟试卷', icon: 'el-icon-s-promotion' } }] }, { path: '/views', component: Layout, redirect: '/views/TestPaper', name: 'TestPaper', meta: { title: '试卷管理', icon: 'el-icon-s-help' }, children: [ { path: 'TestPaperList', name: 'Table', component: () => import('@/views/TestPaper/TestPaperList'), meta: { title: '试卷列表', icon: 'table' } }, { path: 'index', name: 'index', component: () => import('@/views/TestPaper/index'), hidden: true, meta: { title: '试卷维护', icon: 'table' } }, { path: 'ManualTestPaper', name: 'Table', component: () => import('@/views/TestPaper/ManualTestPaper'), meta: { title: '组卷', icon: 'table' } }, ] }, { path: '/order', component: Layout, redirect: '/', name: 'order', meta: { title: '订单管理', icon: 'el-icon-s-marketing' }, children: [{ path: 'recharge', name: 'recharge', component: () => import('@/views/order/rechargeList'), meta: { title: '充值记录', } }, { path: 'shop', name: 'shop', component: () => import('@/views/order/shopList'), meta: { title: '购买记录', } }] }, { path: '/user', component: Layout, redirect: '/', name: 'user', meta: { title: '用户管理', icon: 'el-icon-s-help' }, children: [{ path: 'user', name: 'User', component: () => import('@/views/user/userlist'), meta: { title: '普通用户列表', } }, { path: 'admin', name: 'admin', component: () => import('@/views/user/adminList'), meta: { title: '管理员列表', } }, ] }, { path: '/password', component: Layout, redirect: '/', name: 'password', meta: { title: '系统管理', icon: 'el-icon-s-platform' }, children: [{ path: 'index', name: 'index', component: () => import('@/views/password/index'), meta: { title: '忘记密码', } }, { path: 'TestPaperClass', name: 'Table', component: () => import('@/views/TestPaper/TestPaperClass'), meta: { title: '分类管理', } }, { path: 'carousel', name: 'carousel', component: () => import('@/views/carousel/index'), meta: { title: '轮播图', } }, { path: 'new', name: 'new', component: () => import('@/views/carousel/new'), meta: { title: '最新资讯', } }] }, // 404 page must be placed at the end !!! { path: '*', redirect: '/404', hidden: true } ] }else { constantRoutes1 = [{ path: '/login', component: () => import('@/views/login/index'), hidden: true }, { path: '/404', component: () => import('@/views/404'), hidden: true }, { path: '/', component: Layout, redirect: '/dashboard', children: [{ path: 'dashboard', name: '首页', component: () => import('@/views/dashboard/index'), meta: { title: '首页', icon: 'dashboard' } }] }, // { // path: '/example', // component: Layout, // redirect: '/example/table', // name: 'Example', // meta: { // title: '题库管理', // icon: 'el-icon-s-help' // }, // children: [{ // path: 'QuestionBank', // name: 'Table', // component: () => import('@/views/QuestionBank/index'), // meta: { // title: '题库', // icon: 'table' // } // }] // }, { path: '/moduleIndex', component: Layout, redirect: '/module/index', name: 'module', meta: { title: '练习', icon: 'el-icon-s-help' }, children: [{ path: 'recharge', name: 'recharge', component: () => import('@/views/module/index'), meta: { title: '练习', icon: 'el-icon-s-operation' } }, { path: 'index', name: 'index', component: () => import('@/views/TestPaper/index'), hidden: true, meta: { title: '试卷维护', icon: 'table' } }, ] }, { path: '/realQuestion', component: Layout, redirect: '/module/realQuestion', name: 'realQuestion', meta: { title: '历年真题', icon: 'el-icon-s-help' }, children: [{ path: 'recharge', name: 'recharge', component: () => import('@/views/module/realQuestion'), meta: { title: '历年真题', icon: 'el-icon-s-management' } }] }, { path: '/simulation', component: Layout, redirect: '/module/simulation', name: 'module', meta: { title: '模拟试卷', icon: 'el-icon-s-help' }, children: [{ path: 'recharge', name: 'recharge', component: () => import('@/views/module/simulation'), meta: { title: '模拟试卷', icon: 'el-icon-s-promotion' } }] }, // { // path: '/views', // component: Layout, // redirect: '/views/TestPaper', // name: 'TestPaper', // meta: { // title: '试卷管理', // icon: 'el-icon-s-help' // }, // children: [ // { // path: 'TestPaperList', // name: 'Table', // component: () => import('@/views/TestPaper/TestPaperList'), // meta: { // title: '试卷列表', // icon: 'table' // } // }, // { // path: 'index', // name: 'index', // component: () => import('@/views/TestPaper/index'), // hidden: true, // meta: { // title: '试卷维护', // icon: 'table' // } // }, // // { // // path: 'ManualTestPaper', // // name: 'Table', // // component: () => import('@/views/TestPaper/ManualTestPaper'), // // meta: { // // title: '组卷', // // icon: 'table' // // } // // }, // ] // }, { path: '/order', component: Layout, redirect: '/', name: 'order', meta: { title: '订单管理', icon: 'el-icon-s-marketing' }, children: [{ path: 'recharge', name: 'recharge', component: () => import('@/views/order/rechargeList'), meta: { title: '充值记录', } }, { path: 'shop', name: 'shop', component: () => import('@/views/order/shopList'), meta: { title: '购买记录', } }] }, { path: '/user', component: Layout, redirect: '/', name: 'user', meta: { title: '用户管理', icon: 'el-icon-s-help' }, children: [{ path: 'user', name: 'User', component: () => import('@/views/user/userlist'), meta: { title: '普通用户列表', } }, ] }, { path: '/password', component: Layout, redirect: '/', name: 'password', meta: { title: '系统管理', icon: 'el-icon-s-platform' }, children: [{ path: 'index', name: 'index', component: () => import('@/views/password/index'), meta: { title: '忘记密码', } }, { path: 'TestPaperClass', name: 'Table', component: () => import('@/views/TestPaper/TestPaperClass'), meta: { title: '分类管理', } }, { path: 'carousel', name: 'carousel', component: () => import('@/views/carousel/index'), meta: { title: '轮播图', } }, { path: 'new', name: 'new', component: () => import('@/views/carousel/new'), meta: { title: '最新资讯', } }] }, // 404 page must be placed at the end !!! { path: '*', redirect: '/404', hidden: true } ] } return constantRoutes1; }