TaskList.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div class="tasks">
  3. <div class="tasks-top">
  4. <el-calendar v-model="date" />
  5. <div class="tasks-top-notification">
  6. <div class="tasks-top-notification-title">
  7. <div>
  8. <svg-icon icon-class="task-notification" />
  9. <span class="title">任务通知</span>
  10. </div>
  11. <div></div>
  12. </div>
  13. <div class="tasks-top-notification-container"></div>
  14. </div>
  15. </div>
  16. <div class="tasks-container">
  17. <div class="tasks-container-title">
  18. <div class="tasks-container-title-left">
  19. <svg-icon icon-class="clock" />
  20. <span class="title">时间轴</span>
  21. <span class="date">{{ dateTime }}</span>
  22. <i class="el-icon-arrow-left" @click="dateSkip(-1)" />
  23. <i class="el-icon-arrow-right" @click="dateSkip(1)" />
  24. </div>
  25. <div>
  26. <el-select v-model="selected"></el-select>
  27. </div>
  28. </div>
  29. <div class="tasks-container-main">
  30. <div v-for="(item, i) in task_group_list" :key="i" class="tasks-group">
  31. <div class="tasks-group-top">
  32. <span class="tasks-group-top-time">{{ item.begin_time_view_text }}</span>
  33. <span class="tasks-group-top-line"></span>
  34. </div>
  35. <div class="tasks-group-list">
  36. <div v-for="list in item.task_list" :key="list.id" class="tasks-group-list-info">
  37. <div class="tasks-group-list-info-name">
  38. {{ timeType(list.time_type) }}任务:{{ list.name }}
  39. <el-link
  40. class="task-link"
  41. :underline="false"
  42. @click="taskLink(list.teaching_type, list.id)"
  43. >
  44. {{ teachingType(list.teaching_type) }}
  45. </el-link>
  46. </div>
  47. <div class="tasks-group-list-info-item-name">{{ list.cs_item_name }}</div>
  48. <div class="tasks-group-list-info-time">{{ list.time_space_view_txt }}</div>
  49. <div></div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import { GetMyDayTaskList } from '@/api/table';
  59. import { CreateEnterLiveRoomSession } from '@/api/live';
  60. import { parseTime, formatDate } from '@/utils';
  61. export default {
  62. name: 'TaskList',
  63. data() {
  64. return {
  65. date: new Date(),
  66. selected: '',
  67. task_group_list: []
  68. };
  69. },
  70. computed: {
  71. dateTime: function () {
  72. return parseTime(this.date, '{m}-{d}');
  73. }
  74. },
  75. watch: {
  76. date: function () {
  77. this.getTaskList();
  78. }
  79. },
  80. mounted() {
  81. this.getTaskList();
  82. },
  83. methods: {
  84. timeType(type) {
  85. switch (type) {
  86. case 0:
  87. return '课前';
  88. case 1:
  89. return '课中';
  90. case 2:
  91. return '课后';
  92. default:
  93. return '';
  94. }
  95. },
  96. teachingType(type) {
  97. switch (type) {
  98. case 10:
  99. return '进入直播间';
  100. default:
  101. return '查看';
  102. }
  103. },
  104. taskLink(type, task_id) {
  105. if (type === 10) {
  106. CreateEnterLiveRoomSession({
  107. task_id
  108. }).then(({ live_room_sys_user_id, room_id, session_id, room_user_id }) => {
  109. this.$router.push({
  110. path: `/live/${this.$store.state.user.user_type === 'TEACHER' ? 'teacher' : 'student'}`,
  111. query: { live_room_sys_user_id, room_id, session_id, task_id, room_user_id }
  112. });
  113. });
  114. } else {
  115. this.$message.warning('暂未实现');
  116. }
  117. },
  118. dateSkip(num) {
  119. let day = 24 * 60 * 60 * 1000 * num;
  120. this.date = new Date(this.date.getTime() + day);
  121. },
  122. getTaskList() {
  123. GetMyDayTaskList({ date_stamp: formatDate(this.date) }).then(response => {
  124. this.task_group_list = response.task_group_list;
  125. });
  126. }
  127. }
  128. };
  129. </script>
  130. <style lang="scss">
  131. .tasks {
  132. &-top {
  133. display: flex;
  134. justify-content: space-between;
  135. .el-calendar {
  136. width: 334px;
  137. height: 300px;
  138. &__header .el-button {
  139. padding: 7px 10px;
  140. }
  141. &-table div.el-calendar-day {
  142. height: 29px;
  143. }
  144. &__body {
  145. thead th {
  146. padding: 0 0 4px 0;
  147. }
  148. }
  149. }
  150. &-notification {
  151. background-color: #fff;
  152. flex: 1;
  153. height: 300px;
  154. margin-left: 16px;
  155. padding: 20px 24px;
  156. &-title {
  157. height: 56px;
  158. & .title {
  159. display: inline-block;
  160. margin-left: 10px;
  161. }
  162. }
  163. }
  164. }
  165. &-container {
  166. margin-top: 16px;
  167. border-radius: 8px;
  168. width: 100%;
  169. min-height: calc(100vh - 522px);
  170. background-color: #fff;
  171. &-title {
  172. display: flex;
  173. justify-content: space-between;
  174. padding: 16px;
  175. &-left {
  176. line-height: 40px;
  177. .title {
  178. margin-left: 8px;
  179. }
  180. .date {
  181. margin-left: 24px;
  182. color: #a6a6a6;
  183. vertical-align: middle;
  184. }
  185. .el-icon-arrow-right {
  186. cursor: pointer;
  187. }
  188. .el-icon-arrow-left {
  189. @extend .el-icon-arrow-right;
  190. margin: 0 26px 0 33px;
  191. }
  192. }
  193. }
  194. &-main {
  195. margin: 0 24px 8px 40px;
  196. .tasks-group {
  197. margin-top: 8px;
  198. &-top {
  199. display: flex;
  200. justify-content: space-between;
  201. align-items: center;
  202. &-time {
  203. color: #808080;
  204. }
  205. &-line {
  206. width: calc(100% - 78px);
  207. height: 1px;
  208. background-color: #d9d9d9;
  209. }
  210. }
  211. &-list {
  212. margin-left: 78px;
  213. &-info {
  214. display: inline-block;
  215. padding: 16px 24px;
  216. border: 1px solid #ccc;
  217. border-radius: 8px;
  218. margin: 10px 15px 10px 0;
  219. background-color: #fff4e3;
  220. > div {
  221. margin: 8px 0;
  222. }
  223. &-name {
  224. .task-link {
  225. font-size: 16px;
  226. vertical-align: top;
  227. margin-left: 8px;
  228. color: $basicColor;
  229. }
  230. }
  231. &-item-name {
  232. font-size: 14px;
  233. color: #727280;
  234. }
  235. &-time {
  236. font-size: 14px;
  237. }
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. </style>