TaskList.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div class="tasks">
  3. <div class="tasks-top">
  4. <el-calendar v-model="dateTime" />
  5. <div class="tasks-top-notification">
  6. <div class="tasks-top-notification-title">
  7. <div>
  8. <svg-icon icon-class="tasks-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: {
  72. get: function () {
  73. return parseTime(this.date, '{m}-{d}');
  74. },
  75. set: function (newValue) {
  76. this.date = newValue;
  77. this.getTaskList();
  78. }
  79. }
  80. },
  81. mounted() {
  82. this.getTaskList();
  83. },
  84. methods: {
  85. timeType(type) {
  86. switch (type) {
  87. case 0:
  88. return '课前';
  89. case 1:
  90. return '课中';
  91. case 2:
  92. return '课后';
  93. default:
  94. return '';
  95. }
  96. },
  97. teachingType(type) {
  98. switch (type) {
  99. case 10:
  100. return '进入直播间';
  101. default:
  102. return '查看';
  103. }
  104. },
  105. taskLink(type, task_id) {
  106. if (type === 10) {
  107. CreateEnterLiveRoomSession({
  108. task_id
  109. }).then(({ live_room_sys_user_id, room_id, session_id }) => {
  110. this.$router.push({
  111. path: '/live',
  112. query: { live_room_sys_user_id, room_id, session_id }
  113. });
  114. });
  115. } else {
  116. this.$message.warning('暂未实现');
  117. }
  118. },
  119. dateSkip(num) {
  120. let day = 24 * 60 * 60 * 1000 * num;
  121. this.dateTime = new Date(this.date.getTime() + day);
  122. },
  123. getTaskList() {
  124. GetMyDayTaskList({ date_stamp: formatDate(this.date) }).then(response => {
  125. this.task_group_list = response.task_group_list;
  126. });
  127. },
  128. // 跳转到讲次详情
  129. routerPush(id) {
  130. this.$router.push({ path: `/cs_item_detail/index/${id}` });
  131. }
  132. }
  133. };
  134. </script>
  135. <style lang="scss">
  136. .tasks {
  137. &-top {
  138. display: flex;
  139. justify-content: space-between;
  140. .el-calendar {
  141. width: 334px;
  142. height: 300px;
  143. &__header .el-button {
  144. padding: 7px 10px;
  145. }
  146. &-table div.el-calendar-day {
  147. height: 29px;
  148. }
  149. &__body {
  150. thead th {
  151. padding: 0 0 4px 0;
  152. }
  153. }
  154. }
  155. &-notification {
  156. background-color: #fff;
  157. flex: 1;
  158. height: 300px;
  159. margin-left: 16px;
  160. padding: 20px 24px;
  161. &-title {
  162. height: 56px;
  163. }
  164. }
  165. }
  166. &-container {
  167. margin: 16px 0;
  168. border-radius: 8px;
  169. width: 100%;
  170. min-height: calc(100vh - 515px);
  171. background-color: #fff;
  172. &-title {
  173. display: flex;
  174. justify-content: space-between;
  175. padding: 16px;
  176. &-left {
  177. line-height: 40px;
  178. .title {
  179. margin-left: 8px;
  180. }
  181. .date {
  182. margin-left: 24px;
  183. color: #a6a6a6;
  184. vertical-align: middle;
  185. }
  186. .el-icon-arrow-right {
  187. cursor: pointer;
  188. }
  189. .el-icon-arrow-left {
  190. @extend .el-icon-arrow-right;
  191. margin: 0 26px 0 33px;
  192. }
  193. }
  194. }
  195. &-main {
  196. margin: 0 24px 8px 40px;
  197. .tasks-group {
  198. margin-top: 8px;
  199. &-top {
  200. display: flex;
  201. justify-content: space-between;
  202. align-items: center;
  203. &-time {
  204. color: #808080;
  205. }
  206. &-line {
  207. width: calc(100% - 78px);
  208. height: 1px;
  209. background-color: #d9d9d9;
  210. }
  211. }
  212. &-list {
  213. margin-left: 78px;
  214. &-info {
  215. display: inline-block;
  216. padding: 16px 24px;
  217. border: 1px solid #ccc;
  218. border-radius: 8px;
  219. margin-right: 15px;
  220. background-color: #fff4e3;
  221. > div {
  222. margin: 8px 0;
  223. }
  224. &-name {
  225. .task-link {
  226. font-size: 16px;
  227. vertical-align: top;
  228. margin-left: 8px;
  229. color: $basicColor;
  230. }
  231. }
  232. &-item-name {
  233. font-size: 14px;
  234. color: #727280;
  235. }
  236. &-time {
  237. font-size: 14px;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. }
  245. </style>