<template>
  <div class="m-container">
    <div class="cellWrap">
      <div class="mcell" v-for="(item, index) in reportList" :key="index">
        <div class="left">
          <img :src="item.studentAvatar?item.studentAvatar:nomorlIcon" class="titleIcon" alt="" />
          <div class="textWrap">
            <span class="title">{{ item.groupName?item.groupName:'暂无课程名' }}</span>
            <span class="timer">{{ item.month }}</span>
          </div>
        </div>
        <div class="cellBtn" @click="submitReport(item)">提交报告</div>
      </div>

      <!-- 空 -->

      <MEmpty v-if="!reportList.length" msg='暂无待评价月报' :full='true'/>
    </div>
  </div>
</template>
<script>
import { getNeedPost } from "@/api/teacher";
import MEmpty from "@/components/MEmpty";
export default {
  components:{
    MEmpty
  },
  data() {
    return {
      reportList: [],
      nomorlIcon:require("@/assets/images/icon_student.png")
    };
  },
  created() {
    let params = this.$route.query;
    if (params.Authorization) {
      localStorage.setItem("Authorization", decodeURI(params.Authorization));
      localStorage.setItem("userInfo", decodeURI(params.Authorization));
    }
  },
  mounted() {
     document.title = "待评价月报";
    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>
@import url("../../assets/commonLess/variable.less");
.m-container {
  min-height: 100vh;
  background-color: #f3f4f8;
  .titleIcon {
    width: .42rem;
    height: .42rem;
    border-radius: 50%;
    margin-right: .09rem;
  }
  .cellWrap {
    background-color: #fff;
    .mcell {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      background-color: #fff;
      margin-left: 0.16rem;
      height: 0.82rem;
      border-bottom: 1px solid #f0f0f0;
      align-items: center;
      .left {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        .timer {
          font-size: 0.14rem;
          color: #666666;
          margin-right: 0.3rem;
        }
        .title {
          font-size: 0.16rem;
          color: #1a1a1a;
          display: block;
          width: 1.45rem;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }

      .cellBtn {
        text-align: center;
        width: 0.8rem;
        height: 0.28rem;
        line-height: 0.28rem;
        color: #fff;
        background-color: @mColor;
        border-radius: 0.22rem;
        font-size: 0.14rem;
        margin-right: 0.12rem;
      }
    }
  }
}
</style>