|
@@ -144,13 +144,18 @@ export default {
|
|
|
this.$set(this, `total`, res.total);
|
|
|
},
|
|
|
async submit() {
|
|
|
- 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.user.uid) {
|
|
|
+ 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();
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
filters: {
|