|
@@ -42,17 +42,30 @@ export default {
|
|
|
const shop_id = _.get(this.user, 'shop._id');
|
|
|
if (!shop_id) return;
|
|
|
this.$stomp({
|
|
|
- [`/exchange/shopMsg/${shop_id}`]: this.onMessage,
|
|
|
+ [`/exchange/${this.$ex}/${shop_id}`]: this.onMessage,
|
|
|
});
|
|
|
},
|
|
|
onMessage(message) {
|
|
|
- this.$notify({
|
|
|
- title: '新消息',
|
|
|
- message: '您有新的消息,请注意及时处理!',
|
|
|
- position: 'top-right',
|
|
|
- type: 'warning',
|
|
|
- });
|
|
|
- this.getNotRead();
|
|
|
+ let body = message.body;
|
|
|
+ if (!body) return;
|
|
|
+ body = JSON.parse(body);
|
|
|
+ const type = body.type;
|
|
|
+ if (type === 'shopMsg') {
|
|
|
+ this.$notify({
|
|
|
+ title: '新消息',
|
|
|
+ message: '您有新的消息,请注意及时处理!',
|
|
|
+ position: 'top-right',
|
|
|
+ type: 'warning',
|
|
|
+ });
|
|
|
+ this.getNotRead();
|
|
|
+ } else if (type === 'chat') {
|
|
|
+ this.$notify({
|
|
|
+ title: '新消息',
|
|
|
+ message: '有顾客进行咨询,请及时回复!',
|
|
|
+ position: 'top-right',
|
|
|
+ type: 'warning',
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|