@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,674 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sdk-panel-panel-chats" :class="{'is-show-nearest': showNearest}">
|
|
3
|
+
<div class="sdk-panel-panel-chats__main" ref="main" @scroll="handlePanelScroll">
|
|
4
|
+
<chat-panel-loading
|
|
5
|
+
v-if="reloading"
|
|
6
|
+
></chat-panel-loading>
|
|
7
|
+
<chat-panel-empty
|
|
8
|
+
v-else-if="isEmpty"
|
|
9
|
+
></chat-panel-empty>
|
|
10
|
+
<template v-else>
|
|
11
|
+
<chat-panel-increment
|
|
12
|
+
:loading="loadHistorying"
|
|
13
|
+
:complete="loadHistoryEnd"
|
|
14
|
+
:show-load-more="loadHistoryNum <= 1"
|
|
15
|
+
:range-load="innerEnableRangeLoad"
|
|
16
|
+
:complete-text="loadCompleteText"
|
|
17
|
+
@load="handleIncrementLoadMore"
|
|
18
|
+
@range="handleIncrementRangeMore"
|
|
19
|
+
></chat-panel-increment>
|
|
20
|
+
<template v-if="dataType === 'array'">
|
|
21
|
+
<chat-panel-chat
|
|
22
|
+
v-for="item in data"
|
|
23
|
+
:key="'chat_' + item[keyField]"
|
|
24
|
+
:dir="handleisSenderMethod(item) ? 'right' : 'left'"
|
|
25
|
+
:class="handleChatClassMethod(item)"
|
|
26
|
+
:id="item[keyField]"
|
|
27
|
+
:item="item"
|
|
28
|
+
:render-control="renderControl"
|
|
29
|
+
:fetch-user-method="fetchUserMethod"
|
|
30
|
+
:ref="'chat_' + item[keyField]"
|
|
31
|
+
:show-context-btn="showContextBtn"
|
|
32
|
+
:msg-time-field="msgTimeField"
|
|
33
|
+
@view-context="handleViewContextClick(item)"
|
|
34
|
+
@contextmenu="handleChatContextMenu(item, $event)"
|
|
35
|
+
>
|
|
36
|
+
<template slot="chat" slot-scope="scope">
|
|
37
|
+
<slot name="chat" v-bind="scope"></slot>
|
|
38
|
+
</template>
|
|
39
|
+
<template slot-scope="scope" slot="chat-foot">
|
|
40
|
+
<slot name="chat-foot" v-bind="scope"></slot>
|
|
41
|
+
</template>
|
|
42
|
+
<template slot-scope="scope" slot="chat-append">
|
|
43
|
+
<slot name="chat-append" v-bind="scope"></slot>
|
|
44
|
+
</template>
|
|
45
|
+
</chat-panel-chat>
|
|
46
|
+
</template>
|
|
47
|
+
<template v-else>
|
|
48
|
+
<template v-for="day in data">
|
|
49
|
+
<template
|
|
50
|
+
v-for="milliseconds in day"
|
|
51
|
+
>
|
|
52
|
+
<template
|
|
53
|
+
v-for="item in milliseconds"
|
|
54
|
+
>
|
|
55
|
+
<chat-panel-chat
|
|
56
|
+
:key="'chat_' + item[keyField]"
|
|
57
|
+
:dir="handleisSenderMethod(item) ? 'right' : 'left'"
|
|
58
|
+
:class="handleChatClassMethod(item)"
|
|
59
|
+
:id="item[keyField]"
|
|
60
|
+
:item="item"
|
|
61
|
+
:render-control="renderControl"
|
|
62
|
+
:fetch-user-method="fetchUserMethod"
|
|
63
|
+
:ref="'chat_' + item[keyField]"
|
|
64
|
+
:show-context-btn="showContextBtn"
|
|
65
|
+
:msg-time-field="msgTimeField"
|
|
66
|
+
@view-context="handleViewContextClick(item)"
|
|
67
|
+
@contextmenu="handleChatContextMenu(item, $event)"
|
|
68
|
+
>
|
|
69
|
+
<template slot="chat" slot-scope="scope">
|
|
70
|
+
<slot name="chat" v-bind="scope"></slot>
|
|
71
|
+
</template>
|
|
72
|
+
<template slot-scope="scope" slot="chat-foot">
|
|
73
|
+
<slot name="chat-foot" v-bind="scope"></slot>
|
|
74
|
+
</template>
|
|
75
|
+
<template slot-scope="scope" slot="chat-append">
|
|
76
|
+
<slot name="chat-append" v-bind="scope"></slot>
|
|
77
|
+
</template>
|
|
78
|
+
</chat-panel-chat>
|
|
79
|
+
</template>
|
|
80
|
+
</template>
|
|
81
|
+
</template>
|
|
82
|
+
</template>
|
|
83
|
+
</template>
|
|
84
|
+
</div>
|
|
85
|
+
<div
|
|
86
|
+
class="sdk-panel-panel-chats__nearest"
|
|
87
|
+
v-if="showNearest"
|
|
88
|
+
>
|
|
89
|
+
<chat-panel-nearest
|
|
90
|
+
:empty="loadNearestEnd"
|
|
91
|
+
:loading="loadNearesting"
|
|
92
|
+
:reloading="reloading"
|
|
93
|
+
@load="handleNearestLoadMore"
|
|
94
|
+
@reload="handleNearestReload"
|
|
95
|
+
></chat-panel-nearest>
|
|
96
|
+
</div>
|
|
97
|
+
<div
|
|
98
|
+
class="sdk-panel-panel-chats__new"
|
|
99
|
+
v-if="newMessageData && newMessageData.length"
|
|
100
|
+
@click="handleNewMessageClick"
|
|
101
|
+
>
|
|
102
|
+
<span class="sdk-chat-panel-nearest__button-text">有<b>{{ newMessageData.length }}</b>条新消息</span>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
106
|
+
<script>
|
|
107
|
+
import ChatPanelChat from './chat-panel-chat'
|
|
108
|
+
import ChatPanelLoading from './chat-panel-loading'
|
|
109
|
+
import ChatPanelIncrement from './chat-panel-increment'
|
|
110
|
+
import ChatPanelNearest from './chat-panel-nearest'
|
|
111
|
+
import ChatPanelEmpty from './chat-panel-empty'
|
|
112
|
+
import { isElementInParentViewport } from './util'
|
|
113
|
+
|
|
114
|
+
export default {
|
|
115
|
+
name: 'SdkChatPanelChats',
|
|
116
|
+
components: {
|
|
117
|
+
ChatPanelEmpty,
|
|
118
|
+
ChatPanelChat,
|
|
119
|
+
ChatPanelLoading,
|
|
120
|
+
ChatPanelNearest,
|
|
121
|
+
ChatPanelIncrement
|
|
122
|
+
},
|
|
123
|
+
props: {
|
|
124
|
+
keyField: {
|
|
125
|
+
type: String,
|
|
126
|
+
default: 'id'
|
|
127
|
+
},
|
|
128
|
+
// 没有pageSize的时候证明不需要分页加载
|
|
129
|
+
pageSize: {
|
|
130
|
+
type: Number,
|
|
131
|
+
default: 20
|
|
132
|
+
},
|
|
133
|
+
data: {
|
|
134
|
+
type: [Array, Object]
|
|
135
|
+
},
|
|
136
|
+
startDate: {
|
|
137
|
+
type: Number
|
|
138
|
+
},
|
|
139
|
+
endDate: {
|
|
140
|
+
type: Number
|
|
141
|
+
},
|
|
142
|
+
renderControl: {
|
|
143
|
+
type: Function
|
|
144
|
+
},
|
|
145
|
+
fetchUserMethod: {
|
|
146
|
+
type: Function
|
|
147
|
+
},
|
|
148
|
+
fetchDataMethod: {
|
|
149
|
+
type: Function
|
|
150
|
+
},
|
|
151
|
+
chatClassMethod: {
|
|
152
|
+
type: Function
|
|
153
|
+
},
|
|
154
|
+
isSenderMethod: {
|
|
155
|
+
type: Function
|
|
156
|
+
},
|
|
157
|
+
enableRangeLoad: {
|
|
158
|
+
type: Boolean,
|
|
159
|
+
default: true
|
|
160
|
+
},
|
|
161
|
+
loadCompleteText: {
|
|
162
|
+
type: String
|
|
163
|
+
},
|
|
164
|
+
showContextBtn: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
default: false
|
|
167
|
+
},
|
|
168
|
+
contextChatId: {
|
|
169
|
+
type: String
|
|
170
|
+
},
|
|
171
|
+
msgTimeField: {
|
|
172
|
+
type: String,
|
|
173
|
+
default: 'wechatTime'
|
|
174
|
+
},
|
|
175
|
+
enableDefaultDateRange: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: true
|
|
178
|
+
},
|
|
179
|
+
loading: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
default: false
|
|
182
|
+
},
|
|
183
|
+
autoLoad: {
|
|
184
|
+
type: Boolean,
|
|
185
|
+
default: true
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
data () {
|
|
189
|
+
return {
|
|
190
|
+
showNearest: false,
|
|
191
|
+
innerPageSize: this.pageSize,
|
|
192
|
+
loadHistoryNum: 0,
|
|
193
|
+
loadHistoryEnd: true,
|
|
194
|
+
loadHistorying: false,
|
|
195
|
+
loadNearestEnd: false,
|
|
196
|
+
loadNearesting: false,
|
|
197
|
+
reloading: this.loading,
|
|
198
|
+
viewerReady: false,
|
|
199
|
+
viewerImageId: null,
|
|
200
|
+
fetchDateRange: {
|
|
201
|
+
beginTime: null,
|
|
202
|
+
endTime: null
|
|
203
|
+
},
|
|
204
|
+
/**
|
|
205
|
+
* 主要是为了处理查看上下文时候记录,用户点击查看上下文按钮的时候,外面传contextChat进来,reload之后这个contextChat会没有,但是组件内部要记录一下,后面加载最近的逻辑要根据keepContextChat进行判断
|
|
206
|
+
* 正常的reload不需要展示最近加载按钮,只有从上下文或者查看制定消息的才需要,或者搜索的时候
|
|
207
|
+
*/
|
|
208
|
+
keepContextChatId: null,
|
|
209
|
+
/**
|
|
210
|
+
* 新消息数据
|
|
211
|
+
* 当前滚动位置对应的后面的未查看消息相当于是新消息
|
|
212
|
+
*/
|
|
213
|
+
newMessageData: []
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
created () {
|
|
217
|
+
if (this.autoLoad) {
|
|
218
|
+
this.reloadChatData()
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
computed: {
|
|
222
|
+
dataType () {
|
|
223
|
+
return Array.isArray(this.data) ? 'array' : 'object'
|
|
224
|
+
},
|
|
225
|
+
firstMsgItem () {
|
|
226
|
+
if (!this.data) {
|
|
227
|
+
return
|
|
228
|
+
}
|
|
229
|
+
if (Array.isArray(this.data)) {
|
|
230
|
+
return this.data[0]
|
|
231
|
+
}
|
|
232
|
+
const keys = Object.keys(this.data)
|
|
233
|
+
const firstDayKey = keys[0]
|
|
234
|
+
if (!this.data[firstDayKey]) {
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
const millisecondsKeys = Object.keys(this.data[firstDayKey])
|
|
238
|
+
const firstMillisecondsKey = millisecondsKeys[0]
|
|
239
|
+
if (!this.data[firstDayKey][firstMillisecondsKey]) {
|
|
240
|
+
return
|
|
241
|
+
}
|
|
242
|
+
return this.data[firstDayKey][firstMillisecondsKey][0]
|
|
243
|
+
},
|
|
244
|
+
lastMsgItem () {
|
|
245
|
+
if (!this.data) {
|
|
246
|
+
return
|
|
247
|
+
}
|
|
248
|
+
if (Array.isArray(this.data)) {
|
|
249
|
+
return this.data[this.data.length - 1]
|
|
250
|
+
}
|
|
251
|
+
const keys = Object.keys(this.data)
|
|
252
|
+
const lastDayKey = keys[keys.length - 1]
|
|
253
|
+
if (!this.data[lastDayKey]) {
|
|
254
|
+
return
|
|
255
|
+
}
|
|
256
|
+
const millisecondsKeys = Object.keys(this.data[lastDayKey])
|
|
257
|
+
const lastMillisecondsKey = millisecondsKeys[millisecondsKeys.length - 1]
|
|
258
|
+
if (!this.data[lastDayKey][lastMillisecondsKey]) {
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
return this.data[lastDayKey][lastMillisecondsKey][this.data[lastDayKey][lastMillisecondsKey].length - 1]
|
|
262
|
+
},
|
|
263
|
+
isEmpty () {
|
|
264
|
+
return !this.firstMsgItem
|
|
265
|
+
},
|
|
266
|
+
innerEnableRangeLoad () {
|
|
267
|
+
// 不开启分页加载就不是范围加载
|
|
268
|
+
if (!this.pageSize) {
|
|
269
|
+
return false
|
|
270
|
+
}
|
|
271
|
+
if (!this.enableRangeLoad) {
|
|
272
|
+
return false
|
|
273
|
+
}
|
|
274
|
+
if (this.startDate && this.endDate) {
|
|
275
|
+
if (this.fetchDateRange && this.fetchDateRange.endTime && this.fetchDateRange.beginTime) {
|
|
276
|
+
if (this.fetchDateRange.beginTime <= this.startDate && this.endDate >= this.fetchDateRange.endTime) {
|
|
277
|
+
return false
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return true
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
watch: {
|
|
285
|
+
loading () {
|
|
286
|
+
this.reloading = this.loading
|
|
287
|
+
},
|
|
288
|
+
lastMsgItem (newVal, oldVal) {
|
|
289
|
+
if (!newVal || !oldVal || newVal.id === oldVal.id) {
|
|
290
|
+
return
|
|
291
|
+
}
|
|
292
|
+
this.handleCheckScrollLastMessage()
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
methods: {
|
|
296
|
+
handleNewMessageClick () {
|
|
297
|
+
if (this.newMessageData && this.newMessageData.length) {
|
|
298
|
+
this.scrollTo(this.newMessageData[0][this.keyField])
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
handleCheckScrollLastMessage () {
|
|
302
|
+
if (this._disabledCheckScrollLastMessage) {
|
|
303
|
+
return
|
|
304
|
+
}
|
|
305
|
+
// 检查滚动到最后一条消息
|
|
306
|
+
// 这里需要注意,如果当前面板已经有滚动距离,且大于1个屏幕高的时候,只提醒有新消息,不滚动到最后一条消息
|
|
307
|
+
if (this.$refs.main.scrollTop < this.$refs.main.scrollHeight - this.$refs.main.clientHeight * 3) {
|
|
308
|
+
if (this.lastMsgItem && !this.newMessageData.some(v => v.id === this.lastMsgItem.id)) {
|
|
309
|
+
this.newMessageData.push(this.lastMsgItem)
|
|
310
|
+
}
|
|
311
|
+
} else {
|
|
312
|
+
this.scrollToBottom()
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
handleisSenderMethod (item) {
|
|
316
|
+
if (!this.isSenderMethod) {
|
|
317
|
+
return
|
|
318
|
+
}
|
|
319
|
+
return this.isSenderMethod({
|
|
320
|
+
item
|
|
321
|
+
})
|
|
322
|
+
},
|
|
323
|
+
handleChatContextMenu (item, evt) {
|
|
324
|
+
this.$emit('chat-contextmenu', item, evt)
|
|
325
|
+
},
|
|
326
|
+
handleViewContextClick (item) {
|
|
327
|
+
this.$emit('view-context', {
|
|
328
|
+
chat: item
|
|
329
|
+
})
|
|
330
|
+
},
|
|
331
|
+
handleChatClassMethod (item) {
|
|
332
|
+
if (typeof this.chatClassMethod === 'function') {
|
|
333
|
+
return this.chatClassMethod(item)
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
handlePanelScroll () {
|
|
337
|
+
this.checkNewMessageData()
|
|
338
|
+
// 加载更多消息
|
|
339
|
+
if (this.loadHistoryEnd || this.reloading || !this.$refs.main) {
|
|
340
|
+
return
|
|
341
|
+
}
|
|
342
|
+
if (this.$refs.main.scrollTop <= 0) {
|
|
343
|
+
this.loadHistorying = true
|
|
344
|
+
const relativeItem = this.firstMsgItem
|
|
345
|
+
if (relativeItem) {
|
|
346
|
+
this.fetchDateRange.endTime = relativeItem[this.msgTimeField]
|
|
347
|
+
this.fetchDateRange.beginTime = this.fetchDateRange.endTime - (1 * 1000 * 60 * 60 * 24 * 30)
|
|
348
|
+
}
|
|
349
|
+
if (this.startDate && this.fetchDateRange.beginTime && this.startDate > this.fetchDateRange.beginTime) {
|
|
350
|
+
this.fetchDateRange.beginTime = this.startDate
|
|
351
|
+
}
|
|
352
|
+
this.loadMoreChatData({
|
|
353
|
+
upward: true,
|
|
354
|
+
relativeItem
|
|
355
|
+
}).then((rs) => {
|
|
356
|
+
this.loadHistorying = false
|
|
357
|
+
if (this.innerPageSize) {
|
|
358
|
+
// 历史消息加载完毕
|
|
359
|
+
this.loadHistoryEnd = rs.length < this.innerPageSize
|
|
360
|
+
} else {
|
|
361
|
+
this.loadHistoryEnd = true
|
|
362
|
+
}
|
|
363
|
+
}, () => {
|
|
364
|
+
this.loadHistorying = false
|
|
365
|
+
})
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
handleIncrementRangeMore () {
|
|
369
|
+
this.loadHistorying = true
|
|
370
|
+
this.loadHistoryEnd = false
|
|
371
|
+
const relativeItem = this.firstMsgItem
|
|
372
|
+
if (relativeItem) {
|
|
373
|
+
this.fetchDateRange.endTime = relativeItem[this.msgTimeField]
|
|
374
|
+
this.fetchDateRange.beginTime = this.fetchDateRange.endTime - (1 * 1000 * 60 * 60 * 24 * 30)
|
|
375
|
+
}
|
|
376
|
+
if (this.startDate && this.fetchDateRange.beginTime && this.startDate > this.fetchDateRange.beginTime) {
|
|
377
|
+
this.fetchDateRange.beginTime = this.startDate
|
|
378
|
+
}
|
|
379
|
+
this.loadMoreChatData({
|
|
380
|
+
upward: true,
|
|
381
|
+
relativeItem
|
|
382
|
+
}).then((rs) => {
|
|
383
|
+
this.loadHistorying = false
|
|
384
|
+
// 历史消息加载完毕
|
|
385
|
+
if (this.innerPageSize) {
|
|
386
|
+
// 历史消息加载完毕
|
|
387
|
+
this.loadHistoryEnd = rs.length < this.innerPageSize
|
|
388
|
+
} else {
|
|
389
|
+
this.loadHistoryEnd = true
|
|
390
|
+
}
|
|
391
|
+
}, () => {
|
|
392
|
+
this.loadHistorying = false
|
|
393
|
+
})
|
|
394
|
+
},
|
|
395
|
+
handleIncrementLoadMore () {
|
|
396
|
+
this.loadHistorying = true
|
|
397
|
+
const relativeItem = this.firstMsgItem
|
|
398
|
+
if (relativeItem) {
|
|
399
|
+
this.fetchDateRange.endTime = relativeItem[this.msgTimeField]
|
|
400
|
+
this.fetchDateRange.beginTime = this.fetchDateRange.endTime - (1 * 1000 * 60 * 60 * 24 * 30)
|
|
401
|
+
}
|
|
402
|
+
if (this.startDate && this.fetchDateRange.beginTime && this.startDate > this.fetchDateRange.beginTime) {
|
|
403
|
+
this.fetchDateRange.beginTime = this.startDate
|
|
404
|
+
}
|
|
405
|
+
this.loadMoreChatData({
|
|
406
|
+
upward: true,
|
|
407
|
+
relativeItem
|
|
408
|
+
}).then((rs) => {
|
|
409
|
+
this.loadHistorying = false
|
|
410
|
+
if (this.innerPageSize) {
|
|
411
|
+
// 历史消息加载完毕
|
|
412
|
+
this.loadHistoryEnd = rs.length < this.innerPageSize
|
|
413
|
+
} else {
|
|
414
|
+
this.loadHistoryEnd = true
|
|
415
|
+
}
|
|
416
|
+
}, () => {
|
|
417
|
+
this.loadHistorying = false
|
|
418
|
+
})
|
|
419
|
+
},
|
|
420
|
+
handleNearestReload () {
|
|
421
|
+
this.reloadChatData()
|
|
422
|
+
},
|
|
423
|
+
handleNearestLoadMore () {
|
|
424
|
+
this.loadNearesting = true
|
|
425
|
+
const relativeItem = this.lastMsgItem
|
|
426
|
+
if (relativeItem) {
|
|
427
|
+
this.fetchDateRange.beginTime = relativeItem[this.msgTimeField]
|
|
428
|
+
this.fetchDateRange.endTime = this.fetchDateRange.beginTime + (1 * 1000 * 60 * 60 * 24 * 30)
|
|
429
|
+
}
|
|
430
|
+
if (this.startDate && this.fetchDateRange.beginTime && this.startDate > this.fetchDateRange.beginTime) {
|
|
431
|
+
this.fetchDateRange.beginTime = this.startDate
|
|
432
|
+
}
|
|
433
|
+
this._disabledCheckScrollLastMessage = true
|
|
434
|
+
this.loadMoreChatData({
|
|
435
|
+
upward: false,
|
|
436
|
+
relativeItem: this.lastMsgItem
|
|
437
|
+
}, true).then((rs) => {
|
|
438
|
+
if (!rs || !rs.length && this.fetchDateRange.endTime > Date.now()) {
|
|
439
|
+
this.loadNearestEnd = true
|
|
440
|
+
}
|
|
441
|
+
this.loadNearesting = false
|
|
442
|
+
}, () => {
|
|
443
|
+
this.loadNearesting = false
|
|
444
|
+
}).finally(() => {
|
|
445
|
+
this.$nextTick(() => {
|
|
446
|
+
this._disabledCheckScrollLastMessage = false
|
|
447
|
+
})
|
|
448
|
+
})
|
|
449
|
+
},
|
|
450
|
+
checkNewMessageData () {
|
|
451
|
+
// 标记新消息已读
|
|
452
|
+
if (!this.newMessageData || !this.newMessageData.length) {
|
|
453
|
+
return
|
|
454
|
+
}
|
|
455
|
+
// 如果滚动条滚动到了这条消息,就从新消息里面移除掉
|
|
456
|
+
const cloneNewMessageData = [].concat(this.newMessageData)
|
|
457
|
+
cloneNewMessageData.some((message, index) => {
|
|
458
|
+
const $chatEl = Array.isArray(this.$refs['chat_' + message[this.keyField]]) ? this.$refs['chat_' + message[this.keyField]][0] : null
|
|
459
|
+
if (!$chatEl) {
|
|
460
|
+
return
|
|
461
|
+
}
|
|
462
|
+
if (!isElementInParentViewport($chatEl.$el, this.$refs.main)) {
|
|
463
|
+
return
|
|
464
|
+
}
|
|
465
|
+
this.newMessageData.splice(index, 1)
|
|
466
|
+
})
|
|
467
|
+
},
|
|
468
|
+
scrollTo (id) {
|
|
469
|
+
if (!id) {
|
|
470
|
+
return
|
|
471
|
+
}
|
|
472
|
+
this.$nextTick(() => {
|
|
473
|
+
const chatId = `chat_${id}`
|
|
474
|
+
if (this.$refs[chatId] && this.$refs[chatId][0]) {
|
|
475
|
+
if (!this.$refs.main) {
|
|
476
|
+
return
|
|
477
|
+
}
|
|
478
|
+
this.$refs.main.scrollTop = this.$refs[chatId][0].$el.offsetTop - this.$refs[chatId][0].$el.clientHeight
|
|
479
|
+
}
|
|
480
|
+
})
|
|
481
|
+
},
|
|
482
|
+
scrollToBottom () {
|
|
483
|
+
this.$nextTick(() => {
|
|
484
|
+
if (!this.$refs.main) {
|
|
485
|
+
return
|
|
486
|
+
}
|
|
487
|
+
this.$refs.main.scrollTop = this.$refs.main.scrollHeight + this.$refs.main.clientHeight
|
|
488
|
+
})
|
|
489
|
+
},
|
|
490
|
+
checkNearest ({ lastItem }) {
|
|
491
|
+
// 搜索场景
|
|
492
|
+
if (!!this.endDate) {
|
|
493
|
+
return false
|
|
494
|
+
}
|
|
495
|
+
// 点击查看上下文需要外面传过来,并且reload的时候才缓存一下的值,主要是解决只有查看上下文才展示
|
|
496
|
+
if (!this.keepContextChatId) {
|
|
497
|
+
return false
|
|
498
|
+
}
|
|
499
|
+
if (!this.fetchDateRange) {
|
|
500
|
+
return false
|
|
501
|
+
}
|
|
502
|
+
return this.fetchDateRange.beginTime < Date.now()
|
|
503
|
+
},
|
|
504
|
+
reloadChatData () {
|
|
505
|
+
const filters = {
|
|
506
|
+
firstLoad: true
|
|
507
|
+
}
|
|
508
|
+
this.loadNearestEnd = false
|
|
509
|
+
// 是否启用reload的时候默认生成时间范围,主要是客服端不需要默认的时间范围,但是管理端查看好友/群的聊天记录的时候又需要,因为后端说管理端会关连多个客服,不传时间后端不好处理
|
|
510
|
+
if (this.enableDefaultDateRange) {
|
|
511
|
+
this.fetchDateRange.endTime = this.endDate || Date.now()
|
|
512
|
+
if (this.startDate) {
|
|
513
|
+
this.fetchDateRange.endTime = this.endDate || Date.now()
|
|
514
|
+
if ((this.fetchDateRange.endTime - this.startDate) > 1000 * 60 * 60 * 24 * 30) {
|
|
515
|
+
this.fetchDateRange.beginTime = this.fetchDateRange.endTime - 1000 * 60 * 60 * 24 * 30
|
|
516
|
+
} else {
|
|
517
|
+
this.fetchDateRange.beginTime = this.startDate
|
|
518
|
+
}
|
|
519
|
+
} else {
|
|
520
|
+
this.fetchDateRange.beginTime = this.fetchDateRange.endTime - (1 * 1000 * 60 * 60 * 24 * 30)
|
|
521
|
+
}
|
|
522
|
+
} else {
|
|
523
|
+
// 因为后端需要分段加载,不能一次给太大的日期范围,所以每次最多30天加载
|
|
524
|
+
if (this.startDate && this.endDate) {
|
|
525
|
+
this.fetchDateRange.endTime = this.endDate || Date.now()
|
|
526
|
+
if ((this.fetchDateRange.endTime - this.startDate) > 1000 * 60 * 60 * 24 * 30) {
|
|
527
|
+
this.fetchDateRange.beginTime = this.fetchDateRange.endTime - 1000 * 60 * 60 * 24 * 30
|
|
528
|
+
} else {
|
|
529
|
+
this.fetchDateRange.beginTime = this.startDate
|
|
530
|
+
}
|
|
531
|
+
} else {
|
|
532
|
+
// 不传,后端会自己处理,这样可以防止最新消息没有加载的问题
|
|
533
|
+
this.fetchDateRange.beginTime = null
|
|
534
|
+
this.fetchDateRange.endTime = null
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
this.keepContextChatId = this.contextChatId
|
|
538
|
+
// 清除新消息数据
|
|
539
|
+
this.newMessageData = []
|
|
540
|
+
const ps = new Promise((resolve, reject) => {
|
|
541
|
+
if (this.reloading) {
|
|
542
|
+
return reject()
|
|
543
|
+
}
|
|
544
|
+
this.reloading = true
|
|
545
|
+
return this.loadChatData(filters).then((rs) => {
|
|
546
|
+
this.reloading = false
|
|
547
|
+
// 滚动到最底部
|
|
548
|
+
this.scrollToBottom()
|
|
549
|
+
if (this.innerPageSize) {
|
|
550
|
+
if (!this.increment || this.loadHistoryNum > 1) {
|
|
551
|
+
// 历史消息加载完毕
|
|
552
|
+
this.loadHistoryEnd = rs.length < this.innerPageSize
|
|
553
|
+
}
|
|
554
|
+
} else {
|
|
555
|
+
this.loadHistoryEnd = true
|
|
556
|
+
}
|
|
557
|
+
if (this.checkNearest) {
|
|
558
|
+
this.showNearest = !!this.checkNearest({
|
|
559
|
+
lastItem: this.lastMsgItem
|
|
560
|
+
})
|
|
561
|
+
if (!this.showNearest) {
|
|
562
|
+
this.keepContextChatId = null
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
this.$emit('loaded', {
|
|
566
|
+
data: rs
|
|
567
|
+
})
|
|
568
|
+
resolve(rs)
|
|
569
|
+
}, (err) => {
|
|
570
|
+
this.reloading = false
|
|
571
|
+
reject(err)
|
|
572
|
+
})
|
|
573
|
+
})
|
|
574
|
+
if (!this.inited) {
|
|
575
|
+
this.inited = true
|
|
576
|
+
ps.then(() => {
|
|
577
|
+
this.$emit('initloaded')
|
|
578
|
+
})
|
|
579
|
+
}
|
|
580
|
+
return ps
|
|
581
|
+
},
|
|
582
|
+
loadMoreChatData (filters, isDown) {
|
|
583
|
+
return this.loadChatData(filters).then((rs) => {
|
|
584
|
+
if (rs && rs.length) {
|
|
585
|
+
// 上滚动才定位到最后一个加载的数据
|
|
586
|
+
if (!isDown) {
|
|
587
|
+
const scrollToId = (rs[rs.length - 1] || {})[this.keyField]
|
|
588
|
+
this.scrollTo(scrollToId)
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (this.checkNearest) {
|
|
592
|
+
this.showNearest = !!this.checkNearest({
|
|
593
|
+
lastItem: this.lastMsgItem
|
|
594
|
+
})
|
|
595
|
+
if (!this.showNearest) {
|
|
596
|
+
this.keepContextChatId = null
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
if (!isDown) {
|
|
600
|
+
this.loadHistoryNum++
|
|
601
|
+
}
|
|
602
|
+
this.$emit('loaded', {
|
|
603
|
+
data: rs
|
|
604
|
+
})
|
|
605
|
+
return rs
|
|
606
|
+
})
|
|
607
|
+
},
|
|
608
|
+
loadChatData (filters) {
|
|
609
|
+
return new Promise((resolve, reject) => {
|
|
610
|
+
const rangeLoadFilter = {}
|
|
611
|
+
// if (this.enableRangeLoad) {
|
|
612
|
+
rangeLoadFilter.endTime = this.fetchDateRange.endTime
|
|
613
|
+
rangeLoadFilter.beginTime = this.fetchDateRange.beginTime
|
|
614
|
+
// }
|
|
615
|
+
this.fetchDataMethod(Object.assign({
|
|
616
|
+
upward: true,
|
|
617
|
+
pageSize: this.innerPageSize
|
|
618
|
+
}, filters, rangeLoadFilter)).then((rs) => {
|
|
619
|
+
resolve(rs)
|
|
620
|
+
}, (err) => {
|
|
621
|
+
reject(err)
|
|
622
|
+
})
|
|
623
|
+
})
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
</script>
|
|
628
|
+
<style lang="less">
|
|
629
|
+
.sdk-panel-panel-chats{
|
|
630
|
+
height: 100%;
|
|
631
|
+
position: relative;
|
|
632
|
+
&.is-show-nearest{
|
|
633
|
+
.sdk-panel-panel-chats__main{
|
|
634
|
+
padding-bottom: 72px;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
.sdk-panel-panel-chats__main{
|
|
639
|
+
height: 100%;
|
|
640
|
+
box-sizing: border-box!important;
|
|
641
|
+
overflow-y: scroll;
|
|
642
|
+
overflow-x: hidden;
|
|
643
|
+
padding: 9px 0 24px 0;
|
|
644
|
+
position: relative;
|
|
645
|
+
}
|
|
646
|
+
.sdk-panel-panel-chats__nearest{
|
|
647
|
+
position: absolute;
|
|
648
|
+
top: calc(~'100% - 72px');
|
|
649
|
+
right: 18px;
|
|
650
|
+
z-index: 3;
|
|
651
|
+
}
|
|
652
|
+
.sdk-panel-panel-chats__new{
|
|
653
|
+
position: absolute;
|
|
654
|
+
top: calc(~'100% - 44px');
|
|
655
|
+
right: 18px;
|
|
656
|
+
z-index: 3;
|
|
657
|
+
background-color: rgba(255, 255, 255, .95);
|
|
658
|
+
box-shadow: 0 0 3px rgba(0,0,0,.1);
|
|
659
|
+
border-radius: 15px;
|
|
660
|
+
cursor: pointer;
|
|
661
|
+
height: 30px;
|
|
662
|
+
line-height: 30px;
|
|
663
|
+
padding: 0 12px;
|
|
664
|
+
transition: color .25s;
|
|
665
|
+
color: #666;
|
|
666
|
+
&:hover {
|
|
667
|
+
color: #4387ff;
|
|
668
|
+
}
|
|
669
|
+
b {
|
|
670
|
+
color: #4387ff;
|
|
671
|
+
margin: 0 2px;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sdk-chat-panel-empty">
|
|
3
|
+
<div class="sdk-chat-panel-empty__icon">
|
|
4
|
+
<ui-icon name="weixinqun-line" :size="72"></ui-icon>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="sdk-chat-panel-empty__text">
|
|
7
|
+
暂无数据
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
name: 'SdkChatPanelEmpty'
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
<style lang="less">
|
|
17
|
+
.sdk-chat-panel-empty{
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
height: 100%;
|
|
23
|
+
}
|
|
24
|
+
.sdk-chat-panel-empty__icon{
|
|
25
|
+
color: #ccc;
|
|
26
|
+
}
|
|
27
|
+
.sdk-chat-panel-empty__text{
|
|
28
|
+
color: #aaa;
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
margin-top: 6px;
|
|
31
|
+
}
|
|
32
|
+
</style>
|