knowledge-history-teacher.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <view class="mt-40 flex items-center justify-end gap-x-10">
  3. <text class="text-24 text-fore-light">平均正确率</text>
  4. <text class="text-30 text-fore-title font-bold">80%</text>
  5. </view>
  6. <view class="mt-10">
  7. <progress :percent="80" stroke-width="12" activeColor="#68D119" backgroundColor="#F2F2F2" :border-radius="8"
  8. class="custom-progress" />
  9. </view>
  10. <view class="mt-76">
  11. <student-stat-table :teach-class="teachClass" :data="studentStatData" />
  12. </view>
  13. </template>
  14. <script lang="ts" setup>
  15. import studentStatTable from './student-stat-table.vue';
  16. import { StudentStat, TeachClass } from '@/types/study';
  17. const props = defineProps({
  18. teachClass: {
  19. type: Object as PropType<TeachClass>,
  20. default: () => ({})
  21. }
  22. });
  23. const studentStatData = ref<StudentStat[]>([
  24. {
  25. id: 1,
  26. name: '张三',
  27. questionNum: 10,
  28. dateNum: 10,
  29. rate: 80
  30. },
  31. {
  32. id: 2,
  33. name: '李四',
  34. questionNum: 10,
  35. dateNum: 10,
  36. rate: 80
  37. }
  38. ]);
  39. watch(() => props.teachClass, (newVal) => {
  40. if (newVal.classId) {
  41. console.log('新的班级', newVal);
  42. loadData();
  43. }
  44. }, {
  45. deep: true,
  46. immediate: true
  47. });
  48. const loadData = async () => {
  49. // const res = await getStudentStat(props.teachClass.classId);
  50. // console.log(res);
  51. }
  52. </script>
  53. <style lang="scss" scoped></style>