simulation-entry.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <ie-page bg-color="#F6F8FA">
  3. <ie-navbar title="" bg-color="transparent" :placeholder="false" />
  4. <view class="relative">
  5. <ie-image :is-oss="true" src="/study-bg7.png" customClass="w-full h-[544rpx] absolute top-0 left-0 z-0" />
  6. <ie-image :is-oss="true" src="/study-bg8.png" customClass="w-360 h-310 absolute top-49 right-33 z-1" />
  7. <view class="relative z-2">
  8. <view class="pt-126 ml-90">
  9. <ie-image :is-oss="true" src="/study-title3.png" customClass="w-264 h-60" />
  10. </view>
  11. <view class="mx-30 mt-64">
  12. <view class="p-32 bg-white rounded-15">
  13. <view class="text-32 text-fore-title font-bold">考试院校</view>
  14. <view class="mt-20 text-28 text-fore-subtitle flex items-center">
  15. <text>{{ prevData.universityName }}</text>
  16. <uv-icon name="arrow-right" size="14px" color="#1A1A1A" custom-class="mx-10"></uv-icon>
  17. <text>{{ prevData.majorName }}</text>
  18. </view>
  19. </view>
  20. <view v-for="item in subjects" :key="item.subjectId"
  21. class="flex items-center justify-between mt-20 p-32 bg-white rounded-15">
  22. <ie-image :src="item.icon" custom-class="w-86 h-72" mode="aspectFill" />
  23. <view class="ml-30 flex-1 min-w-1">
  24. <view class="text-320 text-fore-title font-bold">{{ item.subject }}</view>
  25. <view class="mt-6 text-24 text-fore-light">剩余模考次数<text class="ml-20 text-fore-title font-bold">{{ item.examTime }}</text></view>
  26. </view>
  27. <view class="text-24 text-white bg-primary px-20 py-14 rounded-full" @click="handleAIOutPaper(item)">智能出卷</view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </ie-page>
  33. </template>
  34. <script lang="ts" setup>
  35. import { useTransferPage } from '@/hooks/useTransferPage';
  36. import { getSimulationExamSubjects } from '@/api/modules/study';
  37. import iconChinese from '@/pagesStudy/static/image/icon-chinese.png';
  38. import iconMath from '@/pagesStudy/static/image/icon-math.png';
  39. import iconForeign from '@/pagesStudy/static/image/icon-foreign.png';
  40. import iconSkill from '@/pagesStudy/static/image/icon-skill.png';
  41. import iconPhysics from '@/pagesStudy/static/image/icon-physics.png';
  42. import iconPolitics from '@/pagesStudy/static/image/icon-politics.png';
  43. import { Study } from '@/types';
  44. const { transferTo, prevData } = useTransferPage();
  45. const subjects = ref<Study.SimulationExamSubject[]>([]);
  46. const handleAIOutPaper = (item: Study.SimulationExamSubject) => {
  47. if (item.examTime < 1) {
  48. uni.$ie.showToast('剩余模考次数不足');
  49. return;
  50. }
  51. transferTo('/pagesStudy/pages/simulation-start/simulation-start', {
  52. data: {
  53. subjectInfo: item,
  54. universityInfo: prevData.value
  55. }
  56. });
  57. }
  58. const getIcon = (subjectName: string) => {
  59. if (subjectName === '语文') {
  60. return iconChinese;
  61. } else if (subjectName === '数学') {
  62. return iconMath;
  63. } else if (subjectName === '外语' || /.语/.test(subjectName)) {
  64. return iconForeign;
  65. } else if (subjectName === '物理') {
  66. return iconPhysics;
  67. } else if (subjectName === '政治') {
  68. return iconPolitics;
  69. } else {
  70. return iconSkill;
  71. }
  72. }
  73. const loadData = async () => {
  74. const { data } = await getSimulationExamSubjects();
  75. subjects.value = data.map(item => {
  76. return {
  77. ...item,
  78. icon: getIcon(item.subject)
  79. }
  80. });
  81. console.log(subjects.value);
  82. }
  83. onShow(() => {
  84. loadData();
  85. });
  86. </script>
  87. <style lang="scss" scoped></style>