chengji.vue 3.3 KB

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