|
|
@@ -59,8 +59,11 @@
|
|
|
<div v-if="isCreator">
|
|
|
<el-popover v-if="tabName==='task'" trigger="hover">
|
|
|
<div style="display: flex;justify-content: space-around;">
|
|
|
- <el-button v-if="courseInfo.coderId!==null" type="text" @click="addTest('coder')" id="coder-button">Coder</el-button>
|
|
|
- <el-button v-if="courseInfo.evalId!==null" type="text" @click="addTest('eval')" id="eval-button">Eval</el-button>
|
|
|
+ <el-button v-if="courseInfo.coderId!==null" type="text" @click="addTest('coder')" id="coder-button">
|
|
|
+ Coder
|
|
|
+ </el-button>
|
|
|
+ <el-button v-if="courseInfo.evalId!==null" type="text" @click="addTest('eval')" id="eval-button">Eval
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
<template #reference>
|
|
|
<el-button>添加测试</el-button>
|
|
|
@@ -207,8 +210,11 @@
|
|
|
{{ comments.mainMessage.createdAt.substring(0, 16).replace("T", " ") }}
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- {{ comments.mainMessage.content }}<span @click="handleReplyClick(comments.mainMessage, index)"
|
|
|
- class="reply-button">回复</span>
|
|
|
+ {{ comments.mainMessage.content }}
|
|
|
+ <span @click="handleReplyClick(comments.mainMessage, index)" class="reply-button">回复</span>
|
|
|
+ <span v-if="isOwnComment(comments.mainMessage.sender.id)"
|
|
|
+ @click="deleteComment(comments.mainMessage.id)"
|
|
|
+ class="reply-button">删除</span>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</el-row>
|
|
|
@@ -231,8 +237,12 @@
|
|
|
<el-row>
|
|
|
<span style="color: black;">{{
|
|
|
child.targetId === null ? "" : `@${comments.children[child.targetId].sender.name}: `
|
|
|
- }}</span>{{ child.content }}<span
|
|
|
- @click="handleReplyClick(child,index)" class="reply-button">回复</span>
|
|
|
+ }}</span>
|
|
|
+ {{ child.content }}
|
|
|
+ <span @click="handleReplyClick(child,index)" class="reply-button">回复</span>
|
|
|
+ <span v-if="isOwnComment(child.sender.id)"
|
|
|
+ @click="deleteComment(child.id)"
|
|
|
+ class="reply-button">删除</span>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</el-row>
|
|
|
@@ -273,7 +283,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 {
|
|
|
@@ -327,11 +337,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,
|
|
|
@@ -393,6 +403,12 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ isOwnComment(){
|
|
|
+ const _this = this;
|
|
|
+ return function (senderId) {
|
|
|
+ return senderId === Number(_this.$store.state.user.id);
|
|
|
+ };
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
switch (this.$route.params.jump_from_message) {
|
|
|
@@ -551,7 +567,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,
|
|
|
@@ -639,7 +655,7 @@ export default {
|
|
|
confirmButtonText: "立即选课",
|
|
|
cancelButtonText: "我再想想",
|
|
|
})
|
|
|
- .then(({ value }) => {
|
|
|
+ .then(({value}) => {
|
|
|
if (value !== this.courseInfo.invitationCode) {
|
|
|
ElMessage.error("选课码错误");
|
|
|
} else {
|
|
|
@@ -733,18 +749,27 @@ export default {
|
|
|
.then(res => {
|
|
|
const msg = res.data.data;
|
|
|
msg.createdAt = this.timestampToTime(msg.createdAt);
|
|
|
- this.commentTree.push({ mainMessage: msg, children: {} });
|
|
|
+ this.commentTree.push({mainMessage: msg, children: {}});
|
|
|
this.commentContent = "";
|
|
|
ElMessage.success("发送成功");
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ async deleteComment(commentId) {
|
|
|
+ const res = (await this.$apis.deleteMessage(commentId)).data.data || null;
|
|
|
+ if (res == null) {
|
|
|
+ alert(res);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$message.success(res);
|
|
|
+ this.commentTree = (await this.$apis.getCommentsByCourseId(this.$route.params.id)).data.data;
|
|
|
+ },
|
|
|
handleReplyClick(target, index) {
|
|
|
ElMessageBox.prompt("请输入评论内容", "回复", {
|
|
|
confirmButtonText: "发送",
|
|
|
cancelButtonText: "取消",
|
|
|
})
|
|
|
- .then(({ value }) => {
|
|
|
+ .then(({value}) => {
|
|
|
if (value === "") {
|
|
|
ElMessage.error("无法发表空评论");
|
|
|
} else {
|