Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.ts 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879
  1. import { createRouter, createWebHistory } from 'vue-router'
  2. import axios from '@/axios'
  3. import { requestSignature, wxReady } from '@/router/initWxSdk'
  4. import { ref } from 'vue';
  5. import { showFailToast } from 'vant';
  6. const router = createRouter({
  7. history: createWebHistory('/sgsafeh5/'),
  8. routes: [
  9. {
  10. path: '/login',
  11. name: 'Login',
  12. component: () => import('@/view/login/index.vue'),
  13. meta: { requiresAuth: false }
  14. },
  15. {
  16. path: '/login401',
  17. name: 'login401',
  18. component: () => import('@/view/login/index401.vue'),
  19. meta: { requiresAuth: false }
  20. },
  21. {
  22. path: '/Home1',
  23. component: () => import('@/view/Home1.vue'),
  24. meta: { requiresAuth: true }
  25. },
  26. {
  27. path: '/',
  28. redirect: '/Home1'
  29. },
  30. {
  31. path: '/error',
  32. name: 'error',
  33. component: () => import('@/view/biz/error/index.vue'),
  34. meta: { requiresAuth: false }
  35. },
  36. {
  37. path: '/biz/bas/basPartnerH5',
  38. name: 'basPartnerH5',
  39. component: () => import('@/view/biz/bas/basPartnerH5.vue'),
  40. meta: { requiresAuth: false }
  41. },
  42. {
  43. path: '/biz/cot/purContract',
  44. name: 'purContract',
  45. component: () => import('@/view/biz/cot/purContract.vue'),
  46. meta: { requiresAuth: false }
  47. },
  48. {
  49. path: '/biz/cot/salContract',
  50. name: 'salContract',
  51. component: () => import('@/view/biz/cot/salContract.vue'),
  52. meta: { requiresAuth: false }
  53. },
  54. {
  55. path: '/biz/cot/serviceContract',
  56. name: 'serviceContract',
  57. component: () => import('@/view/biz/cot/serviceContract.vue'),
  58. meta: { requiresAuth: false }
  59. },
  60. {
  61. path: '/biz/cot/signRequest',
  62. name: 'signRequest',
  63. component: () => import('@/view/biz/cot/signRequest.vue'),
  64. meta: { requiresAuth: false }
  65. },
  66. {
  67. path: '/biz/pur/purActFinance',
  68. name: 'purActFinance',
  69. component: () => import('@/view/biz/pur/purActFinance.vue'),
  70. meta: { requiresAuth: false }
  71. },
  72. {
  73. path: '/biz/pur/purBillFinance',
  74. name: 'purBillFinance',
  75. component: () => import('@/view/biz/pur/purBillFinance.vue'),
  76. meta: { requiresAuth: false }
  77. },
  78. {
  79. path: '/biz/pur/purPayReqFinance',
  80. name: 'purPayReqFinance',
  81. component: () => import('@/view/biz/pur/purPayReqFinance.vue'),
  82. meta: { requiresAuth: false }
  83. },
  84. {
  85. path: '/biz/pur/purPayRefundFinance',
  86. name: 'purPayRefundFinance',
  87. component: () => import('@/view/biz/pur/purPayRefundFinance.vue'),
  88. meta: { requiresAuth: false }
  89. },
  90. {
  91. path: '/biz/sal/collectionInfoH5',
  92. name: 'collectionInfoH5',
  93. component: () => import('@/view/biz/sal/collectionInfoH5.vue'),
  94. meta: { requiresAuth: false }
  95. },
  96. {
  97. path: '/biz/sal/salPlanH5',
  98. name: 'salPlanH5',
  99. component: () => import('@/view/biz/sal/salPlanH5.vue'),
  100. meta: { requiresAuth: false }
  101. },
  102. {
  103. path: '/biz/sal/salResultH5',
  104. name: 'salResultH5',
  105. component: () => import('@/view/biz/sal/salResultH5.vue'),
  106. meta: { requiresAuth: false }
  107. },
  108. {
  109. path: '/biz/sal/salRetreatH5',
  110. name: 'salRetreatH5',
  111. component: () => import('@/view/biz/sal/salRetreatH5.vue'),
  112. meta: { requiresAuth: false }
  113. },
  114. {
  115. path: '/biz/sal/salUpriceH5',
  116. name: 'salUpriceH5',
  117. component: () => import('@/view/biz/sal/salUpriceH5.vue'),
  118. meta: { requiresAuth: false }
  119. },
  120. {
  121. path: "/yinhuan/home",
  122. name: "yinhuanHome",
  123. component: () => import("@/view/yinhuan/home.vue"),
  124. },
  125. {
  126. path: "/projectManage/todo_detail/index",
  127. name: "projectWorkTodoDetail",
  128. component: () => import("@/view/projectManage/todo_detail/index.vue"),
  129. },
  130. {
  131. path: "/projectManage/todo_detail/index2",
  132. name: "projectWorkTodoDetail2",
  133. component: () => import("@/view/projectManage/todo_detail/index2.vue"),
  134. },
  135. {
  136. path: "/yinhuan/todo_detail/index",
  137. name: "yinhuanTodoDetail",
  138. component: () => import("@/view/yinhuan/todo_detail/index.vue"),
  139. },
  140. {
  141. path: "/yinhuan/JuBaotodo_detail/index",
  142. name: "yinhuanJuBaoTodoDetail",
  143. component: () => import("@/view/yinhuan/JuBaotodo_detail/index.vue"),
  144. },
  145. {
  146. path: "/yinhuan/registration",
  147. name: "yinhuanRegistration",
  148. component: () => import("@/view/yinhuan/registration.vue"),
  149. },
  150. {
  151. path: "/yinhuan/hdRwardReporting",
  152. name: "yinhuanhdRwardReporting",
  153. component: () => import("@/view/yinhuan/hdRwardReporting.vue"),
  154. },
  155. {
  156. path: "/yinhuan/registration_edit/index",
  157. name: "registration_edit",
  158. component: () => import("@/view/yinhuan/registration_edit/index.vue"),
  159. },
  160. {
  161. path: "/yinhuan/JuBaoregistration_edit/index",
  162. name: "JuBaoregistration_edit",
  163. component: () => import("@/view/yinhuan/JuBaoregistration_edit/index.vue"),
  164. },
  165. {
  166. path: "/yinhuan/JuBaoregistration_edit/index",
  167. name: "JuBaoregistration_edit",
  168. component: () => import("@/view/yinhuan/JuBaoregistration_edit/index.vue"),
  169. },
  170. {
  171. path: "/yinhuan/hdLedger",
  172. name: "yinhuanHdLedger",
  173. component: () => import("@/view/yinhuan/hdLedger.vue"),
  174. },
  175. {
  176. path: "/yinhuan/hdLedgerJuBao",
  177. name: "yinhuanHdLedgerJuBao",
  178. component: () => import("@/view/yinhuan/hdLedgerJuBao.vue"),
  179. },
  180. {
  181. path: "/yinhuan/hdLedger_detail",
  182. name: "yinhuanHdLedgerDtail",
  183. component: () => import("@/view/yinhuan/heLedger_detail/index.vue"),
  184. },
  185. {
  186. path: "/yinhuan/JuBaohdLedger_detail",
  187. name: "yinhuanJuBaoHdLedgerDtail",
  188. component: () => import("@/view/yinhuan/JuBaoheLedger_detail/index.vue"),
  189. },
  190. {
  191. path: "/yinhuan/todo",
  192. name: "yinhuanTodo",
  193. component: () => import("@/view/yinhuan/todo.vue"),
  194. },
  195. {
  196. path: "/projectManage/todo",
  197. name: "projectManagetodo",
  198. component: () => import("@/view/projectManage/todo.vue"),
  199. },
  200. {
  201. path: "/safeCheck/home",
  202. name: "checkHome",
  203. component: () => import("@/view/safeCheck/home.vue"),
  204. },
  205. {
  206. path: "/safeCheck/task",
  207. name: "safeCheckTask",
  208. component: () => import("@/view/safeCheck/safeCheckTask.vue"),
  209. },
  210. {
  211. path: "/safeCheck/safeCheckTaskEdit",
  212. name: "safeCheckTaskEdit",
  213. component: () => import("@/view/safeCheck/safeCheck_edit/index.vue"),
  214. },
  215. {
  216. path: "/safeCheck/safeCheckTaskItem",
  217. name: "safeCheckTaskItem",
  218. component: () => import("@/view/safeCheck/safeCheck_item/index.vue"),
  219. },
  220. {
  221. path: "/projectManage/projectIndex",
  222. name: "projectIndex",
  223. component: () => import("@/view/projectManage/projectIndex.vue"),
  224. },
  225. {
  226. path: "/projectManage/projectWorkLedger",
  227. name: "projectWorkLedger",
  228. component: () => import("@/view/projectManage/projectWorkLedger.vue"),
  229. },
  230. {
  231. path: "/projectManage/taiZhang",
  232. name: "taiZhang",
  233. component: () => import("@/view/projectManage/taiZhangV3.vue"),
  234. },
  235. {
  236. path: "/projectManage/taiZhang_detail",
  237. name: "taiZhang_detail",
  238. component: () => import("@/view/projectManage/taiZhang_detail/index.vue"),
  239. },
  240. {
  241. path: "/projectManage/taiZhang_edit",
  242. name: "taiZhang_indexEdit",
  243. component: () => import("@/view/projectManage/taiZhang_edit/indexEdit.vue"),
  244. },
  245. {
  246. path: "/projectManage/taiZhang_edit",
  247. name: "taiZhang_edit",
  248. component: () => import("@/view/projectManage/taiZhang_edit/index.vue"),
  249. },
  250. {
  251. path: "/projectManage/projectConstructionOperation",
  252. name: "projectConstructionOperation",
  253. component: () => import("@/view/projectManage/projectConstructionOperation/index.vue"),
  254. },
  255. {
  256. path: "/projectManage/projectConstructionOperation/projectConstructionOperation_detail",
  257. name: "projectConstructionOperation_detail",
  258. component: () => import("@/view/projectManage/projectConstructionOperation/projectConstructionOperation_detail/index.vue"),
  259. },
  260. {
  261. path: "/projectManage/projectConstructionOperation/projectConstructionOperation_detail2",
  262. name: "projectConstructionOperation_detail2",
  263. component: () => import("@/view/projectManage/projectConstructionOperation/projectConstructionOperation_detail/indexLook.vue"),
  264. },
  265. {
  266. path: "/projectManage/projectConstructionOperation/projectConstructionOperation_detail3",
  267. name: "projectConstructionOperation_detail3",
  268. component: () => import("@/view/projectManage/projectConstructionOperation/projectConstructionOperation_detail/indexLookAll.vue"),
  269. },
  270. {
  271. path: "/lvzhi",
  272. component: () => import("@/view/lvzhi/dutyList.vue"),
  273. },
  274. {
  275. path: "/lvzhicx",
  276. component: () => import("@/view/lvzhi/listCx.vue"),
  277. },
  278. {
  279. path: "/lz-rcdcx",
  280. component: () => import("@/view/lvzhi/dutyRecordListCx.vue"),
  281. },
  282. {
  283. path: "/lz-rcd",
  284. component: () => import("@/view/lvzhi/dutyRecordList.vue"),
  285. },
  286. {
  287. path: "/lz-rcd-detail",
  288. component: () => import("@/view/lvzhi/newDutyRecord.vue"),
  289. },
  290. {
  291. path: '/institution/law',
  292. name: 'Law',
  293. component: () => import("@/view/institution/law.vue")
  294. },
  295. {
  296. path: '/institution/institutionRegime',
  297. name: 'InstitutionRegime',
  298. component: () => import("@/view/institution/institutionRegime.vue")
  299. },
  300. {
  301. path: '/institution/institutionRule',
  302. name: 'InstitutionRule',
  303. component: () => import("@/view/institution/institutionRule.vue")
  304. },
  305. {
  306. path: '/institution/riskList',
  307. name: 'RiskList',
  308. component: () => import("@/view/institution/riskList.vue")
  309. },
  310. {
  311. path: '/institution/emergencyPlan',
  312. name: 'EmergencyPlan',
  313. component: () => import("@/view/institution/emergencyPlan.vue")
  314. },
  315. {
  316. path: '/emergencyResources',
  317. name: 'EmergencyResources',
  318. component: () => import("@/view/resources/index.vue")
  319. },
  320. {
  321. path: '/resourcesQuery',
  322. name: 'ResourcesQuery',
  323. component: () => import("@/view/resources/resourcesQuery.vue")
  324. },
  325. {
  326. path: '/maintenanceRecords',
  327. name: 'MaintenanceRecords',
  328. component: () => import("@/view/resources/maintenanceRecords.vue")
  329. },
  330. {
  331. path: '/recordsQuery',
  332. name: 'RecordsQuery',
  333. component: () => import("@/view/resources/recordsQuery.vue")
  334. },
  335. {
  336. path: '/cardManager',
  337. name: 'CardManager',
  338. component: () => import("@/view/card/index.vue")
  339. },
  340. {
  341. path: '/cardManager/specialWork',
  342. name: 'SpecialWork',
  343. component: () => import("@/view/card/CardSpecialWork.vue")
  344. },
  345. {
  346. path: '/cardManager/equipment',
  347. name: 'Equipment',
  348. component: () => import("@/view/card/CardEquipment.vue")
  349. },
  350. {
  351. path: '/cardManager/engineer',
  352. name: 'Card',
  353. component: () => import("@/view/card/CardEngineer.vue")
  354. },
  355. {
  356. path: '/cardManager/building',
  357. name: 'Building',
  358. component: () => import("@/view/card/CardBuilding.vue")
  359. },
  360. {
  361. path: '/cardManager/manager',
  362. name: 'Manager',
  363. component: () => import("@/view/card/CardManager.vue")
  364. },
  365. {
  366. path: '/emergencyDrillPlan',
  367. name: 'EmergencyDrillPlan',
  368. component: () => import("@/view/drillPlan/index.vue")
  369. },
  370. {
  371. path: '/emergencyDrillPlanEdit',
  372. name: 'EmergencyDrillPlanEdit',
  373. component: () => import("@/view/drillPlan/drillPlanEdit.vue")
  374. },
  375. {
  376. path: '/emergencyDrillActEdit',
  377. name: 'EmergencyDrillActEdit',
  378. component: () => import("@/view/drillPlan/drillActEdit.vue")
  379. },
  380. {
  381. path: '/checkTake',
  382. name: '逢查必考',
  383. component: () => import("@/view/dati/checkTake/index.vue")
  384. },
  385. {
  386. path: '/examtask',
  387. name: '考试任务',
  388. component: () => import("@/view/dati/examCheck/index.vue")
  389. },
  390. {
  391. path: '/checkList',
  392. name: '考试任务表单',
  393. component: () => import("@/view/dati/examCheck/checkList.vue")
  394. },
  395. {
  396. path: '/addPeo',
  397. name: '考试人员添加',
  398. component: () => import("@/view/dati/examCheck/addPeo.vue")
  399. },
  400. {
  401. path: '/dailyproblem',
  402. name: 'DailyProblem',
  403. component: () => import("@/view/dati/daily/index.vue")
  404. },
  405. {
  406. path: '/jieguo1',
  407. name: 'JieGuo1',
  408. component: () => import("@/view/dati/checkTake/jieguo1.vue")
  409. },
  410. {
  411. path: '/jieguo2',
  412. name: 'JieGuo2',
  413. component: () => import("@/view/dati/checkTake/jieguo2.vue")
  414. },
  415. {
  416. path: '/datistart',
  417. name: 'DatiStart',
  418. component: () => import("@/view/dati/daily/datistart.vue")
  419. },
  420. {
  421. path: '/jieguo',
  422. name: 'JieGuo',
  423. component: () => import("@/view/dati/daily/jieguo.vue")
  424. },
  425. {
  426. path: '/paiming',
  427. name: 'PaiMing',
  428. component: () => import("@/view/dati/daily/paiming.vue")
  429. },
  430. {
  431. path: '/home2',
  432. name: 'Home2',
  433. component: () => import("@/view/Home2.vue")
  434. },
  435. {
  436. path: '/homeRole',
  437. name: 'HomeRole',
  438. component: () => import("@/view/HomeRole.vue")
  439. },
  440. {
  441. path: '/oldHome',
  442. name: 'OldHome',
  443. component: () => import("@/view/Home.vue")
  444. },
  445. {
  446. path: '/pendingMatters',
  447. name: 'PendingMatters',
  448. component: () => import("@/view/pendingMatters/index.vue")
  449. },
  450. {
  451. path: '/safeClient',
  452. name: 'SafeClient',
  453. component: () => import("@/view/onsiteProcessControl/safeClient.vue")
  454. },
  455. {
  456. path: '/jobCondition',
  457. name: 'JobCondition',
  458. component: () => import("@/view/onsiteProcessControl/jobCondition.vue")
  459. },
  460. {
  461. path: '/yinhuan/riskChecklist',
  462. name: 'RiskChecklist',
  463. component: () => import("@/view/yinhuan/riskChecklist.vue")
  464. },
  465. {
  466. path: '/yinhuan/riskChecklistView',
  467. name: 'RiskChecklistView',
  468. component: () => import("@/view/yinhuan/riskChecklistView.vue")
  469. },
  470. {
  471. path: '/yinhuan/riskChecklistRecords',
  472. name: 'RiskChecklistRecords',
  473. component: () => import("@/view/yinhuan/riskChecklistRecords.vue")
  474. },
  475. {
  476. path: '/yinhuan/riskChecklistRecordsView',
  477. name: 'RiskChecklistRecordsView',
  478. component: () => import("@/view/yinhuan/riskChecklistRecordsView.vue")
  479. },
  480. {
  481. path: '/drillProcess',
  482. name: 'DrillProcess',
  483. component: () => import("@/view/drillPlan/drillProcess.vue")
  484. },
  485. {
  486. path: '/specificSteps',
  487. name: 'SpecificSteps',
  488. component: () => import("@/view/drillPlan/specificSteps.vue")
  489. },
  490. {
  491. path: '/specificStepsView',
  492. name: '/SpecificStepsView',
  493. component: () => import("@/view/drillPlan/specificStepsView.vue")
  494. },
  495. {
  496. path: '/assRec',
  497. name: '/考核登记首页',
  498. component: () => import("@/view/performance/assRec.vue")
  499. },
  500. {
  501. path: '/asscheckList',
  502. name: '/考核登记新增',
  503. component: () => import("@/view/performance/checkList.vue")
  504. },
  505. {
  506. path: '/assRecN',
  507. name: '/考核记录',
  508. component: () => import("@/view/performance/assRecN.vue")
  509. },
  510. {
  511. path: '/learning',
  512. name: 'Learning',
  513. component: () => import('@/view/performance/learning.vue')
  514. },
  515. {
  516. path: '/annex',
  517. name: '文件发布',
  518. component: () => import('@/view/announ/annex.vue')
  519. },
  520. {
  521. path: '/annexList',
  522. name: '文件发布新增',
  523. component: () => import('@/view/announ/annexList.vue')
  524. },
  525. {
  526. path: '/notice',
  527. name: '通知公告',
  528. component: () => import('@/view/announ/notice.vue')
  529. },
  530. {
  531. path: '/noticeList',
  532. name: '通知公告新增',
  533. component: () => import('@/view/announ/noticeList.vue')
  534. },
  535. {
  536. path: '/keyMatters',
  537. name: '重点事项',
  538. component: () => import('@/view/keyMatters/index.vue')
  539. },
  540. {
  541. path: '/keyMatters/view',
  542. name: '重点事项查看',
  543. component: () => import('@/view/keyMatters/view.vue')
  544. },
  545. {
  546. path: '/keyMatters/report',
  547. name: '重点事项汇报',
  548. component: () => import('@/view/keyMatters/report.vue')
  549. },
  550. {
  551. path: '/planManagement',
  552. name: '计划管理',
  553. component: () => import('@/view/planManagement/index.vue')
  554. },
  555. {
  556. path: '/planManagement/manifest',
  557. name: '任务清单',
  558. component: () => import('@/view/planManagement/manifest.vue')
  559. },
  560. {
  561. path: '/planManagement/manifestView',
  562. name: '任务清单查看',
  563. component: () => import('@/view/planManagement/manifestView.vue')
  564. },
  565. {
  566. path: '/planManagement/manifestReport',
  567. name: '任务清单汇报',
  568. component: () => import('@/view/planManagement/manifestReport.vue')
  569. },
  570. {
  571. path: '/performanceReview/units',
  572. name: '单位绩效评估',
  573. component: () => import('@/view/performanceReview/units.vue')
  574. },
  575. {
  576. path: '/accidentManager/accidentBaoGaoLedger/index',
  577. name: 'accidentBaoGaoLedger',
  578. component: () => import('@/view/accidentManager/accidentBaoGaoLedger/index.vue')
  579. },
  580. {
  581. path: '/accidentManager/accidentJuBao/index',
  582. name: 'accidentJuBao',
  583. component: () => import('@/view/accidentManager/accidentJuBao/index.vue')
  584. },
  585. {
  586. path: '/accidentManager/accidentBaoGaoLedger/accidentBaoGaoLedger_edit/index',
  587. name: 'accidentBaoGaoLedger_edit',
  588. component: () => import('@/view/accidentManager/accidentBaoGaoLedger/accidentBaoGaoLedger_edit/index.vue')
  589. },
  590. {
  591. path: '/accidentManager/accidentJuBao/accidentJuBao_edit/index',
  592. name: 'accidentJuBao_edit',
  593. component: () => import('@/view/accidentManager/accidentJuBao/accidentJuBao_edit/index.vue')
  594. },
  595. {
  596. path: '/accidentManager/accidentJuBaoLedger/index',
  597. name: 'accidentJuBaoLedger',
  598. component: () => import('@/view/accidentManager/accidentJuBaoLedger/index.vue')
  599. },
  600. {
  601. path: '/knowledge/accident',
  602. name: '事故案例',
  603. component: () => import('@/view/knowledge/accident.vue')
  604. },
  605. {
  606. path: '/accidentList',
  607. name: '事故案例编辑',
  608. component: () => import('@/view/knowledge/accidentList.vue')
  609. },
  610. {
  611. path: '/knowledge/manager',
  612. name: '管理案例',
  613. component: () => import('@/view/knowledge/manager.vue')
  614. },
  615. {
  616. path: '/managerList',
  617. name: '管理案例编辑',
  618. component: () => import('@/view/knowledge/managerList.vue')
  619. },
  620. {
  621. path: '/knowledge/Culture',
  622. name: '安全文化',
  623. component: () => import('@/view/knowledge/Culture.vue')
  624. },
  625. {
  626. path: '/CultureList',
  627. name: '安全文化编辑',
  628. component: () => import('@/view/knowledge/CultureList.vue')
  629. },
  630. {
  631. path: '/knowledge/project',
  632. name: '项目案例库',
  633. component: () => import('@/view/knowledge/project.vue')
  634. },
  635. {
  636. path: '/projectList',
  637. name: '项目案例库编辑',
  638. component: () => import('@/view/knowledge/projectList.vue')
  639. },
  640. {
  641. path: '/moneySafe/safeMoneyManagement',
  642. name: '安环费用管理',
  643. component: () => import('@/view/moneySafe/safeMoneyManagement.vue')
  644. },
  645. {
  646. path: '/safeMoneyManagementList',
  647. name: '安环费用管理编辑',
  648. component: () => import('@/view/moneySafe/safeMoneyManagementList.vue')
  649. },
  650. {
  651. path: '/moneySafe/safeMoneyBudget',
  652. name: '安全费用预算',
  653. component: () => import('@/view/moneySafe/safeMoneyBudget.vue')
  654. },
  655. {
  656. path: '/safeMoneyBudgetList',
  657. name: '安全费用预算编辑',
  658. component: () => import('@/view/moneySafe/safeMoneyBudgetList.vue')
  659. },
  660. {
  661. path: '/class2',
  662. name: '学习课程库',
  663. component: () => import("@/view/dati/classOne/class2.vue")
  664. },
  665. {
  666. path: '/courseManagement',
  667. name: '课程管理',
  668. component: () => import('@/view/dati/courseManagement/courseManagement.vue')
  669. },
  670. {
  671. path: '/courseManagementList',
  672. name: '课程管理编辑',
  673. component: () => import('@/view/dati/courseManagement/courseManagementList.vue')
  674. },
  675. {
  676. path: '/courseAddPeo',
  677. name: '课程添加人员',
  678. component: () => import('@/view/dati/courseManagement/addPeo.vue')
  679. },
  680. {
  681. path: '/section',
  682. name: '课程添加小节',
  683. component: () => import('@/view/dati/courseManagement/section.vue')
  684. },
  685. {
  686. path: '/sectionList',
  687. name: '人员小节',
  688. component: () => import('@/view/dati/classOne/sectionList.vue')
  689. },
  690. {
  691. path: '/line',
  692. name: '人员小节答题',
  693. component: () => import('@/view/dati/classOne/line.vue')
  694. },
  695. {
  696. path: '/learning1',
  697. name: '人员学习',
  698. component: () => import('@/view/dati/classOne/learning.vue')
  699. },
  700. {
  701. path: '/fcbkdatistart',
  702. name: '逢查必考跳转答题',
  703. component: () => import('@/view/dati/examCheck/fcbkdatistart.vue')
  704. },
  705. ]
  706. })
  707. // 路由守卫
  708. router.beforeEach(async (to, from, next) => {
  709. /*
  710. const requiresWeCom = to.matched.some(record => record.meta.requiresWeCom);
  711. if (requiresWeCom && typeof wx === 'undefined') {
  712. console.warn('该页面需在企业微信内打开');
  713. // 可以跳转提示页或者 Toast 提示
  714. return next(false);
  715. }
  716. wxReady((requestSignature().data))
  717. */
  718. function isTokenValid(token : string) : boolean {
  719. try {
  720. // 检查 token 是否为合法 JWT 格式(3段)
  721. const parts = token.split('.');
  722. if (parts.length !== 3) {
  723. return false;
  724. }
  725. // 解码 payload 部分
  726. const payloadStr = atob(parts[1]);
  727. const payload = JSON.parse(payloadStr);
  728. // 检查是否有 exp 字段
  729. if (!payload.exp) {
  730. return false;
  731. }
  732. // 判断是否过期(exp 是秒级时间戳)
  733. const expTime = payload.exp * 1000;
  734. return Date.now() <= expTime; // ✅ 没过期就返回 true
  735. } catch (error) {
  736. console.error('Token 解析失败:', error);
  737. return false; // 出错也认为无效
  738. }
  739. }
  740. const getDeptPost = () => {
  741. var url = 'framework/SysDepartment/queryDeptPostByUserId'
  742. var param = {
  743. }
  744. axios.get(url, param).then(response => {
  745. if (response.data.code == 0) {
  746. // this.$store.commit('setPost', response.data.data.post)
  747. // this.$store.commit('setDept', response.data.data.dept)
  748. localStorage.setItem('post', JSON.stringify(response.data.data.post))
  749. localStorage.setItem('dept', JSON.stringify(response.data.data.dept))
  750. localStorage.setItem('role', JSON.stringify(response.data.data.role))
  751. localStorage.setItem('deptTree', JSON.stringify(response.data.data.deptTree))
  752. } else {
  753. localStorage.setItem('post', JSON.stringify([]))
  754. localStorage.setItem('dept', JSON.stringify([]))
  755. localStorage.setItem('role', JSON.stringify([]))
  756. localStorage.setItem('deptTree', JSON.stringify([]))
  757. }
  758. })
  759. }
  760. //const tableDataUserId=ref({})
  761. const getTableDataCode = async (userID : string) : Promise<any> => {
  762. const url = '/framework/SysUser/queryByCode';
  763. const param = { userCode: userID };
  764. const response = await axios.get(url, param);
  765. if (response.data.code === '0') {
  766. return response.data.data; // 这个 return 是给 async 函数的
  767. }
  768. return null; // 或者抛出错误,根据你的业务需求
  769. }
  770. console.log(to);
  771. if (to.path == '/Home1'||to.path=='/yinhuan/todo_detail/index'|| to.path == '/lz-rcd-detail'||to.path == '/emergencyResources'||to.path == '/cardManager/specialWork'||to.path == '/cardManager/equipment'||to.path == '/cardManager/engineer') {
  772. /*const token = localStorage.getItem('token');
  773. // 判断是否已经初始化过用户信息
  774. const hasUserInfo = !!localStorage.getItem('userId');
  775. if (hasUserInfo) {
  776. // @ts-ignore
  777. if (token && isTokenValid(token)) {
  778. next();
  779. return;
  780. }
  781. }*/
  782. // const userId=ref('3E4C4009430211B28E367D90704E23CA')
  783. const userId=ref(import.meta.env.VITE_USER_ID)
  784. console.log(userId.value);
  785. console.log("当前环境:");
  786. console.log(import.meta.env.MODE);
  787. if (import.meta.env.MODE == 'production') {
  788. // console.log('当前版本:', import.meta.env.VITE_APP_VERSION);
  789. const signRes = await requestSignature();
  790. const userInfo = await wxReady(signRes.data)
  791. console.log("获取到的用户信息userInfo为:");
  792. console.log(userInfo);
  793. console.log("userInfo的userId为:");
  794. console.log(userInfo.userID);
  795. //const userData = await getTableDataCode(userInfo.userID)
  796. userId.value = userInfo.userID
  797. console.log("userData的userId为:");
  798. console.log(userId.value);
  799. if (!userInfo) {
  800. if (window.history.length > 1) {
  801. showFailToast("获取信息失败,请联系管理员")
  802. window.history.back();
  803. } else {
  804. // 如果没有历史记录,跳转到首页或其他页面
  805. router.push('/login');
  806. }
  807. }
  808. }
  809. // userId.value='S56077'
  810. //http://localhost:4200/workflow?userId=2&flowId=100&workId=HZ289fc39448dafa0194492f66c80125
  811. var url = 'framework/SysLogin/queryPublicKeyToken'
  812. // var url = 'framework/SysLogin/queryPublicKey'
  813. var param = {
  814. param: userId.value
  815. }
  816. await axios.post(url, param).then(response => {
  817. localStorage.setItem('publicKey', response.data.data.publicKey)
  818. localStorage.setItem('userId', response.data.data.id)
  819. localStorage.setItem('userCode', response.data.data.userCode)
  820. localStorage.setItem('userName', response.data.data.userName)
  821. localStorage.setItem('userDesc', response.data.data.userDesc)
  822. localStorage.setItem('userType', response.data.data.userType)
  823. localStorage.setItem('token', response.data.data.token)
  824. localStorage.setItem('belongId', response.data.data.belongId)
  825. localStorage.setItem('applications', JSON.stringify(response.data.data
  826. .applications))
  827. localStorage.setItem('application', JSON.stringify(response.data.data.applications[
  828. 0]))
  829. sessionStorage.setItem('workflowQuery', JSON.stringify({
  830. flowId: to.query.flowId,
  831. workId: to.query.workId,
  832. trackId: to.query.trackId,
  833. date: new Date().getTime()
  834. }))
  835. })
  836. getDeptPost()
  837. next()
  838. } else {
  839. next()
  840. }
  841. const token = localStorage.getItem('token')
  842. /* if (to.meta.requiresAuth && !token) {
  843. next('/login')
  844. } else if (to.path === '/login' && token) {
  845. next('/Home')
  846. } else {
  847. next()
  848. }*/
  849. })
  850. export default router