123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- import Vue from 'vue'
- import Router from 'vue-router'
- import AppIndex from '../views/home/AppIndex'
- import RouterView from '../views/home/RouterView'
- import {vaildJWT} from "../utils/service/jwt";
- import {getCookie, setCookie} from "../utils/service/cookie";
- Vue.use(Router)
- const defaultRouter = new Router({
- routes: [
- {
- path: '/index',
- name: 'AppIndex',
- component: AppIndex,
- children: [
- {
- path: '/home',
- name: 'Home',
- component: () => import('../views/homePage/Index'),
- meta: { title: '首页', icon: 'icon-menu icon-home', menuKey: "sy" },
- },
- {
- path: '/userManage',
- name: 'UserManage',
- component: RouterView,
- meta: { title: '用户管理', icon: 'icon-menu icon-yhgl', menuKey: "yhgl" },
- children: [
- {
- path: 'userList',
- name: 'UserList',
- component: () => import('../views/userManage/UserList'),
- meta: { title: '用户列表', menuKey: "yhlb" },
- },
- {
- path: 'userListDetail/:id',
- name: 'UserListDetail',
- component: () => import('../views/userManage/UserListDetail'),
- meta: { menuKey: "yhlb" },
- hidden: true
- },
- {
- path: 'userListEdit/:id',
- name: 'UserListEdit',
- component: () => import('../views/userManage/UserListDetail'),
- meta: { menuKey: "yhlb" },
- hidden: true
- },
- {
- path: 'userListAdd',
- name: 'UserListAdd',
- component: () => import('../views/userManage/UserListDetail'),
- meta: { menuKey: "yhlb" },
- hidden: true
- },
- {
- path: 'userApproval',
- name: 'UserApproval',
- component: () => import('../views/userManage/UserApproval'),
- meta: { title: '用户审批', menuKey: "yhsp" },
- hidden: true
- },
- {
- path: 'authManage',
- name: 'AuthManage',
- component: () => import('../views/userManage/AuthManage'),
- meta: { title: '权限管理', menuKey: "qxgl" },
- },
- {
- path: 'authManageAdd',
- name: 'AuthManageAdd',
- component: () => import('../views/userManage/AuthManageEdit'),
- meta: { menuKey: "qxgl" },
- hidden: true
- },
- {
- path: 'authManageDetail/:id',
- name: 'AuthManageDetail',
- component: () => import('../views/userManage/AuthManageEdit'),
- meta: { menuKey: "qxgl" },
- hidden: true
- },
- {
- path: 'authManageEdit/:id',
- name: 'AuthManageEdit',
- component: () => import('../views/userManage/AuthManageEdit'),
- meta: { menuKey: "qxgl" },
- hidden: true
- }
- ]
- },
- {
- path: '/logManage',
- name: 'LogManage',
- component: RouterView,
- meta: { title: '日志管理', icon: 'icon-menu icon-rzgl', menuKey: "rzgl" },
- children: [
- {
- path: 'userLoginLogs',
- name: 'UserLoginLogs',
- component: () => import('../views/logManage/UserLoginLogs'),
- meta: { title: '用户登录日志', menuKey: "yhdlrz" },
- },
- {
- path: 'sysOperationLog',
- name: 'SysOperationLog',
- component: () => import('../views/logManage/SysOperationLog'),
- meta: { title: '系统操作日志', menuKey: "xtczrz" },
- }
- ]
- },
- {
- path: '/sysConfigs',
- name: 'SysConfigs',
- component: RouterView,
- meta: { title: '系统设置', icon: 'icon-menu icon-xtsz', menuKey: "xtsz" },
- children: [
- {
- path: 'orgConfig',
- name: 'OrgConfig',
- component: () => import('../views/sysConfigs/OrgConfig'),
- meta: { title: '单位设置', menuKey: "dwsz" },
- },
- ]
- }
- ]
- },
- {
- path: '/',
- redirect: '/home',
- }
- ]
- })
- defaultRouter.beforeEach((to, from, next) => {
- // console.log("to:", to, "from:", from)
- vaildJWT(getCookie("m_token")).then(res=>{
- if (res.code==="200") {
- setCookie('name', res.data.name, 1)
- next()
- }else {
- window.open(
- `http://47.101.207.123:8080/platform-rk/#/login?url=http://47.101.207.123:8080/user_authentication/#/home`,
- "_self",
- "",
- true
- )
- // location.href = "http://47.101.207.123:8080/platform-rk/#/login?url=http://47.101.207.123:8080/user_authentication/#/home"
- }
- },error=>{
- window.open(
- `http://47.101.207.123:8080/platform-rk/#/login?url=http://47.101.207.123:8080/user_authentication/#/home`,
- "_self",
- "",
- true
- )
- // location.href = "http://47.101.207.123:8080/platform-rk/#/login?url=http://47.101.207.123:8080/user_authentication/#/home"
- })
- // next()
- })
- export default defaultRouter
|