@aochuang/client-sdk 1.0.278
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.
- package/README.md +93 -0
- package/common/avatar/avatar.vue +86 -0
- package/common/avatar/index.js +3 -0
- package/common/badge/badge.vue +105 -0
- package/common/badge/index.js +3 -0
- package/common/context-menu/context-menu-box.vue +61 -0
- package/common/context-menu/context-menu-group.vue +162 -0
- package/common/context-menu/context-menu-item.vue +179 -0
- package/common/context-menu/context-menu.vue +201 -0
- package/common/context-menu/index.js +3 -0
- package/common/context-menu/utils.js +138 -0
- package/common/friend-avatar/default.svg +1 -0
- package/common/friend-avatar/friend-avatar.vue +29 -0
- package/common/friend-avatar/index.js +3 -0
- package/common/image/index.js +3 -0
- package/common/index.js +17 -0
- package/common/room-avatar/default.svg +6 -0
- package/common/room-avatar/index.js +3 -0
- package/common/room-avatar/room-avatar.vue +29 -0
- package/common/scroll-load-more/index.js +3 -0
- package/common/scroll-load-more/scroll-load-more.vue +195 -0
- package/common/user-avatar/default.svg +1 -0
- package/common/user-avatar/index.js +3 -0
- package/common/user-avatar/user-avatar.vue +29 -0
- package/components/account-select/account-select-skeleton.vue +56 -0
- package/components/account-select/account-select.vue +205 -0
- package/components/account-select/all.svg +1 -0
- package/components/account-select/index.js +3 -0
- package/components/chat-editor/MENTION_TOKEN_SUMMARY.md +74 -0
- package/components/chat-editor/chat-editor-button/chat-editor-button.vue +78 -0
- package/components/chat-editor/chat-editor-suggestions/chat-editor-suggestions.vue +329 -0
- package/components/chat-editor/chat-editor-toolbar/chat-editor-toolbar-item.vue +28 -0
- package/components/chat-editor/chat-editor-toolbar/chat-editor-toolbar.vue +17 -0
- package/components/chat-editor/chat-editor.vue +933 -0
- package/components/chat-editor/index.js +12 -0
- package/components/chat-editor/utils.js +189 -0
- package/components/chat-friend-profile/chat-friend-profile.vue +118 -0
- package/components/chat-friend-profile/index.js +3 -0
- package/components/chat-layout/chat-layout.vue +71 -0
- package/components/chat-layout/index.js +3 -0
- package/components/chat-panel/chat-panel-box.vue +350 -0
- package/components/chat-panel/chat-panel-chat.vue +121 -0
- package/components/chat-panel/chat-panel-chats.vue +674 -0
- package/components/chat-panel/chat-panel-empty.vue +32 -0
- package/components/chat-panel/chat-panel-increment.vue +80 -0
- package/components/chat-panel/chat-panel-inner-msg.vue +25 -0
- package/components/chat-panel/chat-panel-loading.vue +29 -0
- package/components/chat-panel/chat-panel-nearest.vue +136 -0
- package/components/chat-panel/chat-panel.vue +292 -0
- package/components/chat-panel/index.js +3 -0
- package/components/chat-panel/util.js +83 -0
- package/components/chat-room-profile/chat-room-profile.vue +103 -0
- package/components/chat-room-profile/index.js +3 -0
- package/components/contacts-friend-select/contacts-friend-select-skeleton.vue +41 -0
- package/components/contacts-friend-select/contacts-friend-select.vue +204 -0
- package/components/contacts-friend-select/index.js +3 -0
- package/components/contacts-group-select/contacts-group-select-item.vue +98 -0
- package/components/contacts-group-select/contacts-group-select-skeleton.vue +81 -0
- package/components/contacts-group-select/contacts-group-select.vue +396 -0
- package/components/contacts-group-select/index.js +3 -0
- package/components/contacts-room-select/contacts-room-select-skeleton.vue +41 -0
- package/components/contacts-room-select/contacts-room-select.vue +208 -0
- package/components/contacts-room-select/index.js +3 -0
- package/components/index.js +43 -0
- package/components/layout/index.js +3 -0
- package/components/layout/layout.vue +70 -0
- package/components/session-select/index.js +11 -0
- package/components/session-select/session-select-item-skeleton.vue +59 -0
- package/components/session-select/session-select-item.vue +190 -0
- package/components/session-select/session-select.vue +386 -0
- package/components/wechat-chat-control/calling/calling.vue +227 -0
- package/components/wechat-chat-control/calling/phone-fill.svg +1 -0
- package/components/wechat-chat-control/calling/vidicon-fill.svg +1 -0
- package/components/wechat-chat-control/channel-live/channel-live.vue +198 -0
- package/components/wechat-chat-control/channel-live/quote-icon.svg +1 -0
- package/components/wechat-chat-control/channel-video/channel-video.vue +180 -0
- package/components/wechat-chat-control/channel-video/quote-icon.svg +1 -0
- package/components/wechat-chat-control/channel-video-card/channel-video-card.vue +139 -0
- package/components/wechat-chat-control/channel-video-card/quote-icon.svg +1 -0
- package/components/wechat-chat-control/company-card/company-card.vue +136 -0
- package/components/wechat-chat-control/company-card/quote-icon.svg +1 -0
- package/components/wechat-chat-control/custom-expression/custom-expression.vue +45 -0
- package/components/wechat-chat-control/empty/empty.vue +27 -0
- package/components/wechat-chat-control/file-url/file-url.vue +307 -0
- package/components/wechat-chat-control/file-url/icons/file-excel-line.svg +1 -0
- package/components/wechat-chat-control/file-url/icons/file-info-line.svg +1 -0
- package/components/wechat-chat-control/file-url/icons/file-music-line.svg +1 -0
- package/components/wechat-chat-control/file-url/icons/file-pdf-line.svg +1 -0
- package/components/wechat-chat-control/file-url/icons/file-ppt-line.svg +1 -0
- package/components/wechat-chat-control/file-url/icons/file-settings-line.svg +1 -0
- package/components/wechat-chat-control/file-url/icons/file-text-line.svg +1 -0
- package/components/wechat-chat-control/file-url/icons/file-unknow-line.svg +1 -0
- package/components/wechat-chat-control/file-url/icons/file-word-line.svg +1 -0
- package/components/wechat-chat-control/file-url/icons/file-zip-line.svg +1 -0
- package/components/wechat-chat-control/file-url/icons/index.js +24 -0
- package/components/wechat-chat-control/image/image.vue +344 -0
- package/components/wechat-chat-control/image/index.js +1 -0
- package/components/wechat-chat-control/image/util.js +29 -0
- package/components/wechat-chat-control/index.js +104 -0
- package/components/wechat-chat-control/jx-sys-text/jx-sys-text.vue +28 -0
- package/components/wechat-chat-control/location/location.vue +179 -0
- package/components/wechat-chat-control/location/offline-bg.png +0 -0
- package/components/wechat-chat-control/member-change/member-change.vue +37 -0
- package/components/wechat-chat-control/music/icons/163.png +0 -0
- package/components/wechat-chat-control/music/icons/163.svg +12 -0
- package/components/wechat-chat-control/music/icons/default.png +0 -0
- package/components/wechat-chat-control/music/icons/default.svg +1 -0
- package/components/wechat-chat-control/music/icons/kuwo.png +0 -0
- package/components/wechat-chat-control/music/icons/qq.png +0 -0
- package/components/wechat-chat-control/music/icons/qq.svg +1 -0
- package/components/wechat-chat-control/music/music.vue +156 -0
- package/components/wechat-chat-control/music/utils.js +30 -0
- package/components/wechat-chat-control/quote-message/quote-message.vue +257 -0
- package/components/wechat-chat-control/real-time-position/icon.svg +1 -0
- package/components/wechat-chat-control/real-time-position/real-time-position.vue +57 -0
- package/components/wechat-chat-control/red-envelopes/quote-icon.svg +1 -0
- package/components/wechat-chat-control/red-envelopes/red-envelope.svg +1 -0
- package/components/wechat-chat-control/red-envelopes/red-envelopes.vue +168 -0
- package/components/wechat-chat-control/revoke-me-message/revoke-me-message.vue +41 -0
- package/components/wechat-chat-control/revoke-other-message/revoke-other-message.vue +41 -0
- package/components/wechat-chat-control/revoke-you-message/revoke-you-message.vue +41 -0
- package/components/wechat-chat-control/room-calling/phone-fill.svg +1 -0
- package/components/wechat-chat-control/room-calling/room-calling.vue +52 -0
- package/components/wechat-chat-control/room-calling/vidicon-fill.svg +1 -0
- package/components/wechat-chat-control/share-card/quote-icon.svg +1 -0
- package/components/wechat-chat-control/share-card/share-card.vue +140 -0
- package/components/wechat-chat-control/system/system.vue +122 -0
- package/components/wechat-chat-control/system-batch-message/system-batch-message.vue +28 -0
- package/components/wechat-chat-control/system-money/system-money.vue +39 -0
- package/components/wechat-chat-control/text/icons/icon.svg +6 -0
- package/components/wechat-chat-control/text/text.vue +164 -0
- package/components/wechat-chat-control/text-with-at/text-with-at.vue +88 -0
- package/components/wechat-chat-control/transfer/collection.svg +1 -0
- package/components/wechat-chat-control/transfer/quote-icon.svg +1 -0
- package/components/wechat-chat-control/transfer/red-transfer.svg +1 -0
- package/components/wechat-chat-control/transfer/refund.svg +1 -0
- package/components/wechat-chat-control/transfer/transfer.svg +1 -0
- package/components/wechat-chat-control/transfer/transfer.vue +263 -0
- package/components/wechat-chat-control/unknow/unknow.vue +21 -0
- package/components/wechat-chat-control/url/icons/link.svg +1 -0
- package/components/wechat-chat-control/url/icons/video.svg +6 -0
- package/components/wechat-chat-control/url/miniprogram.svg +1 -0
- package/components/wechat-chat-control/url/url-file.vue +47 -0
- package/components/wechat-chat-control/url/url-link.vue +169 -0
- package/components/wechat-chat-control/url/url-merge.vue +164 -0
- package/components/wechat-chat-control/url/url-miniprogram.vue +259 -0
- package/components/wechat-chat-control/url/url.vue +116 -0
- package/components/wechat-chat-control/util.js +234 -0
- package/components/wechat-chat-control/video/icons/video.svg +1 -0
- package/components/wechat-chat-control/video/video.vue +304 -0
- package/components/wechat-chat-control/voice/icons/voice.svg +1 -0
- package/components/wechat-chat-control/voice/voice.vue +464 -0
- package/components/wechat-chat-control/wechat-chat-control-config-item.vue +24 -0
- package/components/wechat-chat-control/wechat-chat-control-config-msg.vue +21 -0
- package/components/wechat-chat-control/wechat-chat-control-config.vue +57 -0
- package/components/wechat-chat-panel/chat-panel-chat-status/chat-panel-chat-status.vue +69 -0
- package/components/wechat-chat-panel/chat-panel-item.vue +695 -0
- package/components/wechat-chat-panel/chat-panel.vue +257 -0
- package/components/wechat-chat-panel/index.js +3 -0
- package/components/wework-chat-control/calling/calling.vue +223 -0
- package/components/wework-chat-control/calling/phone-fill.svg +1 -0
- package/components/wework-chat-control/calling/vidicon-fill.svg +1 -0
- package/components/wework-chat-control/channel-live/channel-live.vue +198 -0
- package/components/wework-chat-control/channel-live/quote-icon.svg +1 -0
- package/components/wework-chat-control/channel-video/channel-video.vue +180 -0
- package/components/wework-chat-control/channel-video/quote-icon.svg +1 -0
- package/components/wework-chat-control/company-card/company-card.vue +136 -0
- package/components/wework-chat-control/company-card/quote-icon.svg +1 -0
- package/components/wework-chat-control/custom-expression/custom-expression.vue +34 -0
- package/components/wework-chat-control/empty/empty.vue +27 -0
- package/components/wework-chat-control/expression/expression.vue +53 -0
- package/components/wework-chat-control/file-url/file-url.vue +247 -0
- package/components/wework-chat-control/file-url/icons/file-excel-line.svg +1 -0
- package/components/wework-chat-control/file-url/icons/file-info-line.svg +1 -0
- package/components/wework-chat-control/file-url/icons/file-music-line.svg +1 -0
- package/components/wework-chat-control/file-url/icons/file-pdf-line.svg +1 -0
- package/components/wework-chat-control/file-url/icons/file-ppt-line.svg +1 -0
- package/components/wework-chat-control/file-url/icons/file-settings-line.svg +1 -0
- package/components/wework-chat-control/file-url/icons/file-text-line.svg +1 -0
- package/components/wework-chat-control/file-url/icons/file-unknow-line.svg +1 -0
- package/components/wework-chat-control/file-url/icons/file-word-line.svg +1 -0
- package/components/wework-chat-control/file-url/icons/file-zip-line.svg +1 -0
- package/components/wework-chat-control/file-url/icons/index.js +24 -0
- package/components/wework-chat-control/image/image.vue +296 -0
- package/components/wework-chat-control/image/index.js +1 -0
- package/components/wework-chat-control/image/util.js +21 -0
- package/components/wework-chat-control/index.js +105 -0
- package/components/wework-chat-control/jx-sys-text/jx-sys-text.vue +28 -0
- package/components/wework-chat-control/link/link.vue +100 -0
- package/components/wework-chat-control/location/location.vue +181 -0
- package/components/wework-chat-control/location/offline-bg.png +0 -0
- package/components/wework-chat-control/red-envelopes/quote-icon.svg +1 -0
- package/components/wework-chat-control/red-envelopes/red-envelope.svg +1 -0
- package/components/wework-chat-control/red-envelopes/red-envelopes.vue +168 -0
- package/components/wework-chat-control/share-card/quote-icon.svg +1 -0
- package/components/wework-chat-control/share-card/share-card.vue +140 -0
- package/components/wework-chat-control/text/icons/icon.svg +6 -0
- package/components/wework-chat-control/text/text.vue +157 -0
- package/components/wework-chat-control/unknow/unknow.vue +21 -0
- package/components/wework-chat-control/url/icons/link.svg +1 -0
- package/components/wework-chat-control/url/icons/video.svg +6 -0
- package/components/wework-chat-control/url/miniprogram.svg +1 -0
- package/components/wework-chat-control/url/url-file.vue +37 -0
- package/components/wework-chat-control/url/url-link.vue +169 -0
- package/components/wework-chat-control/url/url-merge.vue +164 -0
- package/components/wework-chat-control/url/url-miniprogram.vue +248 -0
- package/components/wework-chat-control/url/url.vue +103 -0
- package/components/wework-chat-control/util.js +223 -0
- package/components/wework-chat-control/video/icons/video.svg +1 -0
- package/components/wework-chat-control/video/video.vue +304 -0
- package/components/wework-chat-control/voice/icons/voice.svg +1 -0
- package/components/wework-chat-control/voice/voice.vue +464 -0
- package/components/wework-chat-panel/chat-panel-controls/company-card/company-card.vue +35 -0
- package/components/wework-chat-panel/chat-panel-controls/expression/expression.vue +36 -0
- package/components/wework-chat-panel/chat-panel-controls/file-url/file-url.vue +35 -0
- package/components/wework-chat-panel/chat-panel-controls/image/image.vue +36 -0
- package/components/wework-chat-panel/chat-panel-controls/index.js +35 -0
- package/components/wework-chat-panel/chat-panel-controls/jx-sys-text/jx-sys-text.vue +28 -0
- package/components/wework-chat-panel/chat-panel-controls/link/link.vue +35 -0
- package/components/wework-chat-panel/chat-panel-controls/location/location.vue +35 -0
- package/components/wework-chat-panel/chat-panel-controls/text/text.vue +43 -0
- package/components/wework-chat-panel/chat-panel-controls/unkonw/unkonw.vue +39 -0
- package/components/wework-chat-panel/chat-panel-controls/video/video.vue +37 -0
- package/components/wework-chat-panel/chat-panel-controls/voice/voice.vue +35 -0
- package/components/wework-chat-panel/chat-panel-item.vue +650 -0
- package/components/wework-chat-panel/chat-panel.vue +163 -0
- package/components/wework-chat-panel/index.js +3 -0
- package/package.json +23 -0
- package/services/client-chat/client-chat-wechat/client-chat-account.js +426 -0
- package/services/client-chat/client-chat-wechat/client-chat-concats.js +1029 -0
- package/services/client-chat/client-chat-wechat/client-chat-draft.js +92 -0
- package/services/client-chat/client-chat-wechat/client-chat-message.js +588 -0
- package/services/client-chat/client-chat-wechat/client-chat-session-manage.js +67 -0
- package/services/client-chat/client-chat-wechat/client-chat-session.js +1048 -0
- package/services/client-chat/client-chat-wechat/client-chat-socket.js +215 -0
- package/services/client-chat/client-chat-wechat/client-chat.js +1065 -0
- package/services/client-chat/client-chat-wechat/index.js +3 -0
- package/services/client-chat/client-chat-wechat/utils.js +82 -0
- package/services/client-chat/client-chat-wework/client-chat-account.js +310 -0
- package/services/client-chat/client-chat-wework/client-chat-concats.js +772 -0
- package/services/client-chat/client-chat-wework/client-chat-message.js +278 -0
- package/services/client-chat/client-chat-wework/client-chat-session.js +929 -0
- package/services/client-chat/client-chat-wework/client-chat-socket.js +64 -0
- package/services/client-chat/client-chat-wework/client-chat.js +330 -0
- package/services/client-chat/client-chat-wework/index.js +3 -0
- package/services/client-chat/client-chat-wework/utils.js +82 -0
- package/services/index.js +10 -0
- package/services/socket/index.js +5 -0
- package/services/socket/socket.js +797 -0
- package/services/socket/utils.js +7 -0
- package/uni-common/account-portray/account-portray.vue +51 -0
- package/uni-common/account-select/account-select-item.vue +172 -0
- package/uni-common/account-select/account-select.vue +252 -0
- package/uni-common/all-friend-avatar/all-friend-avatar.vue +49 -0
- package/uni-common/friend-avatar/default.svg +1 -0
- package/uni-common/friend-avatar/friend-avatar.vue +27 -0
- package/uni-common/friend-avatar/index.js +3 -0
- package/uni-common/friend-loader/friend-loader.vue +53 -0
- package/uni-common/friend-portray/friend-portray.vue +56 -0
- package/uni-common/group-avatar/default.svg +1 -0
- package/uni-common/group-avatar/group-avatar.vue +18 -0
- package/uni-common/group-avatar/index.js +3 -0
- package/uni-common/room-avatar/default.svg +6 -0
- package/uni-common/room-avatar/index.js +3 -0
- package/uni-common/room-avatar/room-avatar.vue +27 -0
- package/uni-common/room-loader/room-loader.vue +53 -0
- package/uni-common/room-portray/room-portray.vue +56 -0
- package/uni-components/chat-control/calling/calling.vue +91 -0
- package/uni-components/chat-control/calling/phone-fill.svg +1 -0
- package/uni-components/chat-control/calling/vidicon-fill.svg +1 -0
- package/uni-components/chat-control/channel-video/channel-video.vue +89 -0
- package/uni-components/chat-control/channel-video-card/channel-video-card.vue +105 -0
- package/uni-components/chat-control/channel-video-live/channel-video-live.vue +92 -0
- package/uni-components/chat-control/chat-control-config-item/chat-control-config-item.vue +20 -0
- package/uni-components/chat-control/chat-control-config-item/index.js +3 -0
- package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-app.vue +25 -0
- package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-h5.vue +21 -0
- package/uni-components/chat-control/chat-control-config.vue +59 -0
- package/uni-components/chat-control/chat-control.vue +218 -0
- package/uni-components/chat-control/company-card/company-card.vue +123 -0
- package/uni-components/chat-control/const.js +28 -0
- package/uni-components/chat-control/expression/expression.vue +41 -0
- package/uni-components/chat-control/image/image.vue +68 -0
- package/uni-components/chat-control/index.js +89 -0
- package/uni-components/chat-control/location/location.vue +110 -0
- package/uni-components/chat-control/member-change/member-change.vue +32 -0
- package/uni-components/chat-control/quote-message/quote-message.vue +216 -0
- package/uni-components/chat-control/real-time-position/real-time-position.vue +62 -0
- package/uni-components/chat-control/redpacket/red-envelope.svg +1 -0
- package/uni-components/chat-control/redpacket/redpacket.vue +75 -0
- package/uni-components/chat-control/share-card/share-card.vue +101 -0
- package/uni-components/chat-control/system/system.vue +69 -0
- package/uni-components/chat-control/system-batch-message/system-batch-message.vue +30 -0
- package/uni-components/chat-control/system-text/system-text.vue +32 -0
- package/uni-components/chat-control/text/text.vue +67 -0
- package/uni-components/chat-control/text-with-at/text-with-at.vue +51 -0
- package/uni-components/chat-control/transfer/red-transfer.svg +1 -0
- package/uni-components/chat-control/transfer/transfer.vue +80 -0
- package/uni-components/chat-control/unkonw/unkonw.vue +37 -0
- package/uni-components/chat-control/url/icons/file-excel-line.svg +1 -0
- package/uni-components/chat-control/url/icons/file-info-line.svg +1 -0
- package/uni-components/chat-control/url/icons/file-music-line.svg +1 -0
- package/uni-components/chat-control/url/icons/file-pdf-line.svg +1 -0
- package/uni-components/chat-control/url/icons/file-ppt-line.svg +1 -0
- package/uni-components/chat-control/url/icons/file-settings-line.svg +1 -0
- package/uni-components/chat-control/url/icons/file-text-line.svg +1 -0
- package/uni-components/chat-control/url/icons/file-unknow-line.svg +1 -0
- package/uni-components/chat-control/url/icons/file-word-line.svg +1 -0
- package/uni-components/chat-control/url/icons/file-zip-line.svg +1 -0
- package/uni-components/chat-control/url/icons/index.js +24 -0
- package/uni-components/chat-control/url/miniprogram.svg +1 -0
- package/uni-components/chat-control/url/url-miniprogram.vue +116 -0
- package/uni-components/chat-control/url/url.vue +306 -0
- package/uni-components/chat-control/url-new/icons/file-excel-line.svg +1 -0
- package/uni-components/chat-control/url-new/icons/file-info-line.svg +1 -0
- package/uni-components/chat-control/url-new/icons/file-music-line.svg +1 -0
- package/uni-components/chat-control/url-new/icons/file-pdf-line.svg +1 -0
- package/uni-components/chat-control/url-new/icons/file-ppt-line.svg +1 -0
- package/uni-components/chat-control/url-new/icons/file-settings-line.svg +1 -0
- package/uni-components/chat-control/url-new/icons/file-text-line.svg +1 -0
- package/uni-components/chat-control/url-new/icons/file-unknow-line.svg +1 -0
- package/uni-components/chat-control/url-new/icons/file-word-line.svg +1 -0
- package/uni-components/chat-control/url-new/icons/file-zip-line.svg +1 -0
- package/uni-components/chat-control/url-new/icons/index.js +24 -0
- package/uni-components/chat-control/url-new/url-new.vue +110 -0
- package/uni-components/chat-control/utils.js +12 -0
- package/uni-components/chat-control/video/video.vue +156 -0
- package/uni-components/chat-control/voice/voice.vue +166 -0
- package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-collect.vue +84 -0
- package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-system.vue +28 -0
- package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet.vue +85 -0
- package/uni-components/chat-editor/chat-editor-func/chat-editor-func.vue +157 -0
- package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at-panel.vue +158 -0
- package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at.vue +61 -0
- package/uni-components/chat-editor/chat-editor-func-button/chat-editor-func-button.vue +58 -0
- package/uni-components/chat-editor/chat-editor-func-file/chat-editor-func-file.vue +54 -0
- package/uni-components/chat-editor/chat-editor-func-image/chat-editor-func-image.vue +42 -0
- package/uni-components/chat-editor/chat-editor-func-video/chat-editor-func-video.vue +42 -0
- package/uni-components/chat-editor/chat-editor-func-voice/chat-editor-func-voice.vue +25 -0
- package/uni-components/chat-editor/chat-editor-message-send/chat-editor-message-send.vue +158 -0
- package/uni-components/chat-editor/chat-editor-quote/chat-editor-quote.vue +75 -0
- package/uni-components/chat-editor/chat-editor.vue +257 -0
- package/uni-components/chat-editor/index.js +10 -0
- package/uni-components/chat-editor/util.js +65 -0
- package/uni-components/chat-panel/chat-panel-chats-box.vue +238 -0
- package/uni-components/chat-panel/chat-panel-chats-forward/chat-panel-chats-forward.vue +273 -0
- package/uni-components/chat-panel/chat-panel-chats-item.vue +578 -0
- package/uni-components/chat-panel/chat-panel-chats-status/chat-panel-chats-status.vue +71 -0
- package/uni-components/chat-panel/chat-panel-chats.vue +368 -0
- package/uni-components/chat-panel/chat-panel.vue +227 -0
- package/uni-components/contacts-group-select/contacts-group-select-item.vue +85 -0
- package/uni-components/contacts-group-select/contacts-group-select-panel.vue +119 -0
- package/uni-components/contacts-group-select/contacts-group-select.vue +150 -0
- package/utils/color.js +178 -0
- package/utils/data.js +11 -0
- package/utils/date.js +107 -0
- package/utils/event.js +3 -0
- package/utils/file.js +26 -0
- package/utils/index.js +5 -0
- package/utils/json.js +40 -0
- package/utils/log.js +243 -0
- package/utils/queue.js +97 -0
- package/utils/regexp.js +9 -0
- package/utils/string.js +66 -0
- package/utils/url.js +48 -0
- package/utils/util.js +130 -0
|
@@ -0,0 +1,1029 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import Event from '../../../utils/event.js'
|
|
3
|
+
import { createPromise } from '../../../utils/util.js'
|
|
4
|
+
|
|
5
|
+
export default class ClientChatContacts {
|
|
6
|
+
defaultFriendGroupField = 'defaultFriendGroup'
|
|
7
|
+
defaultRoomGroupField = 'defaultRoomGroup'
|
|
8
|
+
|
|
9
|
+
data = Vue.observable({
|
|
10
|
+
refreshRoomGroupCountLoadingMap: {},
|
|
11
|
+
refreshFriendGroupCountLoadingMap: {},
|
|
12
|
+
friendGroupData: [],
|
|
13
|
+
/**
|
|
14
|
+
* {
|
|
15
|
+
* "departmentId": "1801429132909334528",
|
|
16
|
+
* "departmentName": "测试一部",
|
|
17
|
+
* "groupMemo": "木三",
|
|
18
|
+
* "groupName": "群聊分组1",
|
|
19
|
+
* "groupType": 2,
|
|
20
|
+
* "id": "f953ef9a40774230be25c259fba2af7b",
|
|
21
|
+
* "ownerType": 0,
|
|
22
|
+
* "sortIndex": 1710206716604,
|
|
23
|
+
* "tenantId": "1761952223049924608"
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
roomGroupData: [],
|
|
27
|
+
/**
|
|
28
|
+
* {
|
|
29
|
+
* "accountId": "1775049357349355520",
|
|
30
|
+
* "addFrom": 15,
|
|
31
|
+
* "additionalPicture": "",
|
|
32
|
+
* "alias": "ling93hui",
|
|
33
|
+
* "avatar": "https://wx.qlogo.cn/mmhead/ver_1/HtM8dZ3P4y5Xut8qV9bPGnCrrrXLhcfqoowicK9yDUrJDRVEJo4tXfHEYo4ebiaARBWIVcYM94jd9LGOTedDhHWUicHrib6YKRkopwGAp2CMg3A/0",
|
|
34
|
+
* "changeType": 2,
|
|
35
|
+
* "city": "大陆",
|
|
36
|
+
* "conRemark": "",
|
|
37
|
+
* "country": "中国",
|
|
38
|
+
* "desc": "",
|
|
39
|
+
* "deviceType": 0,
|
|
40
|
+
* "gender": 1,
|
|
41
|
+
* "groupId": "6efe8da4f39949b8824e808213f57225",
|
|
42
|
+
* "id": "0086a2b675ffd5d6c5cfaaaeef17aea196670040",
|
|
43
|
+
* "isPassed": true,
|
|
44
|
+
* "labels": [],
|
|
45
|
+
* "lastUpdateTime": 1722909288369,
|
|
46
|
+
* "nickname": "凌辉",
|
|
47
|
+
* "phone": "",
|
|
48
|
+
* "phones": [],
|
|
49
|
+
* "province": "上海",
|
|
50
|
+
* "pyInitial": "LH",
|
|
51
|
+
* "quanPin": "linghui",
|
|
52
|
+
* "region": "中国大陆上海",
|
|
53
|
+
* "wechatAccountId": "7ccabf58328d3524f1f4089e405be4f0ed8d30db",
|
|
54
|
+
* "wechatId": "wxid_88k3o4vexl8l22"
|
|
55
|
+
* }
|
|
56
|
+
*/
|
|
57
|
+
friendData: [],
|
|
58
|
+
/**
|
|
59
|
+
* {
|
|
60
|
+
* "accountId": "1775049357349355520",
|
|
61
|
+
* "accountRealname": "杨雨",
|
|
62
|
+
* "accountUsername": "18627032190",
|
|
63
|
+
* "changeType": 2,
|
|
64
|
+
* "chatroomAvatar": "https://kefures.oss-cn-shenzhen.aliyuncs.com/weremote/chat-logs/c82512dc9fc44ca49a66f3ceea09f438/02c3338c30c11de7a7284adcae6488c7/9998/f50496f945c61eb741fe86be90f5f36d.png",
|
|
65
|
+
* "chatroomId": "45456576437@chatroom",
|
|
66
|
+
* "chatroomMemberCount": 0,
|
|
67
|
+
* "conRemark": "",
|
|
68
|
+
* "deviceType": 0,
|
|
69
|
+
* "id": "01869a0ad096b9f707f005fc9df77e362a56a44b",
|
|
70
|
+
* "nickname": "X布雷斯特丨政企%note11丨41",
|
|
71
|
+
* "notice": "",
|
|
72
|
+
* "owner": {
|
|
73
|
+
* "nickname": "翟康胜🇨🇳私域scrm",
|
|
74
|
+
* "id": "wxid_iz2rc1jtj0jr22",
|
|
75
|
+
* "avatar": "https://wx.qlogo.cn/mmhead/ver_1/XUGXKbN9bwr0rNrPT8ZPHTGTc2khF91x9FlguIUyfQWKQ8JISuLJL4cumg41rkDzpebMUwTgmb2myT8uN8TM4iaUfwErwSAyR8n5ibiapPelDw/0"
|
|
76
|
+
* },
|
|
77
|
+
* "ownerWechatId": "wxid_iz2rc1jtj0jr22",
|
|
78
|
+
* "pyInitial": "XBLSTSZQNOTE11S41",
|
|
79
|
+
* "quanPin": "Xbuleisiteshuzhengqinote11shu41",
|
|
80
|
+
* "selfDisplayName": "",
|
|
81
|
+
* "wechatAccountId": "6ab35665f1809d5c9aa7c6285e1e733981ade2f5"
|
|
82
|
+
* }
|
|
83
|
+
*/
|
|
84
|
+
roomData: [],
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* {
|
|
89
|
+
* groupId: [{
|
|
90
|
+
* ... 好友/群数据
|
|
91
|
+
* }]
|
|
92
|
+
* }
|
|
93
|
+
*/
|
|
94
|
+
groupBindFriendMap: {},
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* {
|
|
98
|
+
* groupId: [{
|
|
99
|
+
* ... 好友/群数据
|
|
100
|
+
* }]
|
|
101
|
+
* }
|
|
102
|
+
*/
|
|
103
|
+
groupBindRoomMap: {},
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* {
|
|
107
|
+
* accountId: {
|
|
108
|
+
* groupId: [{
|
|
109
|
+
* ...好友/群数据
|
|
110
|
+
* }]
|
|
111
|
+
* }
|
|
112
|
+
* }
|
|
113
|
+
*/
|
|
114
|
+
accountBindFriendMap: {},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* {
|
|
118
|
+
* accountId: {
|
|
119
|
+
* groupId: [{
|
|
120
|
+
* ...好友/群数据
|
|
121
|
+
* }]
|
|
122
|
+
* }
|
|
123
|
+
* }
|
|
124
|
+
*/
|
|
125
|
+
accountBindRoomMap: {},
|
|
126
|
+
/**
|
|
127
|
+
* 群成员数据
|
|
128
|
+
* {
|
|
129
|
+
* roomId: []
|
|
130
|
+
* }
|
|
131
|
+
*/
|
|
132
|
+
roomBindMemberMap: {},
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 标记通讯录是否修改了
|
|
136
|
+
* 如果修改了,比如接收到了分配好友的会话时,一定通讯录变了,变了的时候界面需要根据这个状态刷新通讯录
|
|
137
|
+
*/
|
|
138
|
+
isModify: false
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
friendMap = {}
|
|
142
|
+
|
|
143
|
+
roomMap = {}
|
|
144
|
+
|
|
145
|
+
loadContactsRoomGroupDataMethod = null
|
|
146
|
+
|
|
147
|
+
loadContactsFriendGroupDataMethod = null
|
|
148
|
+
|
|
149
|
+
loadContactsFriendDataMethod = null
|
|
150
|
+
|
|
151
|
+
loadContactsRoomDataMethod = null
|
|
152
|
+
|
|
153
|
+
loadContactsRoomMemberDataMethod = null
|
|
154
|
+
|
|
155
|
+
constructor (options) {
|
|
156
|
+
options = Object.assign({
|
|
157
|
+
loadContactsRoomGroupDataMethod: null,
|
|
158
|
+
loadContactsFriendGroupDataMethod: null,
|
|
159
|
+
loadContactsFriendDataMethod: null,
|
|
160
|
+
loadContactsRoomDataMethod: null,
|
|
161
|
+
loadContactsRoomMemberDataMethod: null,
|
|
162
|
+
getContactsFriendMethod: null,
|
|
163
|
+
getContactsRoomMethod: null,
|
|
164
|
+
getContactsFriendGroupCountMethod: null,
|
|
165
|
+
getContactsRoomGroupCountMethod: null,
|
|
166
|
+
onContactsRoomRemoved: null,
|
|
167
|
+
onLoadRoomGroupData: null,
|
|
168
|
+
onLoadFriendGroupData: null,
|
|
169
|
+
onUpdateRoom: null,
|
|
170
|
+
onUpdateFriend: null
|
|
171
|
+
}, options)
|
|
172
|
+
if (!options.loadContactsRoomGroupDataMethod) {
|
|
173
|
+
throw new Error('缺少loadContactsRoomGroupDataMethod配置')
|
|
174
|
+
}
|
|
175
|
+
if (!options.loadContactsFriendGroupDataMethod) {
|
|
176
|
+
throw new Error('缺少loadContactsFriendGroupDataMethod配置')
|
|
177
|
+
}
|
|
178
|
+
if (!options.loadContactsFriendDataMethod) {
|
|
179
|
+
throw new Error('缺少loadContactsFriendDataMethod配置')
|
|
180
|
+
}
|
|
181
|
+
if (!options.loadContactsRoomDataMethod) {
|
|
182
|
+
throw new Error('缺少loadContactsRoomDataMethod配置')
|
|
183
|
+
}
|
|
184
|
+
if (!options.loadContactsRoomMemberDataMethod) {
|
|
185
|
+
throw new Error('缺少loadContactsRoomMemberDataMethod配置')
|
|
186
|
+
}
|
|
187
|
+
if (!options.getContactsFriendMethod) {
|
|
188
|
+
throw new Error('缺少getContactsFriendMethod配置')
|
|
189
|
+
}
|
|
190
|
+
if (!options.getContactsRoomMethod) {
|
|
191
|
+
throw new Error('缺少getContactsRoomMethod配置')
|
|
192
|
+
}
|
|
193
|
+
if (!options.getContactsFriendGroupCountMethod) {
|
|
194
|
+
throw new Error('缺少getContactsFriendGroupCountMethod配置')
|
|
195
|
+
}
|
|
196
|
+
if (!options.getContactsRoomGroupCountMethod) {
|
|
197
|
+
throw new Error('缺少getContactsRoomGroupCountMethod配置')
|
|
198
|
+
}
|
|
199
|
+
this.loadContactsRoomGroupDataMethod = options.loadContactsRoomGroupDataMethod
|
|
200
|
+
this.loadContactsFriendGroupDataMethod = options.loadContactsFriendGroupDataMethod
|
|
201
|
+
this.loadContactsFriendDataMethod = options.loadContactsFriendDataMethod
|
|
202
|
+
this.loadContactsRoomDataMethod = options.loadContactsRoomDataMethod
|
|
203
|
+
this.loadContactsRoomMemberDataMethod = options.loadContactsRoomMemberDataMethod
|
|
204
|
+
this.getContactsFriendMethod = options.getContactsFriendMethod
|
|
205
|
+
this.getContactsRoomMethod = options.getContactsRoomMethod
|
|
206
|
+
this.getContactsRoomGroupCountMethod = options.getContactsRoomGroupCountMethod
|
|
207
|
+
this.getContactsFriendGroupCountMethod = options.getContactsFriendGroupCountMethod
|
|
208
|
+
this.onContactsRoomRemoved = options.onContactsRoomRemoved
|
|
209
|
+
this.onLoadRoomGroupData = options.onLoadRoomGroupData
|
|
210
|
+
this.onLoadFriendGroupData = options.onLoadFriendGroupData
|
|
211
|
+
this.onUpdateRoom = options.onUpdateRoom
|
|
212
|
+
this.onUpdateFriend = options.onUpdateFriend
|
|
213
|
+
this.event = new Event()
|
|
214
|
+
this.reloadPromise = createPromise()
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
get groupBindFriendData () {
|
|
218
|
+
return this.data.groupBindFriendMap
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
get groupBindRoomData () {
|
|
222
|
+
return this.data.groupBindRoomMap
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
get accountBindFriendData () {
|
|
226
|
+
return this.data.accountBindFriendMap
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
get accountBindRoomData () {
|
|
230
|
+
return this.data.accountBindRoomMap
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
get roomBindMemberData () {
|
|
234
|
+
return this.data.roomBindMemberMap
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
get roomData () {
|
|
238
|
+
return this.data.roomData
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
get friendData () {
|
|
242
|
+
return this.data.friendData
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
get friendGroupData () {
|
|
246
|
+
return this.data.friendGroupData
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
get roomGroupData () {
|
|
250
|
+
return this.data.roomGroupData
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
get isModify () {
|
|
254
|
+
return this.data.isModify
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
get refreshRoomGroupCountLoadingMap () {
|
|
258
|
+
return this.data.refreshRoomGroupCountLoadingMap || {}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
get refreshFriendGroupCountLoadingMap () {
|
|
262
|
+
return this.data.refreshFriendGroupCountLoadingMap || {}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
setRoomGroup (data) {
|
|
266
|
+
this.data.roomGroupData = []
|
|
267
|
+
if (data && data.length) {
|
|
268
|
+
data.forEach(item => {
|
|
269
|
+
this.addRoomGroup(item)
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
addRoomGroup (data) {
|
|
275
|
+
if (!data || !data.id) {
|
|
276
|
+
throw new Error('缺少必须参数')
|
|
277
|
+
}
|
|
278
|
+
if (this.data.roomGroupData.some(v => v.id === data.id)) {
|
|
279
|
+
return
|
|
280
|
+
}
|
|
281
|
+
this.data.roomGroupData.push(data)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
updateRoomGroup (id, props) {
|
|
285
|
+
const group = this.data.roomGroupData.find(v => v.id === id)
|
|
286
|
+
if (!group) {
|
|
287
|
+
return
|
|
288
|
+
}
|
|
289
|
+
if (!props) {
|
|
290
|
+
return
|
|
291
|
+
}
|
|
292
|
+
Object.keys(props).forEach(key => {
|
|
293
|
+
group[key] = props[key]
|
|
294
|
+
})
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
removeRoomGroup (id) {
|
|
298
|
+
let index = -1
|
|
299
|
+
this.data.roomGroupData.some((v, i) => {
|
|
300
|
+
if (v.id === id) {
|
|
301
|
+
index = i
|
|
302
|
+
return true
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
if (index < 0) {
|
|
306
|
+
return
|
|
307
|
+
}
|
|
308
|
+
this.data.roomGroupData.splice(index, 1)
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
getRoomGroup (id) {
|
|
312
|
+
return this.data.roomGroupData.find(v => v.id === id)
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
setFriendGroup (data) {
|
|
316
|
+
this.data.friendGroupData = []
|
|
317
|
+
if (data && data.length) {
|
|
318
|
+
data.forEach(item => {
|
|
319
|
+
this.addFriendGroup(item)
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
addFriendGroup (data) {
|
|
325
|
+
if (!data || !data.id) {
|
|
326
|
+
throw new Error('缺少必须参数')
|
|
327
|
+
}
|
|
328
|
+
if (this.data.friendGroupData.some(v => v.id === data.id)) {
|
|
329
|
+
return
|
|
330
|
+
}
|
|
331
|
+
this.data.friendGroupData.push(data)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
getFriendGroup (id) {
|
|
335
|
+
return this.data.friendGroupData.find(v => v.id === id)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
removeFriendGroup (id) {
|
|
339
|
+
let index = -1
|
|
340
|
+
this.data.friendGroupData.some((v, i) => {
|
|
341
|
+
if (v.id === data.id) {
|
|
342
|
+
index = i
|
|
343
|
+
return true
|
|
344
|
+
}
|
|
345
|
+
})
|
|
346
|
+
if (index < 0) {
|
|
347
|
+
return
|
|
348
|
+
}
|
|
349
|
+
this.data.friendGroupData.splice(index, 1)
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
updateFriendGroup (id, props) {
|
|
353
|
+
const group = this.data.friendGroupData.find(v => v.id === id)
|
|
354
|
+
if (!group) {
|
|
355
|
+
return
|
|
356
|
+
}
|
|
357
|
+
if (!props) {
|
|
358
|
+
return
|
|
359
|
+
}
|
|
360
|
+
Object.keys(props).forEach(key => {
|
|
361
|
+
group[key] = props[key]
|
|
362
|
+
})
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
setFriendData (data, reset = true) {
|
|
366
|
+
if (reset) {
|
|
367
|
+
this.friendMap = {}
|
|
368
|
+
this.data.groupBindFriendMap = {}
|
|
369
|
+
this.data.accountBindFriendMap = {}
|
|
370
|
+
this.data.friendData = []
|
|
371
|
+
}
|
|
372
|
+
if (data && data.length) {
|
|
373
|
+
data.forEach(v => {
|
|
374
|
+
// changeType === 3代表是删除
|
|
375
|
+
if (v.changeType === 3) {
|
|
376
|
+
this.removeFriend(v.id)
|
|
377
|
+
} else {
|
|
378
|
+
this.addFriend(v)
|
|
379
|
+
}
|
|
380
|
+
})
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
addFriend (data) {
|
|
385
|
+
if (!data || !data.id) {
|
|
386
|
+
throw new Error('缺少必须参数')
|
|
387
|
+
}
|
|
388
|
+
if (this.friendMap[data.id]) {
|
|
389
|
+
return
|
|
390
|
+
}
|
|
391
|
+
this.friendMap[data.id] = data
|
|
392
|
+
this.data.friendData.push(data)
|
|
393
|
+
const groupIds = (data.groupId || this.defaultFriendGroupField).split(',')
|
|
394
|
+
groupIds.forEach(groupId => {
|
|
395
|
+
if (!this.data.groupBindFriendMap[groupId]) {
|
|
396
|
+
Vue.set(this.data.groupBindFriendMap, groupId, [])
|
|
397
|
+
}
|
|
398
|
+
if (data.wechatAccountId) {
|
|
399
|
+
if (!this.data.accountBindFriendMap[data.wechatAccountId]) {
|
|
400
|
+
Vue.set(this.data.accountBindFriendMap, data.wechatAccountId, {})
|
|
401
|
+
}
|
|
402
|
+
if (!this.data.accountBindFriendMap[data.wechatAccountId][groupId]) {
|
|
403
|
+
Vue.set(this.data.accountBindFriendMap[data.wechatAccountId], groupId , [])
|
|
404
|
+
}
|
|
405
|
+
this.data.accountBindFriendMap[data.wechatAccountId][groupId].push(data)
|
|
406
|
+
}
|
|
407
|
+
this.data.groupBindFriendMap[groupId].push(data)
|
|
408
|
+
})
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
removeFriend (id) {
|
|
412
|
+
if (!id) {
|
|
413
|
+
throw new Error('缺少必须参数')
|
|
414
|
+
}
|
|
415
|
+
if (!this.friendMap[id]) {
|
|
416
|
+
return
|
|
417
|
+
}
|
|
418
|
+
const index = this.data.friendData.indexOf(this.friendMap[id])
|
|
419
|
+
if (index >= 0) {
|
|
420
|
+
this.data.friendData.splice(index, 1)
|
|
421
|
+
}
|
|
422
|
+
const groupIds = (this.friendMap[id].groupId || this.defaultFriendGroupField).split(',')
|
|
423
|
+
groupIds.forEach(groupId => {
|
|
424
|
+
if (this.data.groupBindFriendMap[groupId]) {
|
|
425
|
+
const bindIndex = this.data.groupBindFriendMap[groupId].indexOf(this.friendMap[id])
|
|
426
|
+
if (bindIndex >= 0) {
|
|
427
|
+
this.data.groupBindFriendMap[groupId].splice(bindIndex, 1)
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
const wechatAccountId = this.friendMap[id].wechatAccountId
|
|
431
|
+
if (wechatAccountId && this.data.accountBindFriendMap[wechatAccountId] && this.data.accountBindFriendMap[wechatAccountId][groupId]) {
|
|
432
|
+
const bindIndex = this.data.accountBindFriendMap[wechatAccountId][groupId].indexOf(this.friendMap[id])
|
|
433
|
+
if (bindIndex >= 0) {
|
|
434
|
+
this.data.accountBindFriendMap[wechatAccountId][groupId].splice(bindIndex, 1)
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
})
|
|
438
|
+
delete this.friendMap[id]
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
updateFriend (id, props) {
|
|
442
|
+
if (!id) {
|
|
443
|
+
throw new Error('缺少必须参数')
|
|
444
|
+
}
|
|
445
|
+
if (!this.friendMap[id]) {
|
|
446
|
+
return
|
|
447
|
+
}
|
|
448
|
+
if (!props || typeof props !== 'object') {
|
|
449
|
+
return
|
|
450
|
+
}
|
|
451
|
+
const changeProps = {}
|
|
452
|
+
let isChange = false
|
|
453
|
+
Object.keys(props).forEach((key) => {
|
|
454
|
+
if (this.friendMap[id][key] == props[key]) {
|
|
455
|
+
return
|
|
456
|
+
}
|
|
457
|
+
isChange = true
|
|
458
|
+
changeProps[key] = {
|
|
459
|
+
before: this.friendMap[id][key],
|
|
460
|
+
after: props[key]
|
|
461
|
+
}
|
|
462
|
+
Vue.set(this.friendMap[id], key, props[key])
|
|
463
|
+
})
|
|
464
|
+
// 如果更改的里面有groupId,那么需要把对应分组里面的好友处理一下
|
|
465
|
+
if (changeProps.groupId) {
|
|
466
|
+
// before是老分组
|
|
467
|
+
// after是新分组
|
|
468
|
+
// 如果before和afterd的值是null,那就要未分组
|
|
469
|
+
const removeBindFriend = (groupId, wechatAccountId) => {
|
|
470
|
+
if (this.data.groupBindFriendMap[groupId]) {
|
|
471
|
+
const bindIndex = this.data.groupBindFriendMap[groupId].indexOf(this.friendMap[id])
|
|
472
|
+
if (bindIndex >= 0) {
|
|
473
|
+
this.data.groupBindFriendMap[groupId].splice(bindIndex, 1)
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
if (wechatAccountId && this.data.accountBindFriendMap[wechatAccountId] && this.data.accountBindFriendMap[wechatAccountId][groupId]) {
|
|
477
|
+
const bindIndex = this.data.accountBindFriendMap[wechatAccountId][groupId].indexOf(this.friendMap[id])
|
|
478
|
+
if (bindIndex >= 0) {
|
|
479
|
+
this.data.accountBindFriendMap[wechatAccountId][groupId].splice(bindIndex, 1)
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
const addBindFriend = (groupId, wechatAccountId) => {
|
|
484
|
+
if (!this.data.groupBindFriendMap[groupId]) {
|
|
485
|
+
return
|
|
486
|
+
}
|
|
487
|
+
if (this.data.groupBindFriendMap[groupId].indexOf(this.friendMap[id]) < 0) {
|
|
488
|
+
this.data.groupBindFriendMap[groupId].push(this.friendMap[id])
|
|
489
|
+
}
|
|
490
|
+
if (wechatAccountId) {
|
|
491
|
+
if (!this.data.accountBindFriendMap[wechatAccountId]) {
|
|
492
|
+
Vue.set(this.data.accountBindFriendMap, wechatAccountId, {})
|
|
493
|
+
}
|
|
494
|
+
if (!this.data.accountBindFriendMap[wechatAccountId][groupId]) {
|
|
495
|
+
Vue.set(this.data.accountBindFriendMap[wechatAccountId], groupId , [])
|
|
496
|
+
}
|
|
497
|
+
if (this.data.accountBindFriendMap[wechatAccountId][groupId].indexOf(this.friendMap[id]) < 0) {
|
|
498
|
+
this.data.accountBindFriendMap[wechatAccountId][groupId].push(this.friendMap[id])
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
const beforeGroupId = changeProps.groupId.before || this.defaultFriendGroupField
|
|
503
|
+
const afterGroupId = changeProps.groupId.after || this.defaultFriendGroupField
|
|
504
|
+
removeBindFriend(beforeGroupId, this.friendMap[id].wechatAccountId)
|
|
505
|
+
addBindFriend(afterGroupId, this.friendMap[id].wechatAccountId)
|
|
506
|
+
// before是老分组,num要-1
|
|
507
|
+
// after是新分组,num要+1
|
|
508
|
+
// 如果before和afterd的值是null,那就要未分组+-1
|
|
509
|
+
const beforeGroup = this.getFriendGroup(changeProps.groupId.before || this.defaultFriendGroupField)
|
|
510
|
+
const afterGroup = this.getFriendGroup(changeProps.groupId.after || this.defaultFriendGroupField)
|
|
511
|
+
if (beforeGroup) {
|
|
512
|
+
this.updateFriendGroup(beforeGroup.id, {
|
|
513
|
+
num: Math.max((beforeGroup.num || 0) - 1, 0)
|
|
514
|
+
})
|
|
515
|
+
}
|
|
516
|
+
if (afterGroup) {
|
|
517
|
+
this.updateFriendGroup(afterGroup.id, {
|
|
518
|
+
num: (afterGroup.num || 0) + 1
|
|
519
|
+
})
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (isChange) {
|
|
523
|
+
this.onUpdateFriend && this.onUpdateFriend({
|
|
524
|
+
friend: this.friendMap[id],
|
|
525
|
+
updateProps: props,
|
|
526
|
+
changeProps
|
|
527
|
+
})
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
setRoomData (data, reset = true) {
|
|
532
|
+
if (reset) {
|
|
533
|
+
this.roomMap = {}
|
|
534
|
+
this.data.groupBindRoomMap = {}
|
|
535
|
+
this.data.accountBindRoomMap = {}
|
|
536
|
+
this.data.roomData = []
|
|
537
|
+
}
|
|
538
|
+
if (data && data.length) {
|
|
539
|
+
data.forEach(v => {
|
|
540
|
+
this.addRoom(v)
|
|
541
|
+
})
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
addRoom (data) {
|
|
546
|
+
if (!data || !data.id) {
|
|
547
|
+
throw new Error('缺少必须参数')
|
|
548
|
+
}
|
|
549
|
+
if (this.roomMap[data.id]) {
|
|
550
|
+
return
|
|
551
|
+
}
|
|
552
|
+
this.roomMap[data.id] = data
|
|
553
|
+
this.data.roomData.push(data)
|
|
554
|
+
const groupIds = (data.groupId || this.defaultRoomGroupField).split(',')
|
|
555
|
+
groupIds.forEach(groupId => {
|
|
556
|
+
if (!this.data.groupBindRoomMap[groupId]) {
|
|
557
|
+
Vue.set(this.data.groupBindRoomMap, groupId, [])
|
|
558
|
+
}
|
|
559
|
+
this.data.groupBindRoomMap[groupId].push(data)
|
|
560
|
+
if (data.wechatAccountId) {
|
|
561
|
+
if (!this.data.accountBindRoomMap[data.wechatAccountId]) {
|
|
562
|
+
Vue.set(this.data.accountBindRoomMap, data.wechatAccountId, {})
|
|
563
|
+
}
|
|
564
|
+
if (!this.data.accountBindRoomMap[data.wechatAccountId][groupId]) {
|
|
565
|
+
Vue.set(this.data.accountBindRoomMap[data.wechatAccountId], groupId, [])
|
|
566
|
+
}
|
|
567
|
+
this.data.accountBindRoomMap[data.wechatAccountId][groupId].push(data)
|
|
568
|
+
}
|
|
569
|
+
})
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
removeRoom (id) {
|
|
573
|
+
if (!id) {
|
|
574
|
+
throw new Error('缺少必须参数')
|
|
575
|
+
}
|
|
576
|
+
if (!this.roomMap[id]) {
|
|
577
|
+
return
|
|
578
|
+
}
|
|
579
|
+
const index = this.data.roomData.indexOf(this.roomMap[id])
|
|
580
|
+
if (index >= 0) {
|
|
581
|
+
this.data.roomData.splice(index, 1)
|
|
582
|
+
}
|
|
583
|
+
const groupIds = (this.roomMap[id].groupId || this.defaultRoomGroupField).split(',')
|
|
584
|
+
groupIds.forEach(groupId => {
|
|
585
|
+
if (this.data.groupBindRoomMap[groupId]) {
|
|
586
|
+
const bindIndex = this.data.groupBindRoomMap[groupId].indexOf(this.roomMap[id])
|
|
587
|
+
if (bindIndex >= 0) {
|
|
588
|
+
this.data.groupBindRoomMap[groupId].splice(bindIndex, 1)
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
const wechatAccountId = this.roomMap[id].wechatAccountId
|
|
592
|
+
if (wechatAccountId && this.data.accountBindFriendMap[wechatAccountId] && this.data.accountBindFriendMap[wechatAccountId][groupId]) {
|
|
593
|
+
const bindIndex = this.data.accountBindFriendMap[wechatAccountId][groupId].indexOf(this.roomMap[id])
|
|
594
|
+
if (bindIndex >= 0) {
|
|
595
|
+
this.data.accountBindFriendMap[wechatAccountId][groupId].splice(bindIndex, 1)
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
})
|
|
599
|
+
const room = this.roomMap[id]
|
|
600
|
+
delete this.roomMap[id]
|
|
601
|
+
this.onContactsRoomRemoved && this.onContactsRoomRemoved({
|
|
602
|
+
room
|
|
603
|
+
})
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
updateRoom (id, props) {
|
|
607
|
+
if (!id) {
|
|
608
|
+
throw new Error('缺少必须参数')
|
|
609
|
+
}
|
|
610
|
+
if (!this.roomMap[id]) {
|
|
611
|
+
return
|
|
612
|
+
}
|
|
613
|
+
if (!props || typeof props !== 'object') {
|
|
614
|
+
return
|
|
615
|
+
}
|
|
616
|
+
const changeProps = {}
|
|
617
|
+
let isChange = false
|
|
618
|
+
Object.keys(props).forEach((key) => {
|
|
619
|
+
if (this.roomMap[id][key] == props[key]) {
|
|
620
|
+
return
|
|
621
|
+
}
|
|
622
|
+
isChange = true
|
|
623
|
+
changeProps[key] = {
|
|
624
|
+
before: this.roomMap[id][key],
|
|
625
|
+
after: props[key]
|
|
626
|
+
}
|
|
627
|
+
Vue.set(this.roomMap[id], key, props[key])
|
|
628
|
+
})
|
|
629
|
+
// 如果更改的里面有groupId,那么需要把对应分组里面的群聊处理一下
|
|
630
|
+
if (changeProps.groupId) {
|
|
631
|
+
// before是老分组
|
|
632
|
+
// after是新分组
|
|
633
|
+
// 如果before和afterd的值是null,那就要未分组
|
|
634
|
+
const removeBindRoom = (groupId, wechatAccountId) => {
|
|
635
|
+
if (this.data.groupBindRoomMap[groupId]) {
|
|
636
|
+
const bindIndex = this.data.groupBindRoomMap[groupId].indexOf(this.roomMap[id])
|
|
637
|
+
if (bindIndex >= 0) {
|
|
638
|
+
this.data.groupBindRoomMap[groupId].splice(bindIndex, 1)
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
if (wechatAccountId && this.data.accountBindRoomMap[wechatAccountId] && this.data.accountBindRoomMap[wechatAccountId][groupId]) {
|
|
642
|
+
const bindIndex = this.data.accountBindRoomMap[wechatAccountId][groupId].indexOf(this.roomMap[id])
|
|
643
|
+
if (bindIndex >= 0) {
|
|
644
|
+
this.data.accountBindRoomMap[wechatAccountId][groupId].splice(bindIndex, 1)
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
const addBindRoom = (groupId, wechatAccountId) => {
|
|
649
|
+
if (!this.data.groupBindRoomMap[groupId]) {
|
|
650
|
+
Vue.set(this.data.groupBindRoomMap, groupId, [])
|
|
651
|
+
}
|
|
652
|
+
if (this.data.groupBindRoomMap[groupId].indexOf(this.roomMap[id]) < 0) {
|
|
653
|
+
this.data.groupBindRoomMap[groupId].push(this.roomMap[id])
|
|
654
|
+
}
|
|
655
|
+
if (wechatAccountId) {
|
|
656
|
+
if (!this.data.accountBindRoomMap[wechatAccountId]) {
|
|
657
|
+
Vue.set(this.data.accountBindRoomMap, wechatAccountId, {})
|
|
658
|
+
}
|
|
659
|
+
if (!this.data.accountBindRoomMap[wechatAccountId][groupId]) {
|
|
660
|
+
Vue.set(this.data.accountBindRoomMap[wechatAccountId], groupId, [])
|
|
661
|
+
}
|
|
662
|
+
if (this.data.accountBindRoomMap[wechatAccountId][groupId].indexOf(this.roomMap[id]) < 0) {
|
|
663
|
+
this.data.accountBindRoomMap[wechatAccountId][groupId].push(this.roomMap[id])
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
const beforeGroupId = changeProps.groupId.before || this.defaultRoomGroupField
|
|
668
|
+
const afterGroupId = changeProps.groupId.after || this.defaultRoomGroupField
|
|
669
|
+
removeBindRoom(beforeGroupId, this.roomMap[id].wechatAccountId)
|
|
670
|
+
addBindRoom(afterGroupId, this.roomMap[id].wechatAccountId)
|
|
671
|
+
// before是老分组,num要-1
|
|
672
|
+
// after是新分组,num要+1
|
|
673
|
+
// 如果before和afterd的值是null,那就要未分组+-1
|
|
674
|
+
const beforeGroup = this.getRoomGroup(changeProps.groupId.before || this.defaultRoomGroupField)
|
|
675
|
+
const afterGroup = this.getRoomGroup(changeProps.groupId.after || this.defaultRoomGroupField)
|
|
676
|
+
if (beforeGroup) {
|
|
677
|
+
this.updateRoomGroup(beforeGroup.id, {
|
|
678
|
+
num: Math.max((beforeGroup.num || 0) - 1, 0)
|
|
679
|
+
})
|
|
680
|
+
}
|
|
681
|
+
if (afterGroup) {
|
|
682
|
+
this.updateRoomGroup(afterGroup.id, {
|
|
683
|
+
num: (afterGroup.num || 0) + 1
|
|
684
|
+
})
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
if (isChange) {
|
|
688
|
+
this.onUpdateRoom && this.onUpdateRoom({
|
|
689
|
+
room: this.roomMap[id],
|
|
690
|
+
updateProps: props,
|
|
691
|
+
changeProps
|
|
692
|
+
})
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
loadFriendGroupData () {
|
|
697
|
+
if (this._cacheLoadFriendGroupPromise) {
|
|
698
|
+
return this._cacheLoadFriendGroupPromise
|
|
699
|
+
}
|
|
700
|
+
this._cacheLoadFriendGroupPromise = this.loadContactsFriendGroupDataMethod().then((rs) => {
|
|
701
|
+
this.setFriendGroup(rs.data)
|
|
702
|
+
this.onLoadFriendGroupData && this.onLoadFriendGroupData()
|
|
703
|
+
return rs
|
|
704
|
+
})
|
|
705
|
+
return this._cacheLoadFriendGroupPromise
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
reloadFriendGroupData () {
|
|
709
|
+
if (this._cacheLoadFriendGroupPromise) {
|
|
710
|
+
this._cacheLoadFriendGroupPromise = null
|
|
711
|
+
}
|
|
712
|
+
return this.loadFriendGroupData()
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* 缓存方式刷新数量
|
|
717
|
+
* 根据wechatAccountId缓存
|
|
718
|
+
*/
|
|
719
|
+
refreshAllFriendGroupCount (params) {
|
|
720
|
+
const { wechatAccountId, ...nextParams } = Object.assign({
|
|
721
|
+
wechatAccountId: null
|
|
722
|
+
}, params)
|
|
723
|
+
if (!this._cacheFriendGroupCountMap) {
|
|
724
|
+
this._cacheFriendGroupCountMap = {}
|
|
725
|
+
}
|
|
726
|
+
if (!this._cacheFriendGroupCountMap[wechatAccountId]) {
|
|
727
|
+
const groupIds = (this.data.friendGroupData || []).map(v => v.id)
|
|
728
|
+
groupIds.forEach(id => {
|
|
729
|
+
Vue.set(this.data.refreshFriendGroupCountLoadingMap, id, true)
|
|
730
|
+
})
|
|
731
|
+
this._cacheFriendGroupCountMap[wechatAccountId] = this.getContactsFriendGroupCountMethod(Object.assign({}, nextParams, {
|
|
732
|
+
wechatAccountIds: wechatAccountId ? [wechatAccountId] : null,
|
|
733
|
+
groupIds
|
|
734
|
+
})).finally(() => {
|
|
735
|
+
groupIds.forEach(id => {
|
|
736
|
+
Vue.set(this.data.refreshFriendGroupCountLoadingMap, id, false)
|
|
737
|
+
})
|
|
738
|
+
})
|
|
739
|
+
}
|
|
740
|
+
this._cacheFriendGroupCountMap[wechatAccountId].then(rs => {
|
|
741
|
+
if (!rs || !rs.data || !rs.data.length) {
|
|
742
|
+
return
|
|
743
|
+
}
|
|
744
|
+
rs.data.forEach(group => {
|
|
745
|
+
this.updateFriendGroup(group.id, {
|
|
746
|
+
num: group.num
|
|
747
|
+
})
|
|
748
|
+
})
|
|
749
|
+
})
|
|
750
|
+
return this._cacheFriendGroupCountMap[wechatAccountId]
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
loadRoomGroupData () {
|
|
754
|
+
if (this._cacheLoadRoomGroupPromise) {
|
|
755
|
+
return this._cacheLoadRoomGroupPromise
|
|
756
|
+
}
|
|
757
|
+
this._cacheLoadRoomGroupPromise = this.loadContactsRoomGroupDataMethod().then((rs) => {
|
|
758
|
+
this.setRoomGroup(rs.data)
|
|
759
|
+
this.onLoadRoomGroupData && this.onLoadRoomGroupData()
|
|
760
|
+
return rs
|
|
761
|
+
})
|
|
762
|
+
return this._cacheLoadRoomGroupPromise
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
reloadRoomGroupData () {
|
|
766
|
+
if (this._cacheLoadRoomGroupPromise) {
|
|
767
|
+
this._cacheLoadRoomGroupPromise = null
|
|
768
|
+
}
|
|
769
|
+
return this.loadRoomGroupData()
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
refreshAllRoomGroupCount (params, refresh) {
|
|
773
|
+
const { wechatAccountId, ...nextParams } = Object.assign({
|
|
774
|
+
wechatAccountId: null
|
|
775
|
+
}, params)
|
|
776
|
+
if (!this._cacheRoomGroupCountMap) {
|
|
777
|
+
this._cacheRoomGroupCountMap = {}
|
|
778
|
+
}
|
|
779
|
+
if (!this._cacheRoomGroupCountMap[wechatAccountId] || refresh === true) {
|
|
780
|
+
const groupIds = (this.data.roomGroupData || []).map(v => v.id)
|
|
781
|
+
groupIds.forEach(id => {
|
|
782
|
+
Vue.set(this.data.refreshRoomGroupCountLoadingMap, id, true)
|
|
783
|
+
})
|
|
784
|
+
this._cacheRoomGroupCountMap[wechatAccountId] = this.getContactsRoomGroupCountMethod(Object.assign({}, nextParams, {
|
|
785
|
+
wechatAccountIds: wechatAccountId ? [wechatAccountId] : null,
|
|
786
|
+
groupIds
|
|
787
|
+
})).finally(() => {
|
|
788
|
+
groupIds.forEach(id => {
|
|
789
|
+
Vue.set(this.data.refreshRoomGroupCountLoadingMap, id, false)
|
|
790
|
+
})
|
|
791
|
+
})
|
|
792
|
+
}
|
|
793
|
+
this._cacheRoomGroupCountMap[wechatAccountId].then(rs => {
|
|
794
|
+
if (!rs || !rs.data || !rs.data.length) {
|
|
795
|
+
return
|
|
796
|
+
}
|
|
797
|
+
rs.data.forEach(group => {
|
|
798
|
+
this.updateRoomGroup(group.id, {
|
|
799
|
+
num: group.num
|
|
800
|
+
})
|
|
801
|
+
})
|
|
802
|
+
})
|
|
803
|
+
return this._cacheRoomGroupCountMap[wechatAccountId]
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
getFriend (friendId, refresh) {
|
|
807
|
+
if (!this.getContactsFriendMethod) {
|
|
808
|
+
return Promise.reject(new Error('getContactsFriendMethod未定义'))
|
|
809
|
+
}
|
|
810
|
+
if (refresh !== true) {
|
|
811
|
+
if (this.friendMap[friendId]) {
|
|
812
|
+
return Promise.resolve({
|
|
813
|
+
data: this.friendMap[friendId]
|
|
814
|
+
})
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return this.getContactsFriendMethod({
|
|
818
|
+
id: friendId
|
|
819
|
+
}).then(rs => {
|
|
820
|
+
if (this.friendMap[friendId]) {
|
|
821
|
+
const nextKeys = Object.keys(rs.data || {})
|
|
822
|
+
// 先清空一下好友,还要保持对原始好友对象的引用关系,否则类似好友属性转换位crm属性的场景,好友对象会遗留一些多余属性
|
|
823
|
+
Object.keys(this.friendMap[friendId]).forEach(key => {
|
|
824
|
+
// 把不在的key清理掉,不然后面update的时候,无法对比
|
|
825
|
+
if (!nextKeys.includes(key)) {
|
|
826
|
+
Vue.delete(this.friendMap[friendId], key)
|
|
827
|
+
}
|
|
828
|
+
})
|
|
829
|
+
this.updateFriend(friendId, rs.data)
|
|
830
|
+
} else {
|
|
831
|
+
this.addFriend(rs.data)
|
|
832
|
+
}
|
|
833
|
+
return rs
|
|
834
|
+
})
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
setRoomMemberData (roomId, data) {
|
|
838
|
+
if (!roomId) {
|
|
839
|
+
throw new Error('群少群id')
|
|
840
|
+
}
|
|
841
|
+
if (data && data.length) {
|
|
842
|
+
Vue.set(this.data.roomBindMemberMap, roomId, data)
|
|
843
|
+
} else {
|
|
844
|
+
Vue.delete(this.data.roomBindMemberMap, roomId)
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
loadRoomMemberData (roomId, params, refresh) {
|
|
849
|
+
if (!this.loadRoomMemberDataPromiseMap) {
|
|
850
|
+
this.loadRoomMemberDataPromiseMap = {}
|
|
851
|
+
}
|
|
852
|
+
if (!this.loadRoomMemberDataPromiseMap[roomId] || refresh) {
|
|
853
|
+
this.loadRoomMemberDataPromiseMap[roomId] = this.loadContactsRoomMemberDataMethod(params).then((rs) => {
|
|
854
|
+
this.setRoomMemberData(roomId, rs.data)
|
|
855
|
+
return rs.data
|
|
856
|
+
})
|
|
857
|
+
}
|
|
858
|
+
return this.loadRoomMemberDataPromiseMap[roomId]
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
// 一般用在切换群的时候,把前一次的群缓存的数据清理一下,避免占用内存
|
|
862
|
+
clearRoomMemberData (roomId) {
|
|
863
|
+
this.setRoomMemberData(roomId, null)
|
|
864
|
+
if (this.loadRoomMemberDataPromiseMap[roomId]) {
|
|
865
|
+
delete this.loadRoomMemberDataPromiseMap[roomId]
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
loadFriendData (params) {
|
|
870
|
+
params = Object.assign({
|
|
871
|
+
wechatAccountId: null,
|
|
872
|
+
keyword: null,
|
|
873
|
+
total: null,
|
|
874
|
+
size: 50
|
|
875
|
+
}, params)
|
|
876
|
+
return this.loadContactsFriendDataMethod(params).then(rs => {
|
|
877
|
+
this.setFriendData(rs.data, false)
|
|
878
|
+
return rs
|
|
879
|
+
})
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
reloadFriendData (params) {
|
|
883
|
+
params = Object.assign({
|
|
884
|
+
wechatAccountId: null,
|
|
885
|
+
keyword: null,
|
|
886
|
+
size: 50
|
|
887
|
+
}, params, {
|
|
888
|
+
total: null
|
|
889
|
+
})
|
|
890
|
+
if (this.cancelReloadFriendData) {
|
|
891
|
+
this.cancelReloadFriendData()
|
|
892
|
+
}
|
|
893
|
+
const ps = this.loadContactsFriendDataMethod(params)
|
|
894
|
+
ps.then(rs => {
|
|
895
|
+
this.setFriendData(rs.data, true)
|
|
896
|
+
return rs
|
|
897
|
+
})
|
|
898
|
+
this.cancelReloadFriendData = () => {
|
|
899
|
+
ps && ps.abort && ps.abort()
|
|
900
|
+
}
|
|
901
|
+
return ps
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
searchFriendData (params) {
|
|
905
|
+
params = Object.assign({
|
|
906
|
+
wechatAccountId: null,
|
|
907
|
+
keyword: null,
|
|
908
|
+
size: 50
|
|
909
|
+
}, params, {
|
|
910
|
+
total: null
|
|
911
|
+
})
|
|
912
|
+
return this.loadContactsFriendDataMethod(params)
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
loadRoomData (params) {
|
|
916
|
+
return this.loadContactsRoomDataMethod(Object.assign({
|
|
917
|
+
wechatAccountId: null,
|
|
918
|
+
keyword: null,
|
|
919
|
+
total: null,
|
|
920
|
+
size: 50
|
|
921
|
+
}, params)).then(rs => {
|
|
922
|
+
this.setRoomData(rs.data, false)
|
|
923
|
+
return rs
|
|
924
|
+
})
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
reloadRoomData (params) {
|
|
928
|
+
if (this.cancelReloadRoomData) {
|
|
929
|
+
this.cancelReloadRoomData()
|
|
930
|
+
}
|
|
931
|
+
const ps = this.loadContactsRoomDataMethod(Object.assign({
|
|
932
|
+
wechatAccountId: null,
|
|
933
|
+
keyword: null,
|
|
934
|
+
size: 50
|
|
935
|
+
}, params, {
|
|
936
|
+
total: null
|
|
937
|
+
}))
|
|
938
|
+
ps.then(rs => {
|
|
939
|
+
this.setRoomData(rs.data, true)
|
|
940
|
+
return rs
|
|
941
|
+
})
|
|
942
|
+
this.cancelReloadRoomData = () => {
|
|
943
|
+
ps && ps.abort && ps.abort()
|
|
944
|
+
}
|
|
945
|
+
return ps
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
searchRoomData (params) {
|
|
949
|
+
params = Object.assign({
|
|
950
|
+
wechatAccountId: null,
|
|
951
|
+
keyword: null,
|
|
952
|
+
size: 50
|
|
953
|
+
}, params, {
|
|
954
|
+
total: null
|
|
955
|
+
})
|
|
956
|
+
return this.loadContactsRoomDataMethod(params)
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
getRoom (id, refresh) {
|
|
960
|
+
if (!this.getContactsRoomMethod) {
|
|
961
|
+
return Promise.reject(new Error('getContactsRoomMethod未定义'))
|
|
962
|
+
}
|
|
963
|
+
if (refresh) {
|
|
964
|
+
return this.getContactsRoomMethod({
|
|
965
|
+
id
|
|
966
|
+
}).then(rs => {
|
|
967
|
+
if (rs.data) {
|
|
968
|
+
if (this.roomMap[id]) {
|
|
969
|
+
Object.keys(this.roomMap[id]).forEach(key => {
|
|
970
|
+
delete this.roomMap[id][key]
|
|
971
|
+
})
|
|
972
|
+
Object.keys(rs.data).forEach(key => {
|
|
973
|
+
Vue.set(this.roomMap[id], key, rs.data[key])
|
|
974
|
+
})
|
|
975
|
+
} else {
|
|
976
|
+
this.addRoom(rs.data)
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
return rs
|
|
980
|
+
})
|
|
981
|
+
} else {
|
|
982
|
+
if (this.roomMap[id]) {
|
|
983
|
+
return Promise.resolve({
|
|
984
|
+
data: this.roomMap[id]
|
|
985
|
+
})
|
|
986
|
+
}
|
|
987
|
+
return this.getContactsRoomMethod({
|
|
988
|
+
id
|
|
989
|
+
}).then(rs => {
|
|
990
|
+
this.addRoom(rs.data)
|
|
991
|
+
return rs
|
|
992
|
+
})
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
markModify () {
|
|
997
|
+
this.data.isModify = true
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
unmarkModify () {
|
|
1001
|
+
this.data.isModify = false
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
reset () {
|
|
1005
|
+
this.lastRequestTime = null
|
|
1006
|
+
this.data.friendGroupData = []
|
|
1007
|
+
this.data.roomGroupData = []
|
|
1008
|
+
this.data.friendData = []
|
|
1009
|
+
this.data.roomData = []
|
|
1010
|
+
this.friendMap = {}
|
|
1011
|
+
this.roomMap = {}
|
|
1012
|
+
this.data.groupBindFriendMap = {}
|
|
1013
|
+
this.data.groupBindRoomMap = {}
|
|
1014
|
+
this.data.accountBindFriendMap = {}
|
|
1015
|
+
this.data.accountBindRoomMap = {}
|
|
1016
|
+
this.data.refreshRoomGroupCountLoadingMap = {}
|
|
1017
|
+
this.data.refreshFriendGroupCountLoadingMap = {}
|
|
1018
|
+
this._cacheFriendGroupCountMap = null
|
|
1019
|
+
this._cacheRoomGroupCountMap = null
|
|
1020
|
+
if (this.cancelConnectRequest) {
|
|
1021
|
+
this.cancelConnectRequest()
|
|
1022
|
+
this.cancelConnectRequest = null
|
|
1023
|
+
}
|
|
1024
|
+
if (this.cancelRefreshRequest) {
|
|
1025
|
+
this.cancelRefreshRequest()
|
|
1026
|
+
this.cancelRefreshRequest = null
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|