|
@@ -52,19 +52,20 @@ export default {
|
|
if (this.$checkRes(res)) this.$set(this, `list`, _.reverse(res.data));
|
|
if (this.$checkRes(res)) this.$set(this, `list`, _.reverse(res.data));
|
|
},
|
|
},
|
|
async send() {
|
|
async send() {
|
|
- if (!this.user.uid) {
|
|
|
|
- this.$message.error('游客不能发言,请先注册');
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ // if (!this.user.uid) {
|
|
|
|
+ // this.$message.error('游客不能发言,请先注册');
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
if (this.text != '') {
|
|
if (this.text != '') {
|
|
let object = { sender_name: this.user.name, content: this.text };
|
|
let object = { sender_name: this.user.name, content: this.text };
|
|
- if (this.user.id) object.sender_id = this.user.id;
|
|
|
|
|
|
+ if (this.user.uid) object.sender_id = this.user.uid;
|
|
//TODO接口
|
|
//TODO接口
|
|
let res = await this.create(object);
|
|
let res = await this.create(object);
|
|
this.$checkRes(res, null, res.errmsg || '发言失败');
|
|
this.$checkRes(res, null, res.errmsg || '发言失败');
|
|
} else this.$message.error('请输入信息后发送');
|
|
} else this.$message.error('请输入信息后发送');
|
|
},
|
|
},
|
|
channel() {
|
|
channel() {
|
|
|
|
+ console.log('in function:');
|
|
this.$stomp({
|
|
this.$stomp({
|
|
[`/exchange/public_chat`]: this.onMessage,
|
|
[`/exchange/public_chat`]: this.onMessage,
|
|
});
|
|
});
|