vhs-exam-item.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view class="bg-white rounded-5">
  3. <view class="px-30 pt-32 pb-20">
  4. <view class="text-28 text-fore-title font-bold ellipsis-2">{{ data.paperName }}</view>
  5. <view class="flex items-center gap-16 mt-20">
  6. <view class="tag-item bg-[#FFFBEB] text-[#F97316]">{{ data.subjectName }}</view>
  7. <view class="tag-item bg-back text-fore-light">{{ type === 0 ? '公共课' : '专业课' }}</view>
  8. </view>
  9. </view>
  10. <uv-line color="#F6F8FA" />
  11. <view class="px-30 py-20 flex items-center justify-between">
  12. <view class="text-24 text-fore-light">
  13. <text>共</text>
  14. <text class="text-primary">{{ data.number }}</text>
  15. <text>道题,总分</text>
  16. <text class="text-primary">{{ data.fenshu }}</text>
  17. <text>分</text>
  18. </view>
  19. <view class="px-20 py-8 border border-solid rounded-full text-24 text-white"
  20. :class="[isFinished ? 'bg-success border-success' : 'bg-primary border-primary']" @click="handleStartExam">
  21. <text>{{ isFinished ? '查看分析' : '开始考试' }}</text>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script lang="ts" setup>
  27. import { EnumPaperType, EnumSimulatedRecordStatus, EnumUserRole } from '@/common/enum';
  28. import { Study, Transfer } from '@/types';
  29. import { useTransferPage } from '@/hooks/useTransferPage';
  30. import { useAuth } from '@/hooks/useAuth';
  31. const { hasPermission } = useAuth();
  32. const { transferTo } = useTransferPage();
  33. const props = defineProps<{
  34. data: Study.VHSPaper;
  35. type?: number
  36. }>();
  37. const isFinished = computed(() => {
  38. return props.data.status === EnumSimulatedRecordStatus.SUBMIT;
  39. });
  40. const handleStartExam = () => {
  41. const hasAuth = hasPermission([EnumUserRole.VIP]);
  42. if (hasAuth) {
  43. if (isFinished.value) {
  44. transferTo('/pagesStudy/pages/simulation-analysis/simulation-analysis', {
  45. data: {
  46. examineeId: props.data.examineeId,
  47. paperType: EnumPaperType.SIMULATED
  48. }
  49. });
  50. } else {
  51. const pageOptions: Transfer.ExamAnalysisPageOptions = {
  52. paperType: EnumPaperType.SIMULATED,
  53. readonly: false,
  54. simulationInfo: {
  55. name: props.data.paperName,
  56. // 难受
  57. examineeId: props.data.id,
  58. }
  59. }
  60. transferTo('/pagesStudy/pages/exam-start/exam-start', {
  61. data: pageOptions,
  62. });
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .tag-item {
  69. @apply text-24 rounded-4 px-10 py-6 w-fit;
  70. }
  71. </style>