@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,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="bi-contacts-group-select-panel">
|
|
3
|
+
<view class="bi-contacts-group-select-panel__head">
|
|
4
|
+
<view class="bi-contacts-group-select-panel__head-left">
|
|
5
|
+
<uv-button size="small" @click="handleCancelClick">取消</uv-button>
|
|
6
|
+
</view>
|
|
7
|
+
<view class="bi-contacts-group-select-panel__head-center"></view>
|
|
8
|
+
<view class="bi-contacts-group-select-panel__head-right">
|
|
9
|
+
<uv-button size="small" type="primary" @click="handleConfirmClick">确定</uv-button>
|
|
10
|
+
</view>
|
|
11
|
+
</view>
|
|
12
|
+
<view class="bi-contacts-group-select-panel__body">
|
|
13
|
+
<view class="bi-contacts-group-select-panel__group" v-if="friendGroupData && friendGroupData.length">
|
|
14
|
+
<view class="bi-contacts-group-select-panel__group-head">
|
|
15
|
+
<view class="bi-contacts-group-select-panel__group-title">好友分组</view>
|
|
16
|
+
</view>
|
|
17
|
+
<view class="bi-contacts-group-select-panel__group-body">
|
|
18
|
+
<contacts-group-select-item
|
|
19
|
+
class="bi-contacts-group-select-panel__group-item"
|
|
20
|
+
@click="handleFriendGroupClick(group)"
|
|
21
|
+
v-for="group in friendGroupData"
|
|
22
|
+
type="friend"
|
|
23
|
+
:key="group.id"
|
|
24
|
+
:data="group"
|
|
25
|
+
:selected="group.id === inputValue"
|
|
26
|
+
>
|
|
27
|
+
</contacts-group-select-item>
|
|
28
|
+
</view>
|
|
29
|
+
</view>
|
|
30
|
+
<view class="bi-contacts-group-select-panel__group" v-if="roomGroupData && roomGroupData.length">
|
|
31
|
+
<view class="bi-contacts-group-select-panel__group-head">
|
|
32
|
+
<view class="bi-contacts-group-select-panel__group-title">群聊分组</view>
|
|
33
|
+
</view>
|
|
34
|
+
<view class="bi-contacts-group-select-panel__group-body">
|
|
35
|
+
<contacts-group-select-item
|
|
36
|
+
class="bi-contacts-group-select-panel__group-item"
|
|
37
|
+
@click="handleRoomGroupClick(group)"
|
|
38
|
+
v-for="group in roomGroupData"
|
|
39
|
+
type="room"
|
|
40
|
+
:key="group.id"
|
|
41
|
+
:data="group"
|
|
42
|
+
:selected="group.id === inputValue"
|
|
43
|
+
>
|
|
44
|
+
</contacts-group-select-item>
|
|
45
|
+
</view>
|
|
46
|
+
</view>
|
|
47
|
+
<view class="bi-contacts-group-select-panel__safe"></view>
|
|
48
|
+
</view>
|
|
49
|
+
</view>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
import ContactsGroupSelectItem from './contacts-group-select-item.vue'
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
name: 'BiContactsGroupSelectPanel',
|
|
57
|
+
components: {
|
|
58
|
+
ContactsGroupSelectItem
|
|
59
|
+
},
|
|
60
|
+
props: {
|
|
61
|
+
value: {
|
|
62
|
+
type: String
|
|
63
|
+
},
|
|
64
|
+
friendGroupData: {
|
|
65
|
+
type: Array
|
|
66
|
+
},
|
|
67
|
+
roomGroupData: {
|
|
68
|
+
type: Array
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
data () {
|
|
72
|
+
return {
|
|
73
|
+
inputValue: this.value
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
handleCancelClick () {
|
|
78
|
+
this.$emit('cancel')
|
|
79
|
+
},
|
|
80
|
+
handleConfirmClick () {
|
|
81
|
+
this.$emit('confirm', this.inputValue)
|
|
82
|
+
},
|
|
83
|
+
handleFriendGroupClick (item) {
|
|
84
|
+
this.inputValue = item.id
|
|
85
|
+
},
|
|
86
|
+
handleRoomGroupClick (item) {
|
|
87
|
+
this.inputValue = item.id
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<style lang="less">
|
|
94
|
+
.bi-contacts-group-select-panel__head{
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: row;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: space-between;
|
|
99
|
+
padding: 8px 12px;
|
|
100
|
+
border-bottom: 1px solid #eee;
|
|
101
|
+
}
|
|
102
|
+
.bi-contacts-group-select-panel__body{
|
|
103
|
+
max-height: 70vh;
|
|
104
|
+
overflow: auto;
|
|
105
|
+
padding: 6px 0;
|
|
106
|
+
}
|
|
107
|
+
.bi-contacts-group-select-panel__group-head {
|
|
108
|
+
height: 32px;
|
|
109
|
+
line-height: 32px;
|
|
110
|
+
padding: 0 12px;
|
|
111
|
+
}
|
|
112
|
+
.bi-contacts-group-select-panel__group-title {
|
|
113
|
+
color: #999;
|
|
114
|
+
}
|
|
115
|
+
.bi-contacts-group-select-panel__safe{
|
|
116
|
+
padding-bottom: calc(constant(safe-area-inset-bottom)); /* window-bottom + 适配 iPhoneX */
|
|
117
|
+
padding-bottom: calc(env(safe-area-inset-bottom));
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="bi-account-select">
|
|
3
|
+
<view class="bi-account-select__handle" @click="handleHandleClick">
|
|
4
|
+
<template v-if="loading">
|
|
5
|
+
<uv-loading-icon class="bi-account-select__loading" size="18" text="数据加载中..."></uv-loading-icon>
|
|
6
|
+
</template>
|
|
7
|
+
<template v-else>
|
|
8
|
+
<template v-if="value">
|
|
9
|
+
<view class="bi-account-select__value">
|
|
10
|
+
{{ currentGroup ? currentGroup.groupName : value }}
|
|
11
|
+
</view>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-else>
|
|
14
|
+
<view class="bi-account-select__placeholder">
|
|
15
|
+
请选择分组
|
|
16
|
+
</view>
|
|
17
|
+
</template>
|
|
18
|
+
</template>
|
|
19
|
+
</view>
|
|
20
|
+
<uv-popup
|
|
21
|
+
ref="popup"
|
|
22
|
+
mode="bottom"
|
|
23
|
+
@change="handlePopupChange"
|
|
24
|
+
>
|
|
25
|
+
<contacts-group-select-panel
|
|
26
|
+
:value="value"
|
|
27
|
+
:friend-group-data="friendGroupData"
|
|
28
|
+
:room-group-data="roomGroupData"
|
|
29
|
+
@cancel="handleCancelClick"
|
|
30
|
+
@confirm="handleConfirmClick"
|
|
31
|
+
></contacts-group-select-panel>
|
|
32
|
+
</uv-popup>
|
|
33
|
+
</view>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import ContactsGroupSelectPanel from './contacts-group-select-panel.vue'
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
name: 'BiContactsGroupSelect',
|
|
41
|
+
components: {
|
|
42
|
+
ContactsGroupSelectPanel
|
|
43
|
+
},
|
|
44
|
+
props: {
|
|
45
|
+
value: {
|
|
46
|
+
type: String
|
|
47
|
+
},
|
|
48
|
+
type: {
|
|
49
|
+
type: String,
|
|
50
|
+
validator (value) {
|
|
51
|
+
return ['room', 'friend'].includes(value)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
data () {
|
|
56
|
+
return {
|
|
57
|
+
loading: false,
|
|
58
|
+
friendGroupData: [],
|
|
59
|
+
roomGroupData: []
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
computed: {
|
|
63
|
+
currentGroup () {
|
|
64
|
+
if (!this.value) {
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
let group = this.friendGroupData.find(v => v.id === this.value)
|
|
68
|
+
if (!group) {
|
|
69
|
+
group = this.roomGroupData.find(v => v.id === this.value)
|
|
70
|
+
}
|
|
71
|
+
return group
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
created () {
|
|
75
|
+
this.loadData()
|
|
76
|
+
},
|
|
77
|
+
methods: {
|
|
78
|
+
loadData () {
|
|
79
|
+
this.loading = true
|
|
80
|
+
if (this.type === 'friend') {
|
|
81
|
+
return Promise.all([
|
|
82
|
+
this.$clientChat.contacts.loadFriendGroupData()
|
|
83
|
+
]).then(rs => {
|
|
84
|
+
this.friendGroupData = rs[0].data
|
|
85
|
+
}).finally(() => {
|
|
86
|
+
this.loading = false
|
|
87
|
+
})
|
|
88
|
+
} else if (this.type === 'room') {
|
|
89
|
+
return Promise.all([
|
|
90
|
+
this.$clientChat.contacts.loadRoomGroupData()
|
|
91
|
+
]).then(rs => {
|
|
92
|
+
this.roomGroupData = rs[0].data
|
|
93
|
+
}).finally(() => {
|
|
94
|
+
this.loading = false
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
handleCancelClick () {
|
|
99
|
+
this.$refs.popup.close()
|
|
100
|
+
},
|
|
101
|
+
handleConfirmClick (value) {
|
|
102
|
+
this.$emit('input', value)
|
|
103
|
+
this.$refs.popup.close()
|
|
104
|
+
},
|
|
105
|
+
handlePopupChange ({ show }) {
|
|
106
|
+
this.showPopup = show
|
|
107
|
+
if (show) {
|
|
108
|
+
uni.hideTabBar()
|
|
109
|
+
} else {
|
|
110
|
+
uni.showTabBar()
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
handleHandleClick () {
|
|
114
|
+
this.$refs.popup.open()
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<style lang="less">
|
|
121
|
+
.bi-account-select__handle {
|
|
122
|
+
position: relative;
|
|
123
|
+
padding-right: 18px;
|
|
124
|
+
padding-top: 1px;
|
|
125
|
+
padding-bottom: 1px;
|
|
126
|
+
height: 32px;
|
|
127
|
+
line-height: 32px;
|
|
128
|
+
display: inline-block;
|
|
129
|
+
&:after {
|
|
130
|
+
content: '';
|
|
131
|
+
width: 6px;
|
|
132
|
+
height: 6px;
|
|
133
|
+
border: 1px solid #ccc;
|
|
134
|
+
border-left: 0;
|
|
135
|
+
border-top: 0;
|
|
136
|
+
transform: rotate(45deg) translateY(-50%);
|
|
137
|
+
position: absolute;
|
|
138
|
+
right: 6px;
|
|
139
|
+
top: 50%;
|
|
140
|
+
margin-top: -3px;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
.bi-account-select__loading{
|
|
144
|
+
vertical-align: top;
|
|
145
|
+
margin-top: 7px;
|
|
146
|
+
}
|
|
147
|
+
.bi-account-select__placeholder{
|
|
148
|
+
color: #999;
|
|
149
|
+
}
|
|
150
|
+
</style>
|
package/utils/color.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BKDR Hash (modified version)
|
|
3
|
+
*
|
|
4
|
+
* @param {String} str string to hash
|
|
5
|
+
* @returns {Number}
|
|
6
|
+
*/
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
var BKDRHash = function(str) {
|
|
9
|
+
var seed = 131;
|
|
10
|
+
var seed2 = 137;
|
|
11
|
+
var hash = 0;
|
|
12
|
+
// make hash more sensitive for short string like 'a', 'b', 'c'
|
|
13
|
+
str += 'x';
|
|
14
|
+
// Note: Number.MAX_SAFE_INTEGER equals 9007199254740991
|
|
15
|
+
var MAX_SAFE_INTEGER = parseInt(9007199254740991 / seed2);
|
|
16
|
+
for(var i = 0; i < str.length; i++) {
|
|
17
|
+
if(hash > MAX_SAFE_INTEGER) {
|
|
18
|
+
hash = parseInt(hash / seed2);
|
|
19
|
+
}
|
|
20
|
+
hash = hash * seed + str.charCodeAt(i);
|
|
21
|
+
}
|
|
22
|
+
return hash;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Convert RGB Array to HEX
|
|
27
|
+
*
|
|
28
|
+
* @param {Array} RGBArray - [R, G, B]
|
|
29
|
+
* @returns {String} 6 digits hex starting with #
|
|
30
|
+
*/
|
|
31
|
+
var RGB2HEX = function(RGBArray) {
|
|
32
|
+
var hex = '#';
|
|
33
|
+
RGBArray.forEach(function(value) {
|
|
34
|
+
if (value < 16) {
|
|
35
|
+
hex += 0;
|
|
36
|
+
}
|
|
37
|
+
hex += value.toString(16);
|
|
38
|
+
});
|
|
39
|
+
return hex;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Convert HSL to RGB
|
|
44
|
+
*
|
|
45
|
+
* @see {@link http://zh.wikipedia.org/wiki/HSL和HSV色彩空间} for further information.
|
|
46
|
+
* @param {Number} H Hue ∈ [0, 360)
|
|
47
|
+
* @param {Number} S Saturation ∈ [0, 1]
|
|
48
|
+
* @param {Number} L Lightness ∈ [0, 1]
|
|
49
|
+
* @returns {Array} R, G, B ∈ [0, 255]
|
|
50
|
+
*/
|
|
51
|
+
var HSL2RGB = function(H, S, L) {
|
|
52
|
+
H /= 360;
|
|
53
|
+
|
|
54
|
+
var q = L < 0.5 ? L * (1 + S) : L + S - L * S;
|
|
55
|
+
var p = 2 * L - q;
|
|
56
|
+
|
|
57
|
+
return [H + 1/3, H, H - 1/3].map(function(color) {
|
|
58
|
+
if(color < 0) {
|
|
59
|
+
color++;
|
|
60
|
+
}
|
|
61
|
+
if(color > 1) {
|
|
62
|
+
color--;
|
|
63
|
+
}
|
|
64
|
+
if(color < 1/6) {
|
|
65
|
+
color = p + (q - p) * 6 * color;
|
|
66
|
+
} else if(color < 0.5) {
|
|
67
|
+
color = q;
|
|
68
|
+
} else if(color < 2/3) {
|
|
69
|
+
color = p + (q - p) * 6 * (2/3 - color);
|
|
70
|
+
} else {
|
|
71
|
+
color = p;
|
|
72
|
+
}
|
|
73
|
+
return Math.round(color * 255);
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
function isArray(o) {
|
|
78
|
+
return Object.prototype.toString.call(o) === '[object Array]';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Color Hash Class
|
|
83
|
+
*
|
|
84
|
+
* @class
|
|
85
|
+
*/
|
|
86
|
+
var ColorHash = function(options) {
|
|
87
|
+
options = options || {};
|
|
88
|
+
|
|
89
|
+
var LS = [options.lightness, options.saturation].map(function(param) {
|
|
90
|
+
param = param || [0.35, 0.5, 0.65]; // note that 3 is a prime
|
|
91
|
+
return isArray(param) ? param.concat() : [param];
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
this.L = LS[0];
|
|
95
|
+
this.S = LS[1];
|
|
96
|
+
|
|
97
|
+
if (typeof options.hue === 'number') {
|
|
98
|
+
options.hue = {min: options.hue, max: options.hue};
|
|
99
|
+
}
|
|
100
|
+
if (typeof options.hue === 'object' && !isArray(options.hue)) {
|
|
101
|
+
options.hue = [options.hue];
|
|
102
|
+
}
|
|
103
|
+
if (typeof options.hue === 'undefined') {
|
|
104
|
+
options.hue = [];
|
|
105
|
+
}
|
|
106
|
+
this.hueRanges = options.hue.map(function (range) {
|
|
107
|
+
return {
|
|
108
|
+
min: typeof range.min === 'undefined' ? 0 : range.min,
|
|
109
|
+
max: typeof range.max === 'undefined' ? 360: range.max
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
this.hash = options.hash || BKDRHash;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Returns the hash in [h, s, l].
|
|
118
|
+
* Note that H ∈ [0, 360); S ∈ [0, 1]; L ∈ [0, 1];
|
|
119
|
+
*
|
|
120
|
+
* @param {String} str string to hash
|
|
121
|
+
* @returns {Array} [h, s, l]
|
|
122
|
+
*/
|
|
123
|
+
ColorHash.prototype.hsl = function(str) {
|
|
124
|
+
var H, S, L;
|
|
125
|
+
var hash = this.hash(str);
|
|
126
|
+
|
|
127
|
+
if (this.hueRanges.length) {
|
|
128
|
+
var range = this.hueRanges[hash % this.hueRanges.length];
|
|
129
|
+
var hueResolution = 727; // note that 727 is a prime
|
|
130
|
+
H = ((hash / this.hueRanges.length) % hueResolution) * (range.max - range.min) / hueResolution + range.min;
|
|
131
|
+
} else {
|
|
132
|
+
H = hash % 359; // note that 359 is a prime
|
|
133
|
+
}
|
|
134
|
+
hash = parseInt(hash / 360);
|
|
135
|
+
S = this.S[hash % this.S.length];
|
|
136
|
+
hash = parseInt(hash / this.S.length);
|
|
137
|
+
L = this.L[hash % this.L.length];
|
|
138
|
+
|
|
139
|
+
return [H, S, L];
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Returns the hash in [r, g, b].
|
|
144
|
+
* Note that R, G, B ∈ [0, 255]
|
|
145
|
+
*
|
|
146
|
+
* @param {String} str string to hash
|
|
147
|
+
* @returns {Array} [r, g, b]
|
|
148
|
+
*/
|
|
149
|
+
ColorHash.prototype.rgb = function(str) {
|
|
150
|
+
var hsl = this.hsl(str);
|
|
151
|
+
return HSL2RGB.apply(this, hsl);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Returns the hash in hex
|
|
156
|
+
*
|
|
157
|
+
* @param {String} str string to hash
|
|
158
|
+
* @returns {String} hex with #
|
|
159
|
+
*/
|
|
160
|
+
ColorHash.prototype.hex = function(str) {
|
|
161
|
+
var rgb = this.rgb(str);
|
|
162
|
+
return RGB2HEX(rgb);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const instance = new ColorHash({lightness: 0.5})
|
|
166
|
+
|
|
167
|
+
const getStringColor = (string) => {
|
|
168
|
+
const rs = instance.hex(string)
|
|
169
|
+
return rs
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export {
|
|
173
|
+
getStringColor
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export default ColorHash
|
|
177
|
+
|
|
178
|
+
/* eslint-enable */
|
package/utils/data.js
ADDED
package/utils/date.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 格式化日期
|
|
3
|
+
*/
|
|
4
|
+
export function formatDate (date, fmt = 'YYYY-mm-dd HH:MM:SS') {
|
|
5
|
+
if (!date) {
|
|
6
|
+
return
|
|
7
|
+
}
|
|
8
|
+
if (typeof date === 'string' || typeof date === 'number') {
|
|
9
|
+
if (!isNaN(date)) {
|
|
10
|
+
date = parseInt(date)
|
|
11
|
+
}
|
|
12
|
+
date = new Date(date)
|
|
13
|
+
}
|
|
14
|
+
if (isNaN(date.getTime())) {
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
let ret
|
|
18
|
+
const opt = {
|
|
19
|
+
'Y+': date.getFullYear().toString(),
|
|
20
|
+
'm+': (date.getMonth() + 1).toString(),
|
|
21
|
+
'd+': date.getDate().toString(),
|
|
22
|
+
'H+': date.getHours().toString(),
|
|
23
|
+
'M+': date.getMinutes().toString(),
|
|
24
|
+
'S+': date.getSeconds().toString()
|
|
25
|
+
}
|
|
26
|
+
for (const k in opt) {
|
|
27
|
+
ret = new RegExp('(' + k + ')').exec(fmt)
|
|
28
|
+
if (ret) {
|
|
29
|
+
fmt = fmt.replace(ret[1], (ret[1].length === 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, '0')))
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return fmt
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 将时间戳或者日期字符串转为日期对象
|
|
37
|
+
*/
|
|
38
|
+
export function parseDate (date) {
|
|
39
|
+
if (!date) {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
if (date.getTime) {
|
|
43
|
+
return date
|
|
44
|
+
}
|
|
45
|
+
if (typeof date === 'number') {
|
|
46
|
+
return new Date(date)
|
|
47
|
+
}
|
|
48
|
+
if (typeof date === 'string') {
|
|
49
|
+
const ds = date.split(/\D+/)
|
|
50
|
+
if (ds.length > 2) {
|
|
51
|
+
return new Date(ds[0], ds[1] && (ds[1] - 1), ds[2], ds[3] || 0, ds[4] || 0, ds[5] || 0)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function formatFriendlyTime (datetime) {
|
|
57
|
+
if(!datetime) {
|
|
58
|
+
return ''
|
|
59
|
+
}
|
|
60
|
+
const addZero = (num) => {
|
|
61
|
+
return num < 10 ? '0' + num : num
|
|
62
|
+
}
|
|
63
|
+
let wechatTimeStamp = datetime
|
|
64
|
+
let todayStartTime = new Date().setHours(0, 0, 0, 0)
|
|
65
|
+
let yesterdayStartTime = todayStartTime - 24 * 60 * 60 * 1000
|
|
66
|
+
let messageTime = new Date(wechatTimeStamp).setHours(0, 0, 0, 0)
|
|
67
|
+
let time = new Date(wechatTimeStamp)
|
|
68
|
+
if(messageTime > yesterdayStartTime) {
|
|
69
|
+
return addZero(time.getHours()) + ':' + addZero(time.getMinutes())
|
|
70
|
+
} else if(messageTime <= todayStartTime && messageTime >= yesterdayStartTime) {
|
|
71
|
+
return '昨天'
|
|
72
|
+
} else {
|
|
73
|
+
let dataTime = (time.getMonth()+1) + '-' + time.getDate()
|
|
74
|
+
if(time.getFullYear() === 1970){
|
|
75
|
+
return ""
|
|
76
|
+
}
|
|
77
|
+
return dataTime === "NaN-NaN"? "" : dataTime
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function parseIntZerofill (number) {
|
|
82
|
+
number = parseInt(number)
|
|
83
|
+
return number < 10 ? '0' + number : number
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 格式化时间戳到时分秒
|
|
88
|
+
*/
|
|
89
|
+
export function timeToHHmmss (time) {
|
|
90
|
+
var diffTime = time
|
|
91
|
+
if (diffTime) {
|
|
92
|
+
diffTime = diffTime / 1000
|
|
93
|
+
if (diffTime >= 60 && diffTime < 60 * 60) {
|
|
94
|
+
diffTime = '00' + ':' + parseIntZerofill(diffTime / 60.0) + ':' + parseIntZerofill((parseFloat(diffTime / 60.0) - parseIntZerofill(diffTime / 60.0)) * 60)
|
|
95
|
+
} else if (diffTime >= 60 * 60) {
|
|
96
|
+
diffTime = parseIntZerofill(diffTime / 3600.0) + ':' + parseIntZerofill((parseFloat(diffTime / 3600.0) -
|
|
97
|
+
parseIntZerofill(diffTime / 3600.0)) * 60) + ':' +
|
|
98
|
+
parseIntZerofill((parseFloat((parseFloat(diffTime / 3600.0) - parseIntZerofill(diffTime / 3600.0)) * 60) -
|
|
99
|
+
parseIntZerofill((parseFloat(diffTime / 3600.0) - parseIntZerofill(diffTime / 3600.0)) * 60)) * 60)
|
|
100
|
+
} else if (diffTime < 60) {
|
|
101
|
+
return '00:00:' + parseIntZerofill(Math.ceil(diffTime))
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
diffTime = '00:00:00'
|
|
105
|
+
}
|
|
106
|
+
return diffTime
|
|
107
|
+
}
|
package/utils/event.js
ADDED
package/utils/file.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 格式化文件尺寸为友好字符串
|
|
3
|
+
*/
|
|
4
|
+
export function formatFileSize (fileSize) {
|
|
5
|
+
let fileSizeBack = ''
|
|
6
|
+
if (fileSize < 1024) {
|
|
7
|
+
fileSizeBack = fileSize + 'B'
|
|
8
|
+
return fileSizeBack
|
|
9
|
+
} else if (fileSize < (1024 * 1024)) {
|
|
10
|
+
let temp = fileSize / 1024
|
|
11
|
+
temp = temp.toFixed(0)
|
|
12
|
+
fileSizeBack = temp + 'K'
|
|
13
|
+
return fileSizeBack
|
|
14
|
+
} else if (fileSize < (1024 * 1024 * 1024)) {
|
|
15
|
+
let temp = fileSize / (1024 * 1024)
|
|
16
|
+
temp = temp.toFixed(0)
|
|
17
|
+
fileSizeBack = temp + 'M'
|
|
18
|
+
return fileSizeBack
|
|
19
|
+
} else {
|
|
20
|
+
let temp = fileSize / (1024 * 1024 * 1024)
|
|
21
|
+
temp = temp.toFixed(0)
|
|
22
|
+
fileSizeBack = temp + 'G'
|
|
23
|
+
return fileSizeBack
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
package/utils/index.js
ADDED
package/utils/json.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import X2JS from 'x2js'
|
|
2
|
+
|
|
3
|
+
const x2js = new X2JS({
|
|
4
|
+
attributePrefix: ''
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
export function stringify (data, ag1, ag2) {
|
|
8
|
+
if (data && typeof data === 'object') {
|
|
9
|
+
data = JSON.stringify(data, ag1, ag2)
|
|
10
|
+
}
|
|
11
|
+
return data
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function parse (data) {
|
|
15
|
+
try {
|
|
16
|
+
if (typeof data === 'string') {
|
|
17
|
+
data = JSON.parse(data)
|
|
18
|
+
}
|
|
19
|
+
} catch (e) {}
|
|
20
|
+
return data
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function clone (data) {
|
|
24
|
+
return JSON.parse(JSON.stringify(data))
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function parseXml (xml) {
|
|
28
|
+
let result = null
|
|
29
|
+
try {
|
|
30
|
+
result = x2js.xml2js(xml)
|
|
31
|
+
if (typeof result === 'string') {
|
|
32
|
+
result = JSON.parse(result)
|
|
33
|
+
} else if (result && result.html && result.html.body && result.html.body.parsererror) {
|
|
34
|
+
result = null
|
|
35
|
+
}
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.log(e)
|
|
38
|
+
}
|
|
39
|
+
return result
|
|
40
|
+
}
|