@aochuang/client-sdk 1.0.350 → 1.0.352
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/components/index.js +6 -1
- package/components/session-select/session-select-item.vue +8 -9
- package/components/wechat-chat-control/.DS_Store +0 -0
- package/components/wechat-chat-control/transfer/.DS_Store +0 -0
- package/components/wechat-chat-control/url/.DS_Store +0 -0
- package/components/wechat-chat-control/url/url-miniprogram.vue +1 -5
- package/components/wechat-chat-control/voice/.DS_Store +0 -0
- package/components/wework-chat-control/channel-card/channel-card.vue +144 -0
- package/components/wework-chat-control/channel-live/channel-live.vue +7 -2
- package/components/wework-chat-control/company-card/company-card.vue +1 -1
- package/components/wework-chat-control/custom-expression/custom-expression.vue +2 -1
- package/components/wework-chat-control/file-url/file-url.vue +2 -5
- package/components/wework-chat-control/image/image.vue +137 -2
- package/components/wework-chat-control/index.js +9 -7
- package/components/wework-chat-control/link/.DS_Store +0 -0
- package/components/wework-chat-control/location/location.vue +3 -3
- package/components/wework-chat-control/metting/enterprise-wechat.png +0 -0
- package/components/wework-chat-control/metting/meeting-video.svg +4 -0
- package/components/wework-chat-control/metting/metting.vue +181 -0
- package/components/wework-chat-control/text/text.vue +23 -3
- package/components/wework-chat-control/url/url-channel-live.vue +53 -0
- package/components/wework-chat-control/url/url-miniprogram.vue +6 -7
- package/components/wework-chat-control/url/url.vue +26 -2
- package/components/wework-chat-control/util.js +17 -8
- package/components/wework-chat-control/video/.DS_Store +0 -0
- package/components/wework-chat-control/video/video.vue +10 -2
- package/components/wework-chat-control/voice/voice.vue +1 -1
- package/components/wework-chat-control/wework-chat-control-config-item.vue +24 -0
- package/components/wework-chat-control/wework-chat-control-config-msg.vue +25 -0
- package/{uni-components/chat-control/chat-control-config.vue → components/wework-chat-control/wework-chat-control-config.vue} +16 -13
- package/components/wework-chat-panel/chat-panel-chat-status/chat-panel-chat-status.vue +73 -0
- package/components/wework-chat-panel/chat-panel-item.vue +25 -41
- package/components/wework-chat-panel/chat-panel.vue +95 -12
- package/package.json +10 -3
- package/services/client-chat/client-chat-wechat/client-chat-session.js +54 -170
- package/services/client-chat/client-chat-wework/client-chat-concats.js +81 -17
- package/services/client-chat/client-chat-wework/client-chat-message.js +46 -6
- package/services/client-chat/client-chat-wework/client-chat-session.js +50 -2
- package/services/client-chat/client-chat-wework/client-chat-socket.js +9 -1
- package/services/client-chat/client-chat-wework/client-chat.js +283 -13
- package/services/client-chat/client-chat-wework/utils.js +5 -5
- package/components/wework-chat-panel/chat-panel-controls/company-card/company-card.vue +0 -35
- package/components/wework-chat-panel/chat-panel-controls/expression/expression.vue +0 -36
- package/components/wework-chat-panel/chat-panel-controls/file-url/file-url.vue +0 -35
- package/components/wework-chat-panel/chat-panel-controls/image/image.vue +0 -36
- package/components/wework-chat-panel/chat-panel-controls/index.js +0 -35
- package/components/wework-chat-panel/chat-panel-controls/jx-sys-text/jx-sys-text.vue +0 -28
- package/components/wework-chat-panel/chat-panel-controls/link/link.vue +0 -35
- package/components/wework-chat-panel/chat-panel-controls/location/location.vue +0 -35
- package/components/wework-chat-panel/chat-panel-controls/text/text.vue +0 -43
- package/components/wework-chat-panel/chat-panel-controls/unkonw/unkonw.vue +0 -39
- package/components/wework-chat-panel/chat-panel-controls/video/video.vue +0 -37
- package/components/wework-chat-panel/chat-panel-controls/voice/voice.vue +0 -35
- package/uni-common/account-portray/account-portray.vue +0 -51
- package/uni-common/account-select/account-select-item.vue +0 -172
- package/uni-common/account-select/account-select.vue +0 -252
- package/uni-common/all-friend-avatar/all-friend-avatar.vue +0 -49
- package/uni-common/friend-avatar/default.svg +0 -1
- package/uni-common/friend-avatar/friend-avatar.vue +0 -27
- package/uni-common/friend-avatar/index.js +0 -3
- package/uni-common/friend-loader/friend-loader.vue +0 -53
- package/uni-common/friend-portray/friend-portray.vue +0 -56
- package/uni-common/group-avatar/default.svg +0 -1
- package/uni-common/group-avatar/group-avatar.vue +0 -18
- package/uni-common/group-avatar/index.js +0 -3
- package/uni-common/room-avatar/default.svg +0 -6
- package/uni-common/room-avatar/index.js +0 -3
- package/uni-common/room-avatar/room-avatar.vue +0 -27
- package/uni-common/room-loader/room-loader.vue +0 -53
- package/uni-common/room-portray/room-portray.vue +0 -56
- package/uni-components/chat-control/calling/calling.vue +0 -91
- package/uni-components/chat-control/calling/phone-fill.svg +0 -1
- package/uni-components/chat-control/calling/vidicon-fill.svg +0 -1
- package/uni-components/chat-control/channel-video/channel-video.vue +0 -89
- package/uni-components/chat-control/channel-video-card/channel-video-card.vue +0 -105
- package/uni-components/chat-control/channel-video-live/channel-video-live.vue +0 -92
- package/uni-components/chat-control/chat-control-config-item/chat-control-config-item.vue +0 -20
- package/uni-components/chat-control/chat-control-config-item/index.js +0 -3
- package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-app.vue +0 -25
- package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-h5.vue +0 -21
- package/uni-components/chat-control/chat-control.vue +0 -218
- package/uni-components/chat-control/company-card/company-card.vue +0 -123
- package/uni-components/chat-control/const.js +0 -28
- package/uni-components/chat-control/expression/expression.vue +0 -41
- package/uni-components/chat-control/image/image.vue +0 -68
- package/uni-components/chat-control/index.js +0 -89
- package/uni-components/chat-control/location/location.vue +0 -110
- package/uni-components/chat-control/member-change/member-change.vue +0 -32
- package/uni-components/chat-control/quote-message/quote-message.vue +0 -216
- package/uni-components/chat-control/real-time-position/real-time-position.vue +0 -62
- package/uni-components/chat-control/redpacket/red-envelope.svg +0 -1
- package/uni-components/chat-control/redpacket/redpacket.vue +0 -75
- package/uni-components/chat-control/share-card/share-card.vue +0 -101
- package/uni-components/chat-control/system/system.vue +0 -69
- package/uni-components/chat-control/system-batch-message/system-batch-message.vue +0 -30
- package/uni-components/chat-control/system-text/system-text.vue +0 -32
- package/uni-components/chat-control/text/text.vue +0 -67
- package/uni-components/chat-control/text-with-at/text-with-at.vue +0 -51
- package/uni-components/chat-control/transfer/red-transfer.svg +0 -1
- package/uni-components/chat-control/transfer/transfer.vue +0 -80
- package/uni-components/chat-control/unkonw/unkonw.vue +0 -37
- package/uni-components/chat-control/url/icons/file-excel-line.svg +0 -1
- package/uni-components/chat-control/url/icons/file-info-line.svg +0 -1
- package/uni-components/chat-control/url/icons/file-music-line.svg +0 -1
- package/uni-components/chat-control/url/icons/file-pdf-line.svg +0 -1
- package/uni-components/chat-control/url/icons/file-ppt-line.svg +0 -1
- package/uni-components/chat-control/url/icons/file-settings-line.svg +0 -1
- package/uni-components/chat-control/url/icons/file-text-line.svg +0 -1
- package/uni-components/chat-control/url/icons/file-unknow-line.svg +0 -1
- package/uni-components/chat-control/url/icons/file-word-line.svg +0 -1
- package/uni-components/chat-control/url/icons/file-zip-line.svg +0 -1
- package/uni-components/chat-control/url/icons/index.js +0 -24
- package/uni-components/chat-control/url/miniprogram.svg +0 -1
- package/uni-components/chat-control/url/url-miniprogram.vue +0 -116
- package/uni-components/chat-control/url/url.vue +0 -306
- package/uni-components/chat-control/url-new/icons/file-excel-line.svg +0 -1
- package/uni-components/chat-control/url-new/icons/file-info-line.svg +0 -1
- package/uni-components/chat-control/url-new/icons/file-music-line.svg +0 -1
- package/uni-components/chat-control/url-new/icons/file-pdf-line.svg +0 -1
- package/uni-components/chat-control/url-new/icons/file-ppt-line.svg +0 -1
- package/uni-components/chat-control/url-new/icons/file-settings-line.svg +0 -1
- package/uni-components/chat-control/url-new/icons/file-text-line.svg +0 -1
- package/uni-components/chat-control/url-new/icons/file-unknow-line.svg +0 -1
- package/uni-components/chat-control/url-new/icons/file-word-line.svg +0 -1
- package/uni-components/chat-control/url-new/icons/file-zip-line.svg +0 -1
- package/uni-components/chat-control/url-new/icons/index.js +0 -24
- package/uni-components/chat-control/url-new/url-new.vue +0 -110
- package/uni-components/chat-control/utils.js +0 -12
- package/uni-components/chat-control/video/video.vue +0 -156
- package/uni-components/chat-control/voice/voice.vue +0 -166
- package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-collect.vue +0 -84
- package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-system.vue +0 -28
- package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet.vue +0 -85
- package/uni-components/chat-editor/chat-editor-func/chat-editor-func.vue +0 -157
- package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at-panel.vue +0 -158
- package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at.vue +0 -61
- package/uni-components/chat-editor/chat-editor-func-button/chat-editor-func-button.vue +0 -58
- package/uni-components/chat-editor/chat-editor-func-file/chat-editor-func-file.vue +0 -54
- package/uni-components/chat-editor/chat-editor-func-image/chat-editor-func-image.vue +0 -42
- package/uni-components/chat-editor/chat-editor-func-video/chat-editor-func-video.vue +0 -42
- package/uni-components/chat-editor/chat-editor-func-voice/chat-editor-func-voice.vue +0 -25
- package/uni-components/chat-editor/chat-editor-message-send/chat-editor-message-send.vue +0 -158
- package/uni-components/chat-editor/chat-editor-quote/chat-editor-quote.vue +0 -75
- package/uni-components/chat-editor/chat-editor.vue +0 -257
- package/uni-components/chat-editor/index.js +0 -10
- package/uni-components/chat-editor/util.js +0 -65
- package/uni-components/chat-panel/chat-panel-chats-box.vue +0 -238
- package/uni-components/chat-panel/chat-panel-chats-forward/chat-panel-chats-forward.vue +0 -273
- package/uni-components/chat-panel/chat-panel-chats-item.vue +0 -578
- package/uni-components/chat-panel/chat-panel-chats-status/chat-panel-chats-status.vue +0 -71
- package/uni-components/chat-panel/chat-panel-chats.vue +0 -368
- package/uni-components/chat-panel/chat-panel.vue +0 -227
- package/uni-components/contacts-group-select/contacts-group-select-item.vue +0 -85
- package/uni-components/contacts-group-select/contacts-group-select-panel.vue +0 -119
- package/uni-components/contacts-group-select/contacts-group-select.vue +0 -150
|
@@ -126,11 +126,7 @@ export default class ClientChatContacts {
|
|
|
126
126
|
*/
|
|
127
127
|
roomBindMemberMap: {},
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
* 标记通讯录是否修改了
|
|
131
|
-
* 如果修改了,比如接收到了分配好友的会话时,一定通讯录变了,变了的时候界面需要根据这个状态刷新通讯录
|
|
132
|
-
*/
|
|
133
|
-
isModify: false
|
|
129
|
+
modifiedAccountMap: {}
|
|
134
130
|
})
|
|
135
131
|
|
|
136
132
|
friendMap = {}
|
|
@@ -237,10 +233,6 @@ export default class ClientChatContacts {
|
|
|
237
233
|
return this.data.roomGroupData
|
|
238
234
|
}
|
|
239
235
|
|
|
240
|
-
get isModify () {
|
|
241
|
-
return this.data.isModify
|
|
242
|
-
}
|
|
243
|
-
|
|
244
236
|
setRoomGroup (data) {
|
|
245
237
|
this.data.roomGroupData = []
|
|
246
238
|
if (data && data.length) {
|
|
@@ -491,10 +483,10 @@ export default class ClientChatContacts {
|
|
|
491
483
|
}
|
|
492
484
|
}
|
|
493
485
|
const qwAccountId = this.roomMap[id].qwAccountId
|
|
494
|
-
if (qwAccountId && this.data.
|
|
495
|
-
const bindIndex = this.data.
|
|
486
|
+
if (qwAccountId && this.data.accountBindRoomMap[qwAccountId] && this.data.accountBindRoomMap[qwAccountId][groupId]) {
|
|
487
|
+
const bindIndex = this.data.accountBindRoomMap[qwAccountId][groupId].indexOf(this.roomMap[id])
|
|
496
488
|
if (bindIndex >= 0) {
|
|
497
|
-
this.data.
|
|
489
|
+
this.data.accountBindRoomMap[qwAccountId][groupId].splice(bindIndex, 1)
|
|
498
490
|
}
|
|
499
491
|
}
|
|
500
492
|
})
|
|
@@ -628,6 +620,37 @@ export default class ClientChatContacts {
|
|
|
628
620
|
return rs
|
|
629
621
|
})
|
|
630
622
|
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* 强制从服务端刷新好友资料,绕过本地缓存。
|
|
626
|
+
*/
|
|
627
|
+
refreshFriend (friendId) {
|
|
628
|
+
if (!friendId) {
|
|
629
|
+
return Promise.reject('缺少好友id')
|
|
630
|
+
}
|
|
631
|
+
if (!this.getContactsFriendMethod) {
|
|
632
|
+
return Promise.reject(new Error('getContactsFriendMethod未定义'))
|
|
633
|
+
}
|
|
634
|
+
return this.getContactsFriendMethod({
|
|
635
|
+
id: friendId
|
|
636
|
+
}).then(rs => {
|
|
637
|
+
if (!rs || !rs.data) {
|
|
638
|
+
return Promise.reject('未找到好友' + friendId)
|
|
639
|
+
}
|
|
640
|
+
if (this.friendMap[friendId]) {
|
|
641
|
+
const nextKeys = Object.keys(rs.data)
|
|
642
|
+
Object.keys(this.friendMap[friendId]).forEach(key => {
|
|
643
|
+
if (!nextKeys.includes(key)) {
|
|
644
|
+
Vue.delete(this.friendMap[friendId], key)
|
|
645
|
+
}
|
|
646
|
+
})
|
|
647
|
+
this.updateFriend(friendId, rs.data)
|
|
648
|
+
} else {
|
|
649
|
+
this.addFriend(rs.data)
|
|
650
|
+
}
|
|
651
|
+
return rs
|
|
652
|
+
})
|
|
653
|
+
}
|
|
631
654
|
|
|
632
655
|
setRoomMemberData (roomId, data) {
|
|
633
656
|
if (!roomId) {
|
|
@@ -738,12 +761,52 @@ export default class ClientChatContacts {
|
|
|
738
761
|
})
|
|
739
762
|
}
|
|
740
763
|
|
|
741
|
-
|
|
742
|
-
|
|
764
|
+
refreshRoom (id) {
|
|
765
|
+
if (!id) {
|
|
766
|
+
return Promise.reject('缺少群id')
|
|
767
|
+
}
|
|
768
|
+
if (!this.getContactsRoomMethod) {
|
|
769
|
+
return Promise.reject(new Error('getContactsRoomMethod未定义'))
|
|
770
|
+
}
|
|
771
|
+
return this.getContactsRoomMethod({
|
|
772
|
+
id
|
|
773
|
+
}).then(rs => {
|
|
774
|
+
if (!rs || !rs.data) {
|
|
775
|
+
return Promise.reject('未找到群' + id)
|
|
776
|
+
}
|
|
777
|
+
const localRoom = this.roomMap[id]
|
|
778
|
+
if (localRoom) {
|
|
779
|
+
this.removeRoom(id)
|
|
780
|
+
const nextKeys = Object.keys(rs.data)
|
|
781
|
+
Object.keys(localRoom).forEach(key => {
|
|
782
|
+
if (!nextKeys.includes(key)) {
|
|
783
|
+
Vue.delete(localRoom, key)
|
|
784
|
+
}
|
|
785
|
+
})
|
|
786
|
+
Object.keys(rs.data).forEach(key => {
|
|
787
|
+
Vue.set(localRoom, key, rs.data[key])
|
|
788
|
+
})
|
|
789
|
+
}
|
|
790
|
+
this.addRoom(localRoom || rs.data)
|
|
791
|
+
return rs
|
|
792
|
+
})
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
isModify (qwAccountId) {
|
|
796
|
+
return !!(qwAccountId && this.data.modifiedAccountMap[qwAccountId])
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
markModify (qwAccountIds) {
|
|
800
|
+
const ids = Array.isArray(qwAccountIds) ? qwAccountIds : [qwAccountIds]
|
|
801
|
+
ids.filter(Boolean).forEach(id => {
|
|
802
|
+
Vue.set(this.data.modifiedAccountMap, id, true)
|
|
803
|
+
})
|
|
743
804
|
}
|
|
744
805
|
|
|
745
|
-
unmarkModify () {
|
|
746
|
-
|
|
806
|
+
unmarkModify (qwAccountId) {
|
|
807
|
+
if (qwAccountId) {
|
|
808
|
+
Vue.delete(this.data.modifiedAccountMap, qwAccountId)
|
|
809
|
+
}
|
|
747
810
|
}
|
|
748
811
|
|
|
749
812
|
reset () {
|
|
@@ -758,6 +821,7 @@ export default class ClientChatContacts {
|
|
|
758
821
|
this.data.groupBindRoomMap = {}
|
|
759
822
|
this.data.accountBindFriendMap = {}
|
|
760
823
|
this.data.accountBindRoomMap = {}
|
|
824
|
+
this.data.modifiedAccountMap = {}
|
|
761
825
|
this._cacheFriendGroupCountMap = null
|
|
762
826
|
this._cacheRoomGroupCountMap = null
|
|
763
827
|
if (this.cancelConnectRequest) {
|
|
@@ -769,4 +833,4 @@ export default class ClientChatContacts {
|
|
|
769
833
|
this.cancelRefreshRequest = null
|
|
770
834
|
}
|
|
771
835
|
}
|
|
772
|
-
}
|
|
836
|
+
}
|
|
@@ -2,6 +2,7 @@ import Vue from 'vue'
|
|
|
2
2
|
import Event from '../../../utils/event.js'
|
|
3
3
|
import { unique } from '../../../utils/string.js'
|
|
4
4
|
import { formatDate } from '../../../utils/date.js'
|
|
5
|
+
import { createPromise } from '../../../utils/util'
|
|
5
6
|
|
|
6
7
|
export default class ClientChatMessage {
|
|
7
8
|
|
|
@@ -22,6 +23,8 @@ export default class ClientChatMessage {
|
|
|
22
23
|
})
|
|
23
24
|
|
|
24
25
|
messageMap = {}
|
|
26
|
+
tempMessageMap = {}
|
|
27
|
+
checkMessageSendResultTaskList = []
|
|
25
28
|
|
|
26
29
|
get messageData () {
|
|
27
30
|
return this.data.messageData
|
|
@@ -33,15 +36,18 @@ export default class ClientChatMessage {
|
|
|
33
36
|
queryMethod: null,
|
|
34
37
|
sortField: null, // 排序的字段,必须是唯一的,例如时间
|
|
35
38
|
groupField: null, // 分组的字段
|
|
39
|
+
checkMessageSendResultMethod: null,
|
|
36
40
|
onAddMessageSuccess: null // 新增消息成功回调事件
|
|
37
41
|
}, options)
|
|
38
42
|
if (!options.clientChat) {
|
|
39
43
|
throw new Error('必须将clientChat传递过来')
|
|
40
44
|
}
|
|
45
|
+
if (!options.checkMessageSendResultMethod) throw new Error('缺少checkMessageSendResultMethod配置')
|
|
41
46
|
this.queryMethod = options.queryMethod
|
|
42
47
|
this.clientChat = options.clientChat
|
|
43
48
|
this.groupField = options.groupField
|
|
44
49
|
this.sortField = options.sortField
|
|
50
|
+
this.checkMessageSendResultMethod = options.checkMessageSendResultMethod
|
|
45
51
|
this.onAddMessageSuccess = options.onAddMessageSuccess
|
|
46
52
|
this.event = new Event()
|
|
47
53
|
}
|
|
@@ -68,13 +74,13 @@ export default class ClientChatMessage {
|
|
|
68
74
|
* "createTime": 1723710023517,
|
|
69
75
|
* "id": "6612b84538679a8c881e9f8482ccda9e9b35c00d",
|
|
70
76
|
* "isDeleted": false,
|
|
71
|
-
* "
|
|
77
|
+
* "send": false,
|
|
72
78
|
* "msgId": "1245",
|
|
73
79
|
* "msgSubType": 0,
|
|
74
80
|
* "msgSvrId": "4319123759514541049",
|
|
75
81
|
* "msgType": 1,
|
|
76
82
|
* "origin": "0",
|
|
77
|
-
* "
|
|
83
|
+
* "status": 0,
|
|
78
84
|
* "tenantId": "1761952223049924608",
|
|
79
85
|
* "wechatAccountId": "ad9d9ae2a8be4f27311312cdd4af3549dc8427ef",
|
|
80
86
|
* "wechatFriendId": "2089efcc7f8f40b00b7f05fa4c6dfd3bb642774d",
|
|
@@ -89,6 +95,10 @@ export default class ClientChatMessage {
|
|
|
89
95
|
if (this.messageMap[data.id]) {
|
|
90
96
|
return
|
|
91
97
|
}
|
|
98
|
+
if (this.tempMessageMap[data.id]) {
|
|
99
|
+
Object.assign(data, this.tempMessageMap[data.id])
|
|
100
|
+
delete this.tempMessageMap[data.id]
|
|
101
|
+
}
|
|
92
102
|
const groupField = data[this.groupField]
|
|
93
103
|
if (!this.data.messageData[groupField]) {
|
|
94
104
|
Vue.set(this.data.messageData, groupField, {})
|
|
@@ -105,6 +115,7 @@ export default class ClientChatMessage {
|
|
|
105
115
|
}
|
|
106
116
|
this.data.messageData[groupField][sortFields.day][sortFields.milliseconds].push(data)
|
|
107
117
|
this.messageMap[data.id] = data
|
|
118
|
+
if (data.send && data.status === 1 && !data._temp) this.addCheckMessageSendResultTask(data)
|
|
108
119
|
if (fireEvent !== false) {
|
|
109
120
|
this.event && this.event.emit('add-message', {
|
|
110
121
|
data
|
|
@@ -119,6 +130,7 @@ export default class ClientChatMessage {
|
|
|
119
130
|
if (!id) {
|
|
120
131
|
return
|
|
121
132
|
}
|
|
133
|
+
this.removeCheckMessageSendResultTask(id)
|
|
122
134
|
const message = this.messageMap[id]
|
|
123
135
|
if (!message) {
|
|
124
136
|
return
|
|
@@ -154,6 +166,7 @@ export default class ClientChatMessage {
|
|
|
154
166
|
updateMessage (id, props) {
|
|
155
167
|
const message = this.getMessage(id)
|
|
156
168
|
if (!message) {
|
|
169
|
+
this.tempMessageMap[id] = props
|
|
157
170
|
return
|
|
158
171
|
}
|
|
159
172
|
if (!props) {
|
|
@@ -215,11 +228,11 @@ export default class ClientChatMessage {
|
|
|
215
228
|
}, data, {
|
|
216
229
|
cmdType: 'CmdQwSendMessage'
|
|
217
230
|
})).then(({ data }) => {
|
|
218
|
-
if (data.
|
|
231
|
+
if (data.status === 0) {
|
|
219
232
|
// 发送成功
|
|
220
|
-
} else if (data.
|
|
233
|
+
} else if (data.status === 2) {
|
|
221
234
|
// 发送失败
|
|
222
|
-
} else if (data.
|
|
235
|
+
} else if (data.status === 1) {
|
|
223
236
|
// 发送中
|
|
224
237
|
}
|
|
225
238
|
// 如果返回的是对象,证明发送成功了
|
|
@@ -273,8 +286,35 @@ export default class ClientChatMessage {
|
|
|
273
286
|
this.clearMessage()
|
|
274
287
|
return this.loadMessageData(params)
|
|
275
288
|
}
|
|
289
|
+
|
|
290
|
+
addCheckMessageSendResultTask (message) {
|
|
291
|
+
if (this.checkMessageSendResultTaskList.some(v => v.id === message.id)) return
|
|
292
|
+
let timer
|
|
293
|
+
const task = { id: message.id, promise: createPromise(), check: () => {
|
|
294
|
+
if (message.status !== 1) return task.promise.resolve()
|
|
295
|
+
if (Date.now() - (message.createTime || message.sendTime) > 5 * 60 * 1000) return task.promise.resolve({status: 3, resultMsg: '消息发送超时'})
|
|
296
|
+
timer = setTimeout(() => {
|
|
297
|
+
Promise.resolve(this.checkMessageSendResultMethod({message})).then(rs => {
|
|
298
|
+
const data = rs && rs.data
|
|
299
|
+
if (data && data.status === 1) task.check()
|
|
300
|
+
else task.promise.resolve(data || {})
|
|
301
|
+
}, () => task.check())
|
|
302
|
+
}, 3000)
|
|
303
|
+
}, cancel: () => { clearTimeout(timer); task.promise.reject('reject') } }
|
|
304
|
+
this.checkMessageSendResultTaskList.push(task)
|
|
305
|
+
task.check()
|
|
306
|
+
task.promise.then(rs => this.updateMessage(message.id, rs || {})).finally(() => this.removeCheckMessageSendResultTask(message.id))
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
removeCheckMessageSendResultTask (id) {
|
|
310
|
+
const index = this.checkMessageSendResultTaskList.findIndex(v => v.id === id)
|
|
311
|
+
if (index >= 0) { this.checkMessageSendResultTaskList[index].cancel(); this.checkMessageSendResultTaskList.splice(index, 1) }
|
|
312
|
+
}
|
|
276
313
|
|
|
277
314
|
reset () {
|
|
315
|
+
this.checkMessageSendResultTaskList.forEach(task => task.cancel())
|
|
316
|
+
this.checkMessageSendResultTaskList = []
|
|
317
|
+
this.tempMessageMap = {}
|
|
278
318
|
this.data.messageData = {}
|
|
279
319
|
}
|
|
280
|
-
}
|
|
320
|
+
}
|
|
@@ -82,7 +82,8 @@ export default class ClientChatSession {
|
|
|
82
82
|
/**
|
|
83
83
|
* 删除会话
|
|
84
84
|
*/
|
|
85
|
-
deleteSessionMethod: null
|
|
85
|
+
deleteSessionMethod: null,
|
|
86
|
+
modifiedAccountMap: {}
|
|
86
87
|
})
|
|
87
88
|
|
|
88
89
|
accountIds = []
|
|
@@ -119,6 +120,23 @@ export default class ClientChatSession {
|
|
|
119
120
|
return this.data.loading
|
|
120
121
|
}
|
|
121
122
|
|
|
123
|
+
isModify (qwAccountId) {
|
|
124
|
+
return !!(qwAccountId && this.data.modifiedAccountMap[qwAccountId])
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
markModify (qwAccountIds) {
|
|
128
|
+
const ids = Array.isArray(qwAccountIds) ? qwAccountIds : [qwAccountIds]
|
|
129
|
+
ids.filter(Boolean).forEach(id => {
|
|
130
|
+
Vue.set(this.data.modifiedAccountMap, id, true)
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
unmarkModify (qwAccountId) {
|
|
135
|
+
if (qwAccountId) {
|
|
136
|
+
Vue.delete(this.data.modifiedAccountMap, qwAccountId)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
122
140
|
get loadAssignTaskSessioning () {
|
|
123
141
|
return this.data.loadAssignTaskSessioning
|
|
124
142
|
}
|
|
@@ -205,6 +223,35 @@ export default class ClientChatSession {
|
|
|
205
223
|
getSessionByLocal (sessionId) {
|
|
206
224
|
return this.sessionMap[sessionId]
|
|
207
225
|
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* 强制从服务端刷新会话,绕过本地缓存。
|
|
229
|
+
*/
|
|
230
|
+
refreshSession (sessionId) {
|
|
231
|
+
if (!sessionId) {
|
|
232
|
+
return Promise.reject('缺少会话id')
|
|
233
|
+
}
|
|
234
|
+
return this.getSessionMethod({
|
|
235
|
+
id: sessionId
|
|
236
|
+
}).then(rs => {
|
|
237
|
+
if (!rs || !rs.data) {
|
|
238
|
+
return Promise.reject('未找到会话' + sessionId)
|
|
239
|
+
}
|
|
240
|
+
// 事件计算出的 sessionId 是本地索引,始终保持与服务端返回对象一致。
|
|
241
|
+
const serverSession = Object.assign({}, rs.data, {
|
|
242
|
+
id: sessionId
|
|
243
|
+
})
|
|
244
|
+
const localSession = this.getSessionByLocal(sessionId)
|
|
245
|
+
if (localSession) {
|
|
246
|
+
this.updateSession(sessionId, serverSession)
|
|
247
|
+
} else {
|
|
248
|
+
this.addSession(serverSession)
|
|
249
|
+
}
|
|
250
|
+
return Object.assign({}, rs, {
|
|
251
|
+
data: serverSession
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
}
|
|
208
255
|
|
|
209
256
|
findSession (findFn) {
|
|
210
257
|
let result
|
|
@@ -915,6 +962,7 @@ export default class ClientChatSession {
|
|
|
915
962
|
this.data.sessionData = {}
|
|
916
963
|
this.data.sessionGroupData = {}
|
|
917
964
|
this.data.sessionMuteMap = {}
|
|
965
|
+
this.data.modifiedAccountMap = {}
|
|
918
966
|
// this.data.sessionUnreadCountMap = {}
|
|
919
967
|
this.sessionMap = {}
|
|
920
968
|
if (this.cancelLoadDataRequest) {
|
|
@@ -926,4 +974,4 @@ export default class ClientChatSession {
|
|
|
926
974
|
this.cancelRefreshRequest = null
|
|
927
975
|
}
|
|
928
976
|
}
|
|
929
|
-
}
|
|
977
|
+
}
|
|
@@ -15,11 +15,14 @@ export default class ClietChatSocket {
|
|
|
15
15
|
// 执行回调事件前的方法
|
|
16
16
|
beforeFireCallback: null,
|
|
17
17
|
onCmdQwNewMessage: null,
|
|
18
|
+
onCmdQwContactInfoChanged: null,
|
|
19
|
+
onCmdQwRoomInfoChanged: null,
|
|
18
20
|
onCmdSendMessageResult: null,
|
|
19
21
|
onCmdFriendInfoChanged: null,
|
|
20
22
|
onCmdDownloadVideoResult: null,
|
|
21
23
|
onCmdChatroomInfoChanged: null,
|
|
22
24
|
onCmdChatroomInfoChangedBatch: null,
|
|
25
|
+
onHeartbeatSuccess: null,
|
|
23
26
|
onHeartbeatCheck: null
|
|
24
27
|
}, options)
|
|
25
28
|
if (!options.socket) {
|
|
@@ -27,6 +30,11 @@ export default class ClietChatSocket {
|
|
|
27
30
|
}
|
|
28
31
|
this.socket = options.socket
|
|
29
32
|
this.socket.event.on('onCmdQwNewMessage', options.onCmdQwNewMessage)
|
|
33
|
+
this.socket.event.on('onCmdQwContactInfoChanged', options.onCmdQwContactInfoChanged)
|
|
34
|
+
this.socket.event.on('onCmdQwRoomInfoChanged', options.onCmdQwRoomInfoChanged)
|
|
35
|
+
this.socket.event.on('onHeartbeatSuccess', (evt) => {
|
|
36
|
+
options.onHeartbeatSuccess && options.onHeartbeatSuccess(evt)
|
|
37
|
+
})
|
|
30
38
|
this.socket.event.on('onHeartbeatCheck', ({ mergeParams }) => {
|
|
31
39
|
options.onHeartbeatCheck && options.onHeartbeatCheck({
|
|
32
40
|
mergeParams
|
|
@@ -62,4 +70,4 @@ export default class ClietChatSocket {
|
|
|
62
70
|
setUrl (url) {
|
|
63
71
|
this.socket.setUrl(url)
|
|
64
72
|
}
|
|
65
|
-
}
|
|
73
|
+
}
|