<template>
  <div class="m-container">
    <div class="cellWrap">
      <div class="mcell" v-for="(item,index) in reportList" :key="index" >
        <div class="left">
          <span class="timer">{{ item.month}}</span>
          <span class="title">{{ item.groupName}}</span>
        </div>
        <div class="cellBtn" @click="submitReport(item)">提交报告</div>
      </div>
    </div>
  </div>
</template>
<script>
import {getNeedPost} from '@/api/teacher'
export default {
  data() {
    return {
        reportList:[]
    };
  },
  created(){
       let params = this.$route.query;
    if (params.Authorization) {
      localStorage.setItem("Authorization", decodeURI(params.Authorization));
      localStorage.setItem("userInfo", decodeURI(params.Authorization));
    }
  },
  mounted(){
      getNeedPost().then(res=>{
          if(res.data.code == 200){
              if(res.data.data.length > 0){
                  this.reportList = res.data.data
              }else {
                   this.$toast('当前没有待填写报告')
              }
          }
      })
  },
  methods:{
      submitReport(item){
          this.$router.push({path:'/studyReportNew',query:{id:item.id,classGroupId:item.classGroupId}})
      }
  }
};
</script>
<style lang="less" scoped>
.m-container {
  min-height: 100vh;
  background-color: #f3f4f8;
  .cellWrap {
    background-color: #fff;
    .mcell {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      height: 0.54rem;
      line-height: 0.54rem;
      background-color: #fff;
      margin-left: 0.16rem;
      border-bottom: 1px solid #f0f0f0;
      align-items: center;
      .left {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
          .timer {
        font-size: 0.14rem;
        color: #808080;
        margin-right: 0.3rem;
      }
      .title {
        font-size: 0.14rem;
        color: #1a1a1a;
        display: block;
        width: 1.45rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        
      }
      }
    
      .cellBtn {
        text-align: center;
        width: .8rem;
        height: 0.24rem;
        line-height: .24rem;
        color: #fff;
        background: rgba(20, 146, 138, 1);
        border-radius: 17px;
        font-size: .14rem;
        margin-right: .16rem;
      }
    }
  }
}
</style>