TaskList.vue 11 KB

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