import Vue from 'vue'
import Router from 'vue-router'
// 开发环境不使用懒加载, 因为懒加载页面太多的话会造成webpack热更新太慢, 所以只有开发环境使用懒加载
const _import = require('./import-' + process.env.NODE_ENV)
import Home from '../views/home/index.vue'
import InsertIframe from '../views/layout/insert-iframe.vue'
//审批管理的配置
import FirstExamine from '../views/audit/first-examine.vue'
import SecondExamine from '../views/audit/second-examine.vue'
import CaseList from '../views/audit/case-list.vue'
import ExaminePool from '../views/audit/examine-pool.vue'
import FirstDetails from '../views/audit/first-details.vue'
import SecondDetails from '../views/audit/second-details.vue'
import CaseDetails from '../views/audit/case-details.vue'
// 财务管理的配置
import FinancialLoan from '../views/financialManagement/financialLoan.vue'
import LoanManagement from '../views/financialManagement/loanManagement.vue'
import Fhandle from '../views/financialManagement/fhandle.vue'
import LoanHandle from '../views/financialManagement/loanHandle.vue'
//产品管理的配置
import ProductInfo from '../views/product/product-info.vue'
import ProductAdd from '../views/product/product-add.vue'
import ProductEdit from '../views/product/product-edit.vue'
import BasedCost from '../views/productManage/basedCost.vue'
import CostType from '../views/productManage/costType.vue'
import ImageMaterials from '../views/productManage/imageMaterials.vue'
// 系统管理的配置
import MenuList from '../views/authority/menu-list.vue'
import RoleList from '../views/authority/role-list.vue'
import UserList from '../views/authority/user-list.vue'
Vue.use(Router)
// 路由定义使用说明:
// 1. 代码中路由统一使用name属性跳转.
// 2. 开放path属性用做简短路由, 比如: '/a1', 访问地址: www.renren.io/#/a1
export default new Router({
mode: 'hash',
routes: [
{ path: '/404', component: _import('error/404'), name: '404', desc: '404未找到' },
{ path: '/login', component: _import('login/index'), name: 'login', desc: '登录' },
{
path: '/',
component: _import('layout/index'),
name: 'layout',
redirect: { name: 'home' },
desc: '上左右整体布局',
children: [
// 通过isTab属性, 设定是否通过tab标签页展示内容
{ path: '/home', component: Home, name: 'home', desc: '首页' },
{ path: '/insert-iframe', component: InsertIframe, name: 'iframe', desc: 'iframe', meta: { iframe: true } },
// 审批管理的配置
{ path: '/first-examine', component: FirstExamine, name: '初审待办任务', desc: '初审待办任务', meta: {} },
{ path: '/second-examine', component: SecondExamine, name: '终审待办任务', desc: '终审待办任务', meta: {} },
{ path: '/case-list', component: CaseList, name: '借款案件审理', desc: '借款案件审理', meta: {} },
{ path: '/examine-pool', component: ExaminePool, name: '审批任务池', desc: '审批任务池', meta: {} },
{ path: '/first-details',component: FirstDetails, name:'初审详情',desc: '初审详情', meta:{} },
{ path: '/second-details',component: SecondDetails, name:'终审详情',desc: '终审详情', meta:{} },
{ path: '/case-details',component: CaseDetails, name:'案件详情',desc: '案件详情', meta:{} },
// 财务管理的配置
{ path: '/financialLoan', component: FinancialLoan, name: '财务放款', desc: '财务放款', meta: {} },
{ path: '/loanManagement', component: LoanManagement, name: '放款管理', desc: '放款管理', meta: {} },
{ path: '/fhandle', component: Fhandle, name: '财务处理', desc: '财务处理', meta: {} },
{ path: '/loanHandle', component: LoanHandle, name: '放款管理处理', desc: '放款管理处理', meta: {} },
//产品管理的配置
{ path: '/product-info', component: ProductInfo, name: '产品信息管理', desc: '产品信息管理', meta: {} },
{ path: '/product-add', component: ProductAdd, name: '添加产品', desc: '添加产品', meta: {} },
{ path: '/product-edit', component: ProductEdit, name: '编辑产品', desc: '编辑产品', meta: {} },
{ path: '/basedCost', component: BasedCost, name: '基础费用管理', desc: '基础费用管理', meta: {} },
{ path: '/costType', component: CostType, name: '费用类型管理', desc: '费用类型管理', meta: {} },
{ path: '/imageMaterials', component: ImageMaterials, name: '影像材料管理', desc: '影像材料管理', meta: {} },
// 系统管理的配置
{ path: '/menu-list', component: MenuList, name: '菜单管理', desc: '', meta: {}},
{ path: '/role-list', component: RoleList, name: '角色管理', desc: '', meta: {}},
{ path: '/user-list', component: UserList, name: '用户管理', desc: '', meta: {} },
],
beforeEnter (to, from, next) {
let token = Vue.cookie.get('Authorization')
if (!token || !/\S/.test(token)) {
next({ name: 'login' })
}
next()
}
},
{ path: '*', redirect: { name: '404' } }
]
})