TaskList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <div>
  3. <ul class="task-list">
  4. <li
  5. v-for="({ task_list, cs_item_id, cs_item_name, course_id, course_name, task_time_type }, i) in taskGroupList"
  6. :key="i"
  7. class="task-item"
  8. >
  9. <div class="task-item-top">
  10. <svg-icon icon-class="arrival" class-name="arrival" :style="getItemIconColor(course_id)" />
  11. <span class="cs-item-name">
  12. <span
  13. :style="getItemIconColor(course_id)"
  14. @click="$router.push(`/task_view/${cs_item_id}?task_time_type=${task_time_type}`)"
  15. >
  16. {{ cs_item_name }}
  17. </span>
  18. </span>
  19. <span class="task-button" :style="{ 'background-color': buttonColorList.get(task_time_type) }">
  20. {{ $t(getTimeTypeName(task_time_type)) }}{{ $t('Key289') }}
  21. </span>
  22. </div>
  23. <div class="task-item-bottom">
  24. <div class="course-name" @click="changeTab(menuList[1].tab, course_id)">
  25. {{ course_name }}
  26. </div>
  27. <ul>
  28. <li v-for="({ id, name, teaching_type, time_space_view_txt, finish_status }, j) in task_list" :key="id">
  29. <span>{{ j + 1 }}.</span>
  30. <span>{{ ` ${name} ${liveTeachingType === teaching_type ? time_space_view_txt : ''}` }}</span>
  31. <template v-if="liveTeachingType === teaching_type">
  32. <template v-if="finish_status === 1">
  33. <span
  34. class="enter-live"
  35. :style="{ color: finishStatusList[finish_status].color }"
  36. @click.stop="taskLink(task_list[0].teaching_type, task_list[0].id)"
  37. >
  38. {{ $t('Key616') }} >
  39. </span>
  40. </template>
  41. <template v-else>
  42. <span :style="{ color: finishStatusList[finish_status].color }">
  43. {{ finishStatusList[finish_status].name }}
  44. </span>
  45. </template>
  46. </template>
  47. </li>
  48. </ul>
  49. </div>
  50. </li>
  51. </ul>
  52. </div>
  53. </template>
  54. <script>
  55. export default {
  56. name: 'TaskList'
  57. };
  58. </script>
  59. <script setup>
  60. import { inject } from 'vue';
  61. import { useRouter } from 'vue-router/composables';
  62. import { menuList } from '../index';
  63. import { useTaskLink, useTaskItem, getTimeTypeName, buttonColorList } from './TaskList';
  64. import { taskClassify } from '@/views/teacher/create_course/step_three/components/data/constant.js';
  65. defineProps({
  66. timeUnit: {
  67. type: undefined,
  68. required: true
  69. },
  70. taskGroupList: {
  71. type: Array,
  72. required: true
  73. }
  74. });
  75. const finishStatusList = [
  76. {
  77. value: 0,
  78. name: '未开始',
  79. color: '#FEA014'
  80. },
  81. {
  82. value: 1,
  83. name: '进行中',
  84. color: '#2A76E8'
  85. },
  86. {
  87. value: 2,
  88. name: '已结束',
  89. color: '#E04A4A'
  90. }
  91. ];
  92. const router = useRouter();
  93. const liveTeachingType = taskClassify[4].teaching_type;
  94. let { taskLink } = useTaskLink(router);
  95. let { getItemIconColor } = useTaskItem();
  96. let changeTab = inject('changeTab');
  97. </script>
  98. <style lang="scss" scoped>
  99. .task-list {
  100. li.date-stamp {
  101. margin-top: 16px;
  102. margin-bottom: -8px;
  103. font-weight: 700;
  104. }
  105. .task-item {
  106. display: flex;
  107. flex-direction: column;
  108. row-gap: 8px;
  109. padding: 16px 24px;
  110. margin-top: 16px;
  111. cursor: pointer;
  112. border: 1px solid $border-color;
  113. border-radius: 8px;
  114. &-top {
  115. display: flex;
  116. align-items: center;
  117. .arrival {
  118. width: 20px;
  119. height: 20px;
  120. }
  121. .cs-item-name {
  122. flex: 1;
  123. margin-left: 10px;
  124. }
  125. .task-button {
  126. height: 24px;
  127. padding: 4px 8px;
  128. font-size: 14px;
  129. color: #fff;
  130. border-radius: 8px;
  131. }
  132. }
  133. &-bottom {
  134. padding-left: 30px;
  135. font-size: 14px;
  136. .course-name {
  137. font-weight: 500;
  138. color: #000;
  139. }
  140. ul > li {
  141. margin-top: 8px;
  142. color: #7f7f7f;
  143. cursor: text;
  144. .enter-live {
  145. margin-left: 12px;
  146. cursor: pointer;
  147. }
  148. }
  149. .time-txt {
  150. margin-top: 8px;
  151. color: #808080;
  152. }
  153. }
  154. }
  155. }
  156. </style>