فهرست منبع

index block - login check

hare8999@163.com 1 سال پیش
والد
کامیت
2d4c0fa116

+ 41 - 8
src/views/index/components/index-card-career.vue

@@ -1,10 +1,20 @@
 <template>
   <index-card simple title="生涯视频" more-text="查看全部" @more="handleMore">
-    <index-card-content :list="list" :line-size="lineSize">
-      <template #default="{item}">
-        <index-image-item v-bind="item"></index-image-item>
-      </template>
-    </index-card-content>
+    <template #more-prefix>
+      <div class="fx-1 fx-row jc-end ai-cen f-333 f16">
+        <template v-for="(t,idx) in types">
+          <span :key="'t_'+idx" class="pointer" :class="{'f-primary':idx==currentIndex}" @click="currentIndex=idx">{{ t.name }}</span>
+          <el-divider :key="'d_'+idx" direction="vertical"/>
+        </template>
+      </div>
+    </template>
+    <div v-loading="loading" style="height: 418px">
+      <index-card-content :list="list" :line-size="lineSize">
+        <template #default="{item}">
+          <index-image-item v-bind="item"></index-image-item>
+        </template>
+      </index-card-content>
+    </div>
   </index-card>
 </template>
 
@@ -19,10 +29,13 @@ import loginCheckMixin from '@/views/index/blocks/index-login-interceptor-mixin'
 export default {
   mixins: [transferMixin, loginCheckMixin],
   name: 'index-card-career',
-  components: { IndexImageItem, IndexCardContent, IndexCard },
+  components: {IndexImageItem, IndexCardContent, IndexCard},
   data() {
     return {
+      loading: false,
       morePath: '/new-gaokao/careerVideo',
+      types: [{type: 1, name: '发现自我', list: null}, {type: 2, name: '生涯探索', list: null}],
+      currentIndex: 0,
       list: [],
       lineSize: 4,
       queryParams: {
@@ -32,12 +45,31 @@ export default {
       }
     }
   },
+  computed: {
+    currentType() {
+      return this.types[this.currentIndex]
+    }
+  },
+  watch: {
+    currentType: function () {
+      this.getList()
+    }
+  },
   mounted() {
     this.getList()
   },
   methods: {
     getList() {
-      career.listNoToken(this.queryParams).then(res => {
+      if (this.currentType.list?.length) {
+        this.list = this.currentType.list
+        return
+      }
+      this.loading = true
+      const params = {
+        ...this.queryParams,
+        type: this.currentType.type
+      }
+      career.listNoToken(params).then(res => {
         this.list = res['rows']?.map((item, idx) => {
           const path = '/career/plan/detail'
           const nextParams = {
@@ -57,7 +89,8 @@ export default {
             titleClasses: ['width100', 'fx-row', 'f-666', 'pf', 'f14', 'text-ellipsis']
           }
         })
-      })
+        this.currentType.list = this.list
+      }).finally(() => this.loading = false)
     },
     async handleMore() {
       await this.loginCheck()

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

@@ -22,24 +22,31 @@
 
 <script>
 import IndexCard from "@/views/index/components/index-card.vue";
+import IndexLoginInterceptorMixin from "@/views/index/blocks/index-login-interceptor-mixin";
 
 export default {
   name: "index-card-simulate-f4",
+  mixins: [IndexLoginInterceptorMixin],
   components: {IndexCard},
   methods: {
-    goSimulate() {
+    async goSimulate() {
+      await this.loginCheck()
       this.$router.push('/zhiyuan/SimulatedVolunteer')
     },
-    goBatchLine() {
+    async goBatchLine() {
+      await this.loginCheck()
       this.$router.push('/zhiyuan/batch')
     },
-    goShiftLine() {
+    async goShiftLine() {
+      await this.loginCheck()
       this.$router.push('/zhiyuan/ShiftLine')
     },
-    goScoreSegment() {
+    async goScoreSegment() {
+      await this.loginCheck()
       this.$router.push('/zhiyuan/yfyd')
     },
-    goPlan() {
+    async goPlan() {
+      await this.loginCheck()
       this.$router.push('/zhiyuan/enrollPlan')
     }
   }

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

@@ -24,10 +24,12 @@
 <script>
 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";
 
 export default {
   name: "index-card-test-news",
   components: {IndexCardTop, IndexCard},
+  mixins: [IndexLoginInterceptorMixin],
   data() {
     return {
       topOverride: {
@@ -44,13 +46,16 @@ export default {
     }
   },
   methods: {
-    goElectiveQuery() {
+    async goElectiveQuery() {
+      await this.loginCheck()
       this.$router.push('/new-gaokao/careerSubjectIndex')
     },
-    goElectiveTest() {
+    async goElectiveTest() {
+      await this.loginCheck()
       this.$router.push('/new-gaokao/myTest/testSelectSubject')
     },
-    goCareerTest() {
+    async goCareerTest() {
+      await this.loginCheck()
       this.$router.push('/new-gaokao/myTest/myTest/CareerEva')
     }
   }

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

@@ -6,8 +6,8 @@
           <span class="f-333 f24 bold">{{ title }}</span>
           <span class="f-999 f18 ml30">{{ subTitle }}</span>
         </div>
+        <slot name="more-prefix"></slot>
         <div v-if="moreText" class="f-333 f16 pointer" @click="$emit('more')">
-          <slot name="more-prefix"></slot>
           <span>{{ moreText }}</span>
           <i class="el-icon-arrow-right index-card-more"></i>
         </div>

+ 7 - 5
src/views/index/components/index-college-item.vue

@@ -2,9 +2,9 @@
   <div class="fx-row ai-cen f16 f-333 pointer" :class="university.rowClass" @click="goUniversity">
     <span style="width: 30px">{{rank}}</span>
     <el-image :src="university.src" class="icon52" />
-    <div class="fx-column bold ml12">
-      <span>{{university.title}}</span>
-      <span class="mt3 f-999">{{university.desc}}</span>
+    <div class="fx-column ml12">
+      <span class="bold">{{university.title}}</span>
+      <span class="mt3 f14 f-999">{{university.desc}}</span>
     </div>
     <div class="fx-1 fx-row jc-end ai-cen f14 pr20">
       <span class="mr10">热度</span>
@@ -15,10 +15,11 @@
 
 <script>
 import MxTransferMixin from "@/components/mx-transfer-mixin";
+import IndexLoginInterceptorMixin from "@/views/index/blocks/index-login-interceptor-mixin";
 
 export default {
   name: "index-college-item",
-  mixins: [MxTransferMixin],
+  mixins: [MxTransferMixin, IndexLoginInterceptorMixin],
   props: {
     rank: {
       type: Number,
@@ -30,7 +31,8 @@ export default {
     }
   },
   methods: {
-    goUniversity() {
+    async goUniversity() {
+      await this.loginCheck()
       this.transferTo(this.university.path, this.university.nextData)
     }
   }