TaskList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <div class="tasks">
  3. <div class="tasks-left">
  4. <!-- 菜单 -->
  5. <div class="menu">
  6. <template v-for="{ tab, name, isShow } in menuList">
  7. <span
  8. v-if="isShow"
  9. :key="tab"
  10. :class="['menu-item', tab === 'TaskList' ? 'active' : '']"
  11. @click="changeTab(tab)"
  12. >
  13. {{ name }}
  14. </span>
  15. </template>
  16. </div>
  17. <!-- 日历 -->
  18. <monthly-calendar ref="calendar" @changeTimeUnit="changeTimeUnit" @changeDate="changeDate" />
  19. <!-- 通知 -->
  20. <div class="notice">
  21. <div class="notice-title">
  22. <svg-icon icon-class="task-notification" class-name="svg-normal" />
  23. <span>通知</span>
  24. <span class="notice-title-link" @click="goPersonal">全部 <i class="el-icon-arrow-right" /></span>
  25. </div>
  26. <!-- 通知列表 -->
  27. <div class="notice-container">
  28. <ul>
  29. <li v-for="{ id, is_read, content, send_time, source_entity_id } in message_list" :key="id">
  30. <span class="is-read" v-text="is_read === 'false' ? 'new' : ''" />
  31. <span
  32. class="notice-content"
  33. :style="{ color: is_read === 'true' ? '#8c8c8c' : '#000' }"
  34. @click="readMyMessage(id, source_entity_id)"
  35. >
  36. {{ content }}
  37. </span>
  38. <span class="send-time">{{ send_time }}</span>
  39. </li>
  40. </ul>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="tasks-right">
  45. <div class="task-title">
  46. <svg-icon icon-class="task-list" class-name="svg-normal" /><span class="task-title-name">任务列表</span>
  47. <div class="curricula-type">
  48. <span
  49. v-for="{ constant, name } in taskTimeList"
  50. :key="constant"
  51. :class="['curricula-type-item', timeType === constant ? 'active' : '']"
  52. @click="changeTaskTime(constant)"
  53. >
  54. {{ name }}
  55. </span>
  56. </div>
  57. <span class="select-prefix">
  58. <svg-icon icon-class="schedule" class-name="svg-normal" />
  59. </span>
  60. <el-select v-model="course_id" @change="changeCourse">
  61. <el-option label="全部" value="" />
  62. <el-option v-for="{ id, name } in course_list" :key="id" :label="name" :value="id" />
  63. </el-select>
  64. </div>
  65. <div class="task-container">
  66. <ul v-for="({ task_list, date_stamp }, i) in task_group_list" :key="i" class="task-list">
  67. <li v-if="time_unit === 'MONTH'" class="date-stamp">
  68. {{ date_stamp }}
  69. </li>
  70. <li
  71. v-for="({ id, cs_item_name, time_type, course_name, teaching_type, time_space_view_txt }, j) in task_list"
  72. :key="id"
  73. class="task-item"
  74. :style="{
  75. 'background-color': colorMatching[i % 6].background,
  76. color: colorMatching[i % 6].main,
  77. border: `1px solid ${colorMatching[i % 6].border}`
  78. }"
  79. @click="taskLink_outside(id)"
  80. >
  81. <div class="task-item-top">
  82. <svg-icon icon-class="arrival" :style="{ color: colorMatching[i % 6].main }" />
  83. <span class="cs-item-name">{{ cs_item_name }}</span>
  84. <span
  85. class="task-button"
  86. :style="{ 'background-color': buttonColorList[j % 2] }"
  87. @click.stop="taskLink(teaching_type, id)"
  88. >
  89. {{ getTimeTypeName(time_type) }}任务
  90. </span>
  91. </div>
  92. <div class="task-item-bottom">
  93. <div>
  94. {{ course_name }}
  95. </div>
  96. <div class="time-txt">
  97. {{ time_space_view_txt }}
  98. </div>
  99. </div>
  100. </li>
  101. </ul>
  102. </div>
  103. </div>
  104. </div>
  105. </template>
  106. <script>
  107. import { PageQueryMyMessageList, GetMyTaskList } from '@/api/table';
  108. import { CreateEnterLiveRoomSession } from '@/api/live';
  109. import { ReadMyMessage } from '@/api/user';
  110. import { colorMatching, getMenuList, buttonColorList } from './data';
  111. import { taskTimeList } from '@/common/data';
  112. import { GetMyCourseList_TaskBelong } from '@/api/list';
  113. import MonthlyCalendar from './components/MonthlyCalendar.vue';
  114. export default {
  115. name: 'TaskList',
  116. components: {
  117. MonthlyCalendar
  118. },
  119. data() {
  120. return {
  121. colorMatching,
  122. buttonColorList,
  123. taskTimeList,
  124. course_id: '',
  125. selected: '',
  126. timeType: -1,
  127. menuList: getMenuList(),
  128. task_group_list: [],
  129. message_list: [],
  130. course_list: []
  131. };
  132. },
  133. computed: {
  134. time_unit() {
  135. return this.$refs.calendar.time_unit;
  136. }
  137. },
  138. created() {
  139. PageQueryMyMessageList({
  140. read_status: -1,
  141. message_type: -1,
  142. page_capacity: 4,
  143. cur_page: 1
  144. }).then(({ message_list }) => {
  145. this.message_list = message_list;
  146. });
  147. },
  148. mounted() {
  149. this.init();
  150. },
  151. methods: {
  152. getTimeTypeName(type) {
  153. if (type === 0) return '课前';
  154. if (type === 1) return '课中';
  155. if (type === 2) return '课后';
  156. return '';
  157. },
  158. getMyCourseList_TaskBelong() {
  159. let { curYear, curMonth, focusDate } = this.$refs.calendar;
  160. GetMyCourseList_TaskBelong({
  161. time_unit: this.time_unit,
  162. date_stamp: `${curYear}-${curMonth}-${focusDate}`,
  163. month_stamp: `${curYear}-${curMonth}`
  164. }).then(({ course_list }) => {
  165. this.course_list = course_list;
  166. });
  167. },
  168. getMyTaskList() {
  169. let { curYear, curMonth, focusDate } = this.$refs.calendar;
  170. GetMyTaskList({
  171. time_unit: this.time_unit,
  172. date_stamp: `${curYear}-${curMonth}-${focusDate}`,
  173. month_stamp: `${curYear}-${curMonth}`,
  174. time_type: this.timeType,
  175. course_id: this.course_id
  176. }).then(({ task_group_list }) => {
  177. this.task_group_list = task_group_list;
  178. });
  179. },
  180. // 改变任务时间类型
  181. changeTaskTime(constant) {
  182. this.timeType = constant;
  183. this.getMyTaskList();
  184. },
  185. changeTimeUnit() {
  186. this.init();
  187. },
  188. changeDate() {
  189. this.init();
  190. },
  191. init() {
  192. this.course_id = '';
  193. this.getMyTaskList();
  194. this.getMyCourseList_TaskBelong();
  195. },
  196. changeCourse() {
  197. this.getMyTaskList();
  198. },
  199. taskLink(type, task_id) {
  200. let userType = this.$store.state.user.user_type;
  201. if (type === 10) {
  202. CreateEnterLiveRoomSession({
  203. task_id
  204. }).then(({ live_room_sys_user_id, room_id, session_id, room_user_id }) => {
  205. this.$router.push({
  206. path: `/live/${userType === 'TEACHER' ? 'teacher' : 'student'}`,
  207. query: { live_room_sys_user_id, room_id, session_id, task_id, room_user_id }
  208. });
  209. });
  210. } else {
  211. this.$router.push(`/task_detail/${userType === 'STUDENT' ? 'student' : 'teacher'}/${task_id}`);
  212. }
  213. },
  214. taskLink_outside(task_id) {
  215. this.$router.push(
  216. `/task_detail/${this.$store.state.user.user_type === 'STUDENT' ? 'student' : 'teacher'}/${task_id}`
  217. );
  218. },
  219. readMyMessage(id, source_entity_id) {
  220. ReadMyMessage({ id }).then(() => {
  221. this.taskLink_outside(source_entity_id);
  222. });
  223. },
  224. goPersonal() {
  225. window.location.href = `/GCLS-Personal/#/EnterSys`;
  226. },
  227. changeTab(tab) {
  228. this.$emit('changeTab', tab);
  229. }
  230. }
  231. };
  232. </script>
  233. <style lang="scss" scoped>
  234. .tasks {
  235. display: flex;
  236. &-left {
  237. width: 392px;
  238. margin-right: 16px;
  239. .menu {
  240. display: flex;
  241. height: 56px;
  242. font-size: 20px;
  243. font-weight: 500;
  244. line-height: 56px;
  245. text-align: center;
  246. background-color: #ebebeb;
  247. border: 1px solid $border-color;
  248. border-radius: 8px;
  249. &-item {
  250. flex: 1;
  251. color: rgba(0, 0, 0, 45%);
  252. cursor: pointer;
  253. border-radius: 8px;
  254. &.active {
  255. color: #000;
  256. background-color: #fff;
  257. box-shadow: 0 2px 4px $border-color;
  258. }
  259. }
  260. }
  261. // 日历
  262. .monthly-calendar {
  263. min-height: 498px;
  264. padding: 32px;
  265. margin: 16px 0;
  266. background-color: #fff;
  267. border-radius: 8px;
  268. }
  269. .notice {
  270. height: calc(100vh - 705px);
  271. padding: 32px;
  272. background: #fff;
  273. border-radius: 8px;
  274. &-title {
  275. display: flex;
  276. align-items: center;
  277. justify-content: space-between;
  278. > span:first-of-type {
  279. flex: 1;
  280. padding-left: 16px;
  281. }
  282. &-link {
  283. color: #bababa;
  284. }
  285. }
  286. &-container {
  287. height: 100%;
  288. overflow: auto;
  289. ul {
  290. margin-top: 16px;
  291. li {
  292. display: flex;
  293. padding: 8px 0;
  294. border-bottom: 1px solid $border-color;
  295. .is-read {
  296. width: 80px;
  297. color: $basic-color;
  298. }
  299. .notice-content {
  300. width: 230px;
  301. margin-right: 16px;
  302. cursor: pointer;
  303. }
  304. .send-time {
  305. color: #8c8c8c;
  306. }
  307. }
  308. }
  309. }
  310. }
  311. }
  312. &-right {
  313. width: 802px;
  314. min-height: calc(100vh - 119px);
  315. padding: 16px 24px;
  316. background-color: #fff;
  317. border-radius: 8px;
  318. .task-title {
  319. display: flex;
  320. align-items: center;
  321. padding-bottom: 16px;
  322. border-bottom: 1px solid #d9d9d9;
  323. &-name {
  324. margin-left: 8px;
  325. font-weight: 600;
  326. }
  327. .curricula-type {
  328. display: flex;
  329. align-items: center;
  330. height: 40px;
  331. margin: 0 16px;
  332. color: #8c8c8c;
  333. background-color: $bac-color;
  334. border: 1px solid $border-color;
  335. border-radius: 8px;
  336. &-item {
  337. height: 100%;
  338. padding: 8px;
  339. line-height: 26px;
  340. cursor: pointer;
  341. &.active {
  342. color: #000;
  343. background-color: #fff;
  344. border-radius: 8px;
  345. box-shadow: 0 2px 4px $border-color;
  346. }
  347. }
  348. }
  349. .select-prefix {
  350. padding: 6px;
  351. margin-right: -1px;
  352. border: 1px solid $border-color;
  353. border-radius: 8px 0 0 8px;
  354. }
  355. .el-select {
  356. width: calc(100% - 360px);
  357. }
  358. }
  359. .task-container {
  360. min-height: calc(100% - 50px);
  361. .task-list {
  362. li.date-stamp {
  363. margin-top: 16px;
  364. margin-bottom: -8px;
  365. font-weight: 700;
  366. }
  367. .task-item {
  368. padding: 16px 24px;
  369. margin-top: 16px;
  370. cursor: pointer;
  371. border-radius: 8px;
  372. &-top {
  373. display: flex;
  374. margin-bottom: 8px;
  375. .cs-item-name {
  376. flex: 1;
  377. margin-left: 10px;
  378. }
  379. .task-button {
  380. padding: 4px 8px;
  381. color: #fff;
  382. border-radius: 8px;
  383. }
  384. }
  385. &-bottom {
  386. font-size: 14px;
  387. color: #808080;
  388. .time-txt {
  389. margin-top: 8px;
  390. color: #000;
  391. }
  392. }
  393. }
  394. }
  395. }
  396. }
  397. }
  398. </style>