index.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. import { createRouter, createWebHashHistory } from 'vue-router'
  2. const routes = [
  3. {
  4. name: 'login',
  5. path: '/login',
  6. component: () => import('../views/login'),
  7. meta: {
  8. title: '登录',
  9. },
  10. },
  11. {
  12. name: 'home',
  13. path: '/home',
  14. component: () => import('../views/home'),
  15. meta: {
  16. title: '首页',
  17. },
  18. },
  19. {
  20. path: '/user',
  21. component: () => import('../views/user/index.vue'),
  22. children: [
  23. {
  24. name: 'userAccount',
  25. path: 'account',
  26. component: () => import('../views/user/account.vue'),
  27. meta: {
  28. title: '账号中心',
  29. },
  30. },
  31. {
  32. name: 'userPassWord',
  33. path: 'password',
  34. component: () => import('../views/user/password.vue'),
  35. meta: {
  36. title: '更改密码',
  37. },
  38. },
  39. {
  40. name: 'userMobile',
  41. path: 'mobile',
  42. component: () => import('../views/user/mobile.vue'),
  43. meta: {
  44. title: '手机号',
  45. },
  46. },
  47. ]
  48. },
  49. {
  50. path: '/repair',
  51. component: () => import('../views/repair/index.vue'),
  52. children: [
  53. {
  54. name: 'repairOnline',
  55. path: 'create',
  56. component: () => import('../views/repair/create.vue'),
  57. meta: {
  58. title: '线上报修',
  59. },
  60. },
  61. {
  62. name: 'repairList',
  63. path: 'list',
  64. component: () => import('../views/repair/list.vue'),
  65. meta: {
  66. title: '工单待办',
  67. },
  68. },
  69. {
  70. name: 'repairDetail',
  71. path: 'detail',
  72. component: () => import('../views/repair/detail.vue'),
  73. meta: {
  74. title: '工单详情',
  75. },
  76. },
  77. ]
  78. },
  79. {
  80. path: '/review',
  81. component: () => import('../views/review/index.vue'),
  82. children: [
  83. {
  84. name: 'reviewRecord',
  85. path: 'list',
  86. component: () => import('../views/review/list.vue'),
  87. meta: {
  88. title: '巡检记录',
  89. },
  90. },
  91. {
  92. name: 'reviewClock',
  93. path: 'clock',
  94. component: () => import('../views/review/clock.vue'),
  95. meta: {
  96. title: '巡检打卡',
  97. },
  98. },
  99. ]
  100. },
  101. {
  102. path: '/bill',
  103. component: () => import('../views/bill/index.vue'),
  104. children: [
  105. {
  106. name: 'billList',
  107. path: 'list',
  108. component: () => import('../views/bill/list.vue'),
  109. meta: {
  110. title: '租户账单',
  111. },
  112. },
  113. {
  114. name: 'billDetail',
  115. path: 'detail',
  116. component: () => import('../views/bill/detail.vue'),
  117. meta: {
  118. title: '账单明细',
  119. },
  120. },
  121. ]
  122. },
  123. {
  124. path: '/pay',
  125. component: () => import('../views/pay/index.vue'),
  126. children: [
  127. {
  128. name: 'payRecord',
  129. path: 'record',
  130. component: () => import('../views/pay/record.vue'),
  131. meta: {
  132. title: '扣缴记录',
  133. },
  134. },
  135. {
  136. name: 'payFee',
  137. path: 'fee',
  138. component: () => import('../views/pay/fee.vue'),
  139. meta: {
  140. title: '欠费待收',
  141. },
  142. },
  143. ]
  144. },
  145. {
  146. path: '/device',
  147. component: () => import('../views/device/index.vue'),
  148. children: [
  149. {
  150. name: 'deviceAlarm',
  151. path: 'list',
  152. component: () => import('../views/device/list.vue'),
  153. meta: {
  154. title: '设备异常',
  155. },
  156. },
  157. ]
  158. },
  159. {
  160. name: 'remoteControl',
  161. path: '/remoteControl',
  162. component: () => import('../views/control/list.vue'),
  163. meta: {
  164. title: '远程管控',
  165. },
  166. },
  167. {
  168. name: 'WeChat',
  169. path: '/WeChat',
  170. component: () => import('../views/bill/WeChat'),
  171. meta: {
  172. title: '微信支付',
  173. },
  174. },
  175. {
  176. name: 'Alipay',
  177. path: '/Alipay',
  178. component: () => import('../views/bill/Alipay'),
  179. meta: {
  180. title: '支付宝支付',
  181. },
  182. },
  183. {
  184. name: 'payFinished',
  185. path: '/payFinished',
  186. component: () => import('../views/bill/payFinished'),
  187. meta: {
  188. title: '支付完成',
  189. },
  190. },
  191. {
  192. name: 'AliPayFinished',
  193. path: '/AliPayFinished',
  194. component: () => import('../views/bill/AliPayFinished'),
  195. meta: {
  196. title: '支付完成',
  197. },
  198. },
  199. {
  200. title: '扫码页面',
  201. name: 'scanCode',
  202. path: '/scanCode',
  203. component: () => import('../views/scanCode.vue')
  204. }
  205. ]
  206. const router = createRouter({
  207. history: createWebHashHistory(),
  208. routes
  209. })
  210. // 全局前置守卫,设置页面标题
  211. router.beforeEach((to, from, next) => {
  212. // const title = to.meta && to.meta.title;
  213. // if (title) {
  214. // document.title = title;
  215. // }
  216. document.title = '双碳感知资产运营管理平台';
  217. next(); //必须写
  218. });
  219. export default router