simulation-analysis.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <ie-page bg-color="#F6F8FA">
  3. <ie-navbar title="考试分析" transparent bg-color="#FFFFFF" title-color="black" :keep-title-color="true" />
  4. <view class="relative">
  5. <ie-image :is-oss="true" src="/study-bg11.png" custom-class="w-full h-[545rpx] absolute top-0 left-0 z-0" />
  6. <ie-image :is-oss="true" src="/study-bg12.png" :custom-class="`w-308 h-302 absolute right-14 z-1 ${appStore.isH5 ? 'top-57' : 'top-127'}`" />
  7. <ie-image :is-oss="true" src="/study-title4.png" :custom-class="`w-282 h-64 absolute left-72 z-2 ${appStore.isH5 ? 'top-126' : 'top-196'}`" />
  8. <view v-if="examineeData" :class="`relative z-3 pb-20 mx-30 ${appStore.isH5 ? 'pt-244' : 'pt-314'}`">
  9. <view class="bg-white rounded-15 px-20 pb-1">
  10. <rate-chart :value="rightRate" />
  11. <view class="h-1 bg-[#E6E6E6] my-20"></view>
  12. <view>
  13. <template v-if="!userStore.isVHS">
  14. <view class="my-20 flex items-center justify-between text-24">
  15. <ie-image src="/pagesStudy/static/image/icon-house.png" custom-class="w-24 h-24" mode="aspectFill" />
  16. <text class="ml-10 text-fore-light flex-1">考试院校</text>
  17. <text class="text-fore-title">{{ examineeData.collegeName }}-{{ examineeData.majorName }}</text>
  18. </view>
  19. <view class="my-20 flex items-center justify-between text-24">
  20. <ie-image src="/pagesStudy/static/image/icon-group.png" custom-class="w-24 h-24" mode="aspectFill" />
  21. <text class="ml-10 text-fore-light flex-1">考试科目</text>
  22. <text class="text-fore-title">{{ examineeData.subjectName }}</text>
  23. </view>
  24. </template>
  25. <view class="my-20 flex items-center justify-between text-24">
  26. <ie-image src="/pagesStudy/static/image/icon-clock.png" custom-class="w-24 h-24" mode="aspectFill" />
  27. <text class="ml-10 text-fore-light flex-1">考试时长</text>
  28. <text class="text-fore-title">{{ formatTime(examineeData.duration) }}</text>
  29. </view>
  30. </view>
  31. </view>
  32. <exam-stat :data="examineeData" :show-stats="true" @detail="handleDetail" />
  33. <score-stat :data="examineeData" />
  34. </view>
  35. </view>
  36. </ie-page>
  37. </template>
  38. <script lang="ts" setup>
  39. import RateChart from './components/rate-chart.vue';
  40. import ExamStat from './components/exam-stat.vue';
  41. import ScoreStat from './components/score-stat.vue';
  42. import { getExamineeResult } from '@/api/modules/study';
  43. import { useTransferPage } from '@/hooks/useTransferPage';
  44. import { useUserStore } from '@/store/userStore';
  45. import { useAppStore } from '@/store/appStore';
  46. import { Study, Transfer } from '@/types';
  47. import { EnumPaperType, EnumQuestionType } from '@/common/enum';
  48. const appStore = useAppStore();
  49. const { prevData, transferTo } = useTransferPage<Transfer.SimulationAnalysisPageOptions, Transfer.ExamAnalysisPageOptions>();
  50. const examineeData = ref<Study.Examinee>();
  51. const userStore = useUserStore();
  52. const paperName = computed(() => {
  53. if (userStore.isVHS) {
  54. return examineeData.value?.name || examineeData.value?.subjectName || '';
  55. } else {
  56. return examineeData.value?.name || examineeData.value?.subjectName || '';
  57. }
  58. });
  59. const rightRate = computed(() => {
  60. const { totalCount = 0, wrongCount = 0 } = examineeData.value || {};
  61. return Math.max(Math.round((totalCount - wrongCount) / totalCount * 100), 1);
  62. });
  63. const formatTime = (time: number) => {
  64. if (!time) {
  65. return '';
  66. }
  67. const hours = Math.floor(time / 3600);
  68. const minutes = Math.floor((time % 3600) / 60);
  69. const seconds = time % 60;
  70. if (hours >= 1) {
  71. return `${hours}时${minutes}分${seconds}秒`;
  72. } else {
  73. return `${minutes}分${seconds}秒`;
  74. }
  75. };
  76. const handleDetail = (item: Study.Question) => {
  77. if (!examineeData.value) {
  78. return;
  79. }
  80. const pageOptions: Transfer.ExamAnalysisPageOptions = {
  81. readonly: true,
  82. questionId: item.id,
  83. paperType: prevData.value.paperType,
  84. simulationInfo: {
  85. name: paperName.value,
  86. examineeId: examineeData.value.examineeId
  87. }
  88. }
  89. transferTo('/pagesStudy/pages/exam-start/exam-start', {
  90. data: pageOptions,
  91. });
  92. };
  93. const loadData = async () => {
  94. uni.$ie.showLoading();
  95. const res = await getExamineeResult(prevData.value.examineeId);
  96. examineeData.value = res.data;
  97. uni.$ie.hideLoading();
  98. };
  99. onLoad(() => {
  100. loadData();
  101. });
  102. onPageScroll(() => { })
  103. </script>
  104. <style lang="scss" scoped></style>