123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- import { createRouter, createWebHashHistory } from 'vue-router'
- import { getLocal } from '@/common/js/utils';
- const router = createRouter({
- // hash模式:createWebHashHistory,history模式:createWebHistory
- history: createWebHashHistory(),
- routes: [
- // 首页
- { path: '/', redirect: '/home' },
- { path: '/home', name: 'home', component: () => import('@/views/home/index.vue'), meta: { index: 1 } },
- // 登录页面
- { path: '/login', name: 'login', component: () => import('@/views/login.vue'), meta: { index: 1, noLogin: true } },
- // 注册页面
- { path: '/register', name: 'register', component: () => import('@/views/register.vue'), meta: { index: 1, noLogin: true } },
- // 忘记密码页面
- { path: '/forgetpassword', name: 'forgetPassword', component: () => import('@/views/forgetPassword'), meta: { index: 1, noLogin: true } },
- // 修改密码页面
- { path: '/changepassword', name: 'changePassword', component: () => import('@/views/changePassword'), meta: { index: 1, noLogin: true } },
- // 设备页面
- { path: '/device', name: 'device', component: () => import('@/views/device/index'), meta: { index: 1 } },
- // 设备详情
- { path: '/deviceSet', name: 'deviceSet', component: () => import('@/views/device/deviceSet'), meta: { index: 1 } },
- // 编辑标签
- { path: '/editTag', name: 'editTag', component: () => import('@/views/device/tagSet/index.vue'), meta: { index: 1 } },
- // { path: '/deviceOpr', name: 'deviceOpr', component: () => import('@/views/device/deviceOper2.vue'), meta: { index: 1 } },
- // 音量调节
- { path: '/modulation', name: 'modulation', component: () => import('@/views/device/modulation.vue'), meta: { index: 1} },
- // 远程开门
- { path: '/openDoor', name: 'openDoor', component: () => import('@/views/device/openDoor.vue'), meta: { index: 1} },
- // 远程做糖
- { path: '/doSugar', name: 'doSugar', component: () => import('@/views/device/doSugar.vue'), meta: { index: 1} },
- // 今日做糖列表
- { path: '/toDaySugarList', name: 'toDaySugarList', component: () => import('@/views/device/toDaySugarList.vue'), meta: { index: 1} },
- // 定时开关
- { path: '/alarmClock', name: 'alarmClock', component: () => import('@/views/device/alarmClock.vue'), meta: { index: 1} },
- // 设置闹钟
- { path: '/alarmClockAdd', name: 'alarmClockAdd', component: () => import('@/views/device/alarmClockSet/index.vue'), meta: { index: 1} },
- { path: '/alarmClockSet', name: 'alarmClockSet', component: () => import('@/views/device/alarmClockSet/index.vue'), meta: { index: 1} },
- // 参数设置
- { path: '/paramsSet', name: 'paramsSet', component: () => import('@/views/device/paramsSet/index.vue'), meta: { index: 1} },
- { path: '/paramsSetInfo', name: 'paramsSetInfo', component: () => import('@/views/device/paramsSet/paramsSetInfo.vue'), meta: { index: 1} },
- // 添加分销人
- { path: '/saveProportion', name: 'saveProportion', component: () => import('@/views/device/saveProportion/index.vue'), meta: { index: 1} },
- // 设备充值
- { path: '/recharge', name: 'recharge', component: () => import('@/views/device/recharge.vue'), meta: { index: 1} },
- // 机器排行
- { path: '/robotranking', name: 'robotranking', component: () => import('@/views/robotRanking.vue'), meta: { index: 1 } },
- // 个人中心
- { path: '/user', name: 'user', component: () => import('@/views/user.vue'), meta: { index: 1 } },
- // 备用提现账号
- { path: '/shandeMch', name: 'shandeMch', component: () => import('@/views/shandeMch/index'), meta: { index: 1 } },
- // 提现账号
- { path: '/joinpayMch', name: 'joinpayMch', component: () => import('@/views/joinpayMch/index'), meta: { index: 1 } },
- // 自充值
- { path: '/uniPay', name: 'uniPay', component: () => import('@/views/uniPay/index'), meta: { index: 1 } },
- // 优惠码
- { path: '/discountCode', name: 'discountCode', component: () => import('@/views/discountCode/index'), meta: { index: 1 } },
- { path: '/payCode', name: 'payCode', component: () => import('@/views/discountCode/payCode'), meta: { index: 1 } },
- // 分销设置
- { path: '/distributionSet', name: 'distributionSet', component: () => import('@/views/distributionSet/index'), meta: { index: 1 } },
- { path: '/distributionDetail', name: 'distributionDetail', component: () => import('@/views/distributionSet/detail'), meta: { index: 1 } },
- // 账号权限
- { path: '/accountPer', name: 'accountPer', component: () => import('@/views/accountPer/index'), meta: { index: 1 } },
- // 添加账号
- { path: '/accountPerAdd', name: 'accountPerAdd', component: () => import('@/views/accountPer/add'), meta: { index: 1 } },
- // 角色权限
- { path: '/role', name: 'role', component: () => import('@/views/role/index'), meta: { index: 1 } },
- { path: '/roleSet', name: 'roleSet', component: () => import('@/views/role/add'), meta: { index: 1 } },
- // 商户管理
- { path: '/merchantManage', name: 'merchantManage', component: () => import('@/views/merchantManage/index'), meta: { index: 1 } },
- { path: '/merchantSet', name: 'merchantSet', component: () => import('@/views/merchantManage/set'), meta: { index: 1 } },
- // 广告管理
- { path: '/advertManage', name: 'advertManage', component: () => import('@/views/advertManage/index'), meta: { index: 1 } },
- { path: '/advertSet', name: 'advertSet', component: () => import('@/views/advertManage/adSet.vue'), meta: { index: 1 } },
- // 广告规则
- { path: '/advertRule', name: 'advertRule', component: () => import('@/views/advertManage/advertRule/index.vue'), meta: { index: 1 } },
- // 广告规则新增
- { path: '/advertRuleAdd', name: 'advertRuleAdd', component: () => import('@/views/advertManage/advertRule/add.vue'), meta: { index: 1 } },
- { path: '/advertRuleAddScreen', name: 'advertRuleAddScreen', component: () => import('@/views/advertManage/advertRule/screen.vue'), meta: { index: 1 } },
- // apk管理
- { path: '/apkManage', name: 'apkManage', component: () => import('@/views/apkManage/index'), meta: { index: 1 } },
- // apk管理-新增
- { path: '/apkManageAdd', name: 'apkManageAdd', component: () => import('@/views/apkManage/add'), meta: { index: 1 } },
- // 报警历史
- { path: '/alarmHistory', name: 'alarmHistory', component: () => import('@/views/alarmHistory/index'), meta: { index: 1 } },
- // 订单导出
- { path: '/orderExport', name: 'orderExport', component: () => import('@/views/orderExport/index'), meta: { index: 1 } },
- // 杉德分账导出
- { path: '/subLedgerManage', name: 'subLedgerManage', component: () => import('@/views/subLedgerManage/index'), meta: { index: 1 } },
- // 任务消息
- { path: '/taskMessage', name: 'taskMessage', component: () => import('@/views/taskMessage/index'), meta: { index: 1 } },
- // 设备审批
- { path: '/taskEquipment', name: 'taskEquipment', component: () => import('@/views/taskMessage/equipment'), meta: { index: 1 } },
- // 提现审批
- { path: '/taskJoinPayMchCheck', name: 'taskJoinPayMchCheck', component: () => import('@/views/taskMessage/joinpayMchCheck'), meta: { index: 1 } },
- // 提现审批详情
- { path: '/taskJoinPayMchCheckInfo', name: 'taskJoinPayMchCheckInfo', component: () => import('@/views/taskMessage/joinpayMchCheck/info'), meta: { index: 1 } },
- // 分销审批
- { path: '/taskProportion', name: 'taskProportion', component: () => import('@/views/taskMessage/proportion'), meta: { index: 1 } },
- // 订单中心
- { path: '/orderCenter', name: 'orderCenter', component: () => import('@/views/orderCenter/index'), meta: { index: 1 } },
- // 测试
- { path: '/test', name: 'test', component: () => import('@/views/test'), meta: { index: 1 } },
- // 标签管理
- { path: '/labelMan', name: 'labelMan', component: () => import('@/views/labelMan/index'), meta: { index: 1 } },
- // 标签管理-新增
- { path: '/labelManAdd', name: 'labelManAdd', component: () => import('@/views/labelMan/add'), meta: { index: 1 } },
- // 修改价格
- { path: '/modifyPrice', name: 'modifyPrice', component: () => import('@/views/device/modifyPrice/index'), meta: { index: 1 } },
- // 查看定位
- { path: '/viewPosition', name: 'viewPosition', component: () => import('@/views/device/viewPosition/index'), meta: { index: 1 } },
- // 设备编辑-编辑规则
- { path: '/editAdRule', name: 'editAdRule', component: () => import('@/views/device/editAdRule/index'), meta: { index: 1 } },
- // 跳转空中云汇
- { path: '/hpp', name: 'Hpp', component: () => import('@/views/Hpp.vue'), meta: { index: 1, noLogin: true } },
- ]
- });
- // 路由守卫处理
- router.beforeEach((to, from, next) => {
- // 页面带有不需要识别登录状态的跳过登录验证
- if (to.meta.noLogin) {
- next();
- } else {
- const user = getLocal('loginUser');
- if (!user || user === '') {
- // 没有登录信息跳转登录页面
- router.push('/login');
- } else {
- const userObject = JSON.parse(user);
- // 登录信息异常跳转登录页面
- if (!userObject) { router.push('/login'); }
- if (typeof userObject.id !== 'number') { router.push('/login'); }
- }
- next();
- }
- });
- export default router;
|