<template>
  <view class="flex flex-col gap-20 px-30 pb-20 bg-back h-fit">
    <view class="" v-for="(item, index) in []" :key="index">
      <vhs-exam-item :data="item" />
    </view>
  </view>
</template>
<script lang="ts" setup>
import { getSimulatedRecord, getPaperWorkList } from '@/api/modules/study';
import { EnumExamRecordType, EnumPaperWorkState } from '@/common/enum';
import VhsExamItem from '@/pagesStudy/components/vhs-exam-item.vue';
import { Study } from '@/types';
import PaperWorkItem from '@/pagesStudy/components/paper-work-item.vue';
const props = defineProps({
  examType: {
    type: String,
    default: 'test'
  }
});
const simulatedRecordList = ref<Study.SimulatedRecord[]>([]);
const paperWorkRecordList = ref<Study.PaperWork[]>([]);
const loadData = async (type: string) => {
  simulatedRecordList.value = [];
  paperWorkRecordList.value = [];
  if (type === EnumExamRecordType.SIMULATED) {
    const { data } = await getSimulatedRecord();
    simulatedRecordList.value = data;
  } else {
    const { rows } = await getPaperWorkList({ state: EnumPaperWorkState.COMPLETED });
    paperWorkRecordList.value = rows;
  }
}

watch(() => props.examType, (newVal) => {
  loadData(newVal);
}, {
  immediate: false
});
onShow(() => {
  loadData(props.examType);
});
</script>
<style lang="scss" scoped></style>