<style>
  .myClassMate .planTabDiv {
    height: calc(100vh - 290px);
    max-height: calc(100vh - 290px);
  }

</style>
<template>
  <div class="page-body MainPlan myClassMate">
    <classmateForm :dataList="dataList"></classmateForm>
  </div>
</template>
<script>
  import {
    GetClassPlanStatistical
  } from '../../api/system/index';
  import classmateForm from '../../components/course/classmate-form';
  export default {
    meta: {
      title: "我的上课计划"
    },
    components: {
      classmateForm
    },
    data() {
      return {
        msg: {
          StartTime: "",
          EndTime: '',
          TeacherId: 0,
          ClassRoomId: 0
        },
        dataList: {}
      }
    },
    created() {

    },
    mounted() {
      let userinfo = this.getLocalStorage();
      let AccountId = userinfo.AccountId;
      let myDate = new Date();
      let nowDate =
        myDate.getFullYear() +
        "-" +
        parseInt(myDate.getMonth() + 1) +
        "-" +
        myDate.getDate();
      this.msg.StartTime = nowDate;
      this.msg.EndTime = this.addMoth(nowDate, 1);
      this.msg.TeacherId = AccountId;
      this.getPlanList();
    },
    methods: {
      // 获取校区教室导航列表
      getPlanList() {
        GetClassPlanStatistical(this.msg).then(res => {
          if (res.Code == 1) {
            this.dataList = res.Data;
          }
        }).catch(() => {

        })
      },
      addMoth(d, m) {
        let ds = d.split("-"),
          _d = ds[2] - 0;
        let nextM = new Date(ds[0], ds[1] - 1 + m + 1, 0);
        let max = nextM.getDate();
        d = new Date(ds[0], ds[1] - 1 + m, _d > max ? max : _d);
        return d
          .toLocaleDateString()
          .match(/\d+/g)
          .join("-");
      }
    }
  }

</script>
<style lang="sass">
  @import url('~assets/css/table.sass')

</style>
