vhs-exam-history-student.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <view class="flex flex-col gap-20 px-30 pb-20 bg-back h-fit">
  3. <view class="" v-for="(item, index) in []" :key="index">
  4. <vhs-exam-item :data="item" />
  5. </view>
  6. </view>
  7. </template>
  8. <script lang="ts" setup>
  9. import { getSimulatedRecord, getPaperWorkList } from '@/api/modules/study';
  10. import { EnumExamRecordType, EnumPaperWorkState } from '@/common/enum';
  11. import VhsExamItem from '@/pagesStudy/components/vhs-exam-item.vue';
  12. import { Study } from '@/types';
  13. import PaperWorkItem from '@/pagesStudy/components/paper-work-item.vue';
  14. const props = defineProps({
  15. examType: {
  16. type: String,
  17. default: 'test'
  18. }
  19. });
  20. const simulatedRecordList = ref<Study.SimulatedRecord[]>([]);
  21. const paperWorkRecordList = ref<Study.PaperWork[]>([]);
  22. const loadData = async (type: string) => {
  23. simulatedRecordList.value = [];
  24. paperWorkRecordList.value = [];
  25. if (type === EnumExamRecordType.SIMULATED) {
  26. const { data } = await getSimulatedRecord();
  27. simulatedRecordList.value = data;
  28. } else {
  29. const { rows } = await getPaperWorkList({ state: EnumPaperWorkState.COMPLETED });
  30. paperWorkRecordList.value = rows;
  31. }
  32. }
  33. watch(() => props.examType, (newVal) => {
  34. loadData(newVal);
  35. }, {
  36. immediate: false
  37. });
  38. onShow(() => {
  39. loadData(props.examType);
  40. });
  41. </script>
  42. <style lang="scss" scoped></style>