chengji.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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="myList" :positionIndex="current" class="result-exam-swiper" @change="onSwiperChange">
  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'"
  16. :placeholders="item.placeholders"></tiankong>
  17. <yingyu code="cj" :question="item" showError v-if="item.type == '4'"
  18. :placeholders="item.placeholders"></yingyu>
  19. <view class="answer-content-box">
  20. <view class="answer-dtjx-row">
  21. <view class="answer-title"></view>
  22. <!-- 答案解析 -->
  23. <view @click="showJiexiPopup(item)" class="answer-btn"></view>
  24. </view>
  25. <view class="answer-btn-box" v-if="item.type!=3">
  26. <!-- 你的答案 -->
  27. <view class="answer-item-left">
  28. <text class="answer-item-title">您的答案</text>
  29. <text class="answer-item-error">{{showAnswerReply(item)}}</text>
  30. <view class="answer-line"></view>
  31. </view>
  32. <!-- 答案 -->
  33. <view class="answer-item-right">
  34. <text class="answer-item-title">正确答案</text>
  35. <text class="answer-item-correct">{{showAnswerResult(item)}}</text>
  36. </view>
  37. </view>
  38. <view v-else>
  39. <!-- 答案 -->
  40. <view class="tiankong-answer-content-box">
  41. <!-- <text class="answer-item-title">正确答案</text> -->
  42. <view v-for="(ict,cindex) in showAnswerResult(item)" :key="cindex"
  43. class="tiankong-answer-row">
  44. <text>{{cindex+1}}. </text>
  45. <text v-for="(xItem,xindex) in ict" :key="xindex">
  46. <text> {{xItem}} </text>
  47. <text v-if="xindex != ict.length-1">/</text>
  48. </text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. </w-swiper>
  56. </view>
  57. </view>
  58. <!-- 解析浮层数据 -->
  59. <questionJiexi ref="jiexiRef" :cardId="cardId"></questionJiexi>
  60. <questionJiexiYingyu ref="jiexiRefYingyu" :cardId="cardId" :code="code"></questionJiexiYingyu>
  61. </uni-popup>
  62. </template>
  63. <script setup>
  64. import questionJiexi from '@/components/questionJiexi/questionJiexi.vue';
  65. import questionJiexiYingyu from '@/components/questionJiexi/questionJiexiYingyu.vue';
  66. import wSwiper from '@/components/wSwiper/wSwiper.vue';
  67. import danxuan from "@/components/question/danxuan.vue";
  68. import panduan from "@/components/question/panduan.vue";
  69. import tiankong from "@/components/question/tiankong.vue";
  70. import yingyu from "@/components/question/yingyu/danxuan.vue";
  71. import {
  72. useQuestionTools
  73. } from "@/components/question/useQuestionTools.js";
  74. import cacheManager from "@/utils/cacheManager";
  75. import {computed} from "vue";
  76. const {
  77. getLetterByIndex
  78. } = useQuestionTools();
  79. import {
  80. ref
  81. } from "vue";
  82. const props = defineProps({
  83. list: {
  84. type: Array,
  85. },
  86. cardId: {
  87. type: [String, Number],
  88. default: 1
  89. },
  90. code: {
  91. type: String,
  92. default: 'cj'
  93. }
  94. })
  95. const myList = computed(() => {
  96. return props.list.map(item => {
  97. return {
  98. ...item,
  99. code: 'cj'
  100. }
  101. })
  102. })
  103. const emits = defineEmits(['back'])
  104. const current = ref(0)
  105. const popupRef = ref(null)
  106. const jiexiRef = ref(null);
  107. const jiexiRefYingyu = ref(null)
  108. function onSwiperChange(index) {
  109. uni.$emit('swiper-change', index)
  110. }
  111. // 切换成绩
  112. function showPopup() {
  113. popupRef.value.open()
  114. }
  115. function closePopup() {
  116. popupRef.value.close()
  117. }
  118. // 展示
  119. function showJiexiPopup(data) {
  120. if (data.type != 4) {
  121. jiexiRef.value.showPopup(data);
  122. } else {
  123. jiexiRefYingyu.value.showPopup(data);
  124. uni.$emit('question-jiexi-close')
  125. }
  126. }
  127. function handleBack() {
  128. // 从 单元测试 到 岛 的路由参数
  129. emits('back')
  130. }
  131. function showAnswerResult(item) {
  132. if (item.type == 1) {
  133. // 单选题
  134. return getLetterByIndex(item.result)
  135. } else if (item.type == 2) {
  136. if (item.result == 1) {
  137. return '正确'
  138. } else {
  139. return '错误'
  140. }
  141. } else if (item.type == 4) {
  142. return getLetterByIndex(item.result)
  143. } else {
  144. return item.result
  145. }
  146. }
  147. function showAnswerReply(item) {
  148. if (item.type == 1) {
  149. if (item.reply == null) {
  150. return '未答'
  151. }
  152. // 单选题
  153. return getLetterByIndex(item.reply)
  154. } else if (item.type == 2) {
  155. if (item.reply == null) {
  156. return '未答'
  157. }
  158. if (item.reply == 1) {
  159. return '正确'
  160. } else {
  161. return '错误'
  162. }
  163. } else if(item.type == 4) {
  164. if (item.reply == null) {
  165. return '未答'
  166. }
  167. // 单选题
  168. return getLetterByIndex(item.reply)
  169. } else {
  170. return item.reply
  171. }
  172. }
  173. function courseBjFun() {
  174. const cardId = Number(props.cardId);
  175. switch (cardId) {
  176. case 1:
  177. return 'static/images/course/couse-shuxue-bj.png'
  178. break;
  179. case 2:
  180. return 'static/images/course/course-yingyu-bj.png'
  181. break;
  182. default:
  183. break;
  184. }
  185. }
  186. defineExpose({
  187. showPopup,
  188. closePopup
  189. })
  190. </script>