chengji.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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">
  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 >
  38. <text class="answer-item-title">正确答案</text>
  39. <view v-for="ict in showAnswerResult(item)">{{ict}}</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. </w-swiper>
  46. </view>
  47. </view>
  48. <!-- 解析浮层数据 -->
  49. <questionJiexi ref="jiexiRef"></questionJiexi>
  50. </uni-popup>
  51. </template>
  52. <script setup>
  53. import questionJiexi from '@/components/questionJiexi/questionJiexi.vue';
  54. import wSwiper from '@/components/wSwiper/wSwiper.vue';
  55. import danxuan from "@/components/question/danxuan.vue";
  56. import panduan from "@/components/question/panduan.vue";
  57. import tiankong from "@/components/question/tiankong.vue";
  58. import {
  59. useQuestionTools
  60. } from "@/components/question/useQuestionTools.js";
  61. const {
  62. getLetterByIndex
  63. } = useQuestionTools();
  64. import {
  65. ref
  66. } from "vue";
  67. const props = defineProps({
  68. list: {
  69. type: Array,
  70. },
  71. })
  72. const emits = defineEmits(['back'])
  73. const current = ref(0)
  74. const popupRef = ref(null)
  75. const jiexiRef = ref(null);
  76. // 切换成绩
  77. function showPopup() {
  78. popupRef.value.open()
  79. }
  80. function closePopup() {
  81. popupRef.value.close()
  82. }
  83. // 展示
  84. function showJiexiPopup(data) {
  85. jiexiRef.value.showPopup(data);
  86. }
  87. function handleBack() {
  88. // 从 单元测试 到 岛 的路由参数
  89. emits('back')
  90. }
  91. function showAnswerResult(item) {
  92. if (item.type == 1) {
  93. // 单选题
  94. return getLetterByIndex(item.result)
  95. } else if (item.type == 2){
  96. if (item.result == 1) {
  97. return '正确'
  98. } else {
  99. return '错误'
  100. }
  101. } else {
  102. return item.result
  103. }
  104. }
  105. function showAnswerReply(item) {
  106. if (item.type == 1) {
  107. // 单选题
  108. return getLetterByIndex(item.reply)
  109. } else if (item.type == 2){
  110. if (item.reply == 1) {
  111. return '正确'
  112. } else {
  113. return '错误'
  114. }
  115. } else {
  116. return item.reply
  117. }
  118. }
  119. defineExpose({
  120. showPopup,
  121. closePopup
  122. })
  123. </script>