|
@@ -12,7 +12,9 @@
|
|
|
accessory_list,
|
|
|
homework_list,
|
|
|
message_list,
|
|
|
- child_task_list
|
|
|
+ child_task_list,
|
|
|
+ message_list_task_remark,
|
|
|
+ isRemark
|
|
|
},
|
|
|
taskIndex
|
|
|
) in taskList"
|
|
@@ -37,7 +39,12 @@
|
|
|
:accessory-list="accessory_list"
|
|
|
:homework-list="homework_list"
|
|
|
/>
|
|
|
- <MessageView v-if="[taskClassify[3].teaching_type].includes(teaching_type)" :message-list="message_list" />
|
|
|
+ <MessageView
|
|
|
+ v-if="[taskClassify[3].teaching_type].includes(teaching_type)"
|
|
|
+ :message-list="message_list"
|
|
|
+ :add-message-item="curry(submitTaskMessageReplayTeacher)(taskIndex)(false)"
|
|
|
+ :delete-message-item="curry(deleteMessageItem)(taskIndex)(false)"
|
|
|
+ />
|
|
|
</div>
|
|
|
<!-- 子任务 -->
|
|
|
<template v-if="child_task_list.length > 0">
|
|
@@ -48,9 +55,30 @@
|
|
|
:key="`subtask-${i}`"
|
|
|
:class="[`${taskType}-${taskIndex}-${i}`]"
|
|
|
:subtask-data="data"
|
|
|
+ :add-message-item="curry(submitSubtaskMessageReplayTeacher)(taskIndex)(i)"
|
|
|
+ :delete-message-item="curry(deleteSubtaskMessageItem)(taskIndex)(i)"
|
|
|
/>
|
|
|
</template>
|
|
|
</div>
|
|
|
+ <!-- 任务点评 -->
|
|
|
+ <template v-if="isRemark || message_list_task_remark.length > 0">
|
|
|
+ <div class="task-remark">
|
|
|
+ <div class="task-remark-title">教师点评</div>
|
|
|
+ <MessageView
|
|
|
+ :message-list="message_list_task_remark"
|
|
|
+ :add-message-item="curry(submitTaskMessageReplayTeacher)(taskIndex)(true)"
|
|
|
+ :delete-message-item="curry(deleteMessageItem)(taskIndex)(true)"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="add-remark">
|
|
|
+ <div class="add-remark-button" @click="addRemark(taskIndex)">
|
|
|
+ <svg-icon icon-class="plus" class-name="plus" />
|
|
|
+ <span>进行点评</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
<ShowFile :visible="visible" :file-name="curFileName" :file-id="curFileId" @close="dialogShowFileClose" />
|
|
|
</div>
|
|
@@ -67,6 +95,9 @@ import { inject } from 'vue';
|
|
|
import { useShowFile } from '@/common/show_file/index';
|
|
|
import { previewDateTransform } from '@/utils/course';
|
|
|
import { taskClassify } from '@/views/teacher/create_course/step_three/components/data/constant';
|
|
|
+import { curry } from '@/utils/common';
|
|
|
+import { SubmitTask_MessageReply_TeacherReplyStudent, DeleteTask_MessageReply } from '@/api/course';
|
|
|
+import { MessageBox } from 'element-ui';
|
|
|
|
|
|
import ShowFile from '@/common/show_file/index.vue';
|
|
|
import FileView from '../common/FileView.vue';
|
|
@@ -74,10 +105,124 @@ import CoursewareView from '@/components/course/CoursewareView.vue';
|
|
|
import MessageView from '../common/MessageView.vue';
|
|
|
import SubtaskItem from '../common/SubtaskItem.vue';
|
|
|
|
|
|
+const props = defineProps({
|
|
|
+ curStudentId: {
|
|
|
+ type: String,
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
let { visible, curFileId, curFileName, dialogShowFileClose } = useShowFile();
|
|
|
|
|
|
let taskList = inject('taskList');
|
|
|
let taskType = inject('taskType');
|
|
|
+
|
|
|
+/**
|
|
|
+ * 提交任务消息回复(教师回复学员)
|
|
|
+ * @param {Number} index 任务索引
|
|
|
+ * @param {Boolean} is_task_remark 是否是任务点评
|
|
|
+ * @param {Object} data 回复数据
|
|
|
+ */
|
|
|
+function submitTaskMessageReplayTeacher(index, is_task_remark, data) {
|
|
|
+ SubmitTask_MessageReply_TeacherReplyStudent({
|
|
|
+ student_id: props.curStudentId,
|
|
|
+ task_id: taskList.value[index].id,
|
|
|
+ is_task_remark,
|
|
|
+ info_block_id: '',
|
|
|
+ text: data.text,
|
|
|
+ file_id: data.file_id,
|
|
|
+ message_type: data.message_type
|
|
|
+ }).then(({ status, id }) => {
|
|
|
+ if (status === 1) {
|
|
|
+ taskList.value[index][is_task_remark ? 'message_list_task_remark' : 'message_list'].push({ id, ...data });
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 提交子任务消息回复(教师回复学员)
|
|
|
+ * @param {Number} index
|
|
|
+ * @param {Number} subIndex
|
|
|
+ * @param {Number} infoIndex
|
|
|
+ * @param {Object} data
|
|
|
+ */
|
|
|
+function submitSubtaskMessageReplayTeacher(index, subIndex, infoIndex, data) {
|
|
|
+ const infoBlockItem = taskList.value[index].child_task_list[subIndex].info_block_list[infoIndex];
|
|
|
+ SubmitTask_MessageReply_TeacherReplyStudent({
|
|
|
+ student_id: props.curStudentId,
|
|
|
+ task_id: taskList.value[index].id,
|
|
|
+ is_task_remark: false,
|
|
|
+ info_block_id: infoBlockItem.id,
|
|
|
+ text: data.text,
|
|
|
+ file_id: data.file_id,
|
|
|
+ message_type: data.message_type
|
|
|
+ }).then(({ status, id }) => {
|
|
|
+ if (status === 1) {
|
|
|
+ infoBlockItem.message_list.push({ id, ...data });
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 删除消息列表项
|
|
|
+ * @param {Number} index 任务索引
|
|
|
+ * @param {Boolean} is_task_remark 是否是任务点评
|
|
|
+ * @param {Number} i 消息索引
|
|
|
+ */
|
|
|
+function deleteMessageItem(index, is_task_remark, i) {
|
|
|
+ MessageBox.confirm('您确定要删除该消息吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const messageList = taskList.value[index][is_task_remark ? 'message_list_task_remark' : 'message_list'];
|
|
|
+ DeleteTask_MessageReply({
|
|
|
+ task_id: taskList.value[index].id,
|
|
|
+ message_id: messageList[i].id,
|
|
|
+ is_teacher_reply_student: true,
|
|
|
+ student_id: props.curStudentId
|
|
|
+ }).then(({ status }) => {
|
|
|
+ if (status === 1) {
|
|
|
+ messageList.splice(i, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 删除子任务消息列表项
|
|
|
+ * @param {Number} index 任务索引
|
|
|
+ * @param {Number} subIndex 子任务索引
|
|
|
+ * @param {Number} infoIndex 信息块索引
|
|
|
+ * @param {Number} i 消息索引
|
|
|
+ */
|
|
|
+function deleteSubtaskMessageItem(index, subIndex, infoIndex, i) {
|
|
|
+ MessageBox.confirm('您确定要删除该消息吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const subtaskMessageList = taskList.value[index].child_task_list[subIndex].info_block_list[infoIndex].message_list;
|
|
|
+ DeleteTask_MessageReply({
|
|
|
+ task_id: taskList.value[index].id,
|
|
|
+ message_id: subtaskMessageList[i].id,
|
|
|
+ is_teacher_reply_student: true,
|
|
|
+ student_id: props.curStudentId
|
|
|
+ }).then(({ status }) => {
|
|
|
+ if (status === 1) {
|
|
|
+ subtaskMessageList.splice(i, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 添加点评
|
|
|
+ * @param {Number} taskIndex
|
|
|
+ */
|
|
|
+function addRemark(taskIndex) {
|
|
|
+ taskList.value[taskIndex].isRemark = true;
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -143,5 +288,41 @@ let taskType = inject('taskType');
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .task-remark {
|
|
|
+ padding: 24px;
|
|
|
+ margin-top: 24px;
|
|
|
+ background-color: #fff;
|
|
|
+ border: 1px solid rgba(0, 0, 0, 8%);
|
|
|
+ border-radius: 8px;
|
|
|
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 8%);
|
|
|
+
|
|
|
+ &-title {
|
|
|
+ margin-bottom: 8px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .add-remark {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ margin-top: 24px;
|
|
|
+
|
|
|
+ &-button {
|
|
|
+ padding: 4px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #fff;
|
|
|
+ cursor: pointer;
|
|
|
+ background-color: #5498ff;
|
|
|
+ border-radius: 4px;
|
|
|
+
|
|
|
+ .plus {
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ margin-right: 4px;
|
|
|
+ vertical-align: -7px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|