<template>
  <view>
     <student-stat-table :teach-class="teachClass" :data="studentStatData" @row-click="handleRowClick" />
  </view>
</template>
<script lang="ts" setup>
import studentStatTable from './student-stat-table.vue';
import { StudentStat, TeachClass } from '@/types/study';
import { OPEN_PRACTICE_DETAIL } from '@/types/injectionSymbols';
const openPracticeDetail = inject(OPEN_PRACTICE_DETAIL);
const props = defineProps({
  teachClass: {
    type: Object as PropType<TeachClass>,
    default: () => ({})
  },
  currentType: {
    type: String,
    default: 'rate'
  },
  currentTab: {
    type: String,
    default: 'asc'
  }
});
const studentId = ref(0);
const studentStatData = ref<StudentStat[]>([
  {
    id: 1,
    name: '张三',
    questionNum: 10,
    dateNum: 10,
    rate: 80
  },
  {
    id: 2,
    name: '李四',
    questionNum: 10,
    dateNum: 10,
    rate: 80
  }
]);
const loadData = async () => {
  console.log('loadData', props.teachClass, props.currentTab, props.currentType);
  // const res = await getPracticeData(props.teachClass.classId);
  // data.value = res.data;
}
watchEffect(() => {
  loadData();
});
const handleRowClick = (row: StudentStat) => {
  console.log('点击了行:', row);
  openPracticeDetail?.(row.id, row.name);
}
</script>
<style lang="scss" scoped>
</style>