CompletionView.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <el-dialog :visible="dialogVisible" :width="dialogWidth" @close="dialogClose">
  3. <div class="completion">
  4. <img src="../../assets/course_details/courseware.png" />
  5. <div class="completion-info">
  6. <div>{{ material_name }}</div>
  7. <div>
  8. {{ student_name }} {{ finish_time_view_txt }} {{ $t('Key320') }}:{{ duration }}{{ $t('Key321') }}
  9. <template v-if="category !== 'NPC'">
  10. | {{ $t('Key194') }} {{ count_right }} |
  11. {{ $t('Key195') }}
  12. {{ count_error }}
  13. </template>
  14. </div>
  15. </div>
  16. </div>
  17. <template v-if="category === 'NPC'">
  18. <booknpc
  19. v-if="context"
  20. :context="context"
  21. task-model="ANSWER"
  22. :is-show-save="false"
  23. :book-answer-content="bookAnswerContent"
  24. :theme-color="themeColor"
  25. :preview-type="previewType"
  26. :preview-group-id="previewGroupId"
  27. />
  28. </template>
  29. <template v-if="category === 'NNPE'">
  30. <booknnpe
  31. v-if="context"
  32. :context="context"
  33. :theme-color="themeColor"
  34. task-model="ANSWER"
  35. :is-show-title="true"
  36. :is-show-save="false"
  37. :preview-type="previewType"
  38. :preview-group-id="previewGroupId"
  39. :book-answer-content="bookAnswerContent"
  40. />
  41. </template>
  42. <template v-if="category === 'RLC'">
  43. <bookrlc v-if="context" :context="context" :theme-color="themeColor" :book-font-size="bookFontSize" />
  44. </template>
  45. <div slot="footer"></div>
  46. </el-dialog>
  47. </template>
  48. <script>
  49. import { GetTaskMaterialStudentExamAnswer, GetCoursewareContent_View } from '@/api/course';
  50. export default {
  51. props: {
  52. dialogVisible: {
  53. default: false,
  54. type: Boolean
  55. },
  56. curCoursewareId: {
  57. default: '',
  58. type: String
  59. },
  60. taskId: {
  61. default: '',
  62. type: String
  63. },
  64. curStudentId: {
  65. default: '',
  66. type: String
  67. },
  68. previewGroupId: {
  69. default: '[]',
  70. type: String
  71. }
  72. },
  73. data() {
  74. return {
  75. student_id: '',
  76. student_name: '',
  77. material_name: '',
  78. finish_time_view_txt: '',
  79. duration: 0,
  80. count_not_done: 0,
  81. count_right: 0,
  82. count_error: 0,
  83. context: null,
  84. bookAnswerContent: '',
  85. category: '',
  86. dialogWidth: '820px',
  87. themeColor: '',
  88. bookFontSize: '',
  89. previewType: 'previewCheckShow'
  90. };
  91. },
  92. watch: {
  93. curCoursewareId(newVal) {
  94. if (!newVal) {
  95. this.context = null;
  96. this.bookAnswerContent = '';
  97. return;
  98. }
  99. this.getTaskMaterialStudentExamAnswer().then(() => {
  100. GetCoursewareContent_View({ id: this.curCoursewareId }).then(
  101. ({ content, category, book_theme_color, book_font_size }) => {
  102. if (!content) {
  103. this.context = null;
  104. return;
  105. }
  106. this.category = category;
  107. if (category === 'OC' || category.length === 0 || category === 'AILP') {
  108. return this.$message.warning('该课件类型已被废弃');
  109. }
  110. if (category === 'NPC') {
  111. this.themeColor = book_theme_color;
  112. this.dialogWidth = '900px';
  113. this.context = JSON.parse(content);
  114. return;
  115. }
  116. if (category === 'NNPE') {
  117. this.dialogWidth = '900px';
  118. this.themeColor = book_theme_color;
  119. this.context = JSON.parse(content);
  120. return;
  121. }
  122. if (category === 'RLC') {
  123. this.dialogWidth = '900px';
  124. this.themeColor = book_theme_color;
  125. this.bookFontSize = book_font_size;
  126. this.context = JSON.parse(content);
  127. return;
  128. }
  129. }
  130. );
  131. });
  132. }
  133. },
  134. methods: {
  135. getTaskMaterialStudentExamAnswer() {
  136. return GetTaskMaterialStudentExamAnswer({
  137. material_id: this.curCoursewareId,
  138. task_id: this.taskId,
  139. material_type: 'COURSEWARE',
  140. student_id: this.curStudentId
  141. }).then(
  142. ({
  143. duration,
  144. count_not_done,
  145. count_right,
  146. count_error,
  147. content,
  148. student_id,
  149. student_name,
  150. material_name,
  151. finish_time_view_txt
  152. }) => {
  153. this.material_name = material_name;
  154. this.finish_time_view_txt = finish_time_view_txt;
  155. this.student_id = student_id;
  156. this.student_name = student_name;
  157. this.duration = duration;
  158. this.count_not_done = count_not_done;
  159. this.count_right = count_right;
  160. this.count_error = count_error;
  161. this.bookAnswerContent = content;
  162. }
  163. );
  164. },
  165. dialogClose() {
  166. this.$emit('dialogClose');
  167. }
  168. }
  169. };
  170. </script>
  171. <style lang="scss" scoped>
  172. .completion {
  173. display: flex;
  174. padding: 0 32px 24px;
  175. &-info {
  176. margin-left: 24px;
  177. > div {
  178. height: 20px;
  179. line-height: 20px;
  180. &:first-child {
  181. font-size: 18px;
  182. font-weight: bold;
  183. }
  184. }
  185. }
  186. }
  187. </style>