chengji.vue 4.9 KB

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