import Vue from "vue"; import Router from "vue-router"; Vue.use(Router); /* Layout */ import Layout from "@/layout"; import StoreLayout from "@/layout/store"; /** * Note: sub-menu only appear when route children.length >= 1 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html * * hidden: true if set true, item will not show in the sidebar(default is false) * alwaysShow: true if set true, will always show the root menu * if not set alwaysShow, when item has more than one children route, * it will becomes nested mode, otherwise not show the root menu * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb * name:'router-name' the name is used by (must set!!!) * meta : { roles: ['admin','editor'] control the page roles (you can set multiple roles) title: 'title' the name show in sidebar and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if set false, the item will hidden in breadcrumb(default is true) activeMenu: '/example/list' if set path, the sidebar will highlight the path you set } */ /** * constantRoutes * a base page that does not have permission requirements * all roles can be accessed */ export const constantRoutes = [ { path: "/login", component: () => import("@/views/system/login"), hidden: true, }, { path: "/register", component: () => import("@/views/system/register"), hidden: true, }, { path: '/gallery', redirect: '/gallery/index', component: StoreLayout, children: [{ path: 'index', name: 'Gallery', component: () => import('@/views/app-store/gallery'), meta: { title: '商店首页', icon: 'home' } }] }, { path: '/application', redirect: '/application/index', component: StoreLayout, children: [{ path: 'index', name: 'Application', component: () => import('@/views/app-store/app'), meta: { title: '应用详情', icon: 'home' } }] }, { path: '/list', redirect: '/list/index', component: StoreLayout, children: [{ path: 'index', name: 'AppList', component: () => import('@/views/app-store/list'), meta: { title: '游戏', icon: 'home' } }] }, { path: '/category', redirect: '/category/index', component: StoreLayout, children: [{ path: 'index', name: 'AppCategory', component: () => import('@/views/app-store/category'), meta: { title: '应用分类', icon: 'home' } }] }, { path: '/rank', redirect: '/rank/index', component: StoreLayout, children: [{ path: 'index', name: 'AppRank', component: () => import('@/views/app-store/rank'), meta: { title: '应用排行', icon: 'home' } }] }, { path: '/topic', redirect: '/topic/index', component: StoreLayout, children: [{ path: 'index', name: 'AppTopic', component: () => import('@/views/app-store/topic'), meta: { title: '应用排行', icon: 'home' } }] }, { path: '/search', redirect: '/search/index', component: StoreLayout, children: [{ path: 'index', name: 'AppSearch', component: () => import('@/views/app-store/search'), meta: { title: '搜索应用', icon: 'home' } }] }, { path: '/my', redirect: '/my/index', component: StoreLayout, children: [{ path: 'index', name: 'AppProfile', component: () => import('@/views/app-store/profile'), meta: { title: '个人中心', icon: 'shangcheng' } }] }, { path: '/auth', redirect: '/auth/index', component: StoreLayout, children: [{ path: 'index', name: 'AppAuth', component: () => import('@/views/app-store/auth'), meta: { title: '账号认证', icon: 'shangcheng' } }] }, { path: '/developer', redirect: '/developer/index', component: StoreLayout, children: [{ path: 'index', name: 'Developer', component: () => import('@/views/app-store/developer'), meta: { title: '开发者中心', icon: 'home' } }] }, { path: '/docs', redirect: '/docs/index', component: Layout, children: [{ path: 'index', name: 'Document', component: () => import('@/views/app-store/docs'), meta: { title: '开发文档', icon: 'shangcheng' } }] }, { path: '/home', redirect: '/home/index', component: Layout, children: [{ path: 'index', name: 'AppIndex', component: () => import('@/views/system/apps'), meta: { title: '应用管理', icon: 'home' } }] }, { path: '/chart', redirect: '/chart/index', component: Layout, children: [{ path: 'index', name: 'AppChart', component: () => import('@/views/system/chart'), meta: { title: '实时曲线', icon: 'home' } }] }, { path: '/tool', redirect: '/tool/font', component: Layout, children: [{ path: 'font', name: 'FontTool', component: () => import('@/views/system/font-tool'), meta: { title: '字体转换工具', icon: 'home' } }] }, { path: '/tool', redirect: '/tool/index', component: Layout, children: [{ path: 'index', name: 'AppTool', component: () => import('@/views/system/tool'), meta: { title: '工具', icon: 'home' } }] }, { path: '/build', redirect: '/build/index', component: Layout, children: [{ path: 'index', name: 'AppBuild', component: () => import('@/views/system/build'), meta: { title: '打包日志', icon: 'home' } }] }, { path: '/opqcp', redirect: '/opqcp/index', component: Layout, children: [{ path: 'index', name: 'Opqcp', component: () => import('@/views/system/opqcp'), meta: { title: 'opqcp', icon: 'home' } }] }, { path: '/bytecode', redirect: '/bytecode/index', component: Layout, children: [{ path: 'index', name: 'ByteCodeFile', component: () => import('@/views/system/bytecode-tool'), meta: { title: 'bytecode', icon: 'home' } }] }, { path: '/monitor', redirect: '/monitor/index', component: Layout, children: [{ path: 'index', name: 'Monitor', component: () => import('@/views/system/monitor'), meta: { title: '资源监视', icon: 'home' } }] }, { path: '/device', redirect: '/device/index', component: Layout, children: [{ path: 'index', name: 'Device', component: () => import('@/views/system/device'), meta: { title: '设备管理', icon: 'gongzuotai' } }] }, { path: '/profile', redirect: '/profile/index', component: Layout, children: [{ path: 'index', name: 'Profile', component: () => import('@/views/system/profile'), meta: { title: '个人中心', icon: 'shangcheng' } }] }, { path: '/user', redirect: '/user/index', component: Layout, children: [{ path: 'index', name: 'UserIndex', component: () => import('@/views/system/users'), meta: { title: '用户管理', icon: 'shangcheng' } }] }, { path: '/404', redirect: '/404/index', component: Layout, children: [{ path: 'index', name: 'Page404', component: () => import('@/views/error-pages/404'), meta: { title: '404', icon: 'home' } }] }, { path: '/403', redirect: '/403/index', component: Layout, children: [{ path: 'index', name: 'Page403', component: () => import('@/views/error-pages/403'), meta: { title: '403', icon: 'home' } }] }, { path: '/not-found', redirect: '/not-found/index', component: StoreLayout, children: [{ path: 'index', name: 'NotFound', component: () => import('@/views/error-pages/not-found'), meta: { title: 'not-found', icon: 'home' } }] }, { path: '*', redirect: '/404', hidden: true } ]; // 404 page must be placed at the end !!! export const notFound = { path: '*', redirect: '/404', hidden: true } const createRouter = () => new Router({ // mode: 'history', // require service support, 后台部署在/static 目录 // base: "/static", // 应用的基础路径: 默认为'/',修改为'/static' scrollBehavior: () => ({ y: 0 }), routes: constantRoutes, }); const router = createRouter(); // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 export function resetRouter() { const newRouter = createRouter(); router.matcher = newRouter.matcher; // reset router } export default router;