|
@@ -117,7 +117,6 @@ export default {
|
|
info: {},
|
|
info: {},
|
|
buyerList: [],
|
|
buyerList: [],
|
|
sellerList: [],
|
|
sellerList: [],
|
|
- sending: true,
|
|
|
|
text: '',
|
|
text: '',
|
|
}),
|
|
}),
|
|
created() {
|
|
created() {
|
|
@@ -145,9 +144,9 @@ export default {
|
|
this.$message.error('游客不能发言,请先注册');
|
|
this.$message.error('游客不能发言,请先注册');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.$set(this, `sending`, false);
|
|
|
|
|
|
+ if (!this.checkUser()) return;
|
|
if (this.content != '') {
|
|
if (this.content != '') {
|
|
- let object = { number: this.id, sender_name: this.user.name, content: this.content };
|
|
|
|
|
|
+ let object = { number: this.id, sender_name: this.user.name, content: this.content, role: this.user.role };
|
|
if (this.user.uid) object.sender_id = this.user.uid;
|
|
if (this.user.uid) object.sender_id = this.user.uid;
|
|
let res = await this.create(object);
|
|
let res = await this.create(object);
|
|
this.$refs.editor.setContent();
|
|
this.$refs.editor.setContent();
|
|
@@ -155,7 +154,6 @@ export default {
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
this.$checkRes(res, null, res.errmsg || '发言失败');
|
|
this.$checkRes(res, null, res.errmsg || '发言失败');
|
|
} else this.$message.error('请输入信息后发送');
|
|
} else this.$message.error('请输入信息后发送');
|
|
- this.$set(this, `sending`, true);
|
|
|
|
},
|
|
},
|
|
channel() {
|
|
channel() {
|
|
this.$stomp({
|
|
this.$stomp({
|
|
@@ -167,15 +165,44 @@ export default {
|
|
let body = _.get(message, 'body');
|
|
let body = _.get(message, 'body');
|
|
if (body) {
|
|
if (body) {
|
|
body = JSON.parse(body);
|
|
body = JSON.parse(body);
|
|
- let is_seller = this.sellerList.find(f => f.user_id == body.sender_id);
|
|
|
|
- if (is_seller) this.mainTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
|
|
|
|
- else this.otherTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
|
|
|
|
|
|
+ if (body.role == '5' || body.role == '1')
|
|
|
|
+ this.mainTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
|
|
|
|
+ else {
|
|
|
|
+ let is_seller = this.sellerList.find(f => f.user_id == body.sender_id);
|
|
|
|
+ if (is_seller) this.mainTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
|
|
|
|
+ else this.otherTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
|
|
|
|
+ }
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
document.getElementById('chatBuy').scrollTop = document.getElementById('chatBuy').scrollHeight + 150;
|
|
document.getElementById('chatBuy').scrollTop = document.getElementById('chatBuy').scrollHeight + 150;
|
|
document.getElementById('chatSell').scrollTop = document.getElementById('chatSell').scrollHeight + 150;
|
|
document.getElementById('chatSell').scrollTop = document.getElementById('chatSell').scrollHeight + 150;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ checkUser() {
|
|
|
|
+ let result = true;
|
|
|
|
+ if (this.user.role == '5' || this.user.role == '1') return result;
|
|
|
|
+ else {
|
|
|
|
+ let res = this.buyerList.find(f => f.user_id == this.user.uid);
|
|
|
|
+ if (!res) {
|
|
|
|
+ res = this.sellerList.find(f => f.user_id == this.user.uid);
|
|
|
|
+ if (!res) {
|
|
|
|
+ this.$message.error('您没有参与这场对接会,无法发言');
|
|
|
|
+ result = false;
|
|
|
|
+ } else {
|
|
|
|
+ if (res.status != '1') {
|
|
|
|
+ this.$message.error('您没有通过审核,无法发言');
|
|
|
|
+ result = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (res.status != '1') {
|
|
|
|
+ this.$message.error('您没有通过审核,无法发言');
|
|
|
|
+ result = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState(['user']),
|
|
...mapState(['user']),
|