<template>
  <div class="app-container">
    <br/>
    <el-card style="width: 90%; margin: auto">
      <el-table :data="tableData" height="650px" v-loading="loading" border :row-style="{ height: '40px' }"
                :cell-style="{ padding: '0' }"
                >
        <el-table-column prop="lesson" label="节次\星期" width="120" align="center" style="height: 20px;">
          <template slot-scope="scope">
            <div style=" font-size: 13px"> {{ scope.row.sortName }}</div>
            <div style=" font-size: 13px"> {{ scope.row.startTime }}--{{ scope.row.endTime }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="monday.courseName" label="星期一" align="center">
          <template slot-scope="scope">
            <div v-if="scope.row.monday"> {{ scope.row.monday.courseName }}</div>
            <div v-else></div>
          </template>
        </el-table-column>
        <el-table-column label="星期二" align="center">
          <template slot-scope="scope">
            <div v-if="scope.row.tuesday"> {{ scope.row.tuesday.courseName }}</div>
            <div v-else></div>
          </template>
        </el-table-column>
        <el-table-column label="星期三" align="center">
          <template slot-scope="scope">
            <div v-if="scope.row.wednesday"> {{ scope.row.wednesday.courseName }}</div>
            <div v-else></div>
          </template>
        </el-table-column>
        <el-table-column label="星期四" align="center">
          <template slot-scope="scope">
            <div v-if="scope.row.thursday"> {{ scope.row.thursday.courseName }}</div>
            <div v-else></div>
          </template>
        </el-table-column>
        <el-table-column label="星期五" align="center">
          <template slot-scope="scope">
            <div v-if="scope.row.friday"> {{ scope.row.friday.courseName }}</div>
            <div v-else></div>
          </template>
        </el-table-column>
        <el-table-column prop="saturday" label="星期六" align="center">
          <template slot-scope="scope">
            <div v-if="scope.row.saturday"> {{ scope.row.saturday.courseName }}</div>
            <div v-else></div>
          </template>
        </el-table-column>
        <el-table-column label="星期日" align="center">
          <template slot-scope="scope">
            <div v-if="scope.row.sunday"> {{ scope.row.sunday.courseName }}</div>
            <div v-else></div>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import {
  getMyTable
} from "@/api/smartSchool/lesson/index.js";

export default {
  name: '',
  data() {
    return {
      loading: false,
      tableData: []
    }
  },
  components: {},
  methods: {
    /** 查询课程表 */
    getLessonTable() {
      this.loading = true;
      getMyTable().then((response) => {
        this.tableData = response.rows
        this.loading = false

      });
    },
  },
  created() {
    this.getLessonTable()
  },
}
</script>

<style scoped>

</style>
