QuItemShow.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view v-if="quData && quData.id" class="qu-box" :class="{'sub-box': sub}">
  3. <view class="qu-item">
  4. <text class="sort">{{ quData.sort }}</text>
  5. <text>【{{ quData.quType_dictText }}】<text class="score"> {{ quData.score }}分</text></text>
  6. <view class="content">
  7. <rich-text :nodes="quData.content | formatRichText"></rich-text>
  8. </view>
  9. </view>
  10. <!-- 单选多选判断 -->
  11. <view v-if="quData.quType==='1' || quData.quType==='2' || quData.quType==='3' || quData.quType==='5' " class="qu-answer">
  12. <view v-for="an in quData.answerList" class="item"
  13. :class="{'true':an.checked && an.isRight, 'wrong': an.checked && !an.isRight}">
  14. <view class="tag">{{ an.abc }}</view>
  15. <view class="content">
  16. <view>{{ an.content }}</view>
  17. <view v-if="an.image">
  18. <image :src="an.image" style="width:80vw" mode="aspectFit">
  19. </view>
  20. </view>
  21. <view class="right-box" v-if="an.isRight">
  22. <icon type="success" size="16" />
  23. <text>答案</text>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 组合题题干无 -->
  28. <view v-if="quData.quType!=='99'" class="as-box">
  29. <view class="rest-box" v-if="quData.isRight">
  30. <icon type="success" size="16" color="#09BB07" />
  31. <text class="text">
  32. 答对了,得分:{{quData.actualScore}}
  33. </text>
  34. </view>
  35. <view class="rest-box" v-if="!quData.isRight">
  36. <icon type="warn" size="16" color="#FF0000" />
  37. <text class="text">
  38. 答错了,得分:{{quData.actualScore}}
  39. </text>
  40. </view>
  41. <view v-if="quData.quType==='4'">
  42. <view>我的回答:</view>
  43. <view>
  44. <rich-text :nodes="quData.answer | formatRichText"></rich-text>
  45. </view>
  46. </view>
  47. <view v-if="quData.quType==='5'">
  48. <view>我的回答:</view>
  49. <view v-for="an in quData.answerList" v-if="an.answer">
  50. {{ an.answer }}
  51. </view>
  52. </view>
  53. </view>
  54. <view v-if="quData.quType==='99' && quData.subList.length>0">
  55. <view v-for="sub in quData.subList">
  56. <qu-item-show :value="sub" :sub="true"></qu-item-show>
  57. </view>
  58. </view>
  59. <view v-if="quData.analysis" class="as-box">
  60. <view class="title">试题解析:</view>
  61. <rich-text :nodes="quData.analysis | formatRichText"></rich-text>
  62. </view>
  63. <view class="split" v-if="!sub"></view>
  64. </view>
  65. </template>
  66. <script>
  67. import QuItemShow from './QuItemShow.vue'
  68. export default {
  69. name: 'QuItemShow',
  70. components:{
  71. QuItemShow
  72. },
  73. props: {
  74. value: {
  75. type: Object
  76. },
  77. sub: {
  78. type: Boolean,
  79. default: false
  80. }
  81. },
  82. data() {
  83. return {
  84. // 当前试题内容
  85. quData: {
  86. quType: '',
  87. answerList: []
  88. }
  89. }
  90. },
  91. watch: {
  92. // 检测查询变化
  93. value: {
  94. handler() {
  95. this.quData = this.value
  96. }
  97. }
  98. },
  99. created() {
  100. this.quData = this.value
  101. },
  102. methods: {
  103. }
  104. }
  105. </script>