index.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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/index',
  71. component: () => import("@/layout/Index.vue"),
  72. meta: {
  73. title:"研报"
  74. },
  75. children:[
  76. {
  77. path: "index",
  78. name: "ReportIndex",
  79. component: () => import("@/views/report/Index.vue"),
  80. meta: {
  81. title: "研报",
  82. keepAlive:true,
  83. isRoot:true
  84. },
  85. },
  86. {
  87. path: "classify",
  88. name: "ReportClassify",
  89. component: () => import("@/views/report/Classify.vue"),
  90. meta: {
  91. title: "FICC研报分类",
  92. keepAlive:false,
  93. isRoot:false,
  94. hasBack: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. },
  176. {
  177. path: "/apply",
  178. name: "Apply",
  179. component: () => import("@/layout/Index.vue"),
  180. meta: {
  181. title:"申请试用"
  182. },
  183. children: [
  184. {
  185. path: "permission",// source来源(如:2) fromPage=来源页面(如:活动列表)
  186. name: "ApplyPermission",
  187. component: () => import("@/views/applyPermission/Apply.vue"),
  188. meta: {
  189. title: "申请试用",
  190. hasBack:true
  191. }
  192. },
  193. {
  194. path: "result",
  195. name: "ApplyPermissionResult",
  196. component: () => import("@/views/applyPermission/Result.vue"),
  197. meta: {
  198. title: "申请结果",
  199. hasBack:true
  200. }
  201. }
  202. ]
  203. },
  204. // 图库模块
  205. {
  206. path:'/chart',
  207. name:"Chart",
  208. component: () => import("@/layout/Index.vue"),
  209. meta:{
  210. title:"ETA图库"
  211. },
  212. children:[
  213. {
  214. path:"list",
  215. name:"ChartList",
  216. component:()=>import('@/views/chart/List.vue'),
  217. meta: {
  218. title: "ETA图库",
  219. keepAlive:true,
  220. isRoot:true
  221. }
  222. }
  223. ]
  224. },
  225. // 沙盘推演模块
  226. {
  227. path:'/sandBox',
  228. name:"sandBox",
  229. component: () => import("@/layout/Index.vue"),
  230. redirect:'/sandBox/list',
  231. meta:{
  232. title:"沙盘推演"
  233. },
  234. children:[
  235. {
  236. path:"list",
  237. name:"sandBoxList",
  238. component:()=>import('@/views/sandBox/List.vue'),
  239. meta: {
  240. title: "沙盘推演",
  241. keepAlive:false,
  242. isRoot:true
  243. }
  244. }
  245. ]
  246. },
  247. // 用户模块
  248. {
  249. path:'/user',
  250. name:"User",
  251. component: () => import("@/layout/Index.vue"),
  252. meta:{
  253. title:"用户"
  254. },
  255. children:[
  256. {
  257. path:"setinfo",
  258. name:"UserSetInfo",
  259. component:()=>import('@/views/user/SetUserInfo.vue'),
  260. meta: {
  261. title: "我的设置",
  262. keepAlive:false,
  263. isRoot:false,
  264. hasBack:true
  265. }
  266. }
  267. ]
  268. },
  269. //价格驱动
  270. {
  271. path: '/pricedriven',
  272. name: "priceDriven",
  273. component: () => import("@/layout/Index.vue"),
  274. meta: {
  275. title:"价格驱动"
  276. },
  277. children: [
  278. {
  279. path: "/pricedriven",
  280. name: "priceDrivenDeteail",
  281. component: () => import("@/views/priceDriven/detail.vue"),
  282. meta: {
  283. title: "价格驱动",
  284. keepAlive:false,
  285. isRoot:true
  286. },
  287. },
  288. ]
  289. },
  290. //视频社区模块
  291. {
  292. path:'/video',
  293. name:"Video",
  294. component: () => import("@/layout/Index.vue"),
  295. meta:{
  296. title:"视频社区"
  297. },
  298. children:[
  299. {
  300. path:"list",
  301. name:"VideoList",
  302. component:()=>import('@/views/video/List.vue'),
  303. meta: {
  304. title: "视频社区",
  305. keepAlive:true,
  306. isRoot:true
  307. }
  308. }
  309. ]
  310. },
  311. //语音播报模块
  312. {
  313. path:'/voice',
  314. name:"Voice",
  315. component: () => import("@/layout/Index.vue"),
  316. meta:{
  317. title:"语音播报"
  318. },
  319. children:[
  320. {
  321. path:"list",
  322. name:"VoiceList",
  323. component:()=>import('@/views/voice/List.vue'),
  324. meta: {
  325. title: "语音播报",
  326. keepAlive:true,
  327. isRoot:true
  328. }
  329. }
  330. ]
  331. },
  332. {
  333. path: '/:pathMatch(.*)',
  334. name: 'error',
  335. component: () => import("@/views/404.vue"),
  336. meta: { title: '404' },
  337. }
  338. ]
  339. const router=createRouter({
  340. history:createWebHistory(import.meta.env.VITE_APP_BASE_URL),
  341. routes
  342. })
  343. router.beforeEach((to, from, next) => {
  344. if (to.query.token) {
  345. store.commit('getToken', to.query.token)
  346. store.dispatch('getUserInfo')
  347. }
  348. if(to.meta.isRoot){
  349. store.commit('setBreadCrumb', to)
  350. }else{
  351. if(store.state.breadCrumbList.length==1){
  352. store.commit('modifyBreadCrumb',to.meta.title)
  353. }
  354. }
  355. document.title=to.meta.title
  356. next();
  357. })
  358. export default router