<template>
  <div id="userInfoS">
    <el-dialog
      :visible.sync="dialogBox"
      width="1080px"
      :show-close="false"
      :destroy-on-close="true"
      :before-close="closeBefore"
      :fullscreen="fullscreen"
    >
      <div slot="title" class="hearders">
        <div class="leftTitle">详情</div>
        <div class="rightBoxs">
          <img
            src="@/assets/images/Max@2x.png"
            alt=""
            @click="fullscreen = !fullscreen"
          />
          <img src="@/assets/images/Close@2x.png" alt="" @click="closeBefore" />
        </div>
      </div>
      <el-row class="contentBox" :gutter="30">
        <div style="padding: 0px 20px">
          <search-box :formList="formList" @search="search" @init="init" />
          <table-list
            :tableSets="tableSet"
            :tableData="tableData"
            :navText="navText"
            @addClick="addClick"
            :loading="loading"
          >
            <!-- <template slot="btn" slot-scope="props">
        <el-button type="text" @click="userInfos(props.scope.row)"
          >学生信息</el-button
        >
      </template> -->
          </table-list>
          <pagination
            :total="total"
            :pageSize="pageSize"
            :currentPage="currentPage"
            @handleSizeChange="handleSizeChange"
            @handleCurrentChange="handleCurrentChange"
          />
        </div>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeBefore">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import searchBox from "@/components/searchBox";
import tableList from "@/components/tableList";
import pagination from "@/components/pagination";
export default {
  components: { searchBox, tableList, pagination },
  data() {
    return {
      fullscreen: false,
      dialogBox: false,
      loading: false, //当前表单加载是否加载动画
      navText: {
        title: "学员考试安排",
        index: 0,
        ch: "条",
        num: true,
        choice: true,
        addHide: true,
        tableHide:true,
        backFatherBtn: {
          status: false,
          title: "未定义",
        },
      },
      tableSet: [
        {
          label: "姓名",
          prop: "realname",
          hidden: true,
        },
        {
          label: "手机号",
          prop: "telphone",
          hidden: true,
        },
        {
          label: "课程名称",
          prop: "courseName",
          hidden: true,
        },
        {
          label: "视频名称",
          prop: "title",
          hidden: true,
        },
        {
          label: "开始学习时间",
          prop: "startTime",
          hidden: true,
          scope: 'aTimeList'
        },
        {
          label: "结束学习时间",
          prop: "endTime",
          hidden: true,
          scope: 'aTimeList'
        },
        {
          label: "实际学习时长",
          prop: "studyDuration",
          hidden: true,
          scope: 'time'
        },
      ], //表头信息
      tableData: [], //表单数据
      total: 0, //一共多少条
      pageSize: 10, //每页多少条数据
      currentPage: 1, //当前页码
      formList: [
        {
          label: "开始时间",
          prop: "TimeList1",
          scope: "datePicker",
        },
        {
          label: "结束时间",
          prop: "TimeList2",
          scope: "datePicker",
        },
        {
          label: "课程名称",
          prop: "courseName",
          placeholder: "请输入课程名称",
        },
        {
          label: "视频名称",
          prop: "title",
          placeholder: "请输入视频名称",
        }
      ], //搜索
      userId: null
    };
  },
  methods: {
    getInfos(v){
      this.userId = v
      this.search()
    },
    search(v) {
      if (v === undefined) {
        v = {
          pageSize: this.pageSize,
          pageNum: this.currentPage,
        };
      }
      var data = {
        userId:this.userId,
        startTime1: v.TimeList1 ? (v.TimeList1[0] / 1000).toFixed(0) : "",
        startTime2: v.TimeList1 ? (v.TimeList1[1] / 1000).toFixed(0) : "",
        endTime1: v.TimeList2 ? (v.TimeList2[0] / 1000).toFixed(0) : "",
        endTime2: v.TimeList2 ? (v.TimeList2[1] / 1000).toFixed(0) : "",
        courseName: v.courseName,
        title:v.title,
        pageSize: this.pageSize,
        pageNum: this.currentPage,
      };
       this.loading = true;
      this.$api.inquirestudyRecordlists(data).then((res) => {
        this.tableData = res.rows;
        this.total = res.total;
        this.navText.index = res.total;
        this.dialogBox = true
      });
      this.loading = false;
    },
    init() {
      this.search();
    },
    handleSizeChange(v) {
      this.pageSize = v;
      this.currentPage = 1;
      this.search();
    },
    handleCurrentChange(v) {
      this.currentPage = v;
      this.search();
    },
    addClick(v, int) {},
    closeBefore() {
      this.dialogBox = false;
    },
  },
};
</script>

<style lang="less" scoped>
.trLists {
  td {
    background-color: rgb(249, 250, 252);
    font-weight: 600;
  }
}
td {
  padding: 10px;
}
th {
  padding: 10px;
  background-color: rgb(249, 250, 252);
}
.label {
  text-align: right;
  background-color: rgb(249, 250, 252);
  width: 15%;
}
.flex {
  width: 35%;
}
/deep/.el-button {
  border-radius: 8px;
}
/deep/.el-dialog {
  border-radius: 8px;
  .el-dialog__header {
    padding: 0;
    .hearders {
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0px 18px 0px 20px;
      border-bottom: 1px solid #e2e2e2;
      .leftTitle {
        font-size: 14px;
        font-weight: bold;
        color: #2f4378;
      }
      .rightBoxs {
        display: flex;
        align-items: center;
        img {
          width: 14px;
          height: 14px;
          margin-left: 13px;
          cursor: pointer;
        }
      }
    }
  }
  .el-dialog__footer {
    padding: 0;
    .dialog-footer {
      padding: 0px 40px;
      height: 70px;
      border-top: 1px solid #e2e2e2;
      display: flex;
      align-items: center;
      justify-content: flex-end;
    }
  }
}
.imgBox {
  width: 100%;
  // height: 210px;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 8px 8px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  .imgLabel {
    flex: 1;
    width: 100%;
    border: 1px dotted #e2e2e2;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    border-radius: 8px;
    .msPhoto {
      display: flex;
      justify-content: center;
      align-items: center;
      max-width: 100%;
      max-height: 270px;
      img {
        max-width: 100%;
        max-height: 270px;
      }
    }
    .imgbbx {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      i {
        font-weight: bold;
        margin: 14px 0;
        font-size: 24px;
      }
    }
  }
  p {
    margin: 5px 0px;
  }
}
</style>