chengji.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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'"></tiankong>
  16. <view class="answer-content-box">
  17. <view class="answer-title"></view>
  18. <view class="answer-btn-box">
  19. <!-- 你的答案 -->
  20. <view class="answer-item-left">
  21. <text class="answer-item-title">您的答案</text>
  22. <text class="answer-item-error">{{showAnswerReply(item)}}</text>
  23. <view class="answer-line"></view>
  24. </view>
  25. <!-- 答案 -->
  26. <view class="answer-item-right">
  27. <text class="answer-item-title">正确答案</text>
  28. <text class="answer-item-correct">{{showAnswerResult(item)}}</text>
  29. </view>
  30. <!-- 答案解析 -->
  31. <view @click="showJiexiPopup(item)" class="answer-btn"></view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. </w-swiper>
  37. </view>
  38. </view>
  39. <!-- 解析浮层数据 -->
  40. <questionJiexi ref="jiexiRef"></questionJiexi>
  41. </uni-popup>
  42. </template>
  43. <script setup>
  44. import questionJiexi from '@/components/questionJiexi/questionJiexi.vue';
  45. import wSwiper from '@/components/wSwiper/wSwiper.vue';
  46. import danxuan from "@/components/question/danxuan.vue";
  47. import panduan from "@/components/question/panduan.vue";
  48. import tiankong from "@/components/question/tiankong.vue";
  49. import {
  50. useQuestionTools
  51. } from "@/components/question/useQuestionTools.js";
  52. const {
  53. getLetterByIndex
  54. } = useQuestionTools();
  55. import {
  56. ref
  57. } from "vue";
  58. const props = defineProps({
  59. list: {
  60. type: Array,
  61. },
  62. jieId: {
  63. type: [String, Number]
  64. },
  65. zhangId: {
  66. type: [String, Number]
  67. },
  68. nianji: {
  69. type: [String, Number]
  70. },
  71. xueqi: {
  72. type: [String,Number]
  73. }
  74. })
  75. const current = ref(0)
  76. const popupRef = ref(null)
  77. const jiexiRef = ref(null);
  78. // 切换成绩
  79. function showPopup() {
  80. popupRef.value.open()
  81. }
  82. // 展示
  83. function showJiexiPopup(data) {
  84. jiexiRef.value.showPopup(data);
  85. }
  86. function handleBack() {
  87. // 从 单元测试 到 岛 的路由参数
  88. uni.navigateTo({
  89. url: `/pages/study/index?nianji=${props.nianji}&xueqi=${props.xueqi}&zhangId=${props.zhangId}&jieId=${props.jieId}`
  90. })
  91. }
  92. function showAnswerResult(item) {
  93. if (item.type == 1) {
  94. // 单选题
  95. return getLetterByIndex(item.result)
  96. } else if (item.type == 3){
  97. if (item.result == 1) {
  98. return '正确'
  99. } else {
  100. return '错误'
  101. }
  102. } else {
  103. return item.result
  104. }
  105. }
  106. function showAnswerReply(item) {
  107. if (item.type == 1) {
  108. // 单选题
  109. return getLetterByIndex(item.reply)
  110. } else if (item.type == 3){
  111. if (item.reply == 1) {
  112. return '正确'
  113. } else {
  114. return '错误'
  115. }
  116. } else {
  117. return item.reply
  118. }
  119. }
  120. defineExpose({
  121. showPopup
  122. })
  123. </script>