chengji.vue 5.6 KB

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