Browse Source

专业库tree完善

shilipojs 3 years ago
parent
commit
c2a57941d9

+ 19 - 7
src/views/career/plan/new-profess-detail.vue

@@ -174,10 +174,11 @@ export default {
       tabActive: 0,
       defaultProps: {
         children: 'children',
-        label: 'label'
+        label: 'name'
       },
       type: '本科',
-      majorList: [],
+      masterMajorList: [],
+      specialtyMajorList: [],
       majorDetail: {}, // 概况
       prospects: {}, // 前景
       contentPropsByBen: ['introduction', 'eduObjective', 'eduRequirement', 'subjectRequirement', 'loreAndAbility', 'studyDirection', 'mainCourse', 'famousScholar'], // 本科概况列
@@ -188,6 +189,10 @@ export default {
     }
   },
   computed: {
+    majorList() {
+      if(this.type == '本科') return this.masterMajorList
+      if(this.type == '专科') return this.specialtyMajorList
+    },
     // 平均薪资趋势
     reverseSalary() {
       if (!this.prospects.averageSalary) return null
@@ -323,10 +328,12 @@ export default {
       }
     },
     type: {
-      immediate: true,
-      handler(newVal) {
-        // 2 院校 1 前景 0 概览
-        this.getAllMajor()
+      immediate:true,
+      handler(val){
+        console.log(val)
+        if((val  == '本科' && this.masterMajorList.length == 0) || (val  == '专科' && this.specialtyMajorList.length == 0)){
+          this.getAllMajor()
+        }
       }
     },
     '$route': {
@@ -347,7 +354,12 @@ export default {
       allMajor({
         type: this.type
       }).then(res => {
-        this.majorList = res.data
+        if(this.type == '本科'){
+          this.masterMajorList = res.data
+        }
+        if(this.type == '专科'){
+          this.specialtyMajorList = res.data
+        }
       })
     },
     getCareerProspects() {

+ 0 - 1
src/views/career/plan/new-profess-lib.vue

@@ -79,7 +79,6 @@ export default {
         if((val  == '本科' && this.masterMajorList.length == 0) || (val  == '专科' && this.specialtyMajorList.length == 0)){
           this.getAllMajor()
         }
-
       }
     }
   },