@aochuang/client-sdk 1.0.333 → 1.0.335
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/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 +6 -6
- package/components/wework-chat-control/text/text.vue +22 -3
- package/components/wework-chat-control/util.js +11 -5
- 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/components/wework-chat-control/wework-chat-control-config.vue +62 -0
- package/components/wework-chat-panel/chat-panel-item.vue +7 -7
- package/components/wework-chat-panel/chat-panel.vue +90 -9
- package/package.json +1 -1
- package/services/client-chat/client-chat-wework/client-chat-concats.js +32 -1
- package/services/client-chat/client-chat-wework/client-chat-session.js +30 -1
- package/services/client-chat/client-chat-wework/client-chat-socket.js +3 -1
- package/services/client-chat/client-chat-wework/client-chat.js +133 -4
- package/services/client-chat/client-chat-wework/utils.js +3 -3
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<sdk-chat-panel
|
|
3
3
|
ref="panel"
|
|
4
|
-
v-bind="
|
|
4
|
+
v-bind="props"
|
|
5
5
|
:is-sender-method="handleIsSenderMethod"
|
|
6
6
|
@initloaded="handleChatsInitLoaded"
|
|
7
7
|
@chat-contextmenu="handleChatContext"
|
|
@@ -37,6 +37,9 @@
|
|
|
37
37
|
</template>
|
|
38
38
|
<template slot="main">
|
|
39
39
|
<slot name="main"></slot>
|
|
40
|
+
<template v-if="selectable">
|
|
41
|
+
<slot name="selection" :total="checkTotal"></slot>
|
|
42
|
+
</template>
|
|
40
43
|
</template>
|
|
41
44
|
</sdk-chat-panel>
|
|
42
45
|
</template>
|
|
@@ -59,7 +62,8 @@ export default {
|
|
|
59
62
|
}
|
|
60
63
|
},
|
|
61
64
|
keyField: {
|
|
62
|
-
type: String
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'id'
|
|
63
67
|
},
|
|
64
68
|
startDate: {
|
|
65
69
|
type: Number
|
|
@@ -88,9 +92,6 @@ export default {
|
|
|
88
92
|
type: Boolean,
|
|
89
93
|
default: true
|
|
90
94
|
},
|
|
91
|
-
renderControl: {
|
|
92
|
-
type: Function
|
|
93
|
-
},
|
|
94
95
|
fetchUserMethod: {
|
|
95
96
|
type: Function
|
|
96
97
|
},
|
|
@@ -126,12 +127,33 @@ export default {
|
|
|
126
127
|
},
|
|
127
128
|
contextChatId: {
|
|
128
129
|
type: String
|
|
130
|
+
},
|
|
131
|
+
onBeforeSelectionChange: {
|
|
132
|
+
type: Function
|
|
129
133
|
}
|
|
130
134
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
data () {
|
|
136
|
+
return {
|
|
137
|
+
checkMsgMap: {}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
computed: {
|
|
141
|
+
props () {
|
|
142
|
+
const { config, ...nextProps } = this.$props
|
|
143
|
+
return nextProps
|
|
134
144
|
},
|
|
145
|
+
checkTotal () {
|
|
146
|
+
return Object.keys(this.checkMsgMap).length
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
watch: {
|
|
150
|
+
selectable () {
|
|
151
|
+
if (!this.selectable) {
|
|
152
|
+
this.checkMsgMap = {}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
methods: {
|
|
135
157
|
handleIsSenderMethod ({ item }) {
|
|
136
158
|
return !!item.send
|
|
137
159
|
},
|
|
@@ -148,8 +170,67 @@ export default {
|
|
|
148
170
|
this.currentContextChat = null
|
|
149
171
|
return this.$refs.panel && this.$refs.panel.reload()
|
|
150
172
|
},
|
|
173
|
+
handleFilterSelectMessageMethod (msg) {
|
|
174
|
+
if (!this.filterSelectMessageMethod) {
|
|
175
|
+
return true
|
|
176
|
+
}
|
|
177
|
+
return this.filterSelectMessageMethod({
|
|
178
|
+
item: msg
|
|
179
|
+
})
|
|
180
|
+
},
|
|
181
|
+
handleMsgCheckboxChange (msg, value) {
|
|
182
|
+
if (value) {
|
|
183
|
+
this.selectChat(msg)
|
|
184
|
+
} else {
|
|
185
|
+
this.unselectChat(msg)
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
selectChat (chat) {
|
|
189
|
+
if (!chat) {
|
|
190
|
+
return
|
|
191
|
+
}
|
|
192
|
+
if (!this.selectable) {
|
|
193
|
+
console.warn('未开启选择')
|
|
194
|
+
return
|
|
195
|
+
}
|
|
196
|
+
if (this.onBeforeSelectionChange && this.onBeforeSelectionChange({
|
|
197
|
+
chat,
|
|
198
|
+
value: true
|
|
199
|
+
}) === false) {
|
|
200
|
+
return
|
|
201
|
+
}
|
|
202
|
+
this.$set(this.checkMsgMap, chat[this.keyField], chat)
|
|
203
|
+
},
|
|
204
|
+
unselectChat (chat) {
|
|
205
|
+
if (!chat) {
|
|
206
|
+
return
|
|
207
|
+
}
|
|
208
|
+
if (!this.selectable) {
|
|
209
|
+
console.warn('未开启选择')
|
|
210
|
+
return
|
|
211
|
+
}
|
|
212
|
+
if (this.onBeforeSelectionChange && this.onBeforeSelectionChange({
|
|
213
|
+
chat,
|
|
214
|
+
value: false
|
|
215
|
+
}) === false) {
|
|
216
|
+
return
|
|
217
|
+
}
|
|
218
|
+
this.$delete(this.checkMsgMap, chat[this.keyField])
|
|
219
|
+
},
|
|
220
|
+
unselectAllChat () {
|
|
221
|
+
return Object.keys(this.checkMsgMap).map(key => {
|
|
222
|
+
return this.unselectChat(this.checkMsgMap[key])
|
|
223
|
+
})
|
|
224
|
+
},
|
|
225
|
+
getSelectChats () {
|
|
226
|
+
return Object.keys(this.checkMsgMap).map(key => {
|
|
227
|
+
return this.checkMsgMap[key]
|
|
228
|
+
})
|
|
229
|
+
},
|
|
151
230
|
handleChatContext (item, evt) {
|
|
152
|
-
this.$emit('chat-contextmenu',
|
|
231
|
+
this.$emit('chat-contextmenu', {
|
|
232
|
+
item
|
|
233
|
+
}, evt)
|
|
153
234
|
},
|
|
154
235
|
handleChatViewContext ({ item }) {
|
|
155
236
|
this.$emit('chat-view-context', {
|
package/package.json
CHANGED
|
@@ -628,6 +628,37 @@ export default class ClientChatContacts {
|
|
|
628
628
|
return rs
|
|
629
629
|
})
|
|
630
630
|
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* 强制从服务端刷新好友资料,绕过本地缓存。
|
|
634
|
+
*/
|
|
635
|
+
refreshFriend (friendId) {
|
|
636
|
+
if (!friendId) {
|
|
637
|
+
return Promise.reject('缺少好友id')
|
|
638
|
+
}
|
|
639
|
+
if (!this.getContactsFriendMethod) {
|
|
640
|
+
return Promise.reject(new Error('getContactsFriendMethod未定义'))
|
|
641
|
+
}
|
|
642
|
+
return this.getContactsFriendMethod({
|
|
643
|
+
id: friendId
|
|
644
|
+
}).then(rs => {
|
|
645
|
+
if (!rs || !rs.data) {
|
|
646
|
+
return Promise.reject('未找到好友' + friendId)
|
|
647
|
+
}
|
|
648
|
+
if (this.friendMap[friendId]) {
|
|
649
|
+
const nextKeys = Object.keys(rs.data)
|
|
650
|
+
Object.keys(this.friendMap[friendId]).forEach(key => {
|
|
651
|
+
if (!nextKeys.includes(key)) {
|
|
652
|
+
Vue.delete(this.friendMap[friendId], key)
|
|
653
|
+
}
|
|
654
|
+
})
|
|
655
|
+
this.updateFriend(friendId, rs.data)
|
|
656
|
+
} else {
|
|
657
|
+
this.addFriend(rs.data)
|
|
658
|
+
}
|
|
659
|
+
return rs
|
|
660
|
+
})
|
|
661
|
+
}
|
|
631
662
|
|
|
632
663
|
setRoomMemberData (roomId, data) {
|
|
633
664
|
if (!roomId) {
|
|
@@ -769,4 +800,4 @@ export default class ClientChatContacts {
|
|
|
769
800
|
this.cancelRefreshRequest = null
|
|
770
801
|
}
|
|
771
802
|
}
|
|
772
|
-
}
|
|
803
|
+
}
|
|
@@ -205,6 +205,35 @@ export default class ClientChatSession {
|
|
|
205
205
|
getSessionByLocal (sessionId) {
|
|
206
206
|
return this.sessionMap[sessionId]
|
|
207
207
|
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* 强制从服务端刷新会话,绕过本地缓存。
|
|
211
|
+
*/
|
|
212
|
+
refreshSession (sessionId) {
|
|
213
|
+
if (!sessionId) {
|
|
214
|
+
return Promise.reject('缺少会话id')
|
|
215
|
+
}
|
|
216
|
+
return this.getSessionMethod({
|
|
217
|
+
id: sessionId
|
|
218
|
+
}).then(rs => {
|
|
219
|
+
if (!rs || !rs.data) {
|
|
220
|
+
return Promise.reject('未找到会话' + sessionId)
|
|
221
|
+
}
|
|
222
|
+
// 事件计算出的 sessionId 是本地索引,始终保持与服务端返回对象一致。
|
|
223
|
+
const serverSession = Object.assign({}, rs.data, {
|
|
224
|
+
id: sessionId
|
|
225
|
+
})
|
|
226
|
+
const localSession = this.getSessionByLocal(sessionId)
|
|
227
|
+
if (localSession) {
|
|
228
|
+
this.updateSession(sessionId, serverSession)
|
|
229
|
+
} else {
|
|
230
|
+
this.addSession(serverSession)
|
|
231
|
+
}
|
|
232
|
+
return Object.assign({}, rs, {
|
|
233
|
+
data: serverSession
|
|
234
|
+
})
|
|
235
|
+
})
|
|
236
|
+
}
|
|
208
237
|
|
|
209
238
|
findSession (findFn) {
|
|
210
239
|
let result
|
|
@@ -926,4 +955,4 @@ export default class ClientChatSession {
|
|
|
926
955
|
this.cancelRefreshRequest = null
|
|
927
956
|
}
|
|
928
957
|
}
|
|
929
|
-
}
|
|
958
|
+
}
|
|
@@ -15,6 +15,7 @@ export default class ClietChatSocket {
|
|
|
15
15
|
// 执行回调事件前的方法
|
|
16
16
|
beforeFireCallback: null,
|
|
17
17
|
onCmdQwNewMessage: null,
|
|
18
|
+
onCmdQwContactInfoChanged: null,
|
|
18
19
|
onCmdSendMessageResult: null,
|
|
19
20
|
onCmdFriendInfoChanged: null,
|
|
20
21
|
onCmdDownloadVideoResult: null,
|
|
@@ -27,6 +28,7 @@ export default class ClietChatSocket {
|
|
|
27
28
|
}
|
|
28
29
|
this.socket = options.socket
|
|
29
30
|
this.socket.event.on('onCmdQwNewMessage', options.onCmdQwNewMessage)
|
|
31
|
+
this.socket.event.on('onCmdQwContactInfoChanged', options.onCmdQwContactInfoChanged)
|
|
30
32
|
this.socket.event.on('onHeartbeatCheck', ({ mergeParams }) => {
|
|
31
33
|
options.onHeartbeatCheck && options.onHeartbeatCheck({
|
|
32
34
|
mergeParams
|
|
@@ -62,4 +64,4 @@ export default class ClietChatSocket {
|
|
|
62
64
|
setUrl (url) {
|
|
63
65
|
this.socket.setUrl(url)
|
|
64
66
|
}
|
|
65
|
-
}
|
|
67
|
+
}
|
|
@@ -32,6 +32,7 @@ class ClientChat {
|
|
|
32
32
|
getLoginUserIdMethod: null,
|
|
33
33
|
getLoginUserTokenMethod: null,
|
|
34
34
|
loadAccountDataMethod: null,
|
|
35
|
+
getLoginAccountIdMethod: null, // 因为1.0有帮聊逻辑,帮聊消息以及通讯录的accountId不是登录用户的accountId,会导致找到的会话出现问题,所以这里提供一个方法让外部传入
|
|
35
36
|
loadSessionDataMethod: null,
|
|
36
37
|
updateSessionReadMethod: null,
|
|
37
38
|
getSessionMethod: null,
|
|
@@ -57,8 +58,9 @@ class ClientChat {
|
|
|
57
58
|
}
|
|
58
59
|
if (!options.loadRoomMessageDataMethod) {
|
|
59
60
|
throw new Error('loadRoomMessageDataMethod不能为空')
|
|
60
|
-
}
|
|
61
|
+
}
|
|
61
62
|
this.onOverwriteFriendInfoChange = options.onOverwriteFriendInfoChange
|
|
63
|
+
this.getLoginAccountIdMethod = options.getLoginAccountIdMethod
|
|
62
64
|
this.event = new Event({
|
|
63
65
|
checkOnMethod: (name) => {
|
|
64
66
|
if (name === 'ready') {
|
|
@@ -86,7 +88,8 @@ class ClientChat {
|
|
|
86
88
|
sortField: 'sendTime',
|
|
87
89
|
clientChat: this,
|
|
88
90
|
onAddMessageSuccess: ({ data }) => {
|
|
89
|
-
|
|
91
|
+
const accountId = this.getLoginAccountIdMethod ? this.getLoginAccountIdMethod() : data.qwAccountId
|
|
92
|
+
let sessionId = createSessionId(accountId, data.contactId)
|
|
90
93
|
// 更新会话
|
|
91
94
|
if (!sessionId) {
|
|
92
95
|
return
|
|
@@ -155,7 +158,8 @@ class ClientChat {
|
|
|
155
158
|
sortField: 'sendTime',
|
|
156
159
|
clientChat: this,
|
|
157
160
|
onAddMessageSuccess: ({ data }) => {
|
|
158
|
-
|
|
161
|
+
const accountId = this.getLoginAccountIdMethod ? this.getLoginAccountIdMethod() : data.qwAccountId
|
|
162
|
+
let sessionId = createSessionId(accountId, data.roomId)
|
|
159
163
|
// 更新会话
|
|
160
164
|
if (!sessionId) {
|
|
161
165
|
return
|
|
@@ -258,6 +262,47 @@ class ClientChat {
|
|
|
258
262
|
})
|
|
259
263
|
this.socket = new ClientChatSocket({
|
|
260
264
|
socket: options.socket,
|
|
265
|
+
onCmdQwContactInfoChanged: ({ data }) => {
|
|
266
|
+
const contacts = data && (Array.isArray(data.contacts)
|
|
267
|
+
? data.contacts
|
|
268
|
+
: (data.contactId ? [data] : []))
|
|
269
|
+
if (!contacts || !contacts.length) {
|
|
270
|
+
return
|
|
271
|
+
}
|
|
272
|
+
const tasks = []
|
|
273
|
+
const removedTasks = []
|
|
274
|
+
contacts.forEach(contact => {
|
|
275
|
+
if (!contact) {
|
|
276
|
+
return
|
|
277
|
+
}
|
|
278
|
+
const changeType = Number(contact.changeType)
|
|
279
|
+
if (changeType === 1) {
|
|
280
|
+
tasks.push(this.handleQwContactAdded(contact, data))
|
|
281
|
+
} else if (changeType === 2) {
|
|
282
|
+
tasks.push(this.handleQwContactUpdated(contact))
|
|
283
|
+
} else if (changeType === 3) {
|
|
284
|
+
removedTasks.push(this.handleQwContactRemoved(contact, data))
|
|
285
|
+
}
|
|
286
|
+
})
|
|
287
|
+
return Promise.all(tasks.concat(removedTasks)).then(results => {
|
|
288
|
+
const accountUnreadCountMap = {}
|
|
289
|
+
removedTasks.forEach((task, index) => {
|
|
290
|
+
const result = results[tasks.length + index]
|
|
291
|
+
if (!result || !result.accountId || !result.unreadCount) {
|
|
292
|
+
return
|
|
293
|
+
}
|
|
294
|
+
accountUnreadCountMap[result.accountId] = (accountUnreadCountMap[result.accountId] || 0) + result.unreadCount
|
|
295
|
+
})
|
|
296
|
+
return Promise.all(Object.keys(accountUnreadCountMap).map(accountId => {
|
|
297
|
+
const removedUnreadCount = accountUnreadCountMap[accountId]
|
|
298
|
+
return this.account.updateAccountUnreadMessageNum(accountId, ({ unreadMesasgeNum }) => {
|
|
299
|
+
return Math.max(0, unreadMesasgeNum - removedUnreadCount)
|
|
300
|
+
}).catch(error => {
|
|
301
|
+
console.warn('[client-chat] update account unread count failed', error)
|
|
302
|
+
})
|
|
303
|
+
}))
|
|
304
|
+
})
|
|
305
|
+
},
|
|
261
306
|
// 接受新消息
|
|
262
307
|
onCmdQwNewMessage: ({ data }) => {
|
|
263
308
|
// 插入消息
|
|
@@ -291,6 +336,90 @@ class ClientChat {
|
|
|
291
336
|
}
|
|
292
337
|
})
|
|
293
338
|
}
|
|
339
|
+
|
|
340
|
+
getQwAccountCorpId (qwAccountId, corpId) {
|
|
341
|
+
if (corpId || !qwAccountId || !this.account) {
|
|
342
|
+
return corpId
|
|
343
|
+
}
|
|
344
|
+
const account = this.account.getAccountData().find(item => item.id === qwAccountId)
|
|
345
|
+
return account && account.corpId
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
handleQwContactAdded (contact, eventData) {
|
|
349
|
+
const qwAccountId = contact.qwAccountId || (eventData && eventData.qwAccountId)
|
|
350
|
+
const corpId = this.getQwAccountCorpId(
|
|
351
|
+
qwAccountId,
|
|
352
|
+
contact.corpId || (eventData && eventData.corpId)
|
|
353
|
+
)
|
|
354
|
+
const contactId = contact.contactId
|
|
355
|
+
const accountId = this.getLoginAccountIdMethod ? this.getLoginAccountIdMethod() : qwAccountId
|
|
356
|
+
const sessionId = createSessionId(accountId, contactId)
|
|
357
|
+
if (!sessionId) {
|
|
358
|
+
return Promise.resolve()
|
|
359
|
+
}
|
|
360
|
+
const localSession = this.session.getSessionByLocal(sessionId)
|
|
361
|
+
const oldUnread = localSession ? (localSession.unreadMsgCount || 0) : 0
|
|
362
|
+
this.contacts.markModify()
|
|
363
|
+
return this.session.refreshSession(sessionId).then(rs => {
|
|
364
|
+
const serverSession = rs && rs.data
|
|
365
|
+
const newUnread = serverSession ? (serverSession.unreadMsgCount || 0) : 0
|
|
366
|
+
const accountId = (serverSession && serverSession.qwAccountId) || qwAccountId
|
|
367
|
+
const unreadDiff = newUnread - oldUnread
|
|
368
|
+
if (accountId && unreadDiff) {
|
|
369
|
+
return this.account.updateAccountUnreadMessageNum(accountId, ({ unreadMesasgeNum }) => {
|
|
370
|
+
return Math.max(0, unreadMesasgeNum + unreadDiff)
|
|
371
|
+
})
|
|
372
|
+
}
|
|
373
|
+
}).catch(error => {
|
|
374
|
+
console.warn('[client-chat] refresh added contact session failed', error)
|
|
375
|
+
})
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
handleQwContactUpdated (contact) {
|
|
379
|
+
if (!contact.contactId) {
|
|
380
|
+
return Promise.resolve()
|
|
381
|
+
}
|
|
382
|
+
return this.contacts.refreshFriend(contact.contactId).then(() => {
|
|
383
|
+
this.contacts.markModify()
|
|
384
|
+
}).catch(error => {
|
|
385
|
+
console.warn('[client-chat] refresh contact failed', error)
|
|
386
|
+
})
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
handleQwContactRemoved (contact, eventData) {
|
|
390
|
+
if (!contact.contactId) {
|
|
391
|
+
return Promise.resolve()
|
|
392
|
+
}
|
|
393
|
+
this.contacts.removeFriend(contact.contactId)
|
|
394
|
+
let session = this.session.findSession(({ session }) => {
|
|
395
|
+
return String(session.type) === '0' &&
|
|
396
|
+
session.targetId === contact.contactId &&
|
|
397
|
+
(!contact.qwAccountId || session.qwAccountId === contact.qwAccountId)
|
|
398
|
+
})
|
|
399
|
+
if (!session) {
|
|
400
|
+
const qwAccountId = contact.qwAccountId || (eventData && eventData.qwAccountId)
|
|
401
|
+
const accountId = this.getLoginAccountIdMethod ? this.getLoginAccountIdMethod() : qwAccountId
|
|
402
|
+
const sessionId = createSessionId(
|
|
403
|
+
accountId,
|
|
404
|
+
contact.contactId
|
|
405
|
+
)
|
|
406
|
+
session = sessionId && this.session.getSessionByLocal(sessionId)
|
|
407
|
+
}
|
|
408
|
+
this.contacts.markModify()
|
|
409
|
+
if (!session) {
|
|
410
|
+
return Promise.resolve()
|
|
411
|
+
}
|
|
412
|
+
if (this.session.currentSession && this.session.currentSession.id === session.id) {
|
|
413
|
+
this.session.setCurrentSession(null)
|
|
414
|
+
}
|
|
415
|
+
const accountId = session.qwAccountId || contact.qwAccountId
|
|
416
|
+
const unreadCount = session.unreadMsgCount || 0
|
|
417
|
+
this.session.removeSession(session.id)
|
|
418
|
+
return Promise.resolve({
|
|
419
|
+
accountId,
|
|
420
|
+
unreadCount
|
|
421
|
+
})
|
|
422
|
+
}
|
|
294
423
|
|
|
295
424
|
connect () {
|
|
296
425
|
if (this.data.connectStatus === CONNECT_STATUS.Complete) {
|
|
@@ -328,4 +457,4 @@ class ClientChat {
|
|
|
328
457
|
}
|
|
329
458
|
}
|
|
330
459
|
|
|
331
|
-
export default ClientChat
|
|
460
|
+
export default ClientChat
|
|
@@ -13,11 +13,11 @@ export function isUni () {
|
|
|
13
13
|
* @param accountId - 客服id
|
|
14
14
|
* @param targetId - wechatFriendId | wechatChatroomId
|
|
15
15
|
*/
|
|
16
|
-
export function createSessionId (
|
|
17
|
-
if (!
|
|
16
|
+
export function createSessionId (accountId, targetId) {
|
|
17
|
+
if (!accountId || !targetId) {
|
|
18
18
|
return
|
|
19
19
|
}
|
|
20
|
-
return shajs('sha1').update(`${
|
|
20
|
+
return shajs('sha1').update(`${accountId}${targetId}`).digest('hex')
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
3
|
-
import { companyCard } from '../../../wework-chat-control'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsCompanyCard',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(companyCard, {
|
|
29
|
-
props: {
|
|
30
|
-
data: props.data
|
|
31
|
-
}
|
|
32
|
-
})])
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { expression } from '../../../wework-chat-control'
|
|
3
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsExpression',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
default: () => ({})
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(expression, {
|
|
29
|
-
props: {
|
|
30
|
-
data: props.data
|
|
31
|
-
},
|
|
32
|
-
key: c.data.key
|
|
33
|
-
})])
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
</script>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
3
|
-
import { fileUrl } from '../../../wework-chat-control'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsFileUrl',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(fileUrl, {
|
|
29
|
-
props: {
|
|
30
|
-
content: props.data.content
|
|
31
|
-
}
|
|
32
|
-
})])
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { image } from '../../../wework-chat-control'
|
|
3
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsImage',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
default: () => ({})
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(image, {
|
|
29
|
-
props: {
|
|
30
|
-
data: props.data
|
|
31
|
-
},
|
|
32
|
-
key: c.data.key
|
|
33
|
-
})])
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
</script>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import text from './text/text.vue'
|
|
2
|
-
import link from './link/link.vue'
|
|
3
|
-
import companyCard from './company-card/company-card.vue'
|
|
4
|
-
import video from './video/video.vue'
|
|
5
|
-
import image from './image/image.vue'
|
|
6
|
-
import unkonw from './unkonw/unkonw.vue'
|
|
7
|
-
import expression from './expression/expression.vue'
|
|
8
|
-
import voice from './voice/voice.vue'
|
|
9
|
-
import jxSysText from './jx-sys-text/jx-sys-text.vue'
|
|
10
|
-
import fileUrl from './file-url/file-url.vue'
|
|
11
|
-
import location from './location/location.vue'
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
0: text,
|
|
15
|
-
2: text,
|
|
16
|
-
14: image,
|
|
17
|
-
101: image,
|
|
18
|
-
// '49': link,
|
|
19
|
-
22: video,
|
|
20
|
-
23: video,
|
|
21
|
-
103: video,
|
|
22
|
-
29: expression,
|
|
23
|
-
104: expression,
|
|
24
|
-
16: voice,
|
|
25
|
-
40: voice,
|
|
26
|
-
1011: jxSysText,
|
|
27
|
-
1022: jxSysText,
|
|
28
|
-
41: companyCard,
|
|
29
|
-
13: fileUrl,
|
|
30
|
-
15: fileUrl,
|
|
31
|
-
20: fileUrl,
|
|
32
|
-
102: fileUrl,
|
|
33
|
-
6: location,
|
|
34
|
-
unkonw
|
|
35
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { jxSysText } from '../../../wework-chat-control'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
name: 'SdkWeworkChatPanelControlsJxSysText',
|
|
6
|
-
functional: true,
|
|
7
|
-
props: {
|
|
8
|
-
dir: {
|
|
9
|
-
type: String
|
|
10
|
-
},
|
|
11
|
-
data: {
|
|
12
|
-
type: Object,
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
fetchUserMethod: {
|
|
16
|
-
type: Function
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
render (h, c) {
|
|
20
|
-
const { props } = c
|
|
21
|
-
return h(jxSysText, {
|
|
22
|
-
props: {
|
|
23
|
-
content: props.data.content
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
</script>
|