chengji.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <uni-popup ref="popupRef" :animation="false" :is-mask-click="false"
  3. mask-background-color="rgba(255, 255, 255, 0.6);" class="ezy-popup-width-all">
  4. <view class="ezy-result-page" :style="{backgroundImage: 'url(' + courseBjFun() + ')'}">
  5. <view class="icon-title-navBar-box">
  6. <view @click="handleBack" class="nav-bar-icon"></view>
  7. <view class="nav-bar-title">成绩</view>
  8. </view>
  9. <view class="shiti-frame-box">
  10. <w-swiper :list="list" :positionIndex="current" class="result-exam-swiper">
  11. <template v-slot:default="{item,index}">
  12. <view class="body" v-if="item.mta_show">
  13. <danxuan :question="item" showError v-if="item.type == '1'"></danxuan>
  14. <panduan :question="item" showError v-if="item.type == '2'"></panduan>
  15. <tiankong :question="item" showError v-if="item.type == '3'" :placeholders="item.placeholders"></tiankong>
  16. <view class="answer-content-box">
  17. <view class="answer-dtjx-row">
  18. <view class="answer-title"></view>
  19. <!-- 答案解析 -->
  20. <view @click="showJiexiPopup(item)" class="answer-btn"></view>
  21. </view>
  22. <view class="answer-btn-box" v-if="item.type!=3">
  23. <!-- 你的答案 -->
  24. <view class="answer-item-left">
  25. <text class="answer-item-title">您的答案</text>
  26. <text class="answer-item-error">{{showAnswerReply(item)}}</text>
  27. <view class="answer-line"></view>
  28. </view>
  29. <!-- 答案 -->
  30. <view class="answer-item-right">
  31. <text class="answer-item-title">正确答案</text>
  32. <text class="answer-item-correct">{{showAnswerResult(item)}}</text>
  33. </view>
  34. </view>
  35. <view v-else>
  36. <!-- 答案 -->
  37. <view class="tiankong-answer-content-box">
  38. <!-- <text class="answer-item-title">正确答案</text> -->
  39. <view v-for="(ict,cindex) in showAnswerResult(item)" :key="cindex" class="tiankong-answer-row">
  40. <text>{{cindex+1}}. </text>
  41. <text v-for="(xItem,xindex) in ict" :key="xindex">
  42. <text > {{xItem}} </text>
  43. <text v-if="xindex != ict.length-1">/</text>
  44. </text>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. </w-swiper>
  52. </view>
  53. </view>
  54. <!-- 解析浮层数据 -->
  55. <questionJiexi ref="jiexiRef" :cardId="cardId"></questionJiexi>
  56. <questionJiexiYingyu ref="jiexiRefYingyu" :cardId="cardId"></questionJiexiYingyu>
  57. </uni-popup>
  58. </template>
  59. <script setup>
  60. import questionJiexi from '@/components/questionJiexi/questionJiexi.vue';
  61. import questionJiexiYingyu from '@/components/questionJiexi/questionJiexiYingyu.vue';
  62. import wSwiper from '@/components/wSwiper/wSwiper.vue';
  63. import danxuan from "@/components/question/danxuan.vue";
  64. import panduan from "@/components/question/panduan.vue";
  65. import tiankong from "@/components/question/tiankong.vue";
  66. import {
  67. useQuestionTools
  68. } from "@/components/question/useQuestionTools.js";
  69. import cacheManager from "@/utils/cacheManager";
  70. const {
  71. getLetterByIndex
  72. } = useQuestionTools();
  73. import {
  74. ref
  75. } from "vue";
  76. const props = defineProps({
  77. list: {
  78. type: Array,
  79. },
  80. cardId: {
  81. type: [String,Number],
  82. default: 1
  83. }
  84. })
  85. const emits = defineEmits(['back'])
  86. const current = ref(0)
  87. const popupRef = ref(null)
  88. const jiexiRef = ref(null);
  89. const jiexiRefYingyu = ref(null);
  90. // 切换成绩
  91. function showPopup() {
  92. popupRef.value.open()
  93. }
  94. function closePopup() {
  95. popupRef.value.close()
  96. }
  97. // 展示
  98. function showJiexiPopup(data) {
  99. if (data.type != 4 ) {
  100. jiexiRef.value.showPopup(data);
  101. } else {
  102. jiexiRefYingyu.value.showPopup(data);
  103. }
  104. }
  105. function handleBack() {
  106. // 从 单元测试 到 岛 的路由参数
  107. emits('back')
  108. }
  109. function showAnswerResult(item) {
  110. if (item.type == 1) {
  111. // 单选题
  112. return getLetterByIndex(item.result)
  113. } else if (item.type == 2){
  114. if (item.result == 1) {
  115. return '正确'
  116. } else {
  117. return '错误'
  118. }
  119. } else {
  120. return item.result
  121. }
  122. }
  123. function showAnswerReply(item) {
  124. if (item.type == 1) {
  125. if (item.reply == null) {
  126. return '未答'
  127. }
  128. // 单选题
  129. return getLetterByIndex(item.reply)
  130. } else if (item.type == 2){
  131. if (item.reply == null) {
  132. return '未答'
  133. }
  134. if (item.reply == 1) {
  135. return '正确'
  136. } else {
  137. return '错误'
  138. }
  139. } else {
  140. return item.reply
  141. }
  142. }
  143. function courseBjFun() {
  144. const cardId = Number(props.cardId);
  145. switch (cardId) {
  146. case 1:
  147. return 'static/images/course/couse-shuxue-bj.png'
  148. break;
  149. case 2:
  150. return 'static/images/course/course-yingyu-bj.png'
  151. break;
  152. default:
  153. break;
  154. }
  155. }
  156. defineExpose({
  157. showPopup,
  158. closePopup
  159. })
  160. </script>