留言板调整

This commit is contained in:
fan 2020-11-17 19:06:59 +08:00
parent 842c10a3f3
commit 9a470268b2

View File

@ -153,6 +153,10 @@ export default {
this.$message.error('留言内容超出最大长度!'); this.$message.error('留言内容超出最大长度!');
return; return;
} }
if (!this.content) {
this.$message.error('留言内容不能为空!');
return;
}
answerPost({postId: 1, content: this.content}).then(resp => { answerPost({postId: 1, content: this.content}).then(resp => {
this.pageNum = Math.ceil(resp.data / this.pageSize); this.pageNum = Math.ceil(resp.data / this.pageSize);
this.handleCurrentChange(); this.handleCurrentChange();
@ -305,7 +309,7 @@ export default {
changeCommentContent(val) { changeCommentContent(val) {
if (this.replyUserName && val.startsWith(this.replyUserName)) { if (this.replyUserName && val.startsWith(this.replyUserName)) {
this.commentContentNoName = val.slice(this.replyUserName.length); this.commentContentNoName = val.slice(this.replyUserName.length);
} else { } else if (this.replyUserName) {
this.commentContent = this.replyUserName + this.commentContentNoName; this.commentContent = this.replyUserName + this.commentContentNoName;
} }
} }