Browse Source

make dynamic video category name

hare8999@163.com 2 years ago
parent
commit
59bffa03ec
1 changed files with 27 additions and 11 deletions
  1. 27 11
      src/views/questioncenter/main.vue

+ 27 - 11
src/views/questioncenter/main.vue

@@ -10,14 +10,16 @@
         <el-tabs type="card">
           <el-tab-pane label="名校试卷">
             <el-row :gutter="20">
-              <el-col :span="8" @click.native="toPreView(item.id, item.papername)" class="f14 mb15 pointer text-ellipsis" v-for="item in papersList">
+              <el-col :span="8" @click.native="toPreView(item.id, item.papername)"
+                      class="f14 mb15 pointer text-ellipsis" v-for="item in papersList">
                 {{ item.papername }}
               </el-col>
             </el-row>
           </el-tab-pane>
           <el-tab-pane label="历年真题">
             <el-row :gutter="20">
-              <el-col :span="8" @click.native="toPreView(item.id, item.papername)" class="f14 mb15 pointer text-ellipsis" v-for="item in paperYearList">
+              <el-col :span="8" @click.native="toPreView(item.id, item.papername)"
+                      class="f14 mb15 pointer text-ellipsis" v-for="item in paperYearList">
                 {{ item.papername }}
               </el-col>
             </el-row>
@@ -30,15 +32,17 @@
           <el-tab-pane label="同步课程">
             <el-row :gutter="20">
               <el-col :span="6" class="video_item" v-for="item in tbvideoList">
-                <img :src="item.img" @click=" toVideoDetail(item.pack_id,item.chapter_id,item.id, item.section_aliId,item.aliIdType)"/>
+                <img :src="item.img"
+                     @click=" toVideoDetail(item.pack_id,item.chapter_id,item.id, item.section_aliId,item.aliIdType)"/>
                 <p class="text-center text-ellipsis f-999">{{ item.section_name }}</p>
               </el-col>
             </el-row>
           </el-tab-pane>
-          <el-tab-pane label="高考课程">
+          <el-tab-pane v-if="specialSupport" :label="specialName">
             <el-row :gutter="20">
               <el-col :span="6" class="video_item" v-for="item in gkVideoList">
-                <img :src="item.img" @click=" toVideoDetail(item.pack_id,item.chapter_id,item.id, item.section_aliId,item.aliIdType)"/>
+                <img :src="item.img"
+                     @click=" toVideoDetail(item.pack_id,item.chapter_id,item.id, item.section_aliId,item.aliIdType)"/>
                 <p class="text-center text-ellipsis f-999">{{ item.section_name }}</p>
               </el-col>
             </el-row>
@@ -54,9 +58,10 @@ import IndexCardSmart from '@/views/index/components/index-card-smart.vue'
 import IndexCardGenerating from '@/views/index/components/index-card-generating.vue'
 import { papersList } from '@/api/webApi/webQue'
 import { videoList } from '@/api/webApi/webVideo'
+import { mapGetters } from 'vuex'
 
 export default {
-  components: { IndexCard, IndexCardGenerating,IndexCardSmart },
+  components: { IndexCard, IndexCardGenerating, IndexCardSmart },
   data() {
     return {
       // 智能练习
@@ -97,6 +102,15 @@ export default {
     this.getVideoList(0)
     this.getVideoList(2)
   },
+  computed: {
+    ...mapGetters(['isSenior', 'isJunior']),
+    specialSupport() {
+      return this.isSenior || this.isJunior
+    },
+    specialName() {
+      return this.isSenior ? '高考课程' : this.isJunior ? '中考课程' : ''
+    }
+  },
   methods: {
     toPreView(paperId, paperName) {
       this.$router.push({
@@ -142,7 +156,7 @@ export default {
         isMain: true,
         sectionName: ''
       }).then((res) => {
-        subject == 0 ? this.tbvideoList = res.rows  : this.gkVideoList = res.rows
+        subject == 0 ? this.tbvideoList = res.rows : this.gkVideoList = res.rows
       })
     },
     toVideoDetail(id, chapter_id, childrenId, section_aliId, aliIdType) {
@@ -174,17 +188,19 @@ export default {
   cursor: pointer;
 }
 
-.video_item{
+.video_item {
   border-radius: 4px;
   margin-bottom: 20px;
   /*padding-right: 22px;*/
 }
+
 .video_item > img {
   width: 100%;
 }
-.video_item >p{
-  padding:5px 0;
-  box-shadow: 0px 1px 4px 0px rgba(47,78,154,0.14);
+
+.video_item > p {
+  padding: 5px 0;
+  box-shadow: 0px 1px 4px 0px rgba(47, 78, 154, 0.14);
 }
 
 @media screen and (min-width: 1440px) {