chat-customer-47net 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1004,6 +1004,10 @@ const __vue2_script$7 = {
1004
1004
  initData: {
1005
1005
  type: Object,
1006
1006
  default: () => ({})
1007
+ },
1008
+ buttonLock: {
1009
+ type: Boolean,
1010
+ default: false
1007
1011
  }
1008
1012
  },
1009
1013
  computed: {
@@ -1077,7 +1081,7 @@ const __vue2_script$7 = {
1077
1081
  }
1078
1082
  };
1079
1083
  const __cssModules$7 = {};
1080
- var __component__$7 = /* @__PURE__ */normalizeComponent(__vue2_script$7, render$8, staticRenderFns$7, false, __vue2_injectStyles$7, "ae646dbc", null, null);
1084
+ var __component__$7 = /* @__PURE__ */normalizeComponent(__vue2_script$7, render$8, staticRenderFns$7, false, __vue2_injectStyles$7, "4b80e726", null, null);
1081
1085
  function __vue2_injectStyles$7(context) {
1082
1086
  for (let o in __cssModules$7) {
1083
1087
  this[o] = __cssModules$7[o];
@@ -6100,7 +6104,12 @@ var render$5 = function () {
6100
6104
  }
6101
6105
  }, [_vm.userOrOther === "user" || _vm.itemUserId === _vm.userId ? _c("div", {
6102
6106
  staticClass: "consult-47this-chat-item-user"
6103
- }, [_c("p", [_vm._v(" " + _vm._s(_vm.message) + " "), _c("span", {
6107
+ }, [_c("p", [_c("b", {
6108
+ staticClass: "markdown-body",
6109
+ domProps: {
6110
+ "innerHTML": _vm._s(_vm.markdownToHtml)
6111
+ }
6112
+ }), _c("span", {
6104
6113
  staticClass: "time"
6105
6114
  }, [_vm._v(_vm._s(_vm.time))])])]) : _c("div", {
6106
6115
  staticClass: "consult-47this-chat-item-consult"
@@ -6325,6 +6334,10 @@ const __vue2_script$4 = {
6325
6334
  activeItem: {
6326
6335
  type: Object,
6327
6336
  default: () => ({})
6337
+ },
6338
+ socket: {
6339
+ type: Object,
6340
+ default: () => ({})
6328
6341
  }
6329
6342
  },
6330
6343
  data() {
@@ -6345,9 +6358,19 @@ const __vue2_script$4 = {
6345
6358
  },
6346
6359
  markdownToHtml() {
6347
6360
  const text = this.message.replace(/ {2,}/g, match => " ".repeat(match.length));
6361
+ const renderer = new marked.Renderer();
6362
+ renderer.link = href => {
6363
+ const currentDomain = window.location.hostname;
6364
+ const targetDomain = new URL(href.href).hostname;
6365
+ if (targetDomain === currentDomain) {
6366
+ return `<a href="${href.href}" @click.prevent="handleInternalLink('${href.href}')"${href.title ? ` title="${href.title}"` : ""}>${href.text}</a>`;
6367
+ }
6368
+ return `<a href="${href.href}" target="_blank" rel="noopener noreferrer"${href.title ? ` title="${href.title}"` : ""}>${href.text}</a>`;
6369
+ };
6348
6370
  marked.setOptions({
6349
6371
  breaks: true,
6350
- sanitize: false
6372
+ sanitize: false,
6373
+ renderer
6351
6374
  });
6352
6375
  return marked(text);
6353
6376
  }
@@ -6363,9 +6386,6 @@ const __vue2_script$4 = {
6363
6386
  roomId: this.roomId,
6364
6387
  userId: this.userId
6365
6388
  }, this.initData.socketUrl);
6366
- if (this.initData.socket) {
6367
- this.initData.socket.emit("setVisitedpage", this.userId, window.location.href, this.initData.siteName);
6368
- }
6369
6389
  } catch (error) {
6370
6390
  console.error("changeByHumanAgent error:", error);
6371
6391
  } finally {
@@ -6465,11 +6485,18 @@ const __vue2_script$4 = {
6465
6485
  question: this.clientQuestion,
6466
6486
  updateTime: this.updateTime
6467
6487
  });
6488
+ },
6489
+ handleInternalLink(href) {
6490
+ if (this.$router) {
6491
+ this.$router.push(href);
6492
+ } else {
6493
+ window.location.href = href;
6494
+ }
6468
6495
  }
6469
6496
  }
6470
6497
  };
6471
6498
  const __cssModules$4 = {};
6472
- var __component__$4 = /* @__PURE__ */normalizeComponent(__vue2_script$4, render$5, staticRenderFns$4, false, __vue2_injectStyles$4, "4c5e7de8", null, null);
6499
+ var __component__$4 = /* @__PURE__ */normalizeComponent(__vue2_script$4, render$5, staticRenderFns$4, false, __vue2_injectStyles$4, "6cf68fcc", null, null);
6473
6500
  function __vue2_injectStyles$4(context) {
6474
6501
  for (let o in __cssModules$4) {
6475
6502
  this[o] = __cssModules$4[o];
@@ -6519,7 +6546,8 @@ var render$3 = function () {
6519
6546
  "init-data": _vm.initData,
6520
6547
  "type": item.type,
6521
6548
  "update-time": item.updateTime,
6522
- "active-item": _vm.activeItem
6549
+ "active-item": _vm.activeItem,
6550
+ "socket": _vm.socket
6523
6551
  },
6524
6552
  on: {
6525
6553
  "submitEmail": _vm.submitEmail,
@@ -6602,6 +6630,10 @@ const __vue2_script$3 = {
6602
6630
  activeItem: {
6603
6631
  type: Object,
6604
6632
  default: () => ({})
6633
+ },
6634
+ socket: {
6635
+ type: Object,
6636
+ default: () => ({})
6605
6637
  }
6606
6638
  },
6607
6639
  data() {
@@ -6668,6 +6700,7 @@ const __vue2_script$3 = {
6668
6700
  },
6669
6701
  updateMessage(event) {
6670
6702
  this.message = event.target.value;
6703
+ this.$emit("updateMessage");
6671
6704
  },
6672
6705
  loadMore() {
6673
6706
  if (this.isInit || this.loading || this.noMore) {
@@ -6734,7 +6767,7 @@ const __vue2_script$3 = {
6734
6767
  }
6735
6768
  };
6736
6769
  const __cssModules$3 = {};
6737
- var __component__$3 = /* @__PURE__ */normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3, "3bfe1a1a", null, null);
6770
+ var __component__$3 = /* @__PURE__ */normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3, "b72de9f2", null, null);
6738
6771
  function __vue2_injectStyles$3(context) {
6739
6772
  for (let o in __cssModules$3) {
6740
6773
  this[o] = __cssModules$3[o];
@@ -6775,7 +6808,8 @@ var render$2 = function () {
6775
6808
  "themeColors": _vm.initData.themeColors,
6776
6809
  "conversations": _vm.conversations,
6777
6810
  "messages": _vm.messages,
6778
- "activeItem": _vm.activeItem
6811
+ "activeItem": _vm.activeItem,
6812
+ "socket": _vm.socket
6779
6813
  },
6780
6814
  on: {
6781
6815
  "handleRoute": _vm.handleRoute,
@@ -6786,7 +6820,8 @@ var render$2 = function () {
6786
6820
  "loadMore": _vm.loadMore,
6787
6821
  "submitEmail": _vm.submitEmail,
6788
6822
  "sendLeaveMessage": _vm.sendLeaveMessage,
6789
- "restart": _vm.restart
6823
+ "restart": _vm.restart,
6824
+ "updateMessage": _vm.updateMessage
6790
6825
  }
6791
6826
  })], 1);
6792
6827
  };
@@ -6809,6 +6844,10 @@ const __vue2_script$2 = {
6809
6844
  conversations: {
6810
6845
  type: Array,
6811
6846
  default: () => []
6847
+ },
6848
+ socket: {
6849
+ type: Object,
6850
+ default: () => ({})
6812
6851
  }
6813
6852
  },
6814
6853
  data() {
@@ -6824,7 +6863,8 @@ const __vue2_script$2 = {
6824
6863
  chatList: [],
6825
6864
  roomId: ""
6826
6865
  },
6827
- salesUserStatus: ""
6866
+ salesUserStatus: "",
6867
+ buttonLock: false
6828
6868
  };
6829
6869
  },
6830
6870
  computed: {
@@ -6858,9 +6898,6 @@ const __vue2_script$2 = {
6858
6898
  };
6859
6899
  });
6860
6900
  return list2;
6861
- },
6862
- socket() {
6863
- return this.initData.socket;
6864
6901
  }
6865
6902
  },
6866
6903
  watch: {
@@ -6870,6 +6907,9 @@ const __vue2_script$2 = {
6870
6907
  this.onListenMessage();
6871
6908
  this.onListenEnd();
6872
6909
  }
6910
+ },
6911
+ route(newVal, oldVal) {
6912
+ this.$emit("onChangeRoute", newVal);
6873
6913
  }
6874
6914
  },
6875
6915
  methods: {
@@ -6877,7 +6917,7 @@ const __vue2_script$2 = {
6877
6917
  this.userId = getClientId();
6878
6918
  },
6879
6919
  loginSocket() {
6880
- this.initData.socket.emit("login", {
6920
+ this.socket.emit("login", {
6881
6921
  userId: this.userId,
6882
6922
  userName: this.initData.userName,
6883
6923
  token: getToken(),
@@ -6896,6 +6936,8 @@ const __vue2_script$2 = {
6896
6936
  this.historyRoute.push(route);
6897
6937
  },
6898
6938
  handleNewConversation() {
6939
+ if (this.buttonLock) return;
6940
+ this.buttonLock = true;
6899
6941
  if (getClientId()) {
6900
6942
  this.createNewConversation("dialog");
6901
6943
  } else {
@@ -6911,6 +6953,7 @@ const __vue2_script$2 = {
6911
6953
  siteName: this.initData.siteName
6912
6954
  }, () => {
6913
6955
  this.handleRoute("dialog");
6956
+ this.buttonLock = false;
6914
6957
  });
6915
6958
  },
6916
6959
  onListenMessage() {
@@ -6955,7 +6998,7 @@ const __vue2_script$2 = {
6955
6998
  setClientId(res.userId);
6956
6999
  this.userId = res.userId;
6957
7000
  this.createNewConversation("dialog");
6958
- this.initData.socket.emit("login", {
7001
+ this.socket.emit("login", {
6959
7002
  userId: this.userId,
6960
7003
  userName: res.userName,
6961
7004
  token: getToken(),
@@ -6985,11 +7028,15 @@ const __vue2_script$2 = {
6985
7028
  if (err.status === 401) {
6986
7029
  localStorage.setItem("auth._token.login", "false");
6987
7030
  removeClientId();
6988
- this.handleRoute("sign");
7031
+ this.handleRoute("cover");
6989
7032
  }
7033
+ }).finally(() => {
7034
+ this.buttonLock = false;
6990
7035
  });
6991
7036
  },
6992
7037
  handleToConversation(conversation) {
7038
+ if (this.buttonLock) return;
7039
+ this.buttonLock = true;
6993
7040
  this.joinRoom(conversation.roomId);
6994
7041
  this.repeatOnChat(conversation.roomId);
6995
7042
  this.getChatList(conversation.roomId);
@@ -7022,6 +7069,7 @@ const __vue2_script$2 = {
7022
7069
  },
7023
7070
  async getChatList(roomId) {
7024
7071
  const query = {
7072
+ userId: this.userId,
7025
7073
  roomId,
7026
7074
  page: this.chats.page,
7027
7075
  size: 20
@@ -7086,6 +7134,7 @@ const __vue2_script$2 = {
7086
7134
  },
7087
7135
  async loadMore(callback) {
7088
7136
  const query = {
7137
+ userId: this.userId,
7089
7138
  roomId: this.onRoomId,
7090
7139
  page: this.chats.page,
7091
7140
  size: 20
@@ -7183,11 +7232,14 @@ const __vue2_script$2 = {
7183
7232
  }).catch(() => {
7184
7233
  this.salesUserStatus = "";
7185
7234
  });
7235
+ },
7236
+ updateMessage() {
7237
+ this.$emit("updateMessage");
7186
7238
  }
7187
7239
  }
7188
7240
  };
7189
7241
  const __cssModules$2 = {};
7190
- var __component__$2 = /* @__PURE__ */normalizeComponent(__vue2_script$2, render$2, staticRenderFns$2, false, __vue2_injectStyles$2, "d4fc1a0c", null, null);
7242
+ var __component__$2 = /* @__PURE__ */normalizeComponent(__vue2_script$2, render$2, staticRenderFns$2, false, __vue2_injectStyles$2, "28aea5c6", null, null);
7191
7243
  function __vue2_injectStyles$2(context) {
7192
7244
  for (let o in __cssModules$2) {
7193
7245
  this[o] = __cssModules$2[o];
@@ -7210,7 +7262,9 @@ var render$1 = function () {
7210
7262
  "touchstart": _vm.handleTouchStart,
7211
7263
  "touchend": _vm.handleTouchEnd
7212
7264
  }
7213
- });
7265
+ }, [_vm.remindNum ? _c("div", {
7266
+ staticClass: "consult-47this-remind-num"
7267
+ }, [_vm._v(_vm._s(_vm.remindNum))]) : _vm._e()]);
7214
7268
  };
7215
7269
  var staticRenderFns$1 = [];
7216
7270
  const ConsultButton_vue_vue_type_style_index_0_scoped_true_lang = "";
@@ -7220,11 +7274,16 @@ const __vue2_script$1 = {
7220
7274
  themeColors: {
7221
7275
  type: String,
7222
7276
  default: "transparent"
7277
+ },
7278
+ remindNum: {
7279
+ type: Number,
7280
+ default: 0
7223
7281
  }
7224
7282
  },
7225
7283
  data() {
7226
7284
  return {
7227
7285
  touchStartTime: 0
7286
+ // remindNum: 2
7228
7287
  };
7229
7288
  },
7230
7289
  methods: {
@@ -7246,7 +7305,7 @@ const __vue2_script$1 = {
7246
7305
  }
7247
7306
  };
7248
7307
  const __cssModules$1 = {};
7249
- var __component__$1 = /* @__PURE__ */normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1, "79220e51", null, null);
7308
+ var __component__$1 = /* @__PURE__ */normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1, "3d081358", null, null);
7250
7309
  function __vue2_injectStyles$1(context) {
7251
7310
  for (let o in __cssModules$1) {
7252
7311
  this[o] = __cssModules$1[o];
@@ -7272,11 +7331,15 @@ var render = function () {
7272
7331
  attrs: {
7273
7332
  "init-data": _vm.initData,
7274
7333
  "conversations": _vm.conversations,
7275
- "getInitData": _vm.getInitData
7334
+ "getInitData": _vm.getInitData,
7335
+ "socket": _vm.socket,
7336
+ "isSetVisitedpage": _vm.isSetVisitedpage
7276
7337
  },
7277
7338
  on: {
7278
7339
  "packUp": _vm.packUp,
7279
- "updateInitData": _vm.getInitData
7340
+ "updateInitData": _vm.getInitData,
7341
+ "onChangeRoute": _vm.onChangeRoute,
7342
+ "updateMessage": _vm.updateMessage
7280
7343
  }
7281
7344
  }), _vm.showButton ? _c("ConsultButton", {
7282
7345
  directives: [{
@@ -7286,7 +7349,8 @@ var render = function () {
7286
7349
  expression: "!showView"
7287
7350
  }],
7288
7351
  attrs: {
7289
- "theme-colors": _vm.initData.themeColors
7352
+ "theme-colors": _vm.initData.themeColors,
7353
+ "remindNum": _vm.unRead
7290
7354
  },
7291
7355
  on: {
7292
7356
  "click": _vm.handleClick
@@ -7312,21 +7376,50 @@ const __vue2_script = {
7312
7376
  conversations: [],
7313
7377
  userId: getClientId(),
7314
7378
  isHandlingStorage: false,
7315
- onCurrentValue: false
7379
+ onCurrentValue: false,
7380
+ onRoute: "cover",
7381
+ socket: null,
7382
+ audio: null,
7383
+ isAudioInited: false,
7384
+ onWindowUrl: window.location.href,
7385
+ isSetVisitedpage: true
7316
7386
  };
7317
7387
  },
7388
+ computed: {
7389
+ unRead() {
7390
+ var _a2;
7391
+ if (!this.initData.user) return 0;
7392
+ if (!this.initData.user.room) return 0;
7393
+ const room = this.initData.user.room;
7394
+ const unRead = ((_a2 = room.find(item => item.topic === this.initData.siteName)) == null ? void 0 : _a2.unRead) || 0;
7395
+ if (unRead > 99) {
7396
+ return 99;
7397
+ }
7398
+ return unRead;
7399
+ },
7400
+ customerAudio() {
7401
+ if (!this.initData.socketUrl) {
7402
+ return "";
7403
+ }
7404
+ return `${this.initData.socketUrl}/static/audio/unread.mp3`;
7405
+ }
7406
+ },
7318
7407
  mounted() {
7319
7408
  this.watchLocalStorage();
7320
- this.setCurrentUrl();
7321
7409
  this.onCurrentValue = localStorage.getItem("auth._token.login");
7410
+ document.addEventListener("touchstart", this.initAudio);
7411
+ document.addEventListener("click", this.initAudio);
7322
7412
  },
7323
7413
  beforeDestroy() {
7324
7414
  window.removeEventListener("storage", this.handleStorageChange);
7415
+ document.removeEventListener("touchstart", this.initAudio);
7416
+ document.removeEventListener("click", this.initAudio);
7325
7417
  if (this.unwatchRoute) this.unwatchRoute();
7326
7418
  },
7327
7419
  watch: {
7328
7420
  "$route"(to, from) {
7329
- this.setCurrentUrl();
7421
+ this.onWindowUrl = window.location.href;
7422
+ this.isSetVisitedpage = true;
7330
7423
  }
7331
7424
  },
7332
7425
  methods: {
@@ -7352,13 +7445,19 @@ const __vue2_script = {
7352
7445
  },
7353
7446
  // 获取当前页面的URL
7354
7447
  setCurrentUrl() {
7355
- if (this.initData.socket) {
7356
- this.initData.socket.emit("setVisitedpage", this.userId, window.location.href, this.initData.siteName);
7448
+ if (this.socket) {
7449
+ this.socket.emit("setVisitedpage", this.userId, window.location.href, this.initData.siteName);
7450
+ }
7451
+ },
7452
+ updateMessage() {
7453
+ if (this.isSetVisitedpage) {
7454
+ this.setCurrentUrl();
7455
+ this.isSetVisitedpage = false;
7357
7456
  }
7358
7457
  },
7359
7458
  logOut() {
7360
- if (this.initData.socket) {
7361
- this.initData.socket.emit("logOut");
7459
+ if (this.socket) {
7460
+ this.socket.emit("logOut");
7362
7461
  }
7363
7462
  },
7364
7463
  async handleStorageChange(e) {
@@ -7383,7 +7482,7 @@ const __vue2_script = {
7383
7482
  this.changeRoute("cover");
7384
7483
  const user = await getNxcUserOrCreate({}, this.initData.socketUrl);
7385
7484
  this.userId = user.userId;
7386
- this.initData.user = user;
7485
+ this.$set(this.initData, "user", user);
7387
7486
  setClientId(this.userId);
7388
7487
  this.conversations = [];
7389
7488
  this.getConversations();
@@ -7392,7 +7491,7 @@ const __vue2_script = {
7392
7491
  console.log("err", err);
7393
7492
  if (err.status === 401) {
7394
7493
  this.userId = "";
7395
- this.initData.user = {};
7494
+ this.$set(this.initData, "user", {});
7396
7495
  this.conversations = [];
7397
7496
  this.changeRoute("cover");
7398
7497
  localStorage.setItem("auth._token.login", false);
@@ -7406,7 +7505,7 @@ const __vue2_script = {
7406
7505
  } else {
7407
7506
  setClientId("");
7408
7507
  this.userId = "";
7409
- this.initData.user = {};
7508
+ this.$set(this.initData, "user", {});
7410
7509
  this.conversations = [];
7411
7510
  this.logOut();
7412
7511
  this.changeRoute("cover");
@@ -7419,9 +7518,30 @@ const __vue2_script = {
7419
7518
  },
7420
7519
  handleClick() {
7421
7520
  this.showView = true;
7521
+ if (this.onRoute === "dialog") {
7522
+ this.updateOpenView(true);
7523
+ this.clearClinetUnRead();
7524
+ if (this.$refs.consultContainer) {
7525
+ this.$refs.consultContainer.scrollToBottom();
7526
+ }
7527
+ }
7422
7528
  },
7423
7529
  packUp() {
7424
7530
  this.showView = false;
7531
+ this.updateOpenView(false);
7532
+ },
7533
+ updateOpenView(isOpenView) {
7534
+ this.socket.emit("updateOpenView", {
7535
+ isOpenView,
7536
+ userId: this.userId,
7537
+ siteName: this.initData.siteName
7538
+ });
7539
+ },
7540
+ clearClinetUnRead() {
7541
+ this.socket.emit("clearClinetUnRead", {
7542
+ siteName: this.initData.siteName
7543
+ });
7544
+ this.updateUserUnRead(0);
7425
7545
  },
7426
7546
  getConversations() {
7427
7547
  if (!this.userId) return;
@@ -7443,8 +7563,10 @@ const __vue2_script = {
7443
7563
  getUser({
7444
7564
  userId: this.userId
7445
7565
  }, this.initData.socketUrl).then(res => {
7446
- this.initData.user = res;
7447
- removeVisitor(res.createTime);
7566
+ if (res) {
7567
+ this.$set(this.initData, "user", res);
7568
+ removeVisitor(res.createTime);
7569
+ }
7448
7570
  });
7449
7571
  },
7450
7572
  getInitData() {
@@ -7453,12 +7575,29 @@ const __vue2_script = {
7453
7575
  this.getConversations();
7454
7576
  },
7455
7577
  onUpdateConversations() {
7456
- this.initData.socket.on("updateConversations", () => {
7578
+ this.socket.on("updateConversations", () => {
7457
7579
  this.getInitData();
7458
7580
  });
7459
7581
  },
7582
+ onUpdateUserUnRead() {
7583
+ this.socket.on("updateUserUnRead", data => {
7584
+ this.updateUserUnRead(data);
7585
+ });
7586
+ },
7587
+ updateUserUnRead(unRead) {
7588
+ var _a2;
7589
+ const room = ((_a2 = this.initData.user) == null ? void 0 : _a2.room) || [];
7590
+ room.forEach(item => {
7591
+ if (item.topic === this.initData.siteName) {
7592
+ this.$set(item, "unRead", unRead);
7593
+ }
7594
+ });
7595
+ if (unRead && unRead > 0) {
7596
+ this.playAudio();
7597
+ }
7598
+ },
7460
7599
  joinRoom(roomId) {
7461
- this.initData.socket.emit("join", {
7600
+ this.socket.emit("join", {
7462
7601
  userId: this.userId,
7463
7602
  roomId: "",
7464
7603
  token: getToken(),
@@ -7468,6 +7607,38 @@ const __vue2_script = {
7468
7607
  changeRoute(route) {
7469
7608
  this.$refs.consultContainer.handleRoute(route);
7470
7609
  },
7610
+ onChangeRoute(route) {
7611
+ this.onRoute = route;
7612
+ if (route === "cover") {
7613
+ this.updateOpenView(false);
7614
+ }
7615
+ if (route === "dialog") {
7616
+ this.updateOpenView(true);
7617
+ this.clearClinetUnRead();
7618
+ }
7619
+ },
7620
+ initAudio() {
7621
+ if (this.isAudioInited || !this.audio) return;
7622
+ this.audio.muted = true;
7623
+ this.audio.play().then(() => {
7624
+ this.audio.pause();
7625
+ this.audio.currentTime = 0;
7626
+ this.audio.muted = false;
7627
+ this.isAudioInited = true;
7628
+ }).catch(error => {
7629
+ console.error("audio play error:", error);
7630
+ });
7631
+ },
7632
+ playAudio() {
7633
+ if (this.audio) {
7634
+ clearTimeout(this.audioTimer);
7635
+ this.audioTimer = setTimeout(() => {
7636
+ this.audio.pause();
7637
+ this.audio.currentTime = 0;
7638
+ this.audio.play();
7639
+ }, 200);
7640
+ }
7641
+ },
7471
7642
  async init(data, callback, error) {
7472
7643
  if (!data) {
7473
7644
  error && error("data is required");
@@ -7488,8 +7659,10 @@ const __vue2_script = {
7488
7659
  const {
7489
7660
  io
7490
7661
  } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index-6fdde059.mjs")));
7491
- this.$set(this.initData, "socket", io(data.socketUrl));
7662
+ this.socket = io(data.socketUrl);
7492
7663
  this.onUpdateConversations();
7664
+ this.onUpdateUserUnRead();
7665
+ this.audio = new Audio(`${data.socketUrl}/static/audio/unread.mp3`);
7493
7666
  if (accessToken && accessToken !== "false") {
7494
7667
  this.processTokenChange({
7495
7668
  key: "auth._token.login",