index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view>
  3. <view>
  4. <uni-icons type="left" size="30" @click=""></uni-icons>
  5. <text>单元测试</text>
  6. <view><text>{{count}}</text>/<text>{{total}}</text></view>
  7. </view>
  8. <w-swiper :list="list" :swiperHeight="300" :positionIndex="current">
  9. <template v-slot:default="{item}">
  10. <view class="body" v-if="item.mta_show">
  11. <danxuan :question="item" v-if="item.type == '1'"></danxuan>
  12. <panduan :question="item" v-if="item.type == '2'"></panduan>
  13. <tiankong :question="item" v-if="item.type == '3'"></tiankong>
  14. </view>
  15. </template>
  16. </w-swiper>
  17. <button class="transition-button" v-if="isLast" type="primary"
  18. @click="handleSubmit(uniPointsRef)">submit</button>
  19. <!-- 答卷 -->
  20. <chengji ref="chengjiRef" :list="list" :jieId="jieId" :zhangId="zhangId" :nextZhangId="nextZhangId"
  21. :nianji="nianji" :xueqi="xueqi"></chengji>
  22. <!-- 分数弹窗 -->
  23. <uniPointsVue ref="uniPointsRef" @checkAnswer="checkAnswer" @goStudy="goStudyContinue"></uniPointsVue>
  24. </view>
  25. </template>
  26. <script setup>
  27. import questionJiexi from '@/components/questionJiexi/questionJiexi.vue';
  28. import wSwiper from '@/components/wSwiper/wSwiper.vue';
  29. import danxuan from "@/components/question/danxuan.vue";
  30. import panduan from "@/components/question/panduan.vue";
  31. import tiankong from "@/components/question/tiankong.vue";
  32. import chengji from "@/components/chengji/chengji.vue";
  33. import uniPointsVue from '@/components/points/uni-points.vue';
  34. import {
  35. useStudyRouteParams
  36. } from "@/utils/emitEvents.js"
  37. import {
  38. useExam
  39. } from './useUnit';
  40. import {
  41. ref,
  42. onMounted
  43. } from "vue";
  44. const {setStudyStorage} = useStudyRouteParams();
  45. const {
  46. isFirst,
  47. isLast,
  48. count,
  49. total,
  50. current,
  51. list,
  52. rightAnswer,
  53. wrongAnswer,
  54. jifen,
  55. zhangId,
  56. jieId,
  57. nextZhangId,
  58. nianji,
  59. xueqi,
  60. nextQuestion,
  61. prevQuestion,
  62. handleSubmit,
  63. initPage
  64. } = useExam();
  65. const uniPointsRef = ref(null);
  66. const chengjiRef = ref(null);
  67. function sendDataToStudyPage() {
  68. // 设置 从单元测试 到 岛 的路由参数
  69. setStudyStorage({
  70. nianji: nianji.value,
  71. xueqi: xueqi.value,
  72. zhangId: zhangId.value,
  73. jieId: jieId.value,
  74. nextZhangId: nextZhangId.value,
  75. });
  76. }
  77. // 查看答案
  78. function checkAnswer() {
  79. chengjiRef.value.showPopup();
  80. }
  81. // 继续学习
  82. function goStudyContinue() {
  83. sendDataToStudyPage();
  84. uni.switchTab({
  85. url: `/pages/study/index?zhangId`
  86. })
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .swiper-box {
  91. height: 200px;
  92. }
  93. .swiper-item {
  94. display: flex;
  95. flex-direction: column;
  96. justify-content: center;
  97. align-items: center;
  98. height: 200px;
  99. }
  100. </style>