index.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. import { createRouter, createWebHashHistory } from "vue-router";
  2. import { getLocal } from "@/common/js/utils";
  3. const router = createRouter({
  4. // hash模式:createWebHashHistory,history模式:createWebHistory
  5. history: createWebHashHistory(),
  6. routes: [
  7. // 首页
  8. { path: "/", redirect: "/home" },
  9. // Home 页面
  10. {
  11. path: "/home",
  12. name: "home",
  13. component: () => import("@/views/home/index.vue"),
  14. meta: { index: 1 },
  15. },
  16. // 生产部员工录入信息
  17. {
  18. path: "/fife",
  19. name: "fife",
  20. component: () => import("@/views/fife/index.vue"),
  21. meta: { index: 1, noLogin: true },
  22. },
  23. // 售后部员工修改位置信息
  24. {
  25. path: "/modifyLoc",
  26. name: "modifyLoc",
  27. component: () => import("@/views/fife/modifyLoc.vue"),
  28. meta: { index: 1 },
  29. },
  30. // 登录页面
  31. {
  32. path: "/login",
  33. name: "login",
  34. component: () => import("@/views/login.vue"),
  35. meta: { index: 1, noLogin: true },
  36. },
  37. // 微信登录跳板
  38. {
  39. path: "/wxLogin",
  40. name: "wxLogin",
  41. component: () => import("@/views/wxLogin.vue"),
  42. meta: { index: 1, noLogin: true },
  43. },
  44. // 注册页面
  45. {
  46. path: "/register",
  47. name: "register",
  48. component: () => import("@/views/register.vue"),
  49. meta: { index: 1, noLogin: true },
  50. },
  51. // 忘记密码页面
  52. {
  53. path: "/forgetpassword",
  54. name: "forgetPassword",
  55. component: () => import("@/views/forgetPassword"),
  56. meta: { index: 1, noLogin: true },
  57. },
  58. // 绑定微信
  59. {
  60. path: "/bindWechat",
  61. name: "bindWechat",
  62. component: () => import("@/views/bindWechat.vue"),
  63. meta: { index: 1, noLogin: true },
  64. },
  65. // 数据同步
  66. {
  67. path: "/syncOldData",
  68. name: "syncOldData",
  69. component: () => import("@/views/syncOldData/index.vue"),
  70. meta: { index: 1 },
  71. },
  72. // 修改密码页面
  73. {
  74. path: "/changepassword",
  75. name: "changePassword",
  76. component: () => import("@/views/changePassword"),
  77. meta: { index: 1, noLogin: true },
  78. },
  79. // 意见反馈
  80. {
  81. path: "/feedback",
  82. name: "feedback",
  83. component: () => import("@/views/feedback"),
  84. meta: { index: 1 },
  85. },
  86. // 设备页面
  87. {
  88. path: "/device",
  89. name: "device",
  90. component: () => import("@/views/device/index"),
  91. meta: { index: 1, keepAlive: true },
  92. },
  93. // 设备详情
  94. {
  95. path: "/deviceSet",
  96. name: "deviceSet",
  97. component: () => import("@/views/device/deviceSet"),
  98. meta: { index: 1 },
  99. },
  100. // 编辑标签
  101. {
  102. path: "/editTag",
  103. name: "editTag",
  104. component: () => import("@/views/device/tagSet/index.vue"),
  105. meta: { index: 1 },
  106. },
  107. // { path: '/deviceOpr', name: 'deviceOpr', component: () => import('@/views/device/deviceOper2.vue'), meta: { index: 1 } },
  108. // 音量调节
  109. {
  110. path: "/modulation",
  111. name: "modulation",
  112. component: () => import("@/views/device/modulation.vue"),
  113. meta: { index: 1 },
  114. },
  115. // 远程开门
  116. {
  117. path: "/openDoor",
  118. name: "openDoor",
  119. component: () => import("@/views/device/openDoor.vue"),
  120. meta: { index: 1 },
  121. },
  122. // 远程做糖
  123. {
  124. path: "/doSugar",
  125. name: "doSugar",
  126. component: () => import("@/views/device/doSugar.vue"),
  127. meta: { index: 1 },
  128. },
  129. // 今日做糖列表
  130. {
  131. path: "/toDaySugarList",
  132. name: "toDaySugarList",
  133. component: () => import("@/views/device/toDaySugarList.vue"),
  134. meta: { index: 1 },
  135. },
  136. // 定时开关
  137. {
  138. path: "/alarmClock",
  139. name: "alarmClock",
  140. component: () => import("@/views/device/alarmClock.vue"),
  141. meta: { index: 1 },
  142. },
  143. // 设置闹钟
  144. {
  145. path: "/alarmClockAdd",
  146. name: "alarmClockAdd",
  147. component: () => import("@/views/device/alarmClockSet/index.vue"),
  148. meta: { index: 1 },
  149. },
  150. {
  151. path: "/alarmClockSet",
  152. name: "alarmClockSet",
  153. component: () => import("@/views/device/alarmClockSet/index.vue"),
  154. meta: { index: 1 },
  155. },
  156. // 参数设置
  157. {
  158. path: "/paramsSet",
  159. name: "paramsSet",
  160. component: () => import("@/views/device/paramsSet/index.vue"),
  161. meta: { index: 1 },
  162. },
  163. {
  164. path: "/paramsSetInfo",
  165. name: "paramsSetInfo",
  166. component: () => import("@/views/device/paramsSet/paramsSetInfo.vue"),
  167. meta: { index: 1 },
  168. },
  169. // 添加分销人
  170. {
  171. path: "/saveProportion",
  172. name: "saveProportion",
  173. component: () => import("@/views/device/saveProportion/index.vue"),
  174. meta: { index: 1 },
  175. },
  176. // 设备充值
  177. {
  178. path: "/recharge",
  179. name: "recharge",
  180. component: () => import("@/views/device/recharge.vue"),
  181. meta: { index: 1 },
  182. },
  183. // 机器排行
  184. {
  185. path: "/robotranking",
  186. name: "robotranking",
  187. component: () => import("@/views/robotRanking.vue"),
  188. meta: { index: 1 },
  189. },
  190. // 个人中心
  191. {
  192. path: "/user",
  193. name: "user",
  194. component: () => import("@/views/user.vue"),
  195. meta: { index: 1 },
  196. },
  197. // 结算账号
  198. {
  199. path: "/settlement",
  200. name: "settlement",
  201. component: () => import("@/views/settlement/index"),
  202. meta: { index: 1 },
  203. },
  204. // 公告编辑
  205. {
  206. path: "/announcement",
  207. name: "announcement",
  208. component: () => import("@/views/announcement/index"),
  209. meta: { index: 1 },
  210. },
  211. // 提现账号
  212. {
  213. path: "/joinpayMch",
  214. name: "joinpayMch",
  215. component: () => import("@/views/joinpayMch/index"),
  216. meta: { index: 1 },
  217. },
  218. // 自充值
  219. {
  220. path: "/uniPay",
  221. name: "uniPay",
  222. component: () => import("@/views/uniPay/index"),
  223. meta: { index: 1 },
  224. },
  225. // 优惠码
  226. {
  227. path: "/discountCode",
  228. name: "discountCode",
  229. component: () => import("@/views/discountCode/index"),
  230. meta: { index: 1 },
  231. },
  232. // Airwallex 钱包
  233. {
  234. path: "/airwallex",
  235. name: "airwallex",
  236. component: () => import("@/views/airwallex/index.vue"),
  237. meta: { index: 1 },
  238. },
  239. // Airwallex 创建付款人
  240. {
  241. path: "/airwallexBeneficiary",
  242. name: "airwallexBeneficiary",
  243. component: () => import("@/views/airwallex/beneficiary.vue"),
  244. meta: { index: 1 },
  245. },
  246. // Airwallex 付款单
  247. {
  248. path: "/airwallexPayout",
  249. name: "airwallexPayout",
  250. component: () => import("@/views/airwallex/payout.vue"),
  251. meta: { index: 1 },
  252. },
  253. // Airwallex 去付款
  254. {
  255. path: "/caPayment",
  256. name: "caPayment",
  257. component: () => import("@/views/airwallex/caPayment.vue"),
  258. meta: { index: 1 },
  259. },
  260. // Airwallex 付款结果详情
  261. {
  262. path: "/paymentDetail",
  263. name: "paymentDetail",
  264. component: () => import("@/views/airwallex/paymentDetail.vue"),
  265. meta: { index: 1 },
  266. },
  267. {
  268. path: "/payCode",
  269. name: "payCode",
  270. component: () => import("@/views/discountCode/payCode"),
  271. meta: { index: 1 },
  272. },
  273. // 分销设置
  274. {
  275. path: "/distributionSet",
  276. name: "distributionSet",
  277. component: () => import("@/views/distributionSet/index"),
  278. meta: { index: 1 },
  279. },
  280. {
  281. path: "/distributionDetail",
  282. name: "distributionDetail",
  283. component: () => import("@/views/distributionSet/detail"),
  284. meta: { index: 1 },
  285. },
  286. // 账号权限
  287. {
  288. path: "/accountPer",
  289. name: "accountPer",
  290. component: () => import("@/views/accountPer/index"),
  291. meta: { index: 1 },
  292. },
  293. // 添加账号
  294. {
  295. path: "/accountPerAdd",
  296. name: "accountPerAdd",
  297. component: () => import("@/views/accountPer/add"),
  298. meta: { index: 1 },
  299. },
  300. // 角色权限
  301. {
  302. path: "/role",
  303. name: "role",
  304. component: () => import("@/views/role/index"),
  305. meta: { index: 1 },
  306. },
  307. {
  308. path: "/roleSet",
  309. name: "roleSet",
  310. component: () => import("@/views/role/add"),
  311. meta: { index: 1 },
  312. },
  313. // 商户管理
  314. {
  315. path: "/merchantManage",
  316. name: "merchantManage",
  317. component: () => import("@/views/merchantManage/index"),
  318. meta: { index: 1, keepAlive: true },
  319. },
  320. // 商户信息
  321. {
  322. path: "/merchantSet",
  323. name: "merchantSet",
  324. component: () => import("@/views/merchantManage/set"),
  325. meta: { index: 1 },
  326. },
  327. // 广告管理
  328. {
  329. path: "/advertManage",
  330. name: "advertManage",
  331. component: () => import("@/views/advertManage/index"),
  332. meta: { index: 1 },
  333. },
  334. {
  335. path: "/advertSet",
  336. name: "advertSet",
  337. component: () => import("@/views/advertManage/adSet.vue"),
  338. meta: { index: 1 },
  339. },
  340. // 广告规则
  341. {
  342. path: "/advertRule",
  343. name: "advertRule",
  344. component: () => import("@/views/advertManage/advertRule/index.vue"),
  345. meta: { index: 1 },
  346. },
  347. // 广告规则新增
  348. {
  349. path: "/advertRuleAdd",
  350. name: "advertRuleAdd",
  351. component: () => import("@/views/advertManage/advertRule/add.vue"),
  352. meta: { index: 1 },
  353. },
  354. {
  355. path: "/advertRuleAddScreen",
  356. name: "advertRuleAddScreen",
  357. component: () => import("@/views/advertManage/advertRule/screen.vue"),
  358. meta: { index: 1 },
  359. },
  360. // apk管理
  361. {
  362. path: "/apkManage",
  363. name: "apkManage",
  364. component: () => import("@/views/apkManage/index"),
  365. meta: { index: 1 },
  366. },
  367. // apk管理-新增
  368. {
  369. path: "/apkManageAdd",
  370. name: "apkManageAdd",
  371. component: () => import("@/views/apkManage/add"),
  372. meta: { index: 1 },
  373. },
  374. // apk热更新
  375. {
  376. path: "/apkHotUpdate",
  377. name: "apkHotUpdate",
  378. component: () => import("@/views/hotUpdate/index"),
  379. meta: { index: 1, noLogin: true },
  380. },
  381. // apk热更新添加
  382. {
  383. path: "/apkHotUpdateAdd",
  384. name: "apkHotUpdateAdd",
  385. component: () => import("@/views/hotUpdate/add"),
  386. meta: { index: 1, noLogin: true },
  387. },
  388. // 报警历史
  389. {
  390. path: "/alarmHistory",
  391. name: "alarmHistory",
  392. component: () => import("@/views/alarmHistory/index"),
  393. meta: { index: 1 },
  394. },
  395. // 订单导出
  396. {
  397. path: "/orderExport",
  398. name: "orderExport",
  399. component: () => import("@/views/orderExport/index"),
  400. meta: { index: 1 },
  401. },
  402. // 常用工具
  403. {
  404. path: "/commonTools",
  405. name: "commonTools",
  406. component: () => import("@/views/commonTools/index"),
  407. meta: { index: 1 },
  408. },
  409. // 任务消息
  410. {
  411. path: "/taskMessage",
  412. name: "taskMessage",
  413. component: () => import("@/views/taskMessage/index"),
  414. meta: { index: 1 },
  415. },
  416. // 设备审批
  417. {
  418. path: "/taskEquipment",
  419. name: "taskEquipment",
  420. component: () => import("@/views/taskMessage/equipment"),
  421. meta: { index: 1 },
  422. },
  423. // 提现审批
  424. {
  425. path: "/taskJoinPayMchCheck",
  426. name: "taskJoinPayMchCheck",
  427. component: () => import("@/views/taskMessage/joinpayMchCheck"),
  428. meta: { index: 1 },
  429. },
  430. // 提现审批详情
  431. {
  432. path: "/taskJoinPayMchCheckInfo",
  433. name: "taskJoinPayMchCheckInfo",
  434. component: () => import("@/views/taskMessage/joinpayMchCheck/info"),
  435. meta: { index: 1 },
  436. },
  437. // 分销审批
  438. {
  439. path: "/taskProportion",
  440. name: "taskProportion",
  441. component: () => import("@/views/taskMessage/proportion"),
  442. meta: { index: 1 },
  443. },
  444. // 分销审批
  445. {
  446. path: "/refundReminder",
  447. name: "refundReminder",
  448. component: () => import("@/views/taskMessage/refundReminder"),
  449. meta: { index: 1 },
  450. },
  451. // 订单中心
  452. {
  453. path: "/orderCenter",
  454. name: "orderCenter",
  455. component: () => import("@/views/orderCenter/index"),
  456. meta: { index: 1 },
  457. },
  458. // 测试
  459. {
  460. path: "/test",
  461. name: "test",
  462. component: () => import("@/views/test"),
  463. meta: { index: 1 },
  464. },
  465. // 标签管理
  466. {
  467. path: "/labelMan",
  468. name: "labelMan",
  469. component: () => import("@/views/labelMan/index"),
  470. meta: { index: 1 },
  471. },
  472. // 标签管理-新增
  473. {
  474. path: "/labelManAdd",
  475. name: "labelManAdd",
  476. component: () => import("@/views/labelMan/add"),
  477. meta: { index: 1 },
  478. },
  479. // 修改价格
  480. {
  481. path: "/modifyPrice",
  482. name: "modifyPrice",
  483. component: () => import("@/views/device/modifyPrice/index"),
  484. meta: { index: 1 },
  485. },
  486. // 屏蔽/展示商品
  487. {
  488. path: "/showGoods",
  489. name: "showGoods",
  490. component: () => import("@/views/device/showGoods/index"),
  491. meta: { index: 1 },
  492. },
  493. // DIY花型
  494. {
  495. path: "/diyFlower",
  496. name: "diyFlower",
  497. component: () => import("@/views/device/diyFlower/index"),
  498. meta: { index: 1 },
  499. },
  500. // 设备清洗提醒
  501. {
  502. path: "/alramClean",
  503. name: "alramClean",
  504. component: () => import("@/views/device/alramClean/index"),
  505. meta: { index: 1 },
  506. },
  507. // 远程退币
  508. {
  509. path: "/returnCoin",
  510. name: "returnCoin",
  511. component: () => import("@/views/device/returnCoin/index"),
  512. meta: { index: 1 },
  513. },
  514. // 修改机器密码
  515. {
  516. path: "/devicePassword",
  517. name: "devicePassword",
  518. component: () => import("@/views/device/devicePassword/index"),
  519. meta: { index: 1 },
  520. },
  521. // 查看定位
  522. {
  523. path: "/viewPosition",
  524. name: "viewPosition",
  525. component: () => import("@/views/device/viewPosition/index"),
  526. meta: { index: 1 },
  527. },
  528. // 设备编辑-编辑规则
  529. {
  530. path: "/editAdRule",
  531. name: "editAdRule",
  532. component: () => import("@/views/device/editAdRule/index"),
  533. meta: { index: 1 },
  534. },
  535. // 跳转空中云汇收单-消费者付款
  536. {
  537. path: "/hpp",
  538. name: "Hpp",
  539. component: () => import("@/views/Hpp.vue"),
  540. meta: { index: 1, noLogin: true },
  541. },
  542. // 定制logo
  543. {
  544. path: "/customLogo",
  545. name: "customLogo",
  546. component: () => import("@/views/device/customLogo.vue"),
  547. meta: { index: 1 },
  548. },
  549. // 查看日志
  550. {
  551. path: "/viewLogs",
  552. name: "viewLogs",
  553. component: () => import("@/views/device/viewLogs/index"),
  554. meta: { index: 1 },
  555. },
  556. // 账户操作
  557. {
  558. path: "/accountOperation",
  559. name: "accountOperation",
  560. component: () => import("@/views/accountOperation/index"),
  561. meta: { index: 1 },
  562. },
  563. // 汇付支付获取openid
  564. {
  565. path: "/weChatPay",
  566. name: "weChatPay",
  567. component: () => import("@/views/weChatPay"),
  568. meta: { index: 1, noLogin: true },
  569. },
  570. // 汇付支付获取openid
  571. {
  572. path: "/popPayment",
  573. name: "popPayment",
  574. component: () => import("@/views/popPayment"),
  575. meta: { index: 1, noLogin: true },
  576. },
  577. // apk管理,广告管理,订单导出 不是所有的帐号能看到
  578. // 汇付支付获取openid
  579. {
  580. path: "/payWechat",
  581. name: "payWechat",
  582. component: () => import("@/views/payWechat"),
  583. meta: { index: 1, noLogin: true },
  584. },
  585. // MQTT
  586. {
  587. path: "/mqtt",
  588. name: "mqtt",
  589. component: () => import("@/views/mqtt/index"),
  590. meta: { index: 1 },
  591. },
  592. // MQTT消息管理
  593. {
  594. path: "/mqttMessage",
  595. name: "mqttMessage",
  596. component: () => import("@/views/mqtt/message/index"),
  597. meta: { index: 1 },
  598. },
  599. // MQTT主题管理
  600. {
  601. path: "/topic",
  602. name: "topic",
  603. component: () => import("@/views/mqtt/topic/index"),
  604. meta: { index: 1 },
  605. },
  606. ],
  607. });
  608. // 路由守卫处理
  609. router.beforeEach((to, from, next) => {
  610. // 从账户操作页面回到home页面
  611. // if (from.name === "accountOperation" && to.name === "home") {
  612. // // router.push("/home");
  613. // location.reload();
  614. // // 阻止重定向回 账户操作页
  615. // if (to.path === '/accountOperation') {
  616. // next(false);
  617. // } else {
  618. // next();
  619. // }
  620. // }
  621. // 页面带有不需要识别登录状态的跳过登录验证
  622. if (to.meta.noLogin) {
  623. next();
  624. } else {
  625. const user = getLocal("loginUser");
  626. if (!user || user === "") {
  627. // 没有登录信息跳转登录页面
  628. router.push("/login");
  629. } else {
  630. const userObject = JSON.parse(user);
  631. // 登录信息异常跳转登录页面
  632. if (!userObject) {
  633. router.push("/login");
  634. }
  635. if (typeof userObject.id !== "number") {
  636. router.push("/login");
  637. }
  638. }
  639. next();
  640. }
  641. });
  642. export default router;