<script setup lang="ts">
import { CaretBottom } from "@element-plus/icons-vue";

defineOptions({
  name: "StudentIndex",
  inheritAttrs: false,
});
import { watch } from "vue";
import { useUserStore } from "@/store/modules/user";
import { ClassList } from "@/api/school/types";
const userStore = useUserStore();
watch(
  () => userStore.schoolId,
  (newValue, oldValue) => {
    console.log(newValue, oldValue);
  }
);
let studentInfo = ref("");
// 班级编号
let classNumber = ref(0);
const classData = ref<ClassList[]>([
  {
    id: 0,
    school_id: 0,
    name: "全部班级",
  },
]);
const tableData = ref<any>([
  {
    number: 1,
    name: "学生A",
    cls: "向日葵小班",
    phone: "15814111616",
    date: "2023-08-22",
    times: 22,
  },
]);
</script>

<template>
  <div class="student-container">
    <!-- 学生查找 -->
    <div class="student-search">
      <el-select
        v-model="classNumber"
        placeholder="全部班级"
        size="large"
        :suffix-icon="CaretBottom"
      >
        <el-option
          v-for="item in classData"
          :key="item.id"
          :label="item.name"
          :value="item.id"
        />
      </el-select>
      <el-input
        v-model="studentInfo"
        size="large"
        placeholder="请输入学生名称或手机号码"
      />
      <el-button size="large" type="primary">查找</el-button>
      <span>共<b>40</b>人</span>
    </div>
    <!-- 学生数据 -->
    <div class="list-table">
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="number" label="序号" align="center" />
        <el-table-column prop="name" label="学生名称" align="center" />
        <el-table-column prop="cls" label="所在班级" align="center" />
        <el-table-column prop="phone" label="手机号码" align="center" />
        <el-table-column prop="date" label="注册时间" align="center" />
        <el-table-column prop="times" label="训练次数" align="center" />
        <el-table-column />
        <el-table-column label="操作" align="center">
          <router-link to="/student/result" class="table-btn"
            >训练效果分析</router-link
          >
          <!--					<a href="javascript:void(0);" class="table-btn disabled">训练效果分析</a>-->
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.student-container {
  position: relative;
  padding: 20px 30px;
}
.student-search {
  margin-bottom: 20px;
  font-size: 16px;
  .el-select {
    width: 180px;
    margin: 0 20px 0 0;
  }
  .el-input {
    width: 250px;
    margin: 0;
  }
  :deep(.el-input__inner) {
    font-size: 16px;
  }
  .el-button {
    font-size: 16px;
    padding: 0 26px;
    margin: 0 20px;
    border-radius: 12px;
  }
  b {
    font-size: 20px;
  }
}
:deep(.el-input__wrapper) {
  background: #ffffff;
  border-radius: 12px;
}
:deep(.el-input__wrapper) {
  box-shadow: none !important;
}
/* 自定义 el-select 样式 */
/* el-select 各种边框线隐藏**/
:deep(.el-select) {
  --el-select-input-focus-border-color: none !important;
}
:deep(.el-select .el-input__wrapper.is-focus) {
  box-shadow: none !important;
}
:deep(.el-select:hover:not(.el-select--disabled) .el-input__wrapper) {
  box-shadow: none !important;
}
:deep(.el-table th.el-table__cell) {
  background: #e9ebee;
}
.list-table {
  background: #ffffff;
  border-radius: 25px;
  overflow: hidden;
  .table-btn {
    display: inline-block;
    height: 38px;
    line-height: 38px;
    padding: 0 15px;
    background: #4284f2;
    border-radius: 10px;
    color: #ffffff;
    &.disabled {
      background: #bfbfbf;
      cursor: not-allowed;
    }
  }
}
</style>
