<template>
  <div>
    <div class="opinionBanner">
    </div>
    <div class="xindex-content" style="padding: 0">
      <div class="modules xcontent2">
        <div class="xcontent2-main">
          <div class="navTop">
            <div>
              <router-link to="/grateful">首页</router-link>&nbsp;>&nbsp;
              <span style="cursor: pointer;">名师好课</span>
            </div>
            <div style="position: relative;">
              <el-input class="portal-input" placeholder="请输入课程名称" style="border-radius: 20px !important; "
                @keyup.enter.native="searchJump()" clearable maxlength="50" v-model="params.courseName">
              </el-input>
              <el-button class="sear-but" @click="searchJump()" type="primary" size="mini">搜索</el-button>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 教师赋能 -->
    <div class="xindex-content" style="padding: 0">
      <div class="modules xcontent2">
        <div class="xcontent2-main">
          <div class="modules-list" style="margin-top: 0;">
            <div class="content">
              <el-table :data="list" stripe border>
                <el-table-column label="课程名称" prop="courseName" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column label="课程价值" prop="meaning" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column label="教师名称" prop="teacherName" align="center" width="150px"></el-table-column>
                <el-table-column label="教师工号" prop="teacherNo" align="center" width="150px"></el-table-column>
              </el-table>
              <div v-if="list.length > 0" style="text-align: center;margin-top: 50px;">
                <pagination style="background-color: rgba(0, 0, 0, 0);" :size="params.pageSize" :total="total"
                  :page="params.pageNo" @change-size="changePageSize" @change-page="loadData" :autoScroll="false">
                </pagination>
              </div>
              <div v-if="list.length == 0" class="pagination-div">
                <span class="notcoures">
                  <img :src="`${webBaseUrl}/images/nocase.png`" alt="">
                  <h5>暂无数据～</h5>
                </span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import timeShow from "@/components/Portal/datetimeShow.vue";
import { teachersList } from "../../api/modules/grateful";
export default {
  data: () => {
    return {
      total: 0,
      list: [],
      params: {
        pageNo: 1,
        pageSize: 10,
        courseName: '',
      }
    };
  },
  components: { timeShow },
  mounted() {
    this.getTeachersList()
  },
  methods: {
    getTeachersList() {
      teachersList(this.params).then((result) => {
        console.log(result);
        const { total, records } = result.data
        this.total = total;
        this.list = records;
      })
    },
    searchJump() {
      this.params.pageNo = 1
      this.getTeachersList()
    },
    loadData(pageNo) {
      this.params.pageNo = pageNo
      this.getTeachersList()
    },
    getPic(index) {
      return this.webBaseUrl + "/images/listblue0" + (index + 1) + ".png";
    },
    changePageSize(pageSize) {
      this.params.pageSize = pageSize;
      this.getTeachersList()
    },
  },
};
</script>
<style scoped lang='scss'>
.opinionBanner {
  width: 100%;
  height: 240px;
  position: relative;
  background: url('../../assets/images/grateful/opinionBanner.png') no-repeat;
  background-size: 100% 100%;

  &::before {
    content: url(../../assets/images//grateful/logo.png);
    position: absolute;
    top: 20px;
    left: 40px;
  }

  &::after {
    content: '名师好课';
    position: absolute;
    bottom: 25px;
    left: 8%;
    color: #ffffff;
    font-weight: 600;
    font-size: 64px;
  }

  img {
    width: 100%;
    height: 240px;
  }
}

.navTop {
  color: #666;
  display: flex;
  justify-content: space-between;

  .sear-but {
    position: absolute;
    bottom: 10%;
    right: 5px;
  }
}

.modules-list {
  // min-height: 555px;
  background: #ffffff;
  border-radius: 8px;

  .content {
    padding: 40px 70px;
    background: linear-gradient(180deg,
        rgba(56, 125, 247, 0.2) 0%,
        rgba(166, 168, 255, 0) 100%) no-repeat;
    background-size: 100% 166px;
    border-radius: 8px;

    .pagination-div {
      text-align: center;
      padding: 70px 0;
    }

  }

  .pagination-div {
    text-align: center;
    padding: 70px 0;
  }


  .sear-but {
    position: absolute;
    bottom: 10%;
    right: 5px;
  }
}
</style>
