index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <div class="task">
  3. <div
  4. v-for="(
  5. {
  6. begin_time,
  7. duration_second,
  8. name,
  9. content,
  10. courseware_list,
  11. teaching_type,
  12. accessory_list,
  13. homework_list,
  14. message_list,
  15. child_task_list
  16. },
  17. taskIndex
  18. ) in taskList"
  19. :key="taskIndex"
  20. >
  21. <div class="task-title">
  22. <span class="task-title-index">{{ taskIndex + 1 }}</span>
  23. <span class="task-title-name">
  24. {{ previewDateTransform(begin_time, duration_second) }}
  25. </span>
  26. </div>
  27. <div :class="['task-content', `${taskType}-${taskIndex}`]">
  28. <div class="task-name">{{ name }}</div>
  29. <div v-html="content"></div>
  30. <div class="task-content-type">
  31. <template v-if="[taskClassify[1].teaching_type, taskClassify[4].teaching_type].includes(teaching_type)">
  32. <CoursewareView
  33. v-for="(data, i) in courseware_list"
  34. :key="`task-${i}`"
  35. :courseware-id="data.courseware_id"
  36. :group-id-selected-info="data.group_id_selected_info"
  37. />
  38. </template>
  39. <hr v-if="taskClassify[4].teaching_type === teaching_type" />
  40. <FileView
  41. v-if="[taskClassify[2].teaching_type, taskClassify[4].teaching_type].includes(teaching_type)"
  42. :accessory-list="accessory_list"
  43. :homework-list="homework_list"
  44. />
  45. <MessageView v-if="[taskClassify[3].teaching_type].includes(teaching_type)" :message-list="message_list" />
  46. </div>
  47. <!-- 子任务 -->
  48. <template v-if="child_task_list.length > 0">
  49. <hr />
  50. <div class="subtask-title">子任务:</div>
  51. <SubtaskItem
  52. v-for="(data, i) in child_task_list"
  53. :key="`subtask-${i}`"
  54. :class="[`${taskType}-${taskIndex}-${i}`]"
  55. :subtask-data="data"
  56. />
  57. </template>
  58. </div>
  59. </div>
  60. <ShowFile :visible="visible" :file-name="curFileName" :file-id="curFileId" @close="dialogShowFileClose" />
  61. </div>
  62. </template>
  63. <script>
  64. export default {
  65. name: 'TeacherView'
  66. };
  67. </script>
  68. <script setup>
  69. import { inject } from 'vue';
  70. import { useShowFile } from '@/common/show_file/index';
  71. import { previewDateTransform } from '@/utils/course';
  72. import { taskClassify } from '@/views/teacher/create_course/step_three/components/data/constant';
  73. import ShowFile from '@/common/show_file/index.vue';
  74. import FileView from '../common/FileView.vue';
  75. import CoursewareView from '@/components/course/CoursewareView.vue';
  76. import MessageView from '../common/MessageView.vue';
  77. import SubtaskItem from '../common/SubtaskItem.vue';
  78. let { visible, curFileId, curFileName, dialogShowFileClose } = useShowFile();
  79. let taskList = inject('taskList');
  80. let taskType = inject('taskType');
  81. </script>
  82. <style lang="scss" scoped>
  83. .task {
  84. display: flex;
  85. flex-direction: column;
  86. row-gap: 48px;
  87. width: 830px;
  88. margin: 0 auto;
  89. & + .task {
  90. margin-top: 40px;
  91. }
  92. &-title {
  93. display: flex;
  94. &-index {
  95. width: 26px;
  96. height: 26px;
  97. margin-right: 8px;
  98. line-height: 26px;
  99. color: #fff;
  100. text-align: center;
  101. background-color: #5498ff;
  102. border-radius: 50%;
  103. }
  104. &-name {
  105. height: 26px;
  106. padding: 2px 12px;
  107. line-height: 22px;
  108. color: #fff;
  109. background-color: #666;
  110. border-radius: 19px;
  111. }
  112. }
  113. &-content {
  114. display: flex;
  115. flex-direction: column;
  116. row-gap: 8px;
  117. padding: 24px;
  118. margin-top: 8px;
  119. color: #2c2c2c;
  120. background-color: #fff;
  121. border: 1px solid $border-color;
  122. border-radius: 8px;
  123. box-shadow: 0 2px 4px $border-color;
  124. .task-name {
  125. font-size: 18px;
  126. font-weight: bold;
  127. }
  128. :deep hr {
  129. width: 100%;
  130. margin: 23px 0;
  131. border: 1px dashed $border-color;
  132. }
  133. .subtask-title {
  134. font-weight: bold;
  135. }
  136. }
  137. }
  138. </style>