lrf 2 năm trước cách đây
mục cha
commit
f7aec088ed
2 tập tin đã thay đổi với 22 bổ sung9 xóa
  1. 21 8
      src/layout/header/notice.vue
  2. 1 1
      src/plugins/setting.js

+ 21 - 8
src/layout/header/notice.vue

@@ -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',
+        });
+      }
     },
   },
 };

+ 1 - 1
src/plugins/setting.js

@@ -16,7 +16,7 @@ const dev = {
   login: 'tehqDev', //visit
   passcode: 'tehqDev', //visit123
 };
-
+Vue.prototype.$ex = process.env.NODE_ENV === 'development' ? 't_m_dev_local' : 't_m';
 Vue.config.stomp = {
   // brokerURL: 'ws://192.168.1.118/ws',
   brokerURL: '/ws', // ws://${location.host}/ws