Browse Source

大数据导学首页菜单

shilipojs 2 years ago
parent
commit
98bd06494c
1 changed files with 30 additions and 2 deletions
  1. 30 2
      src/views/evaluating/main.vue

+ 30 - 2
src/views/evaluating/main.vue

@@ -4,7 +4,7 @@
       <el-image :src="`${$imgBase}index/banner/daoxue_banner.png`" fit="cover"></el-image>
     </div>
     <div class="fx-column fx-cen-cen pb20">
-      <index-card title="在线试卷" class="mt20 index-block">
+      <index-card title="在线试卷" class="mt20 index-block" v-if="role">
         <el-row :gutter="20">
           <el-col :span="8" v-for="item in onLinePaper">
             <div class="wrap-item fx-row jc-between ai-center">
@@ -27,7 +27,7 @@
       </index-card>
       <index-card title="学情分析" class="mt20 index-block">
         <el-row :gutter="20">
-          <el-col :span="8" v-for="item in idc" @click="$router.push(item.path)">
+          <el-col :span="8" v-for="item in idcFormatList" @click="$router.push(item.path)">
             <div class="wrap-item fx-row jc-between ai-center">
               <div class="left mr30">
                 <el-image :src="item.img"></el-image>
@@ -56,12 +56,40 @@
 import IndexCard from '@/views/index/components/index-card.vue'
 import MxImageWrap from '@/views/questioncenter/components/main-card/mx-image-wrap.vue'
 import loginCheckMixin from '@/views/components/blocks/index-login-check-mixin'
+import { checkRole } from '@/utils/permission'
+import { mapGetters } from 'vuex'
 
 export default {
   components: { IndexCard, MxImageWrap },
   mixins: [loginCheckMixin],
+  computed:{
+    ...mapGetters(['middlebarRouters']),
+    idcListOpt() {
+      const obj = {}
+      this.idc.map(item => {
+        obj[`${item.title}${item.path}`] = {desc: item.desc }
+      })
+      return obj
+    },
+    idcFormatList() {
+      if(!this.middlebarRouters.length) return []
+      if(!this.middlebarRouters.find(item => item.meta.title == '学情分析'))  return  []
+      if(!checkRole(['frontMaster'])) return this.idc
+      const listOptKey = Object.keys(this.idcListOpt)
+
+      let formatList = []
+      return this.middlebarRouters.find(item => item.meta.title == '学情分析').children.slice(0,3).map((item,idx) =>{
+        return {
+          title: item.meta.title,
+          img:this.idc[idx].img,
+          path:item.path,
+        }
+      })
+    }
+  },
   data() {
     return {
+      role:checkRole(['frontStudent']),
       onLinePaper: [
         {
           title: '个人测评',