<!-- 活动解析 -->
<template>
  <div>
    <!-- table 表格 -->
    <el-row :gutter="20" class="main-items" >

      <!--数据监控homeworkRecoveryList.list-->
      <el-col :span="20" class="main" :offset="2">

        <el-table
          :data="GetTeacherAllHomework.list"
          :header-cell-class-name="tableheaderClassName"
          :header-cell-style="{
          'color': '#999999',
          'font-size': '16px'
           }"
          size="medium"
          stripe
        >
          <el-table-column
            label="学生"
            prop="name"
            header-align="center"
          >
          </el-table-column>
          <el-table-column
            prop="subject"
            label="科目"
            header-align="center"
          >
          </el-table-column>
           <el-table-column
            prop="grade"
            label="年级"
            header-align="center"
          >
          </el-table-column>
          <el-table-column
            prop="time"
            label="时间"
            header-align="center"
          ></el-table-column>
           <el-table-column prop label="作业图片" header-align="center" width="200">
        <template slot-scope="scope">
          <span
            class="allocation"
            @click="GetStudentHomeworkDetail(scope.row)"
          >查看</span>
        </template>
      </el-table-column>
        </el-table>
        <!-- 分页显示 -->
          <el-pagination
            background
            @size-change="handleSizeChange1"
            @current-change="pageChange1"
            :page-sizes="[10]"
            layout="total,prev, pager, next"
            :total= parseInt(GetTeacherAllHomework.pages)
          ></el-pagination>
      </el-col>
        <el-col :span="20" class :offset="2">
            <div style="margin-top:200px; text-align:center;">
              <el-button @click="routerback()" type="success" round>返回</el-button>
            </div>
          </el-col>
    </el-row>

  </div>
</template>
<script>
  import { mapGetters, mapActions } from "vuex";
 import { IMG_BASE_URL, APPOR_BASE_URL } from "@/config";
  export default {
    components: { },
    name: "actvResolveLabel",
    props: {},
    data() {
      return {
        BASE_URL:IMG_BASE_URL,
        filters: {
          MaxtimeValue:'',
          pageNo: 1,
          pageSize: 10,
          oneMonth:'',
          teacherId:''

        },
      };
    },
    watch: {},
   created() {
    const teacherId = this.$route.query.teacherId;
    const oneMonth = this.$route.query.oneMonth;
    const type = this.$route.query.type;
    // debugger
    this.filters.teacherId = teacherId;
    this.filters.oneMonth = oneMonth;
    this.TeacherType = type
  },
    computed: {
      ...mapGetters(['GetTeacherAllHomework'])
    },
    methods: {
      ...mapActions(["setUser"]),
      // 表格头部样式
      tableheaderClassName({ row, rowIndex }) {
        return "table-head-th";
      },
    
     // 查看学生作业原图详情
    GetStudentHomeworkDetail(v) {
    //   debugger
      this.$store.dispatch("GetStudentHomeworkDetail", {
        teacherId:this.filters.teacherId,
        homeworkId: v.homeworkId,
        type: this.TeacherType
      });
      this.$router.push({
        path: "/Super/HomeWorkPictrue"
      });
    },
        // 回退
    routerback() {
      this.$router.back(-1);
    },
      //时间封装
      formatDate: function () {
        let date = new Date();
        let y = date.getFullYear();
        let MM = date.getMonth() + 1;
        MM = MM < 10 ? ('0' + MM) : MM;
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        let m = date.getMinutes();
        m = m < 10 ? ('0' + m) : m;
        let s = date.getSeconds();
        s = s < 10 ? ('0' + s) : s;
        return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
      },
      //累计批改总张数列表
      async HomeworkRecoveryList() {
        this.$store.dispatch("GetTeacherAllHomeworkInfo", {
          pageNo: this.filters.pageNo,
          pageSize: this.filters.pageSize,
          maxCreateTime: this.formatDate(),
          teacherId: this.filters.teacherId,
          oneMonth: this.filters.oneMonth,
        });
      },
      pageChange1(val) {
        this.filters.pageNo = val;
        this.HomeworkRecoveryList();
      },
    
      handleSizeChange1(val) {
        this.filters.pageSize = val;
        this.HomeworkRecoveryList();
      },
  
    },
    mounted() {
      sessionStorage.setItem('tabIndex',3);
      this.HomeworkRecoveryList()
    }
  };
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>

  .main{
    background-color: #fff;
    margin-top: 16px;
    padding: 0 !important;
    border: 1px solid #E1E1E1;
    min-height: 980px;
  }

  el-table{
    color: #999999;
    font-size: 18px;
  }
  .main-items{
    color: #393939;
    text-align: center;
    line-height: 80px;
  }


  .input-with-select .el-input-group__prepend {
    background-color: #fff;
  }

  .showModel {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background: #000000;
    opacity: 0.2;
    overflow: hidden;
    z-index: 1000;
    color: #fff;
  }
  .model {
    z-index: 10000;
    width: 60%;
    height: auto;
    position: fixed;
    top: 15%;
    left: 30%;
    margin: auto;
    background: #fff;
    border-radius: 10px;
    text-align: center;
  }

  .model-text {
    background: rgba(255, 255, 255, 1);
    border-radius: 10px;
    overflow: hidden;
  }

  .model-items-left {
    /* float:left; */
    width: 100%;
    color: #393939;
    font-size: 24px;
    height: 100px;
  }
  .model-items-left-top {
    display: flex;
    justify-content: space-between;
  }

  .model-items-left-top-img {
    width: 68px;
    height: 68px;
    border-radius: 8px;
    position: relative;
    bottom: 25px;
  }
  .model-items-left-top-number {
    color: #7e7e7e;
    font-size: 18px;
    margin-left: 10px;
  }

  .el-table .table-head-th{
    background-color:#F6F7FB;
    font-size: 16px !important;
    color: #393939;

  }
  .model-manager {
    display: flex;
    justify-content: space-between;
    margin: 30px;
    color: #393939;
    font-size: 24px;
  }
  .allocation-items{
    /* float:left; */
    width: 45%;
    display: inline-block;
    margin-right: 20px;
    margin-bottom:30px;
   
  }
  .allocation{
    color: #52CC60;
    font-size: 20px;
    text-decoration: underline;
    cursor: pointer;
  }
.el-pagination.is-background .el-pager li:not(.disabled).active {
    background-color:#52cc60!important;
    color: #fff;
}
  .pages{
    margin: 15px 0;
  }
.el-table td, .el-table th {
    text-align: center!important;
}
</style>
