import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) const commonRoutes = [{ path: '/login', name: 'login', meta: { title: '登录', }, component: () => import('../components/Login.vue'), }, { path: '/other', // 点击侧边栏跳到一个单独的路由页面,需要定义,层级和其他顶级路由一样 name: 'other', meta: { title: '单独的路由', }, component: () => import('../views/Other.vue'), }, { path: '/404', name: '404', meta: { title: '404', }, component: () => import('../components/404.vue'), }, { path: '/', redirect: '/charging_station', }, ] // 本地所有的页面 需要配合后台返回的数据生成页面 export const asyncRoutes = { // 充电桩 charging_station: { path: 'charging_station', name: 'charging_station', meta: { title: '站点管理', }, component: () => import('../views/charging_pile/Station.vue'), }, charging_pile: { path: 'charging_pile', name: 'charging_pile', meta: { title: '充电桩管理', }, component: () => import('../views/charging_pile/Pile.vue'), }, charging_price: { path: 'charging_price', name: 'charging_price', meta: { title: '电价管理', }, component: () => import('../views/charging_pile/Price.vue'), }, charging_fault: { path: 'charging_fault', name: 'charging_fault', meta: { title: '故障运维', }, component: () => import('../views/charging_pile/Fault.vue'), }, // 客户 corporate_client: { path: 'corporate_client', name: 'corporate_client', meta: { title: '企业客户', }, component: () => import('../views/customer_center/CorporateClient.vue'), }, wx_user: { path: 'wx_user', name: 'wx_user', meta: { title: '用户管理', }, component: () => import('../views/customer_center/WxUser.vue'), }, // 运营中心 activity: { path: 'activity', name: 'activity', meta: { title: '活动发布', }, component: () => import('../views/operations_center/activity.vue'), }, coupon: { path: 'coupon', name: 'coupon', meta: { title: '优惠券', }, component: () => import('../views/operations_center/coupon.vue'), }, user_vip: { path: 'user_vip', name: 'user_vip', meta: { title: '会员', }, component: () => import('../views/operations_center/user_vip.vue'), }, invoice: { path: 'invoice', name: 'invoice', meta: { title: '发票管理', }, component: () => import('../views/operations_center/invoice.vue'), }, // 订单 charge_order: { path: 'charge_order', name: 'charge_order', meta: { title: '充电订单', }, component: () => import('../views/order/charge_order.vue'), }, recharge_order: { path: 'recharge_order', name: 'recharge_order', meta: { title: '充值订单', }, component: () => import('../views/order/recharge_order.vue'), }, refund_order: { path: 'refund_order', name: 'refund_order', meta: { title: '充电退款订单', }, component: () => import('../views/order/refund_order.vue'), }, order_total: { path: 'order_total', name: 'order_total', meta: { title: '订单统计', }, component: () => import('../views/order/order_total.vue'), }, // 数据中心 yunying_reports: { path: 'yunying_reports', name: 'yunying_reports', meta: { title: '运营报表', }, component: () => import('../views/reports/yunying_reports.vue'), }, caiwu_reports: { path: 'caiwu_reports', name: 'caiwu_reports', meta: { title: '财务报表', }, component: () => import('../views/reports/caiwu_reports.vue'), }, yunwei_reports: { path: 'yunwei_reports', name: 'yunwei_reports', meta: { title: '运维报表', }, component: () => import('../views/reports/yunwei_reports.vue'), }, // 系统配置 system: { path: 'system', name: 'system', meta: { title: '参数设置', }, component: () => import('../views/system/system.vue'), }, admin: { path: 'admin', name: 'admin', meta: { title: '系统用户', }, component: () => import('../views/system/admin.vue'), }, auth: { path: 'auth', name: 'auth', meta: { title: '权限管理', }, component: () => import('../views/system/auth.vue'), }, log: { path: 'log', name: 'log', meta: { title: '日志管理', }, component: () => import('../views/system/log.vue'), }, // 报表分析 rate: { path: 'rate', name: 'rate', meta: { title: '日志管理', }, component: () => import('../views/reports/rate.vue'), }, backup_and_repair: { path: 'backup_and_repair', name: 'backup_and_repair', meta: { title: '日志管理', }, component: () => import('../views/reports/backup_and_repair.vue'), }, activation: { path: 'activation', name: 'activation', meta: { title: '日志管理', }, component: () => import('../views/reports/activation.vue'), }, income_analysis: { path: 'income_analysis', name: 'income_analysis', meta: { title: '日志管理', }, component: () => import('../views/reports/income_analysis.vue'), }, t1: { path: 't1', name: 't1', meta: { title: '表格', }, component: () => import('../views/T1.vue'), }, password: { path: 'password', name: 'password', meta: { title: '修改密码', }, component: () => import('../views/Password.vue'), }, msg: { path: 'msg', name: 'msg', meta: { title: '通知消息', }, component: () => import('../views/Msg.vue'), }, userinfo: { path: 'userinfo', name: 'userinfo', meta: { title: '用户信息', }, component: () => import('../views/UserInfo.vue'), }, } const createRouter = () => new Router({ routes: commonRoutes, }) const router = createRouter() export function resetRouter() { const newRouter = createRouter() router.matcher = newRouter.matcher } export default router