Преглед на файлове

global router setting - fit dynamic menus

hare8999@163.com преди 1 година
родител
ревизия
c3a6424218

+ 3 - 2
src/components/TransferMixin.js

@@ -61,10 +61,11 @@ export default {
       const location = typeof path === 'string' ? {
         path: path,
         query: query
-      } : {
+      } : query ? {
         ...path,
         query: query
-      }
+      } : path
+      console.log('transfer merged location:', location)
       if (useReplace !== '_blank') {
         return useReplace ? this.$router.replace(location) : this.$router.push(location)
       } else {

+ 5 - 5
src/router/index.js

@@ -548,7 +548,7 @@ export const constantRoutes = [{
       name: 'careerDetail',
       meta: {
         title: '生涯视频播放',
-        parentPath: '/new-gaokao/careerVideo' // 用于直接跳转时定位菜单
+        parentRoute: 'CareerVideo' // 用于直接跳转时定位菜单
       }
     },
       {
@@ -584,7 +584,7 @@ export const constantRoutes = [{
         name: 'RecordDetail',
         meta: {
           title: '模拟志愿-记录详情',
-          parentPath: '/zhiyuan/volunteerList'
+          parentRoute: 'VolunteerList'
         }
       },
       {
@@ -664,7 +664,7 @@ export const constantRoutes = [{
         name: 'MajorChoice',
         meta: {
           title: '由专业选科目',
-          parentPath: '/new-gaokao/careerSubjectIndex'
+          parentRoute: 'ElectiveQueryIndex'
         }
       },
       {
@@ -681,7 +681,7 @@ export const constantRoutes = [{
         name: 'SubjectChoice',
         meta: {
           title: '由科目选专业',
-          parentPath: '/new-gaokao/careerSubjectIndex'
+          parentRoute: 'ElectiveQueryIndex'
         }
       },
       {
@@ -690,7 +690,7 @@ export const constantRoutes = [{
         name: 'UniversityDetail',
         meta: {
           title: '生涯评测-院校详情',
-          parentPath: '/new-gaokao/three/UniversitiesColleges'
+          parentRoute: 'LibraryCollege'
         }
       },
       {

+ 2 - 1
src/views/career/components/CareerHolland.vue

@@ -174,7 +174,8 @@ export default {
     },
     goReportPage() {
       this.$router.push({
-        path: "/new-gaokao/assistant?id=" + 2
+        name: 'CareerAssistant',
+        query: {id: 2}
       })
     }
   }

+ 2 - 1
src/views/career/components/CareerMbti.vue

@@ -151,7 +151,8 @@
       },
       goReportPage() {
       this.$router.push({
-        path: "/new-gaokao/assistant?id=" + 2
+        name: 'CareerAssistant',
+        query: {id: 2}
       })
     }
     }

+ 1 - 1
src/views/career/components/UniversityDetail.vue

@@ -3,7 +3,7 @@
       <el-card style="color: #5E5E5E;" ref="navBar">
         <el-breadcrumb separator-class="el-icon-arrow-right">
           <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
-          <el-breadcrumb-item :to="{ path: '/career/plan/UniversitiesColleges'}">校园库</el-breadcrumb-item>
+          <el-breadcrumb-item :to="{ name: 'LibraryCollege'}">校园库</el-breadcrumb-item>
           <el-breadcrumb-item>校院详情</el-breadcrumb-item>
         </el-breadcrumb>
       </el-card>

+ 8 - 1
src/views/career/index.vue

@@ -4,7 +4,7 @@
     <div class="fx-cen-cen fx-column pb20">
       <index-card-voluntary-f6 class="mt20 index-block" />
       <index-card-voluntary-entry class="mt20 index-block" />
-      <index-card-news-single class="index-block mt20" type="填报技巧" morePath="/fuzhu/newGaokaoNews"  />
+      <index-card-news-single v-bind="singleAttr" class="index-block mt20"  />
     </div>
   </div>
 </template>
@@ -21,6 +21,13 @@ export default {
       bannerStyle: {
         backgroundImage: `url(${require('@/assets/images/index/banner/voluntary-banner.png')})`,
         height: '300px'
+      },
+      singleAttr: {
+        type: '填报技巧',
+        morePath: {
+          name: 'NewsAll',
+          query: {name: '填报技巧'}
+        }
       }
     }
   }

+ 2 - 9
src/views/career/information/singleStroke.vue

@@ -35,18 +35,11 @@ export default {
       detailMode: false,
       detailTitle: "",
       detailId: 0,
-      type: "",
-      category: {
-        single: '单招志愿',
-        syzx: '生涯资讯',
-      },
+      type: ""
     };
   },
   mounted() {
-    const subPaths = this.$route.path.split("/");
-    const lastSubPath = subPaths[subPaths.length - 1]
-    const typeKey = lastSubPath.split("_")[lastSubPath.split("_").length - 1]
-    this.type = this.category[typeKey]
+    this.type = this.$route.meta.type
     let news = this.prevData?.news
     if(news){
       console.log(news)

+ 1 - 1
src/views/career/main.vue

@@ -17,7 +17,7 @@
           </div>
         </div>
       </index-card>
-      <index-card-news-single class="mt20 index-block" type="单招志愿" morePath="/fuzhu/volunteering_single"  />
+      <index-card-news-single class="mt20 index-block" type="单招志愿" :morePath="{name: 'NewsSingle'}"  />
     </div>
   </div>
 </template>

+ 2 - 2
src/views/career/zhiyuan/cards/index-card-voluntary-entry.vue

@@ -3,8 +3,8 @@
     <el-image :src="require('@/assets/images/index/voluntary/voluntary-simulate.png')"/>
     <div class="fx-row fx-cen-cen">
       <div class="mt15">
-        <el-button type="primary" size="large" @click="$router.push('/zhiyuan/SimulatedVolunteer')">进入填报</el-button>
-        <el-button type="primary" size="large" @click="$router.push('/zhiyuan/volunteerList')">我的志愿</el-button>
+        <el-button type="primary" size="large" @click="$router.push({name: 'SimulatedVolunteer'})">进入填报</el-button>
+        <el-button type="primary" size="large" @click="$router.push({name: 'VolunteerList'})">我的志愿</el-button>
       </div>
     </div>
   </index-card>

+ 5 - 5
src/views/career/zhiyuan/cards/index-card-voluntary-f6.vue

@@ -31,25 +31,25 @@ export default {
           ...commonStyle,
           title: '批次控制线',
           src: require('@/assets/images/index/voluntary/voluntary-batch.png'),
-          path: '/zhiyuan/batch'
+          path: {name: 'BatchLine'}
         },
         {
           ...commonStyle,
           title: '投档线',
           src: require('@/assets/images/index/voluntary/voluntary-shift.png'),
-          path: '/zhiyuan/ShiftLine'
+          path: {name: 'ShiftLine'}
         },
         {
           ...commonStyle,
           title: '一分一段',
           src: require('@/assets/images/index/voluntary/voluntary-segment.png'),
-          path: '/zhiyuan/yfyd'
+          path: {name: 'ScoreSegment'}
         },
         {
           ...commonStyle,
           title: '招生计划',
           src: require('@/assets/images/index/voluntary/voluntary-plan.png'),
-          path: '/zhiyuan/enrollPlan'
+          path: {name: 'EnrollPlan'}
         },
         {
           ...commonStyle,
@@ -61,7 +61,7 @@ export default {
           ...commonStyle,
           title: '院校查询',
           src: require('@/assets/images/index/voluntary/voluntary-college.png'),
-          path: '/new-gaokao/three/UniversitiesColleges'
+          path: {name: 'LibraryCollege'}
         }
       ]
     }

+ 1 - 1
src/views/elective/main.vue

@@ -6,7 +6,7 @@
       <index-card-test4 class="mt20 index-block" />
       <index-card-career class="mt20 index-block"/>
       <index-card-college class="mt20 index-block" />
-      <index-card-news-single class="mt20 index-block" type="高考政策" morePath="/fuzhu/newGaokaoNews"  />
+      <index-card-news-single class="mt20 index-block" type="高考政策" :morePath="{name: 'NewsAll'}"  />
       <index-card-elective class="mt20 index-block" />
     </div>
   </div>

+ 1 - 1
src/views/index/components/index-card-career.vue

@@ -33,7 +33,7 @@ export default {
   data() {
     return {
       loading: false,
-      morePath: '/new-gaokao/careerVideo',
+      morePath: {name: 'CareerVideo'},
       types: [{type: 1, name: '发现自我', list: null}, {type: 2, name: '生涯探索', list: null}],
       currentIndex: 0,
       list: [],

+ 1 - 1
src/views/index/components/index-card-college.vue

@@ -51,7 +51,7 @@ export default {
   components: {IndexCollegeItem, IndexImageItem, IndexCardContent, IndexCard},
   data() {
     return {
-      morePath: '/new-gaokao/three/UniversitiesColleges',
+      morePath: {name: 'LibraryCollege'},
       listA: [],
       listB: [],
       listC: [],

+ 3 - 3
src/views/index/components/index-card-news-single.vue

@@ -30,7 +30,7 @@ export default {
       default: '',
     },
     morePath: {
-      type: String,
+      type: String | Object,
       default: '',
     },
   },
@@ -57,9 +57,9 @@ export default {
       await this.loginCheck()
       this.transferTo(this.morePath)
     },
-    async goNewsWithType(type,news) {
+    async goNewsWithType(type, news) {
       await this.loginCheck()
-      this.transferTo(this.morePath, { type,news })
+      this.transferTo(this.morePath, { type, news })
     }
   }
 }

+ 1 - 1
src/views/index/components/index-card-news.vue

@@ -32,7 +32,7 @@ export default {
   components: {IndexCard},
   data() {
     return {
-      morePath: '/fuzhu/newGaokaoNews',
+      morePath: {name: 'NewsAll'},
       newsTypes: [],
       activeName: '',
       newsCache: {}

+ 5 - 5
src/views/index/components/index-card-simulate-f4.vue

@@ -31,23 +31,23 @@ export default {
   methods: {
     async goSimulate() {
       await this.loginCheck()
-      this.$router.push('/zhiyuan/SimulatedVolunteer')
+      this.$router.push({name: 'SimulatedVolunteer'})
     },
     async goBatchLine() {
       await this.loginCheck()
-      this.$router.push('/zhiyuan/batch')
+      this.$router.push({name: 'BatchLine'})
     },
     async goShiftLine() {
       await this.loginCheck()
-      this.$router.push('/zhiyuan/ShiftLine')
+      this.$router.push({name: 'ShiftLine'})
     },
     async goScoreSegment() {
       await this.loginCheck()
-      this.$router.push('/zhiyuan/yfyd')
+      this.$router.push({name: 'ScoreSegment'})
     },
     async goPlan() {
       await this.loginCheck()
-      this.$router.push('/zhiyuan/enrollPlan')
+      this.$router.push({name: 'EnrollPlan'})
     }
   }
 }

+ 6 - 5
src/views/index/components/index-card-test-news.vue

@@ -25,11 +25,12 @@
 import IndexCard from "@/views/index/components/index-card.vue";
 import IndexCardTop from "@/views/index/components/index-card-top.vue";
 import IndexLoginInterceptorMixin from "@/views/index/blocks/index-login-interceptor-mixin";
+import MxTransferMixin from "@/components/mx-transfer-mixin";
 
 export default {
   name: "index-card-test-news",
   components: {IndexCardTop, IndexCard},
-  mixins: [IndexLoginInterceptorMixin],
+  mixins: [MxTransferMixin, IndexLoginInterceptorMixin],
   data() {
     return {
       topOverride: {
@@ -41,22 +42,22 @@ export default {
           type: '生涯资讯'
         },
         more: '查看全部',
-        morePath: '/new-gaokao/volunteering_syzx'
+        morePath: {name: 'NewsCareer'}
       }
     }
   },
   methods: {
     async goElectiveQuery() {
       await this.loginCheck()
-      this.$router.push('/new-gaokao/careerSubjectIndex')
+      this.transferTo({name: 'ElectiveQueryIndex'})
     },
     async goElectiveTest() {
       await this.loginCheck()
-      this.$router.push('/new-gaokao/myTest/testSelectSubject')
+      this.transferTo({name: 'ElectiveTestIndex'})
     },
     async goCareerTest() {
       await this.loginCheck()
-      this.$router.push('/new-gaokao/myTest/myTest/CareerEva')
+      this.transferTo({name: 'CareerTestIndex'})
     }
   }
 }

+ 4 - 4
src/views/index/components/index-card-three-subject-query.vue

@@ -29,19 +29,19 @@ export default {
   methods: {
     async goUniversity() {
       await this.loginCheck()
-      this.transferTo('/new-gaokao/three/UniversitiesColleges')
+      this.transferTo({name: 'LibraryCollege'})
     },
     async goProfession() {
       await this.loginCheck()
-      this.transferTo('/new-gaokao/three/ProfessLib')
+      this.transferTo({name: 'LibraryProfession'})
     },
     async goVocation() {
       await this.loginCheck()
-      this.transferTo('/new-gaokao/three/Vocation')
+      this.transferTo({name: 'LibraryVocation'})
     },
     async goSubjectQuery() {
       await this.loginCheck()
-      this.transferTo('/new-gaokao/careerSubjectIndex')
+      this.transferTo({name: 'ElectiveQueryIndex'})
     }
   }
 }

+ 3 - 2
src/views/index/components/index-card-top.vue

@@ -41,7 +41,7 @@ export default {
       default: ''
     },
     morePath: {
-      type: String,
+      type: String | Object,
       default: '/fuzhu/newGaokaoNews'
     },
     simple: {
@@ -74,7 +74,8 @@ export default {
     },
     async handleMore(news) {
       await this.loginCheck()
-      this.transferTo(this.morePath, {news})
+      const next = news ? {news} : null
+      this.transferTo(this.morePath, next)
     }
   }
 }

+ 1 - 1
src/views/index/components/index-image-item.vue

@@ -31,7 +31,7 @@ export default {
       default: ''
     },
     path: {
-      type: String,
+      type: String | Object,
       default: ''
     },
     classes: {

+ 1 - 1
src/views/index/components/index-news-single-wrapper.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="fx-row">
-    <index-card-news-single type="单招志愿" morePath="/fuzhu/volunteering_single" class="mr20" style="width: 65%"/>
+    <index-card-news-single type="单招志愿" :morePath="{name: 'NewsSingle'}" class="mr20" style="width: 65%"/>
     <index-card-top :list-space="0" class="fx-1"/>
   </div>
 </template>

+ 1 - 1
src/views/index/components/index-preference-simulate.vue

@@ -13,7 +13,7 @@ export default {
   name: 'index-preference-simulate',
   data() {
     return {
-      path: '/zhiyuan/SimulatedVolunteer'
+      path: {name: 'SimulatedVolunteer'}
     }
   },
   methods: {

+ 5 - 5
src/views/index/components/index-preference.vue

@@ -27,7 +27,7 @@ export default {
           src:`${this.$imgBase}index/login/img_batch@2x.png`,
           title: '批次控制线',
           desc: 'Control Line',
-          path: '/zhiyuan/batch',
+          path: {name: 'BatchLine'},
           titleClasses: titleClasses,
           titleStyle: titleStyle
         },
@@ -36,7 +36,7 @@ export default {
           src:`${this.$imgBase}index/login/img_cast_off@2x.png`,
           title: '投档线',
           desc: 'Pitch Line',
-          path: '/zhiyuan/ShiftLine',
+          path: {name: 'ShiftLine'},
           titleClasses: titleClasses,
           titleStyle: titleStyle
         },
@@ -45,7 +45,7 @@ export default {
           src:`${this.$imgBase}index/login/img_segment@2x.png`,
           title: '一分一段',
           desc: 'Piece by Piece',
-          path: '/zhiyuan/yfyd',
+          path: {name: 'ScoreSegment'},
           titleClasses: titleClasses,
           titleStyle: titleStyle
         },
@@ -54,7 +54,7 @@ export default {
           src:`${this.$imgBase}index/login/img_plan@2x.png`,
           title: '招生计划',
           desc: 'Enrollment Plan',
-          path: '/zhiyuan/enrollPlan',
+          path: {name: 'EnrollPlan'},
           titleClasses: titleClasses,
           titleStyle: titleStyle
         },
@@ -63,7 +63,7 @@ export default {
           src:`${this.$imgBase}index/login/img_library_college@2x.png`,
           title: '院校库',
           desc: 'College Library',
-          path: '/new-gaokao/three/UniversitiesColleges',
+          path: {name: 'LibraryCollege'},
           class: ['mt10'],
           titleClasses: titleClasses,
           titleStyle: titleStyle