index.ts 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. import * as EnumType from '@/common/constants/routerName';
  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/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/stop',
  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/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/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/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/hedging',
  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/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/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/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/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/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/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/managers',
  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/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/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/stop',
  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/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/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/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/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/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/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/performance',
  332. name: EnumType.Sell.performance,
  333. component: () => import('@/views/business/sell/list/performance/index.vue'),
  334. meta: {
  335. requireAuth: true,
  336. },
  337. },
  338. {
  339. path: '/sell/all',
  340. name: EnumType.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: EnumType.Exposure.realTime },
  356. children: [
  357. {
  358. path: '/exposure/realTime',
  359. name: EnumType.Exposure.realTime,
  360. component: () => import('@/views/business/exposure/list/realTime/index.vue'),
  361. meta: {
  362. requireAuth: true,
  363. },
  364. },
  365. {
  366. path: '/exposure/spot',
  367. name: EnumType.Exposure.spot,
  368. component: () => import('@/views/business/exposure/list/spot/index.vue'),
  369. meta: {
  370. requireAuth: true,
  371. },
  372. },
  373. {
  374. path: '/exposure/futures',
  375. name: EnumType.Exposure.futures,
  376. component: () => import('@/views/business/exposure/list/futures/index.vue'),
  377. meta: {
  378. requireAuth: true,
  379. },
  380. },
  381. {
  382. path: '/exposure/history',
  383. name: EnumType.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/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/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/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: '/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: '/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: '/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: '/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/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/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',
  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',
  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/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',
  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',
  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',
  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/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/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/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/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/recharge',
  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/withdrawal',
  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/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/plan',
  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/flow',
  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/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/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/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/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/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/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/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/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/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_tab' },
  902. children: [
  903. {
  904. path: '/platinum_broker_management/tab',
  905. name: 'platinum_broker_management_tab',
  906. component: () => import('@/views/platinum/platinum_broker_management/platinum_broker_management_tab/index.vue'),
  907. meta: {
  908. requireAuth: true,
  909. },
  910. },
  911. ]
  912. },
  913. ],
  914. },
  915. {
  916. path: '/test',
  917. name: 'test',
  918. component: () => import('@/views/test/index.vue'),
  919. },
  920. {
  921. // VueRouter 匹配规则是从上往下 建议把*放最后
  922. path: '/:pathMatch(.*)*',
  923. name: '404',
  924. component: () => import('@/views/error-page/404.vue'),
  925. },
  926. ];
  927. const router = createRouter({
  928. history: createWebHashHistory(),
  929. routes,
  930. });
  931. // 路由拦截
  932. router.beforeEach((to, from, next) => {
  933. // 前往登录页时 直接走登出流程
  934. if (to.fullPath === '/login') {
  935. eventBus.$emit('logout');
  936. next();
  937. } else {
  938. // 前往其他页 判断是否是登录状态
  939. if (isLogin()) {
  940. return next();
  941. } else {
  942. if (!getLoadIsComplete()) { // 没有加载对应的资料,表示第一次启动项目
  943. console.log('to', to);
  944. const { ACCOUNT, PASSWORD } = to.query
  945. const name = to.name ? to.name : 'home'
  946. if (ACCOUNT && PASSWORD) {
  947. setLoadComplete(false)
  948. globalDataRefresh().then(() => {
  949. const { ACCOUNT, PASSWORD } = to.query
  950. login(ACCOUNT as string, PASSWORD as string, [], true).then(res => {
  951. setLoadComplete(true)
  952. localStorageUtil.setItem('loginAccount', ACCOUNT); // 缓存登录账号
  953. eventBus.$emit('loginSuccess', true);
  954. next({ name })
  955. }).catch(err => {
  956. // 异常需要跳转到错误页面,让用户手动重试
  957. console.log('err', err);
  958. })
  959. })
  960. } else { // 跳转到登录页面
  961. next()
  962. }
  963. } else { //
  964. next()
  965. }
  966. }
  967. }
  968. });
  969. export default router;