CompletionView.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. :submit-cn="$store.getters.submitCn"
  23. :is-show-title="true"
  24. :is-show-save="false"
  25. :is-answer-item-show="false"
  26. :book-answer-content="bookAnswerContent"
  27. :theme-color="themeColor"
  28. :preview-type="previewType"
  29. :preview-group-id="previewGroupId"
  30. :current-tree-i-d="curCoursewareId"
  31. />
  32. </template>
  33. <template v-if="category === 'NNPE'">
  34. <booknnpe
  35. v-if="context"
  36. :context="context"
  37. :theme-color="themeColor"
  38. task-model="ANSWER"
  39. :is-show-title="true"
  40. :is-show-save="false"
  41. :is-answer-item-show="false"
  42. :preview-type="previewType"
  43. :preview-group-id="previewGroupId"
  44. :book-answer-content="bookAnswerContent"
  45. :current-tree-i-d="curCoursewareId"
  46. />
  47. </template>
  48. <template v-if="category === 'RLC'">
  49. <bookrlc
  50. v-if="context"
  51. :context="context"
  52. :theme-color="themeColor"
  53. :book-font-size="bookFontSize"
  54. :current-tree-i-d="curCoursewareId"
  55. :preview-type="previewType"
  56. :preview-group-id="previewGroupId"
  57. :is-answer-item-show="false"
  58. :is-show-save="false"
  59. task-model="ANSWER"
  60. :book-answer-content="bookAnswerContent"
  61. />
  62. </template>
  63. <template v-if="category === 'NEW'">
  64. <BookNew
  65. v-if="context"
  66. ref="book"
  67. :context="context"
  68. :current-tree-i-d="curCoursewareId"
  69. :is-show-save="false"
  70. task-model="ANSWER"
  71. :book-answer-content="bookAnswerContent"
  72. />
  73. </template>
  74. <template v-if="category == 'EEP'">
  75. <BookEep
  76. v-if="context"
  77. :id="curCoursewareId"
  78. :content="context.content"
  79. :content-group-row-list="context.content_group_row_list"
  80. :component-list="context.component_list"
  81. :book-background="context.background"
  82. :component-user-answer="bookAnswerContent"
  83. :row-checked="previewGroupId"
  84. :change-chapter="getCoursewareContentView"
  85. :permiss-control="{
  86. can_answer: false,
  87. can_judge_correct: false,
  88. can_show_answer: false,
  89. can_correct: false,
  90. can_check_correct: false
  91. }"
  92. />
  93. </template>
  94. <div slot="footer"></div>
  95. </el-dialog>
  96. </template>
  97. <script>
  98. import { GetTaskMaterialStudentExamAnswer, GetCoursewareContent_View } from '@/api/course';
  99. export default {
  100. props: {
  101. dialogVisible: {
  102. default: false,
  103. type: Boolean
  104. },
  105. curCoursewareId: {
  106. default: '',
  107. type: String
  108. },
  109. taskId: {
  110. default: '',
  111. type: String
  112. },
  113. curStudentId: {
  114. default: '',
  115. type: String
  116. },
  117. previewGroupId: {
  118. default: '[]',
  119. type: String
  120. }
  121. },
  122. data() {
  123. return {
  124. student_id: '',
  125. student_name: '',
  126. material_name: '',
  127. finish_time_view_txt: '',
  128. duration: 0,
  129. count_not_done: 0,
  130. count_right: 0,
  131. count_error: 0,
  132. context: null,
  133. bookAnswerContent: '',
  134. category: '',
  135. dialogWidth: '820px',
  136. themeColor: '',
  137. bookFontSize: '',
  138. previewType: 'previewCheckShow'
  139. };
  140. },
  141. watch: {
  142. curCoursewareId(newVal) {
  143. if (!newVal) {
  144. this.context = null;
  145. this.bookAnswerContent = '';
  146. return;
  147. }
  148. this.getTaskMaterialStudentExamAnswer().then(() => {
  149. this.getCoursewareContentView();
  150. });
  151. }
  152. },
  153. methods: {
  154. getCoursewareContentView(id) {
  155. GetCoursewareContent_View({ id: id || this.curCoursewareId }).then((res) => {
  156. const { content, category, book_theme_color, book_font_size } = res;
  157. if (!content) {
  158. this.context = null;
  159. return;
  160. }
  161. this.category = category;
  162. if (category === 'OC' || category.length === 0 || category === 'AILP') {
  163. return this.$message.warning('该课件类型已被废弃');
  164. }
  165. if (category === 'NPC') {
  166. this.themeColor = book_theme_color;
  167. this.dialogWidth = '900px';
  168. this.context = JSON.parse(content);
  169. return;
  170. }
  171. if (category === 'NNPE') {
  172. this.dialogWidth = '900px';
  173. this.themeColor = book_theme_color;
  174. this.context = JSON.parse(content);
  175. return;
  176. }
  177. if (category === 'RLC') {
  178. this.dialogWidth = '900px';
  179. this.themeColor = book_theme_color;
  180. this.bookFontSize = book_font_size;
  181. this.context = JSON.parse(content);
  182. return;
  183. }
  184. if (category === 'NEW') {
  185. this.dialogWidth = '1190px';
  186. this.context = JSON.parse(content);
  187. return;
  188. }
  189. if (category === 'EEP') {
  190. this.dialogWidth = '1300px';
  191. this.context = res;
  192. return;
  193. }
  194. });
  195. },
  196. getTaskMaterialStudentExamAnswer() {
  197. return GetTaskMaterialStudentExamAnswer({
  198. material_id: this.curCoursewareId,
  199. task_id: this.taskId,
  200. material_type: 'COURSEWARE',
  201. student_id: this.curStudentId
  202. }).then(
  203. ({
  204. duration,
  205. count_not_done,
  206. count_right,
  207. count_error,
  208. content,
  209. student_id,
  210. student_name,
  211. material_name,
  212. finish_time_view_txt
  213. }) => {
  214. this.material_name = material_name;
  215. this.finish_time_view_txt = finish_time_view_txt;
  216. this.student_id = student_id;
  217. this.student_name = student_name;
  218. this.duration = duration;
  219. this.count_not_done = count_not_done;
  220. this.count_right = count_right;
  221. this.count_error = count_error;
  222. this.bookAnswerContent = content;
  223. }
  224. );
  225. },
  226. dialogClose() {
  227. this.$emit('dialogClose');
  228. }
  229. }
  230. };
  231. </script>
  232. <style lang="scss" scoped>
  233. .completion {
  234. display: flex;
  235. padding: 0 32px 24px;
  236. &-info {
  237. margin-left: 24px;
  238. > div {
  239. height: 20px;
  240. line-height: 20px;
  241. &:first-child {
  242. font-size: 18px;
  243. font-weight: bold;
  244. }
  245. }
  246. }
  247. }
  248. </style>