|
|
@@ -47,7 +47,7 @@
|
|
|
|
|
|
<el-divider v-if="isCreator || isCourseSelected"/>
|
|
|
|
|
|
- <el-card>
|
|
|
+ <el-card v-if="isCreator || isCourseSelected">
|
|
|
|
|
|
<div v-if="isCreator || isCourseSelected" class="course-tabs">
|
|
|
<el-radio-group v-model="tabName" size="large">
|
|
|
@@ -180,27 +180,54 @@
|
|
|
></FileEntry>
|
|
|
</div>
|
|
|
<div v-else-if="tabName==='comment'">
|
|
|
- <el-input v-model="commentContent" placeholder="发表一条友善的评论">
|
|
|
- <template #append>
|
|
|
- <el-button type="primary" @click="createComment">发表评论</el-button>
|
|
|
- </template>
|
|
|
- </el-input>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="20">
|
|
|
+ <el-input v-model="commentContent" placeholder="发表一条友善的评论"/>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-button style="width: 100%" type="primary" @click="createComment" plain>发表评论</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
<el-divider/>
|
|
|
<div class="comment">
|
|
|
- <div v-for="message in commentTree" :key="message.id" class="comment-body">
|
|
|
+ <div v-for="comments in commentTree" :key="comments.id" class="comment-body">
|
|
|
<div class="comment-main">
|
|
|
- <el-row style="font-weight: bold; margin-bottom: 10px">
|
|
|
- <el-col>{{ message.messages[message.mainId].sender.name }}</el-col>
|
|
|
- <el-col>{{ message.messages[message.mainId].createdAt.substring(0, 16) }}</el-col>
|
|
|
+ <el-row>
|
|
|
+ <div
|
|
|
+ style="color: white;background: #619dc9;border-radius: 50%;padding: 10px;width: 20px;height: 20px;display: flex;justify-content: center;align-items: center; margin: 10px 10px 0 0">
|
|
|
+ <span style="color: white; font-weight: bold;font-size: 24px;">{{ comments.mainMessage.sender.name.substring(0, 1) }}</span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-row style="font-weight: bold;">
|
|
|
+ {{ comments.mainMessage.sender.name }}
|
|
|
+ </el-row>
|
|
|
+ <el-row style="font-size: small; color: #6d6d6d; margin-bottom: 6px">
|
|
|
+ {{ comments.mainMessage.createdAt.substring(0, 16).replace("T", " ") }}
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ {{ comments.mainMessage.content }}
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
</el-row>
|
|
|
- <el-row>{{ message.messages[message.mainId].content }}</el-row>
|
|
|
</div>
|
|
|
- <div v-for="(key,child) in message.messages" :key="'message'+key" class="comment-child">
|
|
|
- <el-row v-if="!child.targetType==='COURSE'" style="font-weight: bold; margin-bottom: 10px">
|
|
|
- {{ child.sender.name }}
|
|
|
- </el-row>
|
|
|
- <el-row v-if="!child.targetType==='COURSE'">
|
|
|
- @{{ message.messages[child.targetId].sender.name }}:{{ message.messages[child.targetId].content }}
|
|
|
+ <div v-for="child in comments.children" :key="child.id" class="comment-child">
|
|
|
+ <el-row>
|
|
|
+ <div
|
|
|
+ style="color: white;background: #619dc9;border-radius: 50%;padding: 10px;width: 20px;height: 20px;display: flex;justify-content: center;align-items: center; margin: 10px 10px 0 0">
|
|
|
+ <span style="color: white; font-weight: bold;font-size: 24px;">{{ child.sender.name.substring(0, 1) }}</span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-row style="font-weight: bold; margin-bottom: 6px">
|
|
|
+ {{ child.sender.name }}
|
|
|
+ </el-row>
|
|
|
+ <el-row style="font-size: small; color: #6d6d6d; margin-bottom: 6px">
|
|
|
+ {{ child.createdAt.substring(0, 16).replace("T", " ") }}
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <span style="color: black;">{{ child.targetId === null ? "" : `@${comments.children[child.targetId].sender.name}: ` }}</span>{{ child.content }}<span
|
|
|
+ @click="handleReplyClick(child)" class="reply-button">回复</span>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
<el-divider/>
|
|
|
@@ -240,7 +267,7 @@
|
|
|
<script>
|
|
|
import NoticeItem from "./components/NoticeItem";
|
|
|
import FileEntry from "./components/FileEntry";
|
|
|
-import {ElMessageBox, ElMessage} from "element-plus";
|
|
|
+import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
import variables from "@/utils/variables";
|
|
|
|
|
|
export default {
|
|
|
@@ -296,11 +323,11 @@ export default {
|
|
|
color: "",
|
|
|
},
|
|
|
noticeTypeMap: {
|
|
|
- announce: {type: "公告", title: "发布公告", color: themeColor.orange},
|
|
|
- homework: {type: "作业", title: "发布作业", color: themeColor.blue},
|
|
|
- exam: {type: "考试", title: "发布考试", color: themeColor.red},
|
|
|
+ announce: { type: "公告", title: "发布公告", color: themeColor.orange },
|
|
|
+ homework: { type: "作业", title: "发布作业", color: themeColor.blue },
|
|
|
+ exam: { type: "考试", title: "发布考试", color: themeColor.red },
|
|
|
},
|
|
|
- newNoticeInfo: {noticeDescription: "", priority: "1", fileList: []},
|
|
|
+ newNoticeInfo: { noticeDescription: "", priority: "1", fileList: [] },
|
|
|
postNoticeInfo: {},
|
|
|
fileEntryList: [{
|
|
|
id: 1,
|
|
|
@@ -349,7 +376,6 @@ export default {
|
|
|
},
|
|
|
imgUrl() {
|
|
|
return this.courseInfo.imageUrl === null ? this.noImgUrl : this.courseInfo.imageUrl;
|
|
|
- // + "?t=" + Date.now().valueOf();
|
|
|
},
|
|
|
courseTaskList() {
|
|
|
if (!this.evalExamList || !this.coderExamList) {
|
|
|
@@ -441,8 +467,6 @@ export default {
|
|
|
}
|
|
|
window.open("https://coder.seec.seecoder.cn/exam/create/?id_token=" + this.$store.state.user.token);
|
|
|
break;
|
|
|
- default:
|
|
|
- break;
|
|
|
}
|
|
|
},
|
|
|
toTask(task) {
|
|
|
@@ -472,8 +496,6 @@ export default {
|
|
|
url = type === "eval" ? evalUrl : coderUrl;
|
|
|
}
|
|
|
break;
|
|
|
- default:
|
|
|
- break;
|
|
|
}
|
|
|
} else {
|
|
|
evalUrl = "https://eval.seec.seecoder.cn/teacher/exam/";
|
|
|
@@ -497,8 +519,7 @@ export default {
|
|
|
.then(() => {
|
|
|
this.announcementFormDialog = false;
|
|
|
this.$refs.announceFormRef.resetFields();
|
|
|
- })
|
|
|
- .catch(err => console.log(err));
|
|
|
+ });
|
|
|
},
|
|
|
handlePublishAnnouncement() {
|
|
|
const _this = this;
|
|
|
@@ -515,8 +536,7 @@ export default {
|
|
|
} else {
|
|
|
updateAnnouncement();
|
|
|
}
|
|
|
- })
|
|
|
- .catch();
|
|
|
+ });
|
|
|
} else {
|
|
|
if (this.announcementForm.id === null) {
|
|
|
createAnnouncement();
|
|
|
@@ -527,7 +547,7 @@ export default {
|
|
|
|
|
|
function createAnnouncement() {
|
|
|
let announcementVO = {
|
|
|
- sender: {id: _this.$store.state.user.id,},
|
|
|
+ sender: { id: _this.$store.state.user.id, },
|
|
|
courseId: _this.courseInfo.id,
|
|
|
title: _this.announcementForm.title,
|
|
|
content: _this.announcementForm.content,
|
|
|
@@ -540,8 +560,7 @@ export default {
|
|
|
_this.announcementFormDialog = false;
|
|
|
_this.$refs.announceFormRef.resetFields();
|
|
|
ElMessage.success("新建公告完成");
|
|
|
- })
|
|
|
- .catch();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
function updateAnnouncement() {
|
|
|
@@ -562,8 +581,7 @@ export default {
|
|
|
_this.announcementFormDialog = false;
|
|
|
_this.$refs.announceFormRef.resetFields();
|
|
|
ElMessage.success("修改公告完成");
|
|
|
- })
|
|
|
- .catch();
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
beforeUpdateAnnouncement(item) {
|
|
|
@@ -585,11 +603,7 @@ export default {
|
|
|
this.$apis.deleteAnnouncement(item.id)
|
|
|
.then(() => {
|
|
|
this.announcementList.splice(index, 1);
|
|
|
- })
|
|
|
- .catch();
|
|
|
- })
|
|
|
- .catch(action => {
|
|
|
- console.log(action);
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
announcementContent(item) {
|
|
|
@@ -621,7 +635,7 @@ export default {
|
|
|
confirmButtonText: "立即选课",
|
|
|
cancelButtonText: "我再想想",
|
|
|
})
|
|
|
- .then(({value}) => {
|
|
|
+ .then(({ value }) => {
|
|
|
if (value !== this.courseInfo.invitationCode) {
|
|
|
ElMessage.error("选课码错误");
|
|
|
} else {
|
|
|
@@ -664,58 +678,35 @@ export default {
|
|
|
.catch(err => {
|
|
|
ElMessage.error("handleCancelCourse: " + err);
|
|
|
});
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
});
|
|
|
},
|
|
|
// tab页相关
|
|
|
- switchTab(tabName) {
|
|
|
+ async switchTab(tabName) {
|
|
|
switch (tabName) {
|
|
|
case "task":
|
|
|
if (this.isTeacher) {
|
|
|
if (this.courseInfo.evalId !== null) {
|
|
|
- this.$apis.getTeacherEvalExamsByCourseId(this.courseInfo.evalId)
|
|
|
- .then(res => {
|
|
|
- this.evalExamList = res.data.data;
|
|
|
- });
|
|
|
+ this.evalExamList = (await this.$apis.getTeacherEvalExamsByCourseId(this.courseInfo.evalId)).data.data;
|
|
|
}
|
|
|
if (this.courseInfo.coderId !== null) {
|
|
|
- this.$apis.getTeacherCoderExamsByCourseId(this.courseInfo.coderId)
|
|
|
- .then(res => {
|
|
|
- this.coderExamList = res.data.data;
|
|
|
- });
|
|
|
+ this.coderExamList = (await this.$apis.getTeacherCoderExamsByCourseId(this.courseInfo.coderId)).data.data;
|
|
|
}
|
|
|
} else if (this.isStudent) {
|
|
|
if (this.courseInfo.evalId !== null) {
|
|
|
- this.$apis.getStudentEvalExamsByCourseId(this.courseInfo.evalId)
|
|
|
- .then(res => {
|
|
|
- this.evalExamList = res.data.data;
|
|
|
- });
|
|
|
+ this.evalExamList = (await this.$apis.getStudentEvalExamsByCourseId(this.courseInfo.evalId)).data.data;
|
|
|
}
|
|
|
if (this.courseInfo.coderId !== null) {
|
|
|
- this.$apis.getStudentCoderExamsByCourseId(this.courseInfo.coderId)
|
|
|
- .then(res => {
|
|
|
- this.coderExamList = res.data.data;
|
|
|
- });
|
|
|
+ this.coderExamList = (await this.$apis.getStudentCoderExamsByCourseId(this.courseInfo.coderId)).data.data;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case "notice":
|
|
|
- this.$apis.getAnnouncementsByCourseId(this.$route.params.id)
|
|
|
- .then(res => {
|
|
|
- this.announcementList = res.data.data;
|
|
|
- });
|
|
|
+ this.announcementList = (await this.$apis.getAnnouncementsByCourseId(this.$route.params.id)).data.data;
|
|
|
break;
|
|
|
case "courseware":
|
|
|
break;
|
|
|
case "comment":
|
|
|
- this.$apis.getCommentsByCourseId(this.$route.params.id)
|
|
|
- .then(res => {
|
|
|
- this.commentTree = res.data.data;
|
|
|
- })
|
|
|
- .catch();
|
|
|
- break;
|
|
|
- default:
|
|
|
+ this.commentTree = (await this.$apis.getCommentsByCourseId(this.$route.params.id)).data.data;
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
@@ -736,12 +727,15 @@ export default {
|
|
|
createdAt: new Date(),
|
|
|
})
|
|
|
.then(res => {
|
|
|
- this.commentTree.push({mainMessage: res.data.data, children: []});
|
|
|
+ console.log(res);
|
|
|
+ this.commentTree.push({ mainMessage: res.data.data, children: [] });
|
|
|
this.commentContent = "";
|
|
|
- })
|
|
|
- .catch();
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
+ handleReplyClick(target) {
|
|
|
+ alert(target);
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|