index.ts 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  1. import { EnumRouterName } from '@/common/constants/enumRouterName';
  2. import { setLoadComplete } from '@/common/methods';
  3. import { getLoadIsComplete } from '@/common/methods/mixin';
  4. import Main from '@/layout/components/main.vue';
  5. import Layout from '@/layout/index.vue';
  6. import { globalDataRefresh } from '@/services/bus';
  7. import { isLogin, login } from '@/services/bus/login';
  8. import { localStorageUtil } from '@/utils/storage';
  9. import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
  10. import eventBus from '../utils/eventBus';
  11. const routes: Array<RouteRecordRaw> = [
  12. {
  13. path: '/login',
  14. name: 'login',
  15. component: () => import('@/views/account/login.vue'),
  16. },
  17. {
  18. path: '/logon',
  19. name: 'logon',
  20. component: () => import('@/views/account/logon.vue'),
  21. },
  22. {
  23. path: '/resetPassword',
  24. name: 'resetPassword',
  25. component: () => import('@/views/account/resetPassword.vue'),
  26. },
  27. {
  28. path: '/',
  29. component: Layout,
  30. props: true,
  31. redirect: '/login',
  32. children: [
  33. {
  34. path: '/home',
  35. name: 'home',
  36. component: () => import('@/views/home.vue'),
  37. },
  38. {
  39. path: '/futures',
  40. name: 'forward',
  41. component: () => import('@/views/market/forward/index.vue'),
  42. },
  43. {
  44. path: '/warehouse-trade',
  45. name: 'warehouseTrade',
  46. component: () => import('@/views/market/warehouseTrade/index.vue'),
  47. },
  48. {
  49. path: 'custom_info',
  50. name: 'custom_info',
  51. component: Main,
  52. meta: {
  53. requireAuth: true,
  54. },
  55. redirect: (to) => {
  56. return { name: 'custom_info_unsubmit' };
  57. },
  58. children: [
  59. {
  60. path: '/custom_info/custom_info_normal',
  61. name: 'custom_info_normal',
  62. component: () => import('@/views/information/custom/list/normal-use/index.vue'),
  63. meta: {
  64. requireAuth: true,
  65. },
  66. },
  67. {
  68. path: '/custom_info/custom_info_disabled',
  69. name: 'custom_info_disabled',
  70. component: () => import('@/views/information/custom/list/stop-use/index.vue'),
  71. meta: {
  72. requireAuth: true,
  73. },
  74. },
  75. {
  76. path: '/custom_info/custom_info_checkpending',
  77. name: 'custom_info_checkpending',
  78. component: () => import('@/views/information/custom/list/checkpending/index.vue'),
  79. meta: {
  80. requireAuth: true,
  81. },
  82. },
  83. {
  84. path: '/custom_info/custom_info_unsubmit',
  85. name: 'custom_info_unsubmit',
  86. component: () => import('@/views/information/custom/list/unsubmit/index.vue'),
  87. meta: {
  88. requireAuth: true,
  89. },
  90. },
  91. ],
  92. },
  93. {
  94. path: 'goods_info',
  95. name: 'goods_info',
  96. component: Main,
  97. meta: {
  98. requireAuth: true,
  99. },
  100. redirect: (to) => {
  101. return { name: 'goods_info_spot' };
  102. },
  103. children: [
  104. {
  105. path: '/goods_info/goods_info_spot',
  106. name: 'goods_info_spot',
  107. component: () => import('@/views/information/goods/list/spot-variety/index.vue'),
  108. meta: {
  109. requireAuth: true,
  110. },
  111. },
  112. {
  113. path: '/goods_info/goods_info_hedge',
  114. name: 'goods_info_hedge',
  115. component: () => import('@/views/information/goods/list/hedging-variety/index.vue'),
  116. meta: {
  117. requireAuth: true,
  118. },
  119. },
  120. ],
  121. },
  122. {
  123. path: '/spot_contract',
  124. name: 'spot_contract',
  125. component: Main,
  126. meta: {
  127. requireAuth: true,
  128. },
  129. redirect: (to) => {
  130. return { name: 'spot_contract_unsubmitted' };
  131. },
  132. children: [
  133. {
  134. path: '/spot_contract/spot_contract_unsubmitted',
  135. name: 'spot_contract_unsubmitted',
  136. component: () => import('@/views/information/spot-contract/list/unsubmitted/index.vue'),
  137. meta: {
  138. requireAuth: true,
  139. },
  140. },
  141. {
  142. path: '/spot_contract/spot_contract_checkpending',
  143. name: 'spot_contract_checkpending',
  144. component: () => import('@/views/information/spot-contract/list/checkpending/index.vue'),
  145. meta: {
  146. requireAuth: true,
  147. },
  148. },
  149. {
  150. path: '/spot_contract/spot_contract_performance',
  151. name: 'spot_contract_performance',
  152. component: () => import('@/views/information/spot-contract/list/performance/index.vue'),
  153. meta: {
  154. requireAuth: true,
  155. },
  156. },
  157. {
  158. path: '/spot_contract/spot_contract_finished',
  159. name: 'spot_contract_finished',
  160. component: () => import('@/views/information/spot-contract/list/finished/index.vue'),
  161. meta: {
  162. requireAuth: true,
  163. },
  164. },
  165. ],
  166. },
  167. {
  168. path: '/account_info',
  169. name: 'account_info',
  170. component: Main,
  171. meta: {
  172. requireAuth: true,
  173. },
  174. redirect: (to) => {
  175. return { name: 'account_info_business' };
  176. },
  177. children: [
  178. {
  179. path: '/account_info/account_info_business',
  180. name: 'account_info_business',
  181. component: () => import('@/views/information/account_info/list/account_info_business/index.vue'),
  182. meta: {
  183. requireAuth: true,
  184. },
  185. },
  186. {
  187. path: '/account_info/account_info_futures',
  188. name: 'account_info_futures',
  189. component: () => import('@/views/information/account_info/list/account_info_futures/index.vue'),
  190. meta: {
  191. requireAuth: true,
  192. },
  193. },
  194. {
  195. path: '/account_info/account_info_manager',
  196. name: 'account_info_manager',
  197. component: () => import('@/views/information/account_info/list/account_info_manager/index.vue'),
  198. meta: {
  199. requireAuth: true,
  200. },
  201. },
  202. {
  203. path: '/account_info/account_info_trade',
  204. name: 'account_info_trade',
  205. component: () => import('@/views/information/account_info/list/account_info_trade/index.vue'),
  206. meta: {
  207. requireAuth: true,
  208. },
  209. },
  210. ],
  211. },
  212. {
  213. path: '/warehouse_info',
  214. name: 'warehouse_info',
  215. component: Main,
  216. meta: {
  217. requireAuth: true,
  218. },
  219. redirect: (to) => {
  220. return { name: 'warehouse_info_normal' };
  221. },
  222. children: [
  223. {
  224. path: '/warehouse_info/warehouse_info_normal',
  225. name: 'warehouse_info_normal',
  226. component: () => import('@/views/information/warehouse-info/list/normal-use/index.vue'),
  227. meta: {
  228. requireAuth: true,
  229. },
  230. },
  231. {
  232. path: '/warehouse_info/warehouse_info_disabled',
  233. name: 'warehouse_info_disabled',
  234. component: () => import('@/views/information/warehouse-info/list/stop-use/index.vue'),
  235. meta: {
  236. requireAuth: true,
  237. },
  238. },
  239. ],
  240. },
  241. {
  242. path: '/outaccount_status',
  243. name: 'outaccount_status',
  244. component: () => import('@/views/search/outaccount_status/index.vue'),
  245. meta: {
  246. requireAuth: true,
  247. },
  248. },
  249. {
  250. path: '/inventory',
  251. name: 'inventory',
  252. component: Main,
  253. meta: {
  254. requireAuth: true,
  255. },
  256. redirect: (to) => {
  257. return { name: 'inventory_current' };
  258. },
  259. children: [
  260. {
  261. path: '/inventory/inventory_current',
  262. name: 'inventory_current',
  263. component: () => import('@/views/search/inventory/list/inventory_current/index.vue'),
  264. meta: {
  265. requireAuth: true,
  266. },
  267. },
  268. {
  269. path: '/inventory/inventory_applyrecord',
  270. name: 'inventory_applyrecord',
  271. component: () => import('@/views/search/inventory/list/inventory_applyrecord/index.vue'),
  272. meta: {
  273. requireAuth: true,
  274. },
  275. },
  276. ]
  277. },
  278. {
  279. path: '/purchase',
  280. name: 'purchase',
  281. component: Main,
  282. meta: {
  283. requireAuth: true,
  284. },
  285. redirect: { name: 'purchase_pending' },
  286. children: [
  287. {
  288. path: '/purchase/purchase_pending',
  289. name: 'purchase_pending',
  290. component: () => import('@/views/business/purchase/list/pending/index.vue'),
  291. meta: {
  292. requireAuth: true,
  293. },
  294. },
  295. {
  296. path: '/purchase/purchase_performance',
  297. name: 'purchase_performance',
  298. component: () => import('@/views/business/purchase/list/performance/index.vue'),
  299. meta: {
  300. requireAuth: true,
  301. },
  302. },
  303. {
  304. path: '/purchase/purchase_all',
  305. name: 'purchase_all',
  306. component: () => import('@/views/business/purchase/list/all/index.vue'),
  307. meta: {
  308. requireAuth: true,
  309. },
  310. },
  311. ],
  312. },
  313. {
  314. path: '/sell',
  315. name: 'sell',
  316. component: Main,
  317. meta: {
  318. requireAuth: true,
  319. },
  320. redirect: { name: 'sell_pending' },
  321. children: [
  322. {
  323. path: '/sell/sell_pending',
  324. name: 'sell_pending',
  325. component: () => import('@/views/business/sell/list/pending/index.vue'),
  326. meta: {
  327. requireAuth: true,
  328. },
  329. },
  330. {
  331. path: '/sell/sell_performance',
  332. name: 'sell_performance',
  333. component: () => import('@/views/business/sell/list/performance/index.vue'),
  334. meta: {
  335. requireAuth: true,
  336. },
  337. },
  338. {
  339. path: '/sell/sell_all',
  340. name: 'sell_all',
  341. component: () => import('@/views/business/sell/list/all/index.vue'),
  342. meta: {
  343. requireAuth: true,
  344. },
  345. },
  346. ],
  347. },
  348. {
  349. path: '/exposure',
  350. name: 'exposure',
  351. component: Main,
  352. meta: {
  353. requireAuth: true,
  354. },
  355. redirect: { name: 'exposure_realtime' },
  356. children: [
  357. {
  358. path: '/exposure/exposure_realtime',
  359. name: 'exposure_realtime',
  360. component: () => import('@/views/business/exposure/list/realTime/index.vue'),
  361. meta: {
  362. requireAuth: true,
  363. },
  364. },
  365. {
  366. path: '/exposure/exposure_spot',
  367. name: 'exposure_spot',
  368. component: () => import('@/views/business/exposure/list/spot/index.vue'),
  369. meta: {
  370. requireAuth: true,
  371. },
  372. },
  373. {
  374. path: '/exposure/exposure_futures',
  375. name: 'exposure_futures',
  376. component: () => import('@/views/business/exposure/list/futures/index.vue'),
  377. meta: {
  378. requireAuth: true,
  379. },
  380. },
  381. {
  382. path: '/exposure/exposure_history',
  383. name: 'exposure_history',
  384. component: () => import('@/views/business/exposure/list/history/index.vue'),
  385. meta: {
  386. requireAuth: true,
  387. },
  388. },
  389. ],
  390. },
  391. {
  392. path: '/plan',
  393. name: 'plan',
  394. component: Main,
  395. meta: {
  396. requireAuth: true,
  397. },
  398. redirect: { name: 'plan_uncommitted' },
  399. children: [
  400. {
  401. path: '/plan/plan_uncommitted',
  402. name: 'plan_uncommitted',
  403. component: () => import('@/views/business/plan/list/uncommitted/index.vue'),
  404. meta: {
  405. requireAuth: true,
  406. },
  407. },
  408. {
  409. path: '/plan/plan_audit',
  410. name: 'plan_audit',
  411. component: () => import('@/views/business/plan/list/audit/index.vue'),
  412. meta: {
  413. requireAuth: true,
  414. },
  415. },
  416. {
  417. path: '/plan/plan_running',
  418. name: 'plan_running',
  419. component: () => import('@/views/business/plan/list/running/index.vue'),
  420. meta: {
  421. requireAuth: true,
  422. },
  423. },
  424. ],
  425. },
  426. {
  427. path: 'review',
  428. name: 'business_review',
  429. component: Main,
  430. meta: {
  431. requireAuth: true,
  432. },
  433. redirect: { name: 'business_review_someprice' },
  434. children: [
  435. {
  436. path: '/business_review/business_review_someprice',
  437. name: 'business_review_someprice',
  438. component: () => import('@/views/manage/business-review/list/someprice/index.vue'),
  439. meta: {
  440. requireAuth: true,
  441. },
  442. },
  443. {
  444. path: '/business_review/business_review_settlement',
  445. name: 'business_review_settlement',
  446. component: () => import('@/views/manage/business-review/list/settlement/index.vue'),
  447. meta: {
  448. requireAuth: true,
  449. },
  450. },
  451. ]
  452. },
  453. {
  454. path: '/finance_review',
  455. name: 'finance_review',
  456. component: Main,
  457. meta: {
  458. requireAuth: true,
  459. },
  460. redirect: { name: 'finance_review_funds' },
  461. children: [
  462. {
  463. path: '/finance_review/finance_review_funds',
  464. name: 'finance_review_funds',
  465. component: () => import('@/views/manage/finance-review/list/funds/index.vue'),
  466. meta: {
  467. requireAuth: true,
  468. },
  469. },
  470. {
  471. path: '/finance_review/finance_review_invoice',
  472. name: 'finance_review_invoice',
  473. component: () => import('@/views/manage/finance-review/list/invoice/index.vue'),
  474. meta: {
  475. requireAuth: true,
  476. },
  477. },
  478. ]
  479. },
  480. {
  481. path: '/inventory_review',
  482. name: 'inventory_review',
  483. component: Main,
  484. meta: {
  485. requireAuth: true,
  486. },
  487. redirect: { name: 'inventory_review_checkin' },
  488. children: [
  489. {
  490. path: '/inventory_review/inventory_review_checkin',
  491. name: 'inventory_review_checkin',
  492. component: () => import('@/views/manage/inventory-review/list/checkin/index.vue'),
  493. meta: {
  494. requireAuth: true,
  495. },
  496. },
  497. {
  498. path: '/inventory_review/inventory_review_checkout',
  499. name: 'inventory_review_checkout',
  500. component: () => import('@/views/manage/inventory-review/list/checkout/index.vue'),
  501. meta: {
  502. requireAuth: true,
  503. },
  504. },
  505. ]
  506. },
  507. {
  508. path: '/exposure_report',
  509. name: 'exposure_report',
  510. component: Main,
  511. meta: {
  512. requireAuth: true,
  513. },
  514. redirect: { name: 'exposure_report_exposure' },
  515. children: [
  516. {
  517. path: '/exposure_report/exposure_report_exposure',
  518. name: 'exposure_report_exposure',
  519. component: () => import('@/views/report/exposure-report/list/exposure_report/index.vue'),
  520. meta: {
  521. requireAuth: true,
  522. },
  523. },
  524. ]
  525. },
  526. {
  527. path: '/finance_report',
  528. name: 'finance_report',
  529. component: Main,
  530. meta: {
  531. requireAuth: true,
  532. },
  533. redirect: { name: 'finance_report_finance' },
  534. children: [
  535. {
  536. path: '/finance_report/finance_report_finance',
  537. name: 'finance_report_finance',
  538. component: () => import('@/views/report/finance-report/list/finance_report_finance/index.vue'),
  539. meta: {
  540. requireAuth: true,
  541. },
  542. },
  543. ]
  544. },
  545. {
  546. path: '/inventory_report',
  547. name: 'inventory_report',
  548. component: Main,
  549. meta: {
  550. requireAuth: true,
  551. },
  552. redirect: { name: 'inventory_report_inventory_category' },
  553. children: [
  554. {
  555. path: '/inventory_report/inventory_report_inventory_category',
  556. name: 'inventory_report_inventory_category',
  557. component: () => import('@/views/report/inventory-report/list/category/index.vue'),
  558. meta: {
  559. requireAuth: true,
  560. },
  561. },
  562. {
  563. path: '/inventory_report/warehouse',
  564. name: 'inventory_report_warehouse',
  565. component: () => import('@/views/report/inventory-report/list/warehouse/index.vue'),
  566. meta: {
  567. requireAuth: true,
  568. },
  569. },
  570. ]
  571. },
  572. {
  573. path: '/spot_report',
  574. name: 'spot_report',
  575. component: Main,
  576. meta: {
  577. requireAuth: true,
  578. },
  579. redirect: { name: 'spot_report_spot' },
  580. children: [
  581. {
  582. path: '/spot_report/spot_report_spot',
  583. name: 'spot_report_spot',
  584. component: () => import('@/views/report/spot-report/list/spot_report/index.vue'),
  585. meta: {
  586. requireAuth: true,
  587. },
  588. },
  589. ]
  590. },
  591. {
  592. path: '/sum_pl_report',
  593. name: 'sum_pl_report',
  594. component: Main,
  595. meta: {
  596. requireAuth: true,
  597. },
  598. redirect: { name: 'sum_pl_report_sum_pl' },
  599. children: [
  600. {
  601. path: '/sum_pl_report/sum_pl_report_sum_pl',
  602. name: 'sum_pl_report_sum_pl',
  603. component: () => import('@/views/report/sum_pl_report/list/sum_pl_report/index.vue'),
  604. meta: {
  605. requireAuth: true,
  606. },
  607. },
  608. ]
  609. },
  610. {
  611. path: '/future_report',
  612. name: 'future_report',
  613. component: Main,
  614. meta: {
  615. requireAuth: true,
  616. },
  617. redirect: { name: 'future_report_future' },
  618. children: [
  619. {
  620. path: '/future_report/future_report_future',
  621. name: 'future_report_future',
  622. component: () => import('@/views/report/future_report/list/future_report/index.vue'),
  623. meta: {
  624. requireAuth: true,
  625. },
  626. },
  627. ]
  628. },
  629. {
  630. path: '/platinum_customer_info',
  631. name: 'platinum_customer_info',
  632. component: Main,
  633. meta: {
  634. requireAuth: true,
  635. },
  636. redirect: { name: 'platinum_custom_info_normal' },
  637. children: [
  638. {
  639. path: '/platinum_customer_info/platinum_custom_info_normal',
  640. name: 'platinum_custom_info_normal',
  641. component: () => import('@/views/platinum/platinum_customer_info/list/normal-use/index.vue'),
  642. meta: {
  643. requireAuth: true,
  644. },
  645. },
  646. {
  647. path: '/platinum_customer_info/platinum_customer_info_unsubmit',
  648. name: 'platinum_customer_info_unsubmit',
  649. component: () => import('@/views/platinum/platinum_customer_info/list/unsubmit/index.vue'),
  650. meta: {
  651. requireAuth: true,
  652. },
  653. },
  654. {
  655. path: '/platinum_customer_info/platinum_customer_info_stop',
  656. name: 'platinum_customer_info_stop',
  657. component: () => import('@/views/platinum/platinum_customer_info/list/stop-use/index.vue'),
  658. meta: {
  659. requireAuth: true,
  660. },
  661. },
  662. ]
  663. },
  664. {
  665. path: '/platinum_pick_query',
  666. name: 'platinum_pick_query',
  667. component: Main,
  668. meta: {
  669. requireAuth: true,
  670. },
  671. redirect: { name: 'platinum_pick_query_tab' },
  672. children: [
  673. {
  674. path: '/platinum_pick_query/platinum_pick_query_tab',
  675. name: 'platinum_pick_query_tab',
  676. component: () => import('@/views/platinum/platinum_pick_query/list/tab/index.vue'),
  677. meta: {
  678. requireAuth: true,
  679. },
  680. },
  681. ]
  682. },
  683. {
  684. path: '/platinum_recharge_withdrawal_review',
  685. name: 'platinum_recharge_withdrawal_review',
  686. component: Main,
  687. meta: {
  688. requireAuth: true,
  689. },
  690. redirect: { name: 'platinum_recharge_review_tab' },
  691. children: [
  692. {
  693. path: '/platinum_withdrawal_review_tab/platinum_recharge_review_tab',
  694. name: 'platinum_recharge_review_tab',
  695. component: () => import('@/views/platinum/platinum_recharge_withdrawal_review/list/recharge/index.vue'),
  696. meta: {
  697. requireAuth: true,
  698. },
  699. },
  700. {
  701. path: '/platinum_withdrawal_review_tab/platinum_withdrawal_review_tab',
  702. name: 'platinum_withdrawal_review_tab',
  703. component: () => import('@/views/platinum/platinum_recharge_withdrawal_review/list/withdrawal/index.vue'),
  704. meta: {
  705. requireAuth: true,
  706. },
  707. },
  708. ]
  709. },
  710. {
  711. path: '/platinum_fixed_investment_price_query',
  712. name: 'platinum_fixed_investment_price_query',
  713. component: Main,
  714. meta: {
  715. requireAuth: true,
  716. },
  717. redirect: { name: 'platinum_fixed_investment_price_query_tab' },
  718. children: [
  719. {
  720. path: '/platinum_fixed_investment_price_query/platinum_fixed_investment_price_query_tab',
  721. name: 'platinum_fixed_investment_price_query_tab',
  722. component: () => import('@/views/platinum/platinum_fixed_investment_price_query/list/tab/index.vue'),
  723. meta: {
  724. requireAuth: true,
  725. },
  726. },
  727. ]
  728. },
  729. {
  730. path: '/platinum_fixed_investment_query',
  731. name: 'platinum_fixed_investment_query',
  732. component: Main,
  733. meta: {
  734. requireAuth: true,
  735. },
  736. redirect: { name: 'platinum_fixed_investment_plan_query' },
  737. children: [
  738. {
  739. path: '/platinum_fixed_investment_plan_query/platinum_fixed_investment_plan_query',
  740. name: 'platinum_fixed_investment_plan_query',
  741. component: () => import('@/views/platinum/platinum_fixed_investment_query/list/plan/index.vue'),
  742. meta: {
  743. requireAuth: true,
  744. },
  745. },
  746. {
  747. path: '/platinum_fixed_investment_plan_query/platinum_fixed_investment_flow_query',
  748. name: 'platinum_fixed_investment_flow_query',
  749. component: () => import('@/views/platinum/platinum_fixed_investment_query/list/flow/index.vue'),
  750. meta: {
  751. requireAuth: true,
  752. },
  753. },
  754. ]
  755. },
  756. {
  757. path: '/platinum_document_query',
  758. name: 'platinum_document_query',
  759. component: Main,
  760. meta: {
  761. requireAuth: true,
  762. },
  763. redirect: { name: 'platinum_document_query_position' },
  764. children: [
  765. {
  766. path: '/platinum_document_query/platinum_document_query_position',
  767. name: 'platinum_document_query_position',
  768. component: () => import('@/views/platinum/platinum_document_query/list/position/index.vue'),
  769. meta: {
  770. requireAuth: true,
  771. },
  772. },
  773. {
  774. path: '/platinum_document_query/platinum_document_query_order',
  775. name: 'platinum_document_query_order',
  776. component: () => import('@/views/platinum/platinum_document_query/list/order/index.vue'),
  777. meta: {
  778. requireAuth: true,
  779. },
  780. },
  781. {
  782. path: '/platinum_document_query/platinum_document_query_waiting',
  783. name: 'platinum_document_query_waiting',
  784. component: () => import('@/views/platinum/platinum_document_query/list/waiting/index.vue'),
  785. meta: {
  786. requireAuth: true,
  787. },
  788. },
  789. {
  790. path: '/platinum_document_query/platinum_document_query_success',
  791. name: 'platinum_document_query_success',
  792. component: () => import('@/views/platinum/platinum_document_query/list/success/index.vue'),
  793. meta: {
  794. requireAuth: true,
  795. },
  796. },
  797. ]
  798. },
  799. {
  800. path: '/platinum_financing_information',
  801. name: 'platinum_financing_information',
  802. component: Main,
  803. meta: {
  804. requireAuth: true,
  805. },
  806. redirect: { name: 'platinum_financing_information_tab' },
  807. children: [
  808. {
  809. path: '/platinum_financing_information/platinum_financing_information_tab',
  810. name: 'platinum_financing_information_tab',
  811. component: () => import('@/views/platinum/platinum_financing_information/list/tab/index.vue'),
  812. meta: {
  813. requireAuth: true,
  814. },
  815. },
  816. ]
  817. },
  818. {
  819. path: '/platinum_agents_and_stores',
  820. name: 'platinum_agents_and_stores',
  821. component: Main,
  822. meta: {
  823. requireAuth: true,
  824. },
  825. redirect: { name: 'platinum_agents_and_stores_tab' },
  826. children: [
  827. {
  828. path: '/platinum_agents_and_stores/platinum_agents_and_stores_tab',
  829. name: 'platinum_agents_and_stores_tab',
  830. component: () => import('@/views/platinum/platinum_agents_and_stores/list/tab/index.vue'),
  831. meta: {
  832. requireAuth: true,
  833. },
  834. },
  835. ]
  836. },
  837. {
  838. path: '/platinum_agreement',
  839. name: 'platinum_agreement',
  840. component: Main,
  841. meta: {
  842. requireAuth: true,
  843. },
  844. redirect: { name: 'platinum_agreement_tab' },
  845. children: [
  846. {
  847. path: '/platinum_agreement/platinum_agreement_tab',
  848. name: 'platinum_agreement_tab',
  849. component: () => import('@/views/platinum/platinum_agreement/list/tab/index.vue'),
  850. meta: {
  851. requireAuth: true,
  852. },
  853. },
  854. ]
  855. },
  856. {
  857. path: '/platinum_capital_flow',
  858. name: 'platinum_capital_flow',
  859. component: Main,
  860. meta: {
  861. requireAuth: true,
  862. },
  863. redirect: { name: 'platinum_capital_flow_tab' },
  864. children: [
  865. {
  866. path: '/platinum_capital_flow_tab/platinum_capital_flow_tab',
  867. name: 'platinum_capital_flow_tab',
  868. component: () => import('@/views/platinum/platinum_capital_flow/platinum_capital_flow_tab/index.vue'),
  869. meta: {
  870. requireAuth: true,
  871. },
  872. },
  873. ]
  874. },
  875. {
  876. path: '/platinum_promotion_report',
  877. name: 'platinum_promotion_report',
  878. component: Main,
  879. meta: {
  880. requireAuth: true,
  881. },
  882. redirect: { name: 'platinum_promotion_report_tab' },
  883. children: [
  884. {
  885. path: '/platinum_promotion_report/platinum_promotion_report_tab',
  886. name: 'platinum_promotion_report_tab',
  887. component: () => import('@/views/platinum/platinum_promotion_report/platinum_promotion_report_tab/index.vue'),
  888. meta: {
  889. requireAuth: true,
  890. },
  891. },
  892. ]
  893. },
  894. {
  895. path: '/platinum_broker_management',
  896. name: 'platinum_broker_management',
  897. component: Main,
  898. meta: {
  899. requireAuth: true,
  900. },
  901. redirect: { name: 'platinum_broker_management_normal_tab' },
  902. children: [
  903. {
  904. path: '/platinum_broker_management/platinum_broker_management_normal_tab',
  905. name: 'platinum_broker_management_normal_tab',
  906. component: () => import('@/views/platinum/platinum_broker_management/normal/index.vue'),
  907. meta: {
  908. requireAuth: true,
  909. },
  910. },
  911. {
  912. path: '/platinum_broker_management/platinum_broker_management_waiting_tab',
  913. name: 'platinum_broker_management_waiting_tab',
  914. component: () => import('@/views/platinum/platinum_broker_management/waiting/index.vue'),
  915. meta: {
  916. requireAuth: true,
  917. },
  918. },
  919. {
  920. path: '/platinum_broker_management/platinum_broker_management_refuse_tab',
  921. name: 'platinum_broker_management_refuse_tab',
  922. component: () => import('@/views/platinum/platinum_broker_management/refuse/index.vue'),
  923. meta: {
  924. requireAuth: true,
  925. },
  926. },
  927. ]
  928. },
  929. {
  930. path: '/spot_trade',
  931. name: EnumRouterName.spot_trade,
  932. component: Main,
  933. meta: {
  934. requireAuth: true,
  935. },
  936. redirect: { name: EnumRouterName.warehouse_receipt_trade, },
  937. children: [
  938. {
  939. path: '/spot_trade/warehouse_receipt_trade',
  940. name: EnumRouterName.warehouse_receipt_trade,
  941. component: () => import('@/views/market/spot_trade/warehouse_receipt_trade/index.vue'),
  942. meta: {
  943. requireAuth: true,
  944. },
  945. children: [
  946. {
  947. path: '/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_floating_price',
  948. name: EnumRouterName.warehouse_receipt_trade_floating_price,
  949. component: () => import('@/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_floating_price/index.vue'),
  950. meta: {
  951. requireAuth: true,
  952. },
  953. },
  954. {
  955. path: '/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_price',
  956. name: EnumRouterName.warehouse_receipt_trade_price,
  957. component: () => import('@/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_price/index.vue'),
  958. meta: {
  959. requireAuth: true,
  960. },
  961. },
  962. ]
  963. },
  964. {
  965. path: '/spot_trade/warehouse_pre_sale',
  966. name: EnumRouterName.warehouse_pre_sale,
  967. component: () => import('@/views/market/spot_trade/warehouse_pre_sale/index.vue'),
  968. meta: {
  969. requireAuth: true,
  970. },
  971. children: [
  972. {
  973. path: '/spot_trade/warehouse_pre_sale/warehouse_pre_sale_floating_price',
  974. name: EnumRouterName.warehouse_pre_sale_floating_price,
  975. component: () => import('@/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_floating_price/index.vue'),
  976. meta: {
  977. requireAuth: true,
  978. },
  979. },
  980. {
  981. path: '/spot_trade/warehouse_pre_sale/warehouse_pre_sale_price',
  982. name: EnumRouterName.warehouse_pre_sale_price,
  983. component: () => import('@/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_price/index.vue'),
  984. meta: {
  985. requireAuth: true,
  986. },
  987. },
  988. ]
  989. },
  990. ]
  991. },
  992. ],
  993. },
  994. {
  995. path: '/test',
  996. name: 'test',
  997. component: () => import('@/views/test/index.vue'),
  998. },
  999. {
  1000. // VueRouter 匹配规则是从上往下 建议把*放最后
  1001. path: '/:pathMatch(.*)*',
  1002. name: '404',
  1003. component: () => import('@/views/error-page/404.vue'),
  1004. },
  1005. ];
  1006. const router = createRouter({
  1007. history: createWebHashHistory(),
  1008. routes,
  1009. });
  1010. // 路由拦截
  1011. router.beforeEach((to, from, next) => {
  1012. // 前往登录页时 直接走登出流程
  1013. if (to.fullPath === '/login') {
  1014. eventBus.$emit('logout');
  1015. next();
  1016. } else {
  1017. // 前往其他页 判断是否是登录状态
  1018. if (isLogin()) {
  1019. return next();
  1020. } else {
  1021. if (!getLoadIsComplete()) { // 没有加载对应的资料,表示第一次启动项目
  1022. console.log('to', to);
  1023. const { ACCOUNT, PASSWORD } = to.query
  1024. const name = to.name ? to.name : 'home'
  1025. if (ACCOUNT && PASSWORD) {
  1026. setLoadComplete(false)
  1027. globalDataRefresh().then(() => {
  1028. const { ACCOUNT, PASSWORD } = to.query
  1029. login(ACCOUNT as string, PASSWORD as string, [], true).then(res => {
  1030. setLoadComplete(true)
  1031. localStorageUtil.setItem('loginAccount', ACCOUNT); // 缓存登录账号
  1032. eventBus.$emit('loginSuccess', true);
  1033. next({ name })
  1034. }).catch(err => {
  1035. // 异常需要跳转到错误页面,让用户手动重试
  1036. console.log('err', err);
  1037. })
  1038. })
  1039. } else { // 跳转到登录页面
  1040. next()
  1041. }
  1042. } else { //
  1043. next()
  1044. }
  1045. }
  1046. }
  1047. });
  1048. export default router;