index.ts 43 KB

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