index-test.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="mx-30">
  3. <view class="flex items-center justify-between">
  4. <view class="w-fit text-32 text-fore-title font-bold leading-60">模拟测试</view>
  5. </view>
  6. <view class="my-44">
  7. <view class="border border-solid border-primary rounded-15">
  8. <view class="h-132 bg-[#EBF9FF] flex px-30 text-center rounded-t-15">
  9. <view class="flex-1 -translate-y-24">
  10. <view class="w-50 h-50 bg-primary rounded-full text-28 text-white font-bold leading-50 mx-auto">1</view>
  11. <view class="mt-26 text-24 text-fore-title">定向院校专业</view>
  12. </view>
  13. <ie-image src="/pagesStudy/static/image/icon-arrow-multiple.png" customClass="w-30 h-18 -translate-y-8" />
  14. <view class="flex-1 -translate-y-24">
  15. <view class="w-50 h-50 bg-primary rounded-full text-28 text-white font-bold leading-50 mx-auto">2</view>
  16. <view class="mt-26 text-24 text-fore-title">选择考试科目</view>
  17. </view>
  18. <ie-image src="/pagesStudy/static/image/icon-arrow-multiple.png" customClass="w-30 h-18 -translate-y-8" />
  19. <view class="flex-1 -translate-y-24">
  20. <view class="w-50 h-50 bg-primary rounded-full text-28 text-white font-bold leading-50 mx-auto">3</view>
  21. <view class="mt-26 text-24 text-fore-title">AI智能出卷</view>
  22. </view>
  23. </view>
  24. <view class="py-60 px-46">
  25. <view class="h-104 rounded-8 border border-solid border-border mb-40 px-30 flex items-center justify-between"
  26. @click="handleSelectCollege">
  27. <view class="flex-1 text-30 text-fore-subtitle">定向</view>
  28. <view class="flex items-center">
  29. <text class="mr-8 text-30 text-[#B3B3B3]">{{ directedSchool.universityName || '请选择' }}</text>
  30. <uv-icon name="arrow-right" size="15px" color="#B3B3B3"></uv-icon>
  31. </view>
  32. </view>
  33. <ie-button type="primary" :disabled="simulationDisabled" @click="handleStartTest">开始考试</ie-button>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script lang="ts" setup>
  40. import { useTransferPage } from '@/hooks/useTransferPage';
  41. import { DirectedSchool, SelectedUniversityMajor, SimulationTestInfo, SimulationTestOptions } from '@/types/study';
  42. import { getSimulationInfo } from '@/api/modules/study';
  43. import { useUserStore } from '@/store/userStore';
  44. const userStore = useUserStore();
  45. const { hasDirectedSchool, directedSchoolList } = toRefs(userStore);
  46. const firstDirectedSchool = computed(() => directedSchoolList.value[0] || {});
  47. const { transferTo } = useTransferPage();
  48. type Props = {
  49. directedSchool: DirectedSchool;
  50. }
  51. const props = withDefaults(defineProps<Props>(), {
  52. directedSchool: () => ({}) as DirectedSchool
  53. });
  54. const tab = ref('0');
  55. const simulationInfo = ref<SimulationTestInfo>({} as SimulationTestInfo);
  56. const tabOptions = ref<{ label: string, value: string }[]>([]);
  57. const simulationDisabled = computed(() => {
  58. return !props.directedSchool.universityId;
  59. });
  60. const handleSelectCollege = () => {
  61. transferTo('/pagesStudy/pages/targeted-setting/targeted-setting', {
  62. data: {}
  63. });
  64. }
  65. const handleStartTest = async () => {
  66. const notice = firstDirectedSchool.value.notice;
  67. if (notice) {
  68. await uni.$ie.showModal({
  69. title: '提示',
  70. content: notice,
  71. showCancel: false,
  72. confirmText: '知道了'
  73. });
  74. } else {
  75. transferTo('/pagesStudy/pages/simulation-entry/simulation-entry', {
  76. data: props.directedSchool
  77. });
  78. }
  79. }
  80. const loadData = () => {
  81. getSimulationInfo().then(res => {
  82. tabOptions.value = res.data.subjects.map(item => ({
  83. label: item,
  84. value: item
  85. }));
  86. tab.value = tabOptions.value[0].value;
  87. simulationInfo.value = res.data;
  88. });
  89. }
  90. onShow(() => {
  91. loadData();
  92. });
  93. </script>
  94. <style lang="scss" scoped>
  95. .item {
  96. @apply flex-1 py-28 rounded-15 bg-[#FAFAFA] border border-solid border-[#F5F5F5];
  97. .item-label {
  98. @apply mt-12 text-30 text-fore-title font-bold text-center;
  99. }
  100. }
  101. .test-tip {
  102. @apply w-fit px-18 py-8 bg-[#FFF5E7] rounded-full text-24 text-fore-title;
  103. }
  104. </style>