chengji.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <uni-popup ref="popupRef" background-color="#fff" type="left" class="popup-container">
  3. <view class="ezy-result-page">
  4. <view class="icon-title-navBar-box">
  5. <view @click="handleBack" class="nav-bar-icon"></view>
  6. <view class="nav-bar-title">成绩</view>
  7. </view>
  8. <view class="shiti-frame-box">
  9. <w-swiper :list="list" :positionIndex="current" class="result-exam-swiper">
  10. <template v-slot:default="{item,index}">
  11. <view class="body" v-if="item.mta_show">
  12. <danxuan :question="item" showError v-if="item.type == '1'"></danxuan>
  13. <panduan :question="item" showError v-if="item.type == '2'"></panduan>
  14. <tiankong :question="item" showError v-if="item.type == '3'"></tiankong>
  15. <view class="answer-content-box">
  16. <view class="answer-title"></view>
  17. <view class="answer-btn-box">
  18. <!-- 你的答案 -->
  19. <view class="answer-item-left">
  20. <text class="answer-item-title">您的答案</text>
  21. <text class="answer-item-error">{{showAnswerReply(item)}}</text>
  22. <view class="answer-line"></view>
  23. </view>
  24. <!-- 答案 -->
  25. <view class="answer-item-right">
  26. <text class="answer-item-title">正确答案</text>
  27. <text class="answer-item-correct">{{showAnswerResult(item)}}</text>
  28. </view>
  29. <!-- 答案解析 -->
  30. <view @click="showJiexiPopup(item)" class="answer-btn"></view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. </w-swiper>
  36. </view>
  37. </view>
  38. <!-- 解析浮层数据 -->
  39. <questionJiexi ref="jiexiRef"></questionJiexi>
  40. </uni-popup>
  41. </template>
  42. <script setup>
  43. import questionJiexi from '@/components/questionJiexi/questionJiexi.vue';
  44. import wSwiper from '@/components/wSwiper/wSwiper.vue';
  45. import danxuan from "@/components/question/danxuan.vue";
  46. import panduan from "@/components/question/panduan.vue";
  47. import tiankong from "@/components/question/tiankong.vue";
  48. import {
  49. useQuestionTools
  50. } from "@/components/question/useQuestionTools.js";
  51. const {
  52. getLetterByIndex
  53. } = useQuestionTools();
  54. import {
  55. ref
  56. } from "vue";
  57. const props = defineProps({
  58. list: {
  59. type: Array,
  60. },
  61. jieId: {
  62. type: [String, Number]
  63. },
  64. zhangId: {
  65. type: [String, Number]
  66. },
  67. nianji: {
  68. type: [String, Number]
  69. },
  70. xueqi: {
  71. type: [String,Number]
  72. }
  73. })
  74. const current = ref(0)
  75. const popupRef = ref(null)
  76. const jiexiRef = ref(null);
  77. // 切换成绩
  78. function showPopup() {
  79. popupRef.value.open()
  80. }
  81. // 展示
  82. function showJiexiPopup(data) {
  83. jiexiRef.value.showPopup(data);
  84. }
  85. function handleBack() {
  86. // 从 单元测试 到 岛 的路由参数
  87. uni.navigateTo({
  88. url: `/pages/study/index?nianji=${props.nianji}&xueqi=${props.xueqi}&zhangId=${props.zhangId}&jieId=${props.jieId}`
  89. })
  90. }
  91. function showAnswerResult(item) {
  92. if (item.type == 1) {
  93. // 单选题
  94. return getLetterByIndex(item.result)
  95. } else if (item.type == 3){
  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 == 3){
  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. })
  122. </script>
  123. <style lang="scss">
  124. .popup-container {
  125. ::v-deep .uni-popup__wrapper.left {
  126. width: 100vw;
  127. }
  128. }
  129. </style>