index.vue 13 KB

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