index.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. import { createRouter, createWebHistory } from "vue-router";
  2. import store from "@/store";
  3. /**
  4. * 说明
  5. * meta中
  6. * keepAlive表示是否要缓存
  7. * isRoot代表是否为侧边栏组件用于处理面包屑数据
  8. * hasBack 控制是否有返回按钮
  9. */
  10. const routes=[
  11. {
  12. path: "/",
  13. name: "Layout",
  14. redirect:'/report/index',
  15. component: ()=>import("@/layout/Index.vue"),
  16. },
  17. //活动模块
  18. {
  19. path: "/activity",
  20. name: "Activity",
  21. redirect:'/activity/list',
  22. component: () => import("@/layout/Index.vue"),
  23. meta: {
  24. title:"活动"
  25. },
  26. children: [
  27. {
  28. path: "list",
  29. name: "ActivityList",
  30. component: () => import("@/views/activity/List.vue"),
  31. meta: {
  32. title: "活动",
  33. keepAlive:true,
  34. isRoot:true
  35. },
  36. },
  37. {
  38. path:'detail',//query: id(活动id)
  39. name:"ActivityDetail",
  40. component: () => import("@/views/activity/Detail.vue"),
  41. meta: {
  42. title: "活动详情",
  43. hasBack:true
  44. },
  45. },
  46. {
  47. path: "reportdetail",
  48. name: "ActivityReportDetail",
  49. component: () => import("@/views/activity/ReportDetail.vue"),
  50. meta: {
  51. title: "报告详情",
  52. hasBack:true
  53. }
  54. },
  55. {
  56. path: "chapterdetail",
  57. name: "ActivityChapterReportDetail",
  58. component: () => import("@/views/activity/ChapterDetail.vue"),
  59. meta: {
  60. title: "报告详情",
  61. hasBack:true
  62. }
  63. }
  64. ]
  65. },
  66. // 报告模块
  67. {
  68. path:'/report',
  69. name:'Report',
  70. redirect: '/report/classify',
  71. component: () => import("@/layout/Index.vue"),
  72. meta: {
  73. title:"研报"
  74. },
  75. children:[
  76. // 研报与首页区分开了 首页为原来的研报页面,现在的研报页面是分类 -- 2022/10/17
  77. {
  78. path: "index",
  79. name: "ReportIndex",
  80. component: () => import("@/views/report/Index.vue"),
  81. meta: {
  82. title: "首页",
  83. keepAlive:true,
  84. isRoot:true
  85. },
  86. },
  87. {
  88. path: "classify",
  89. name: "ReportClassify",
  90. component: () => import("@/views/report/Classify.vue"),
  91. meta: {
  92. title: "研报",
  93. keepAlive:false,
  94. isRoot:true
  95. },
  96. },
  97. {
  98. path: "search",
  99. name: "ReportSearch",
  100. component: () => import("@/views/report/Search.vue"),
  101. meta: {
  102. title: "研报搜索",
  103. keepAlive:true,
  104. isRoot:false,
  105. hasBack:true
  106. },
  107. },
  108. {
  109. path: "detail",
  110. name: "ReportDetail",
  111. component: () => import("@/views/report/Detail.vue"),
  112. meta: {
  113. title: "报告详情",
  114. keepAlive:false,
  115. isRoot:false,
  116. hasBack:true
  117. },
  118. },
  119. {
  120. path: "chapterdetail",
  121. name: "ReportChapterDetail",
  122. component: () => import("@/views/report/ChapterDetail.vue"),
  123. meta: {
  124. title: "报告详情",
  125. keepAlive:false,
  126. isRoot:false,
  127. hasBack:true
  128. },
  129. },
  130. {
  131. path: "list",
  132. name: "ReportList",
  133. component: () => import("@/views/report/List.vue"),
  134. meta: {
  135. title: "报告列表",
  136. keepAlive:true,
  137. isRoot:false,
  138. hasBack:true
  139. },
  140. },
  141. {
  142. path: "specialcolumnlist",
  143. name: "ReportSpecialColumnList",
  144. component: () => import("@/views/report/specialColumn/List.vue"),
  145. meta: {
  146. title: "专栏列表",
  147. keepAlive:true,
  148. isRoot:false,
  149. hasBack:true
  150. },
  151. },
  152. {
  153. path: "specialcolumndetail",
  154. name: "ReportSpecialColumnDetail",
  155. component: () => import("@/views/report/specialColumn/Detail.vue"),
  156. meta: {
  157. title: "专栏详情",
  158. keepAlive:true,
  159. isRoot:false,
  160. hasBack:true
  161. },
  162. },
  163. {
  164. path: "ficcserveintro",
  165. name: "FiccServeIntro",
  166. component: () => import("@/views/report/FiccIntroduce.vue"),
  167. meta: {
  168. title: "FICC服务介绍",
  169. keepAlive:false,
  170. isRoot:false,
  171. hasBack:true
  172. },
  173. },
  174. {
  175. path: "varietyreportlist",
  176. name: "VarietyReportList",
  177. component: () => import("@/views/report/reportForVariety/List.vue"),
  178. meta: {
  179. title: "报告列表",
  180. keepAlive:true,
  181. isRoot:false,
  182. hasBack:true
  183. },
  184. },
  185. {
  186. path: "previewPDF",
  187. name: "PreviewPDF",
  188. component: () => import("@/views/report/PreviewPDF.vue"),
  189. meta: {
  190. title: "预览报告",
  191. keepAlive:true,
  192. isRoot:false,
  193. hasBack:true
  194. },
  195. },
  196. {
  197. path: "disseminatePage",
  198. name: "disseminatePage",
  199. component: () => import("@/views/report/disseminatePage.vue"),
  200. meta: {
  201. title: "活动详情",
  202. keepAlive:true,
  203. isRoot:false,
  204. hasBack:true
  205. },
  206. }
  207. ]
  208. },
  209. {
  210. path: "/apply",
  211. name: "Apply",
  212. component: () => import("@/layout/Index.vue"),
  213. meta: {
  214. title:"申请试用"
  215. },
  216. children: [
  217. {
  218. path: "permission",// source来源(如:2) fromPage=来源页面(如:活动列表)
  219. name: "ApplyPermission",
  220. component: () => import("@/views/applyPermission/Apply.vue"),
  221. meta: {
  222. title: "申请试用",
  223. hasBack:true
  224. }
  225. },
  226. {
  227. path: "result",
  228. name: "ApplyPermissionResult",
  229. component: () => import("@/views/applyPermission/Result.vue"),
  230. meta: {
  231. title: "申请结果",
  232. hasBack:true
  233. }
  234. }
  235. ]
  236. },
  237. // 图库模块
  238. {
  239. path:'/chart',
  240. name:"Chart",
  241. component: () => import("@/layout/Index.vue"),
  242. meta:{
  243. title:"ETA图库"
  244. },
  245. children:[
  246. {
  247. path:"list",
  248. name:"ChartList",
  249. component:()=>import('@/views/chart/List.vue'),
  250. meta: {
  251. title: "ETA图库",
  252. keepAlive:true,
  253. isRoot:true
  254. }
  255. }
  256. ]
  257. },
  258. // 沙盘推演模块
  259. {
  260. path:'/sandBox',
  261. name:"sandBox",
  262. component: () => import("@/layout/Index.vue"),
  263. redirect:'/sandBox/list',
  264. meta:{
  265. title:"沙盘推演"
  266. },
  267. children:[
  268. {
  269. path:"list",
  270. name:"sandBoxList",
  271. component:()=>import('@/views/sandBox/List.vue'),
  272. meta: {
  273. title: "沙盘推演",
  274. keepAlive:true,
  275. isRoot:true
  276. }
  277. }
  278. ]
  279. },
  280. //问答模块
  281. {
  282. path: "/question",
  283. name: "Question",
  284. redirect:'/question/list',
  285. component: () => import("@/layout/Index.vue"),
  286. meta: {
  287. title:"问答"
  288. },
  289. children: [
  290. {
  291. path: "list",
  292. name: "QuestionList",
  293. component: () => import("@/views/question/List.vue"),
  294. meta: {
  295. title: "问答社区",
  296. keepAlive:true,
  297. isRoot:true
  298. }
  299. },{
  300. path: "mylist",
  301. name: "QuestionMyList",
  302. component: () => import("@/views/question/MyList.vue"),
  303. meta: {
  304. title: "我的问答",
  305. keepAlive:true,
  306. // isRoot:false
  307. isRoot:true
  308. }
  309. }
  310. ]
  311. },
  312. // 用户模块
  313. {
  314. path:'/user',
  315. name:"User",
  316. component: () => import("@/layout/Index.vue"),
  317. meta:{
  318. title:"用户"
  319. },
  320. children:[
  321. {
  322. path:"setinfo",
  323. name:"UserSetInfo",
  324. component:()=>import('@/views/user/SetUserInfo.vue'),
  325. meta: {
  326. title: "我的设置",
  327. keepAlive:false,
  328. isRoot:false,
  329. hasBack:true
  330. }
  331. }
  332. ]
  333. },
  334. //价格驱动
  335. {
  336. path: '/pricedriven',
  337. name: "priceDriven",
  338. component: () => import("@/layout/Index.vue"),
  339. meta: {
  340. title:"价格驱动"
  341. },
  342. children: [
  343. {
  344. path: "/pricedriven",
  345. name: "priceDrivenDeteail",
  346. component: () => import("@/views/priceDriven/detail.vue"),
  347. meta: {
  348. title: "价格驱动",
  349. keepAlive:false,
  350. isRoot:true
  351. },
  352. },
  353. ]
  354. },
  355. //视频社区模块
  356. {
  357. path:'/video',
  358. name:"Video",
  359. component: () => import("@/layout/Index.vue"),
  360. meta:{
  361. title:"视频社区"
  362. },
  363. children:[
  364. {
  365. path:"list",
  366. name:"VideoList",
  367. component:()=>import('@/views/video/List.vue'),
  368. meta: {
  369. title: "视频社区",
  370. keepAlive:true,
  371. isRoot:true
  372. }
  373. }
  374. ]
  375. },
  376. //语音播报模块
  377. {
  378. path:'/voice',
  379. name:"Voice",
  380. component: () => import("@/layout/Index.vue"),
  381. meta:{
  382. title:"语音播报"
  383. },
  384. children:[
  385. {
  386. path:"list",
  387. name:"VoiceList",
  388. component:()=>import('@/views/voice/List.vue'),
  389. meta: {
  390. title: "语音播报",
  391. keepAlive:true,
  392. isRoot:true
  393. }
  394. },
  395. {
  396. path:"mine",
  397. name:"VoiceMine",
  398. component:()=>import('@/views/voice/Mine.vue'),
  399. meta: {
  400. title: "我的语音",
  401. keepAlive:true,
  402. isRoot:true
  403. }
  404. },
  405. {
  406. path:"detail",
  407. name:"VoiceDetail",
  408. component:()=>import('@/views/voice/Detail.vue'),
  409. meta: {
  410. title: "语音详情",
  411. keepAlive:false,
  412. isRoot:false,
  413. hasBack:true
  414. }
  415. }
  416. ]
  417. },
  418. //路演视频模块
  419. {
  420. path:'/roadshow',
  421. name:"RoadShow",
  422. component: () => import("@/layout/Index.vue"),
  423. meta:{
  424. title:"线上路演"
  425. },
  426. children:[
  427. {
  428. path:"video/list",
  429. name:"RoadShowVideoList",
  430. component:()=>import('@/views/roadShow/video/List.vue'),
  431. meta: {
  432. title: "线上路演",
  433. keepAlive:true,
  434. isRoot:true
  435. }
  436. }
  437. ]
  438. },
  439. // 我的图库模块
  440. {
  441. path:"/mychart",
  442. name: "MyChart",
  443. component: () => import("@/layout/Index.vue"),
  444. meta: {
  445. title:"我的图库"
  446. },
  447. children:[
  448. {
  449. path:"list",
  450. name:"MyChartList",
  451. component:()=>import('@/views/myChart/List.vue'),
  452. meta: {
  453. title: "我的图库",
  454. keepAlive:true,
  455. isRoot:true
  456. }
  457. },
  458. {
  459. path:"search",
  460. name:"MyChartSearch",
  461. component:()=>import('@/views/myChart/Search.vue'),
  462. meta: {
  463. title: "搜索",
  464. keepAlive:true,
  465. isRoot:false,
  466. hasBack:true
  467. }
  468. },
  469. {
  470. path:"detail",
  471. name:"MyChartDetail",
  472. component:()=>import('@/views/myChart/Detail.vue'),
  473. meta: {
  474. title: "图表详情",
  475. keepAlive:false,
  476. isRoot:false,
  477. hasBack:true
  478. }
  479. }
  480. ]
  481. },
  482. //持仓分析模块
  483. {
  484. path:"/positionanalysis",
  485. name:"PositionAnalysis",
  486. component: () => import("@/layout/Index.vue"),
  487. meta: {
  488. title:"持仓分析"
  489. },
  490. children:[
  491. {
  492. path:"index",
  493. name:"PositionAnalysisIndex",
  494. component:()=>import('@/views/positionAnalysis/Index.vue'),
  495. meta: {
  496. title: "持仓列表",
  497. keepAlive:true,
  498. isRoot:true
  499. }
  500. },
  501. {
  502. path:"detail",
  503. name:"PositionAnalysisDetail",
  504. component:()=>import('@/views/positionAnalysis/Detail.vue'),
  505. meta: {
  506. title: "持仓详情",
  507. keepAlive:false,
  508. isRoot:false,
  509. hasBack:true
  510. }
  511. },
  512. ]
  513. },
  514. //外汇日历表模块
  515. {
  516. path:"/forexCalendar",
  517. name:"ForexCalendar",
  518. component: () => import("@/layout/Index.vue"),
  519. meta: {
  520. title:"外汇日历表"
  521. },
  522. children:[
  523. {
  524. path:"index",
  525. name:"ForexCalendarIndex",
  526. component:()=>import('@/views/forexCalendar/Index.vue'),
  527. meta: {
  528. title: "日历表",
  529. keepAlive:true,
  530. isRoot:true
  531. }
  532. },
  533. {
  534. path:"detail",
  535. name:"ForexCalendarDetail",
  536. component:()=>import('@/views/forexCalendar/EdbDetail.vue'),
  537. meta: {
  538. title: "事项详情",
  539. keepAlive:false,
  540. isRoot:false,
  541. hasBack:true
  542. }
  543. },
  544. ]
  545. },
  546. {
  547. path: '/:pathMatch(.*)',
  548. name: 'error',
  549. component: () => import("@/views/404.vue"),
  550. meta: { title: '404' },
  551. }
  552. ]
  553. const router=createRouter({
  554. history:createWebHistory(import.meta.env.VITE_APP_BASE_URL),
  555. routes,
  556. scrollBehavior(to, from, savedPosition){
  557. if (savedPosition&&to.meta.keepAlive) {
  558. return savedPosition
  559. } else {
  560. return new Promise((resolve)=>{
  561. setTimeout(() => {
  562. resolve({left:0,top:0})
  563. }, 0);
  564. })
  565. }
  566. }
  567. })
  568. router.beforeEach((to, from, next) => {
  569. if (to.query.token) {
  570. store.commit('getToken', to.query.token)
  571. store.dispatch('getUserInfo')
  572. }
  573. if (to.query.platform_source) { // 来源是否是小程序
  574. sessionStorage.setItem('platformSource', to.query.platform_source)
  575. }
  576. if(to.meta.isRoot){
  577. store.commit('setBreadCrumb', to)
  578. }else{
  579. if(store.state.breadCrumbList.length==1){
  580. store.commit('modifyBreadCrumb',to.meta.title)
  581. }
  582. }
  583. document.title=to.meta.title
  584. next();
  585. })
  586. export default router