index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <div v-loading="loading" class="teacher-task-detail">
  3. <task-top :item-info="itemInfo" @viewFile="viewFile" />
  4. <div class="teacher-task-detail-main">
  5. <div class="student-finish-situation">
  6. <div>学员完成情况</div>
  7. <div class="student-list" :style="{ height: student_list_height + 'px' }">
  8. <ul>
  9. <li
  10. v-for="item in student_list"
  11. :key="item.student_id"
  12. :class="['student-item', { active: item.student_id === curStudentId }]"
  13. @click="getTaskStudentExecuteInfo(item.student_id)"
  14. >
  15. <span>{{ item.student_name }}</span>
  16. <svg-icon v-if="item.is_finished === 'true'" icon-class="check-mark" />
  17. </li>
  18. </ul>
  19. </div>
  20. </div>
  21. <div class="finish-detail">
  22. <div class="student-info">
  23. <div>
  24. <el-avatar
  25. :src="curFinishDetail.student_image_url"
  26. :size="32"
  27. icon="el-icon-user-solid"
  28. />
  29. <span class="student-info-name">{{ curFinishDetail.student_name }}</span>
  30. </div>
  31. <span class="finish-time">{{ curFinishDetail.finish_time_view_txt }}</span>
  32. </div>
  33. <div ref="situation" class="finish-situation">
  34. <div class="title">课件任务</div>
  35. <div class="courseware-list">
  36. <el-tag
  37. v-for="item in curFinishDetail.courseware_list"
  38. :key="item.courseware_id"
  39. color="#fff"
  40. :title="item.courseware_name"
  41. @click="showCompletionView(item.courseware_id, item.is_finished)"
  42. >
  43. <div class="courseware">
  44. <svg-icon icon-class="courseware" />
  45. <span class="courseware_name">{{ item.courseware_name }}</span>
  46. <svg-icon
  47. v-if="item.is_finished === 'true'"
  48. class="check-mark"
  49. icon-class="check-mark-circle"
  50. />
  51. </div>
  52. </el-tag>
  53. </div>
  54. <div class="title">文档列表</div>
  55. <div>
  56. <el-tag v-for="item in accessory_list" :key="item.file_id" :title="item.file_name">
  57. <span @click="viewFile(item.file_name, item.file_id)">{{ item.file_name }}</span>
  58. </el-tag>
  59. </div>
  60. <div class="title">作业列表</div>
  61. <div>
  62. <el-tag
  63. v-for="item in curFinishDetail.homework_list"
  64. :key="item.file_id"
  65. color="#fff"
  66. :title="item.file_name"
  67. >
  68. <span @click="viewFile(item.file_name, item.file_id)">{{ item.file_name }}</span>
  69. </el-tag>
  70. </div>
  71. <div class="title">学生留言</div>
  72. <div>{{ curFinishDetail.student_message }}</div>
  73. <template v-if="teaching_type === 10">
  74. <div class="title">学员课后评价</div>
  75. <div>{{ student_remark }}</div>
  76. <div class="title">
  77. <span>学员课后评分</span>
  78. <el-rate v-model="student_score" disabled />
  79. </div>
  80. </template>
  81. <div class="title">
  82. <span>教师点评</span>
  83. <el-rate v-model="teacher_score"></el-rate>
  84. </div>
  85. <div>
  86. <el-input v-model="teacher_remark" type="textarea" resize="none" :rows="6"></el-input>
  87. </div>
  88. <div class="confirm">
  89. <el-button type="primary" @click="remarkTaskStudentExecuteInfo_Teacher">提交</el-button>
  90. <el-button v-if="student_list.length > 1" @click="next">
  91. {{ buttonName() }} <i class="el-icon-right" />
  92. </el-button>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <completion-view
  98. :task-id="id"
  99. :cur-student-id="curStudentId"
  100. :cur-courseware-id="curCoursewareId"
  101. :dialog-visible="dialogVisible"
  102. @dialogClose="dialogClose"
  103. />
  104. <show-file
  105. ref="file"
  106. :file-name="showCurFileName"
  107. :file-id="showCurFileId"
  108. @dialogShowFileClose="dialogShowFileClose"
  109. />
  110. </div>
  111. </template>
  112. <script>
  113. import CompletionView from '@/components/course/CompletionView.vue';
  114. import ShowFile from '@/common/show_file';
  115. import TaskTop from '../TaskTop.vue';
  116. import {
  117. GetTaskInfo,
  118. GetTaskStudentExecuteInfo,
  119. RemarkTaskStudentExecuteInfo_Teacher
  120. } from '@/api/course';
  121. export default {
  122. components: { CompletionView, TaskTop, ShowFile },
  123. data() {
  124. return {
  125. id: this.$route.params.id,
  126. name: '',
  127. teaching_type: '',
  128. itemInfo: {
  129. course_name: '',
  130. cs_item_name: '',
  131. cs_item_learning_material_list: [],
  132. courseware_list: [],
  133. time_space_view_txt: ''
  134. },
  135. time_type: '',
  136. task_mode: '',
  137. time_space_view_txt: '',
  138. courseware_list: [],
  139. accessory_list: [],
  140. file_list: [],
  141. student_list: [],
  142. curStudentId: '',
  143. // 当前学生完成详情
  144. curFinishDetail: {
  145. student_name: '',
  146. student_image_url: '',
  147. courseware_list: [],
  148. homework_list: [],
  149. student_message: '',
  150. finish_time_view_txt: ''
  151. },
  152. teacher_remark: '',
  153. teacher_score: 0,
  154. student_remark: '',
  155. student_score: 0,
  156. dialogVisible: false,
  157. curCoursewareId: '',
  158. loading: false,
  159. student_list_height: 490,
  160. showCurFileName: '',
  161. showCurFileId: ''
  162. };
  163. },
  164. created() {
  165. this.loading = true;
  166. GetTaskInfo({
  167. id: this.id,
  168. is_contain_cs_item_learning_material: true,
  169. is_contain_student: true
  170. })
  171. .then(
  172. ({
  173. name,
  174. teaching_type,
  175. time_type,
  176. course_name,
  177. courseware_list,
  178. cs_item_name,
  179. accessory_list,
  180. cs_item_learning_material_list,
  181. task_mode,
  182. time_space_view_txt,
  183. student_list
  184. }) => {
  185. this.itemInfo = {
  186. time_space_view_txt,
  187. course_name,
  188. cs_item_name,
  189. cs_item_learning_material_list,
  190. courseware_list
  191. };
  192. this.name = name;
  193. this.teaching_type = teaching_type;
  194. this.time_type = time_type;
  195. this.courseware_list = courseware_list;
  196. this.accessory_list = accessory_list;
  197. this.task_mode = task_mode;
  198. this.time_space_view_txt = time_space_view_txt;
  199. this.student_list = student_list;
  200. if (student_list.length > 0) this.getTaskStudentExecuteInfo(student_list[0].student_id);
  201. }
  202. )
  203. .finally(() => {
  204. this.loading = false;
  205. });
  206. },
  207. methods: {
  208. getTaskStudentExecuteInfo(student_id) {
  209. GetTaskStudentExecuteInfo({
  210. task_id: this.id,
  211. student_id
  212. }).then(
  213. ({
  214. courseware_list,
  215. homework_list,
  216. student_message,
  217. student_name,
  218. student_image_url,
  219. finish_time_view_txt,
  220. teacher_remark,
  221. teacher_score,
  222. student_remark,
  223. student_score
  224. }) => {
  225. this.curStudentId = student_id;
  226. this.teacher_remark = teacher_remark;
  227. this.teacher_score = teacher_score;
  228. this.student_remark = student_remark;
  229. this.student_score = student_score;
  230. this.curFinishDetail = {
  231. courseware_list,
  232. homework_list,
  233. student_message,
  234. student_name,
  235. student_image_url,
  236. finish_time_view_txt
  237. };
  238. this.$nextTick(() => {
  239. this.student_list_height = this.$refs.situation.clientHeight;
  240. });
  241. }
  242. );
  243. },
  244. showCompletionView(id, is_finished) {
  245. if (is_finished === 'false') return this.$message.warning('该课件没有被完成');
  246. this.curCoursewareId = id;
  247. this.dialogVisible = true;
  248. },
  249. dialogClose() {
  250. this.curCoursewareId = '';
  251. this.dialogVisible = false;
  252. },
  253. viewFile(fileName, fileId) {
  254. this.showCurFileName = fileName;
  255. this.showCurFileId = fileId;
  256. this.$refs.file.showDialog();
  257. },
  258. dialogShowFileClose() {
  259. this.showCurFileName = '';
  260. this.showCurFileId = '';
  261. },
  262. buttonName() {
  263. let list = this.student_list;
  264. if (list.length <= 0) return '';
  265. return list[list.length - 1].student_id === this.curStudentId ? '上一个' : '下一个';
  266. },
  267. remarkTaskStudentExecuteInfo_Teacher() {
  268. RemarkTaskStudentExecuteInfo_Teacher({
  269. task_id: this.id,
  270. student_id: this.curStudentId,
  271. teacher_score: this.teacher_score,
  272. teacher_remark: this.teacher_remark
  273. }).then(() => {
  274. this.$message.success('点评成功');
  275. });
  276. },
  277. next() {
  278. let list = this.student_list;
  279. if (list.length <= 0) {
  280. return this.$message.warning('当前学生列表为空');
  281. }
  282. let curIndex = list.findIndex(item => item.student_id === this.curStudentId);
  283. let nextList = list.length - 1 === curIndex ? list[curIndex - 1] : list[curIndex + 1];
  284. if (nextList) this.getTaskStudentExecuteInfo(nextList.student_id);
  285. }
  286. }
  287. };
  288. </script>
  289. <style lang="scss">
  290. @import '~@/styles/mixin.scss';
  291. $bor-color: #d9d9d9;
  292. .teacher-task-detail {
  293. @include container;
  294. @include dialog;
  295. margin-top: 56px;
  296. min-height: calc(100vh - 130px);
  297. .el-tag {
  298. @include el-tag;
  299. border-radius: 4px;
  300. margin: 0 8px 6px 0;
  301. border-color: $bor-color;
  302. > span {
  303. cursor: pointer;
  304. }
  305. }
  306. &-main {
  307. display: flex;
  308. min-height: calc(100vh - 390px);
  309. background-color: #fff;
  310. border-radius: 8px;
  311. margin-top: 16px;
  312. .student-finish-situation {
  313. padding: 24px 0;
  314. flex: 3;
  315. > div:first-child {
  316. font-weight: 700;
  317. padding: 0 32px;
  318. margin-bottom: 24px;
  319. }
  320. // 学员列表
  321. .student-list {
  322. overflow: auto;
  323. ul {
  324. cursor: pointer;
  325. .student-item {
  326. display: flex;
  327. justify-content: space-between;
  328. padding: 8px 32px;
  329. &.active {
  330. background-color: #f2f2f2;
  331. }
  332. }
  333. }
  334. }
  335. }
  336. // 完成详情
  337. .finish-detail {
  338. flex: 7;
  339. border-left: 1px solid #dbdbdb;
  340. .student-info {
  341. display: flex;
  342. justify-content: space-between;
  343. padding: 28px 32px;
  344. border-bottom: 1px solid #dbdbdb;
  345. height: 89px;
  346. line-height: 32px;
  347. &-name {
  348. display: inline-block;
  349. vertical-align: text-bottom;
  350. height: 32px;
  351. line-height: 32px;
  352. margin-left: 24px;
  353. }
  354. .finish-time {
  355. color: #999;
  356. }
  357. }
  358. // 完成情况
  359. .finish-situation {
  360. width: 100%;
  361. padding: 24px 32px;
  362. .el-rate {
  363. display: inline-block;
  364. margin-left: 42px;
  365. }
  366. .title {
  367. font-weight: bold;
  368. font-size: 18px;
  369. & + div {
  370. padding: 16px 0;
  371. }
  372. }
  373. .courseware-list {
  374. .el-tag {
  375. cursor: pointer;
  376. .courseware {
  377. overflow: hidden;
  378. .svg-icon {
  379. font-size: 18px;
  380. margin-right: 12px;
  381. }
  382. .check-mark {
  383. position: relative;
  384. top: 2px;
  385. margin: 0 0 0 12px;
  386. }
  387. &_name {
  388. display: inline-block;
  389. max-width: 120px;
  390. }
  391. }
  392. }
  393. }
  394. // 学员详情按钮
  395. .confirm {
  396. display: flex;
  397. justify-content: space-between;
  398. .el-button {
  399. width: 110px;
  400. }
  401. }
  402. }
  403. }
  404. }
  405. }
  406. </style>