mdm-im-v3 2.0.2 → 2.1.0

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +69 -0
  3. package/dist/{FilePreview-u-aYsWSs.js → FilePreview-dpnc9m3Z.js} +2 -2
  4. package/dist/assets/extracted/bc26358d.woff +0 -0
  5. package/dist/assets/extracted/be398edc.ttf +0 -0
  6. package/dist/assets/extracted/de12ee92.woff2 +0 -0
  7. package/dist/core.es.js +2 -2
  8. package/dist/{index-HUSyWSoO.js → index-CNxeqkio.js} +1433 -3172
  9. package/dist/{index-Bn5zFiV_.js → index-CsaYx_7b.js} +697 -47
  10. package/dist/{index-D8yaC3ve.js → index-D5S79LNp.js} +3201 -261
  11. package/dist/index.es.js +1 -1
  12. package/dist/style/index.css +1 -1
  13. package/dist-h5/{ChatHistoryH5-Deqlnw3u.js → ChatHistoryH5-BhrGF5WR.js} +2 -2
  14. package/dist-h5/{ChatPageH5-wyLGmPhW.js → ChatPageH5-B3azJu7O.js} +975 -164
  15. package/dist-h5/{ChatSettingsH5-DD3dnI-H.js → ChatSettingsH5-CFr9Bn69.js} +169 -27
  16. package/dist-h5/{CreateGroupH5-3LIujy3_.js → CreateGroupH5-a16jkObH.js} +2 -2
  17. package/dist-h5/{GroupAnnouncementH5-5EpXQs5V.js → GroupAnnouncementH5-B-Qfzoy2.js} +1 -1
  18. package/dist-h5/{GroupInfoDialogH5-fgcrbRyp.js → GroupInfoDialogH5-BHLKs62Z.js} +1 -1
  19. package/dist-h5/{GroupMembersH5-DX2lxrLB.js → GroupMembersH5-D_f1RFjO.js} +1 -1
  20. package/dist-h5/{GroupNoticeH5-DVXrcmP9.js → GroupNoticeH5-46ZjBe92.js} +1 -1
  21. package/dist-h5/{MemberDetailH5-DAVUVr30.js → MemberDetailH5-B7nlr8ZT.js} +2 -2
  22. package/dist-h5/{SearchPageH5-BiGhJF4U.js → SearchPageH5-hYxNItvz.js} +2 -2
  23. package/dist-h5/{SelectMembersH5-DbrSnTg3.js → SelectMembersH5-DQIfX_w4.js} +2 -2
  24. package/dist-h5/assets/extracted/bc26358d.woff +0 -0
  25. package/dist-h5/assets/extracted/be398edc.ttf +0 -0
  26. package/dist-h5/assets/extracted/de12ee92.woff2 +0 -0
  27. package/dist-h5/{imChat-Cz45JFEl.js → imChat-Bfl2JS8Q.js} +1 -1
  28. package/dist-h5/index.es.js +1 -1
  29. package/dist-h5/{indexH5-BZ77bUNH.js → indexH5-CUQe-Ize.js} +97 -69
  30. package/dist-h5/{indexH5-Cx3l8YDq.js → indexH5-DAnvVyZ1.js} +3238 -261
  31. package/dist-h5/{request-rky8JSGo.js → request-CK8gkCRf.js} +1 -1
  32. package/dist-h5/style/index-h5.css +1 -1
  33. package/package.json +3 -2
@@ -1,11 +1,11 @@
1
1
  import { computed, ref, watch, onBeforeUnmount, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, withModifiers, createTextVNode, toDisplayString, createCommentVNode, Fragment, renderList, createBlock, normalizeClass, normalizeStyle, inject, provide, onMounted, nextTick } from "vue";
2
2
  import { useRouter } from "vue-router";
3
3
  import { NavBar, Icon, Badge, PullRefresh, SwipeCell, Loading, Empty, Button, ActionSheet, Cell, showDialog, showToast } from "vant";
4
- import { u as useChatStore, I as IM_CVS_TYPE, g as getGroupAvatarBg, i as isDefaultAvatar, a as getAvatarBg, b as getAvatarText, c as cloneDeep, d as useMessage, e as useUsers, f as useConversations, h as useMsgList, m as mittBus, j as IM_LOGIN_STATUS, k as handleUrl, l as IM_LOGIN_PLATFORM } from "./indexH5-Cx3l8YDq.js";
4
+ import { u as useChatStore, I as IM_CVS_TYPE, g as getGroupAvatarBg, i as isDefaultAvatar, a as getAvatarBg, b as getAvatarText, c as cloneDeep, d as getConversationBurnSetting, e as useMessage, f as useUsers, h as useConversations, j as useMsgList, m as mittBus, k as IM_LOGIN_STATUS, p as preserveBurnInEx, l as IM_LOGIN_PLATFORM, s as sleep, n as handleUrl } from "./indexH5-DAnvVyZ1.js";
5
5
  import "element-plus";
6
- import "./request-rky8JSGo.js";
6
+ import "./request-CK8gkCRf.js";
7
7
  import { d as defaultAvatar } from "./default_avatar-BE2kit_X.js";
8
- import { J as JoinGroupDialogH5, G as GroupInfoDialogH5 } from "./GroupInfoDialogH5-fgcrbRyp.js";
8
+ import { J as JoinGroupDialogH5, G as GroupInfoDialogH5 } from "./GroupInfoDialogH5-BHLKs62Z.js";
9
9
  const _hoisted_1 = { class: "chat-list-h5" };
10
10
  const _hoisted_2 = { key: 0 };
11
11
  const _hoisted_3 = { style: { "display": "flex", "align-items": "center", "gap": "20px" } };
@@ -21,32 +21,37 @@ const _hoisted_9 = ["src"];
21
21
  const _hoisted_10 = { class: "cvs-item__info" };
22
22
  const _hoisted_11 = { class: "cvs-item__top" };
23
23
  const _hoisted_12 = { class: "cvs-item__name" };
24
- const _hoisted_13 = { class: "cvs-item__time" };
25
- const _hoisted_14 = { class: "cvs-item__msg" };
26
- const _hoisted_15 = {
24
+ const _hoisted_13 = {
25
+ key: 0,
26
+ title: "你已开启阅后即焚",
27
+ style: { "margin-left": "2px", "font-size": "11px", "line-height": "1" }
28
+ };
29
+ const _hoisted_14 = { class: "cvs-item__time" };
30
+ const _hoisted_15 = { class: "cvs-item__msg" };
31
+ const _hoisted_16 = {
27
32
  key: 0,
28
33
  class: "cvs-item__msg-prefix"
29
34
  };
30
- const _hoisted_16 = ["innerHTML"];
31
- const _hoisted_17 = {
35
+ const _hoisted_17 = ["innerHTML"];
36
+ const _hoisted_18 = {
32
37
  key: 1,
33
38
  class: "iconfont mdm-icon-miandarao cvs-item__msg-mute"
34
39
  };
35
- const _hoisted_18 = { class: "swipe-actions" };
36
- const _hoisted_19 = ["onClick"];
40
+ const _hoisted_19 = { class: "swipe-actions" };
37
41
  const _hoisted_20 = ["onClick"];
38
42
  const _hoisted_21 = ["onClick"];
39
- const _hoisted_22 = {
43
+ const _hoisted_22 = ["onClick"];
44
+ const _hoisted_23 = {
40
45
  key: 1,
41
46
  class: "cvs-loading-more"
42
47
  };
43
- const _hoisted_23 = {
48
+ const _hoisted_24 = {
44
49
  key: 2,
45
50
  class: "cvs-loading-finished"
46
51
  };
47
- const _hoisted_24 = { class: "more-actions-list" };
48
- const _hoisted_25 = { class: "more-action-item" };
49
- const _hoisted_26 = { class: "more-action-text" };
52
+ const _hoisted_25 = { class: "more-actions-list" };
53
+ const _hoisted_26 = { class: "more-action-item" };
54
+ const _hoisted_27 = { class: "more-action-text" };
50
55
  const _sfc_main$1 = {
51
56
  __name: "ChatListH5",
52
57
  props: {
@@ -77,6 +82,10 @@ const _sfc_main$1 = {
77
82
  const chatMessage = useChatStore();
78
83
  computed(() => chatMessage.getBaseUrl);
79
84
  const unReadCount = computed(() => chatMessage.getUnReadCount);
85
+ const hasBurnSetting = (cvs) => {
86
+ var _a;
87
+ return getConversationBurnSetting(cvs, (_a = chatMessage.getUserInfo) == null ? void 0 : _a.userID).enabled;
88
+ };
80
89
  const router = useRouter();
81
90
  const emits = __emit;
82
91
  ref("");
@@ -385,7 +394,7 @@ const _sfc_main$1 = {
385
394
  "right-width": effectiveUnreadCount(item) > 0 ? 195 : 130
386
395
  }, {
387
396
  right: withCtx(() => [
388
- createElementVNode("div", _hoisted_18, [
397
+ createElementVNode("div", _hoisted_19, [
389
398
  effectiveUnreadCount(item) > 0 ? (openBlock(), createElementBlock("span", {
390
399
  key: 0,
391
400
  class: "swipe-btn swipe-btn--read",
@@ -393,7 +402,7 @@ const _sfc_main$1 = {
393
402
  }, [..._cache[6] || (_cache[6] = [
394
403
  createElementVNode("i", { class: "iconfont mdm-icon-clear" }, null, -1),
395
404
  createElementVNode("span", null, "已读", -1)
396
- ])], 8, _hoisted_19)) : createCommentVNode("", true),
405
+ ])], 8, _hoisted_20)) : createCommentVNode("", true),
397
406
  createElementVNode("span", {
398
407
  class: normalizeClass(["swipe-btn", item.isPinned ? "swipe-btn--unpin" : "swipe-btn--pin"]),
399
408
  onClick: withModifiers(($event) => handleTogglePinItem(item), ["stop"])
@@ -402,14 +411,14 @@ const _sfc_main$1 = {
402
411
  class: normalizeClass(item.isPinned ? "iconfont mdm-icon-quxiaozhiding" : "iconfont mdm-icon-zhiding")
403
412
  }, null, 2),
404
413
  createElementVNode("span", null, toDisplayString(item.isPinned ? "取消置顶" : "置顶"), 1)
405
- ], 10, _hoisted_20),
414
+ ], 10, _hoisted_21),
406
415
  createElementVNode("span", {
407
416
  class: "swipe-btn swipe-btn--delete",
408
417
  onClick: withModifiers(($event) => handleDeleteItem(item), ["stop"])
409
418
  }, [..._cache[7] || (_cache[7] = [
410
419
  createElementVNode("i", { class: "iconfont mdm-icon-yichu" }, null, -1),
411
420
  createElementVNode("span", null, "删除", -1)
412
- ])], 8, _hoisted_21)
421
+ ])], 8, _hoisted_22)
413
422
  ])
414
423
  ]),
415
424
  default: withCtx(() => [
@@ -449,16 +458,19 @@ const _sfc_main$1 = {
449
458
  ]),
450
459
  createElementVNode("div", _hoisted_10, [
451
460
  createElementVNode("div", _hoisted_11, [
452
- createElementVNode("span", _hoisted_12, toDisplayString(item.showName), 1),
453
- createElementVNode("span", _hoisted_13, toDisplayString(item.latestMsgSendTimeStr), 1)
461
+ createElementVNode("span", _hoisted_12, [
462
+ createTextVNode(toDisplayString(item.showName) + " ", 1),
463
+ hasBurnSetting(item) ? (openBlock(), createElementBlock("span", _hoisted_13, "🔥")) : createCommentVNode("", true)
464
+ ]),
465
+ createElementVNode("span", _hoisted_14, toDisplayString(item.latestMsgSendTimeStr), 1)
454
466
  ]),
455
- createElementVNode("div", _hoisted_14, [
456
- item.recvMsgOpt !== 0 && effectiveUnreadCount(item) ? (openBlock(), createElementBlock("span", _hoisted_15, " [" + toDisplayString(effectiveUnreadCount(item)) + "条] ", 1)) : createCommentVNode("", true),
467
+ createElementVNode("div", _hoisted_15, [
468
+ item.recvMsgOpt !== 0 && effectiveUnreadCount(item) ? (openBlock(), createElementBlock("span", _hoisted_16, " [" + toDisplayString(effectiveUnreadCount(item)) + "条] ", 1)) : createCommentVNode("", true),
457
469
  createElementVNode("span", {
458
470
  class: "cvs-item__msg-text",
459
471
  innerHTML: item.latestMsg
460
- }, null, 8, _hoisted_16),
461
- item.recvMsgOpt !== 0 ? (openBlock(), createElementBlock("span", _hoisted_17)) : createCommentVNode("", true)
472
+ }, null, 8, _hoisted_17),
473
+ item.recvMsgOpt !== 0 ? (openBlock(), createElementBlock("span", _hoisted_18)) : createCommentVNode("", true)
462
474
  ])
463
475
  ])
464
476
  ], 42, _hoisted_6)
@@ -467,10 +479,10 @@ const _sfc_main$1 = {
467
479
  }, 1032, ["right-width"]);
468
480
  }), 128))
469
481
  ])) : createCommentVNode("", true),
470
- listLoading.value ? (openBlock(), createElementBlock("div", _hoisted_22, [
482
+ listLoading.value ? (openBlock(), createElementBlock("div", _hoisted_23, [
471
483
  createVNode(unref(Loading), { size: "20" }),
472
484
  _cache[8] || (_cache[8] = createElementVNode("span", null, "加载中...", -1))
473
- ])) : listFinished.value && displayList.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_23, "没有更多了")) : createCommentVNode("", true)
485
+ ])) : listFinished.value && displayList.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_24, "没有更多了")) : createCommentVNode("", true)
474
486
  ]),
475
487
  _: 1
476
488
  }, 8, ["modelValue"]),
@@ -508,7 +520,7 @@ const _sfc_main$1 = {
508
520
  "cancel-text": "取消"
509
521
  }, {
510
522
  default: withCtx(() => [
511
- createElementVNode("div", _hoisted_24, [
523
+ createElementVNode("div", _hoisted_25, [
512
524
  (openBlock(true), createElementBlock(Fragment, null, renderList(moreActionItems.value, (action) => {
513
525
  return openBlock(), createBlock(unref(Cell), {
514
526
  key: action.value,
@@ -516,11 +528,11 @@ const _sfc_main$1 = {
516
528
  onClick: ($event) => onMoreActionSelect(action)
517
529
  }, {
518
530
  title: withCtx(() => [
519
- createElementVNode("div", _hoisted_25, [
531
+ createElementVNode("div", _hoisted_26, [
520
532
  createElementVNode("i", {
521
533
  class: normalizeClass(["iconfont", action.icon, "more-action-icon"])
522
534
  }, null, 2),
523
- createElementVNode("span", _hoisted_26, toDisplayString(action.text), 1)
535
+ createElementVNode("span", _hoisted_27, toDisplayString(action.text), 1)
524
536
  ])
525
537
  ]),
526
538
  _: 2
@@ -608,7 +620,7 @@ const _sfc_main = {
608
620
  provide("loadMessageCount", pageCount);
609
621
  }
610
622
  const chatMessage = useChatStore();
611
- const { initIMSDK } = useMessage();
623
+ const { initIMSDK, waitForSyncFinish } = useMessage();
612
624
  const baseUrl = computed(() => chatMessage.getBaseUrl);
613
625
  const localUser = computed(() => chatMessage.getUserInfo);
614
626
  computed(() => chatMessage.getLoginStatus);
@@ -660,9 +672,11 @@ const _sfc_main = {
660
672
  };
661
673
  const onHideCvs = async (conversationID) => {
662
674
  if (!conversationID || !imInstance) return;
675
+ const target = conversationList.value.find((item) => item.conversationID === conversationID);
663
676
  const bool = await (imInstance == null ? void 0 : imInstance.setConversation({
664
677
  conversationID,
665
- ex: JSON.stringify({ isHidden: true })
678
+ // 隐藏标记与阅后即焚配置共存于 ex,写入时需保留 burn
679
+ ex: preserveBurnInEx(JSON.stringify({ isHidden: true }), target == null ? void 0 : target.ex)
666
680
  }));
667
681
  if (bool) {
668
682
  const list = cloneDeep(conversationList.value);
@@ -700,12 +714,14 @@ const _sfc_main = {
700
714
  };
701
715
  const onMarkUnread = async (conversationID) => {
702
716
  if (!conversationID || !imInstance) return;
717
+ const target = conversationList.value.find((item) => item.conversationID === conversationID);
703
718
  try {
704
719
  await (imInstance == null ? void 0 : imInstance.setConversation({
705
720
  conversationID,
706
721
  isRead: false,
707
722
  recvMsgOpt: 0,
708
- ex: JSON.stringify({ isRead: true })
723
+ // 保留 burn(阅后即焚)配置
724
+ ex: preserveBurnInEx(JSON.stringify({ isRead: true }), target == null ? void 0 : target.ex)
709
725
  }));
710
726
  showToast("已标记为未读");
711
727
  } catch {
@@ -714,12 +730,14 @@ const _sfc_main = {
714
730
  };
715
731
  const onClearMarkUnread = async (conversationID) => {
716
732
  if (!conversationID || !imInstance) return;
733
+ const target = conversationList.value.find((item) => item.conversationID === conversationID);
717
734
  try {
718
735
  await (imInstance == null ? void 0 : imInstance.setConversation({
719
736
  conversationID,
720
737
  isRead: true,
721
738
  recvMsgOpt: 0,
722
- ex: ""
739
+ // 清除 isRead 标记时保留 burn(阅后即焚)配置
740
+ ex: preserveBurnInEx("", target == null ? void 0 : target.ex)
723
741
  }));
724
742
  showToast("已清除未读标记");
725
743
  } catch {
@@ -789,7 +807,9 @@ const _sfc_main = {
789
807
  info.onlineStatus = statusInfo == null ? void 0 : statusInfo.status;
790
808
  info.platformIDs = (statusInfo == null ? void 0 : statusInfo.platformIDs) || [];
791
809
  if (info.ex && (info.ex.indexOf("isHidden") > -1 || info.ex.indexOf("isDelete") > -1) && info.conversationID) {
792
- await (imInstance == null ? void 0 : imInstance.setConversation({ conversationID: info.conversationID, ex: "" }));
810
+ const restoredEx = preserveBurnInEx("", info.ex);
811
+ await (imInstance == null ? void 0 : imInstance.setConversation({ conversationID: info.conversationID, ex: restoredEx }));
812
+ info.ex = restoredEx;
793
813
  handleConversationList([info], "add");
794
814
  await nextTick();
795
815
  (_b = chatListRef.value) == null ? void 0 : _b.handleSelectChat(info.conversationID);
@@ -817,6 +837,8 @@ const _sfc_main = {
817
837
  const getCvsList = async () => {
818
838
  const allData = [];
819
839
  const allValidData = [];
840
+ startIndex = 0;
841
+ initCount = 0;
820
842
  while (allValidData.length < 100 && initCount < 3) {
821
843
  let currentPage = [];
822
844
  let retryCount = 0;
@@ -831,14 +853,14 @@ const _sfc_main = {
831
853
  initCount++;
832
854
  }
833
855
  if (retryCount >= 3) break;
856
+ await sleep(300 * retryCount);
834
857
  }
835
858
  allData.push(...currentPage);
836
- const validItems = currentPage.filter(
837
- (item) => {
838
- var _a, _b, _c;
839
- return !item.ex || (((_a = item.ex) == null ? void 0 : _a.indexOf("isHidden")) > -1 || ((_b = item.ex) == null ? void 0 : _b.indexOf("isDeleted")) > -1) && item.unreadCount > 0 || ((_c = item.ex) == null ? void 0 : _c.indexOf("isRead")) > -1;
840
- }
841
- );
859
+ const validItems = currentPage.filter((item) => {
860
+ const ex = typeof item.ex === "string" ? item.ex : "";
861
+ const hidden = ex.indexOf("isHidden") > -1 || ex.indexOf("isDeleted") > -1;
862
+ return !hidden || item.unreadCount > 0;
863
+ });
842
864
  allValidData.push(...validItems);
843
865
  if (allValidData.length >= pageSize) break;
844
866
  const nextStart = startIndex + pageSize;
@@ -872,42 +894,48 @@ const _sfc_main = {
872
894
  }
873
895
  }
874
896
  };
875
- const afterLogged = () => {
897
+ const afterLogged = async () => {
876
898
  imInstance = window["imInstance"];
877
899
  fetchAllApplications();
900
+ const syncDone = await waitForSyncFinish();
901
+ console.log(`[IM] 服务端同步${syncDone ? "已完成" : "等待超时"},开始拉取会话列表`);
878
902
  if (effectiveGroupID.value) {
879
- setTimeout(async () => {
880
- try {
881
- const info = await (imInstance == null ? void 0 : imInstance.getOneConversation(effectiveGroupID.value, IM_CVS_TYPE.Group));
882
- if (info == null ? void 0 : info.conversationID) {
883
- handleConversationList([info], "init", handleMessage);
884
- }
885
- } catch {
903
+ try {
904
+ const info = await (imInstance == null ? void 0 : imInstance.getOneConversation(effectiveGroupID.value, IM_CVS_TYPE.Group));
905
+ if (info == null ? void 0 : info.conversationID) {
906
+ handleConversationList([info], "init", handleMessage);
886
907
  }
887
- }, 500);
908
+ } catch {
909
+ }
888
910
  } else {
889
- setTimeout(async () => {
890
- const list = await getCvsList();
891
- if ((list == null ? void 0 : list.length) > 0) {
892
- handleConversationList(list, "init", handleMessage);
893
- const hideCvsList = list.filter((item) => {
894
- var _a, _b;
895
- return ((_a = item.ex) == null ? void 0 : _a.indexOf("isHidden")) > -1 || ((_b = item.ex) == null ? void 0 : _b.indexOf("isDeleted")) > -1;
896
- });
897
- if (hideCvsList.length > 0) {
898
- for (let i = 0; i < hideCvsList.length; i++) {
899
- const cvs = hideCvsList[i];
900
- const bool = await (imInstance == null ? void 0 : imInstance.setConversation({ conversationID: cvs.conversationID, ex: "" }));
901
- if (bool) {
902
- cvs.ex = "";
903
- handleConversationList([cvs], "update", handleMessage);
904
- }
911
+ const list = await getCvsList();
912
+ if ((list == null ? void 0 : list.length) > 0) {
913
+ const localFallbacks = conversationList.value.filter((item) => item.isLocalFallback);
914
+ handleConversationList(list, "init", handleMessage);
915
+ const restFallbacks = localFallbacks.filter(
916
+ (item) => !conversationList.value.some((cvs) => cvs.conversationID === item.conversationID)
917
+ );
918
+ if (restFallbacks.length > 0) {
919
+ conversationList.value = [...restFallbacks, ...conversationList.value];
920
+ }
921
+ const hideCvsList = list.filter((item) => {
922
+ var _a, _b;
923
+ return ((_a = item.ex) == null ? void 0 : _a.indexOf("isHidden")) > -1 || ((_b = item.ex) == null ? void 0 : _b.indexOf("isDeleted")) > -1;
924
+ });
925
+ if (hideCvsList.length > 0) {
926
+ for (let i = 0; i < hideCvsList.length; i++) {
927
+ const cvs = hideCvsList[i];
928
+ const restoredEx = preserveBurnInEx("", cvs.ex);
929
+ const bool = await (imInstance == null ? void 0 : imInstance.setConversation({ conversationID: cvs.conversationID, ex: restoredEx }));
930
+ if (bool) {
931
+ cvs.ex = restoredEx;
932
+ handleConversationList([cvs], "update", handleMessage);
905
933
  }
906
934
  }
907
935
  }
908
- await nextTick();
909
- initMessagePage();
910
- }, 500);
936
+ }
937
+ await nextTick();
938
+ initMessagePage();
911
939
  }
912
940
  };
913
941
  const handleGroupApplicationAdded = (data) => {