|
@@ -52,7 +52,7 @@
|
|
|
<el-col :span="21" class="right">
|
|
|
<el-col :span="24" class="date">
|
|
|
<i class="el-icon-user icon"></i>
|
|
|
- <span>评论发布于{{ publish_time }}</span>
|
|
|
+ <span>评论发布于{{ item.meta | getDate }}</span>
|
|
|
<span>{{ index + 2 }}楼</span>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="info">
|
|
@@ -138,7 +138,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async search({ skip = 0, limit = this.limit, newsid = this.newsid } = { skip: 0, limit: this.limit }) {
|
|
|
- let res = await this.commentquery({ skip, limit, newsid });
|
|
|
+ let res = await this.commentquery({ skip, limit, newsid, status: 1 });
|
|
|
console.log(res);
|
|
|
this.$set(this, `list`, res.data);
|
|
|
this.$set(this, `total`, res.total);
|
|
@@ -148,13 +148,23 @@ export default {
|
|
|
this.$message.error('游客身份无法评论,请先登录');
|
|
|
return;
|
|
|
} else {
|
|
|
- this.form.newsid = this.newsid;
|
|
|
- this.form.uid = this.user.uid;
|
|
|
- let data = this.form;
|
|
|
- let res = await this.commentCreate(data);
|
|
|
- console.log(res);
|
|
|
- this.$checkRes(res, '评论成功', '评论失败');
|
|
|
- this.search();
|
|
|
+ if (this.id) {
|
|
|
+ this.form.newsid = this.id;
|
|
|
+ this.form.uid = this.user.uid;
|
|
|
+ let data = this.form;
|
|
|
+ let res = await this.commentCreate(data);
|
|
|
+ console.log(res);
|
|
|
+ this.$checkRes(res, '评论成功', '评论失败');
|
|
|
+ this.search();
|
|
|
+ } else {
|
|
|
+ this.form.newsid = this.newsid;
|
|
|
+ this.form.uid = this.user.uid;
|
|
|
+ let data = this.form;
|
|
|
+ let res = await this.commentCreate(data);
|
|
|
+ console.log(res);
|
|
|
+ this.$checkRes(res, '评论成功', '评论失败');
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
},
|