Left.vue 2.27 KB
Newer Older
耿迪迪's avatar
耿迪迪 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
<!--
 * @Author: 纪泽龙 jizelong@qq.com
 * @Date: 2022-09-20 11:30:14
 * @LastEditors: 纪泽龙 jizelong@qq.com
 * @LastEditTime: 2022-09-28 09:19:38
 * @FilePath: /danger-manage-web/src/views/myLessons/components/Left.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="lession-left-wrapper flex">
    <el-tabs class="top" v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="待学习" name="first"></el-tab-pane>
      <el-tab-pane label="已学习" name="second"></el-tab-pane>
    </el-tabs>
    <div class="middle flex">
      <transition name="fade-transform" mode="out-in">
        <keep-alive>
          <component :is="currentTabComponent" @examination="examination" :state="state" :list="list"></component>
        </keep-alive>
      </transition>
    </div>
  </div>
</template>

<script>
import LearnAfter from "./LearnAfter";
import LearnBefore from "./LearnBefore";
import {getUserLessons} from "@/api/educationPlanExam/lessonsProgram"
export default {
  name: "lession-left",
  components: {
    // LearnAfter,
    // LearnBefore,
  },
  data() {
    return {
      activeName: "first",
      currentTabComponent: LearnBefore,
      list:[],
      state:{
41
        "0":'未完成',
耿迪迪's avatar
耿迪迪 committed
42
        "1":'未通过',
43
        "2":"已完成",
44 45
        "3":"已过期",
        "4":"未开始"
耿迪迪's avatar
耿迪迪 committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
      },
    };
  },
  created(){
    this.getUserLessons();
  },
  methods: {
    getUserLessons(){
      getUserLessons().then(res=>{
        console.log(res.rows);
        this.list = res.rows;
      })
    },
    handleClick(tab) {
      if (tab.paneName == "first") {
        this.currentTabComponent = LearnBefore;
      } else {
        this.currentTabComponent = LearnAfter;
      }
    },
    examination(e){
      this.$emit('examination',e)
    }
  },
};
</script>
<style lang="scss" scoped>
.lession-left-wrapper {
  padding: 5px 26px 0;
  height: 100%;
  width: 100%;
  flex-direction: column;
  .top {
    // margin-bottom: 47px;
  }
  .middle {
    flex: 1;
    height: 100%;
    width: 100%;
    justify-content: space-between;
    overflow: hidden;
  }
  // .bottom{
  //   max-height: 105px;
  //   height: 11%;
  // }
}
</style>