QuestionPreviewDialog.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <el-dialog
  3. custom-class="question-preview-dialog edit-paper"
  4. :visible.sync="modalIsShow"
  5. title="试题预览"
  6. width="1000px"
  7. top="20px"
  8. :close-on-click-modal="false"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. >
  12. <div v-if="modalIsShow" class="edit-part">
  13. <div class="edit-cont">
  14. <div class="edit-cont-title">
  15. <rich-text :text-json="question.quesBody"></rich-text>
  16. </div>
  17. <div class="edit-cont-body">
  18. <div
  19. v-for="(quesOption, optionIndex) in question.quesOptions"
  20. :key="optionIndex"
  21. class="paper-option"
  22. >
  23. <span>{{ optionIndex | optionOrderWordFilter }}. </span>
  24. <rich-text :text-json="quesOption.optionBody"></rich-text>
  25. </div>
  26. <div v-if="!isNested(question.questionType)" class="paper-answer">
  27. <span>答案:</span>
  28. <question-answer :data="question"></question-answer>
  29. </div>
  30. </div>
  31. <div
  32. v-if="!isNested(question.questionType)"
  33. class="edit-cont-props"
  34. style="margin-top: 10px"
  35. >
  36. <el-tag
  37. v-for="(content, propIndex) in question.quesProperties"
  38. :key="propIndex"
  39. type="primary"
  40. effect="dark"
  41. style="margin-right: 5px; margin-bottom: 5px"
  42. >
  43. <!-- {{ content.courseProperty && content.courseProperty.name }}
  44. <span style="margin: 0 3px">/</span> -->
  45. {{ content.firstProperty && content.firstProperty.name }}
  46. <span
  47. v-if="content.secondProperty && content.secondProperty.name"
  48. style="margin: 0 3px"
  49. >/</span
  50. >
  51. {{ content.secondProperty && content.secondProperty.name }}
  52. </el-tag>
  53. </div>
  54. <div
  55. v-if="isNested(question.questionType)"
  56. class="edit-paper-question-subs"
  57. >
  58. <div
  59. v-for="(subQuestion, subIndex) in question.subQuestions"
  60. :key="subIndex"
  61. class="edit-part"
  62. >
  63. <div class="edit-cont">
  64. <div class="edit-cont-title">
  65. <span>{{ subIndex + 1 }}. </span>
  66. <rich-text :text-json="subQuestion.quesBody"></rich-text>
  67. </div>
  68. <div class="edit-cont-body">
  69. <template v-if="!isMatchingQuestion(question.questionType)">
  70. <div
  71. v-for="(
  72. subQuesOption, subOptIndex
  73. ) in subQuestion.quesOptions"
  74. :key="subOptIndex"
  75. class="paper-option"
  76. >
  77. <span>{{ subOptIndex | optionOrderWordFilter }}. </span>
  78. <rich-text
  79. :text-json="subQuesOption.optionBody"
  80. ></rich-text>
  81. </div>
  82. </template>
  83. <div class="paper-answer">
  84. <span>答案:</span>
  85. <question-answer :data="subQuestion"></question-answer>
  86. </div>
  87. </div>
  88. <div class="edit-cont-props" style="margin-top: 10px">
  89. <el-tag
  90. v-for="(content, propIndex) in subQuestion.quesProperties"
  91. :key="propIndex"
  92. type="primary"
  93. effect="dark"
  94. style="margin-right: 5px; margin-bottom: 5px"
  95. >
  96. <!-- {{ content.courseProperty && content.courseProperty.name }}
  97. <span style="margin: 0 3px">/</span> -->
  98. {{ content.firstProperty && content.firstProperty.name }}
  99. <span
  100. v-if="content.secondProperty && content.secondProperty.name"
  101. style="margin: 0 3px"
  102. >/</span
  103. >
  104. {{ content.secondProperty && content.secondProperty.name }}
  105. </el-tag>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <div slot="footer">
  113. <el-button @click="cancel">关闭</el-button>
  114. </div>
  115. </el-dialog>
  116. </template>
  117. <script>
  118. import QuestionAnswer from "./QuestionAnswer.vue";
  119. export default {
  120. name: "QuestionPreviewDialog",
  121. components: { QuestionAnswer },
  122. props: {
  123. question: {
  124. type: Object,
  125. default() {
  126. return {};
  127. },
  128. },
  129. },
  130. data() {
  131. return {
  132. modalIsShow: false,
  133. };
  134. },
  135. methods: {
  136. cancel() {
  137. this.modalIsShow = false;
  138. },
  139. open() {
  140. this.modalIsShow = true;
  141. },
  142. isNested(questionType) {
  143. const nestedQuestion = [
  144. "PARAGRAPH_MATCHING",
  145. "BANKED_CLOZE",
  146. "CLOZE",
  147. "READING_COMPREHENSION",
  148. "LISTENING_QUESTION",
  149. ];
  150. return nestedQuestion.includes(questionType);
  151. },
  152. isMatchingQuestion(questionType) {
  153. const typeQuestion = ["PARAGRAPH_MATCHING", "BANKED_CLOZE"];
  154. return typeQuestion.includes(questionType);
  155. },
  156. },
  157. };
  158. </script>