123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- import { createRouter, createWebHistory } from "vue-router";
- import store from "@/store";
- /**
- * 说明
- * meta中
- * keepAlive表示是否要缓存
- * isRoot代表是否为侧边栏组件用于处理面包屑数据
- * hasBack 控制是否有返回按钮
- */
- const routes=[
- {
- path: "/",
- name: "Layout",
- redirect:'/report/index',
- component: ()=>import("@/layout/Index.vue"),
- },
- //活动模块
- {
- path: "/activity",
- name: "Activity",
- redirect:'/activity/list',
- component: () => import("@/layout/Index.vue"),
- meta: {
- title:"活动"
- },
- children: [
- {
- path: "list",
- name: "ActivityList",
- component: () => import("@/views/activity/List.vue"),
- meta: {
- title: "活动",
- keepAlive:true,
- isRoot:true
- },
- },
- {
- path:'detail',//query: id(活动id)
- name:"ActivityDetail",
- component: () => import("@/views/activity/Detail.vue"),
- meta: {
- title: "活动详情",
- hasBack:true
- },
- },
- {
- path: "reportdetail",
- name: "ActivityReportDetail",
- component: () => import("@/views/activity/ReportDetail.vue"),
- meta: {
- title: "报告详情",
- hasBack:true
- }
- },
- {
- path: "chapterdetail",
- name: "ActivityChapterReportDetail",
- component: () => import("@/views/activity/ChapterDetail.vue"),
- meta: {
- title: "报告详情",
- hasBack:true
- }
- }
- ]
- },
- // 报告模块
- {
- path:'/report',
- name:'Report',
- redirect: '/report/index',
- component: () => import("@/layout/Index.vue"),
- meta: {
- title:"研报"
- },
- children:[
- {
- path: "index",
- name: "ReportIndex",
- component: () => import("@/views/report/Index.vue"),
- meta: {
- title: "研报",
- keepAlive:true,
- isRoot:true
- },
- },
- {
- path: "classify",
- name: "ReportClassify",
- component: () => import("@/views/report/Classify.vue"),
- meta: {
- title: "FICC研报分类",
- keepAlive:false,
- isRoot:false,
- hasBack:true
- },
- },
- {
- path: "search",
- name: "ReportSearch",
- component: () => import("@/views/report/Search.vue"),
- meta: {
- title: "研报搜索",
- keepAlive:true,
- isRoot:false,
- hasBack:true
- },
- },
- {
- path: "detail",
- name: "ReportDetail",
- component: () => import("@/views/report/Detail.vue"),
- meta: {
- title: "报告详情",
- keepAlive:false,
- isRoot:false,
- hasBack:true
- },
- },
- {
- path: "chapterdetail",
- name: "ReportChapterDetail",
- component: () => import("@/views/report/ChapterDetail.vue"),
- meta: {
- title: "报告详情",
- keepAlive:false,
- isRoot:false,
- hasBack:true
- },
- },
- {
- path: "list",
- name: "ReportList",
- component: () => import("@/views/report/List.vue"),
- meta: {
- title: "报告列表",
- keepAlive:true,
- isRoot:false,
- hasBack:true
- },
- },
- {
- path: "specialcolumnlist",
- name: "ReportSpecialColumnList",
- component: () => import("@/views/report/specialColumn/List.vue"),
- meta: {
- title: "专栏列表",
- keepAlive:true,
- isRoot:false,
- hasBack:true
- },
- },
- {
- path: "specialcolumndetail",
- name: "ReportSpecialColumnDetail",
- component: () => import("@/views/report/specialColumn/Detail.vue"),
- meta: {
- title: "专栏详情",
- keepAlive:true,
- isRoot:false,
- hasBack:true
- },
- },
- {
- path: "ficcserveintro",
- name: "FiccServeIntro",
- component: () => import("@/views/report/FiccIntroduce.vue"),
- meta: {
- title: "FICC服务介绍",
- keepAlive:false,
- isRoot:false,
- hasBack:true
- },
- },
- ]
- },
- {
- path: "/apply",
- name: "Apply",
- component: () => import("@/layout/Index.vue"),
- meta: {
- title:"申请试用"
- },
- children: [
- {
- path: "permission",// source来源(如:2) fromPage=来源页面(如:活动列表)
- name: "ApplyPermission",
- component: () => import("@/views/applyPermission/Apply.vue"),
- meta: {
- title: "申请试用",
- hasBack:true
- }
- },
- {
- path: "result",
- name: "ApplyPermissionResult",
- component: () => import("@/views/applyPermission/Result.vue"),
- meta: {
- title: "申请结果",
- hasBack:true
- }
- }
- ]
- },
- // 图库模块
- {
- path:'/chart',
- name:"Chart",
- component: () => import("@/layout/Index.vue"),
- meta:{
- title:"ETA图库"
- },
- children:[
- {
- path:"list",
- name:"ChartList",
- component:()=>import('@/views/chart/List.vue'),
- meta: {
- title: "ETA图库",
- keepAlive:true,
- isRoot:true
- }
- }
- ]
- },
- // 沙盘推演模块
- {
- path:'/sandBox',
- name:"sandBox",
- component: () => import("@/layout/Index.vue"),
- redirect:'/sandBox/list',
- meta:{
- title:"沙盘推演"
- },
- children:[
- {
- path:"list",
- name:"sandBoxList",
- component:()=>import('@/views/sandBox/List.vue'),
- meta: {
- title: "沙盘推演",
- keepAlive:false,
- isRoot:true
- }
- }
- ]
- },
- // 用户模块
- {
- path:'/user',
- name:"User",
- component: () => import("@/layout/Index.vue"),
- meta:{
- title:"用户"
- },
- children:[
- {
- path:"setinfo",
- name:"UserSetInfo",
- component:()=>import('@/views/user/SetUserInfo.vue'),
- meta: {
- title: "我的设置",
- keepAlive:false,
- isRoot:false,
- hasBack:true
- }
- }
- ]
- },
- //价格驱动
- {
- path: '/pricedriven',
- name: "priceDriven",
- component: () => import("@/layout/Index.vue"),
- meta: {
- title:"价格驱动"
- },
- children: [
- {
- path: "/pricedriven",
- name: "priceDrivenDeteail",
- component: () => import("@/views/priceDriven/detail.vue"),
- meta: {
- title: "价格驱动",
- keepAlive:false,
- isRoot:true
- },
- },
- ]
- },
- //视频社区模块
- {
- path:'/video',
- name:"Video",
- component: () => import("@/layout/Index.vue"),
- meta:{
- title:"视频社区"
- },
- children:[
- {
- path:"list",
- name:"VideoList",
- component:()=>import('@/views/video/List.vue'),
- meta: {
- title: "视频社区",
- keepAlive:true,
- isRoot:true
- }
- }
- ]
- },
- //语音播报模块
- {
- path:'/voice',
- name:"Voice",
- component: () => import("@/layout/Index.vue"),
- meta:{
- title:"语音播报"
- },
- children:[
- {
- path:"list",
- name:"VoiceList",
- component:()=>import('@/views/voice/List.vue'),
- meta: {
- title: "语音播报",
- keepAlive:true,
- isRoot:true
- }
- }
- ]
- },
- {
- path: '/:pathMatch(.*)',
- name: 'error',
- component: () => import("@/views/404.vue"),
- meta: { title: '404' },
- }
- ]
- const router=createRouter({
- history:createWebHistory(import.meta.env.VITE_APP_BASE_URL),
- routes
- })
- router.beforeEach((to, from, next) => {
- if (to.query.token) {
- store.commit('getToken', to.query.token)
- store.dispatch('getUserInfo')
- }
- if(to.meta.isRoot){
- store.commit('setBreadCrumb', to)
- }else{
- if(store.state.breadCrumbList.length==1){
- store.commit('modifyBreadCrumb',to.meta.title)
- }
- }
-
- document.title=to.meta.title
- next();
- })
- export default router
|