@aochuang/client-sdk 1.0.340 → 1.0.341

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.
Files changed (37) hide show
  1. package/components/index.js +1 -6
  2. package/components/session-select/session-select-item.vue +9 -8
  3. package/components/wechat-chat-control/calling/calling.vue +3 -0
  4. package/components/wechat-chat-control/voice/voice.vue +4 -0
  5. package/components/wework-chat-control/company-card/company-card.vue +1 -1
  6. package/components/wework-chat-control/file-url/file-url.vue +5 -2
  7. package/components/wework-chat-control/image/image.vue +2 -137
  8. package/components/wework-chat-control/index.js +6 -6
  9. package/components/wework-chat-control/text/text.vue +3 -22
  10. package/components/wework-chat-control/util.js +6 -12
  11. package/components/wework-chat-control/video/video.vue +2 -10
  12. package/components/wework-chat-control/voice/voice.vue +1 -1
  13. package/components/wework-chat-panel/chat-panel-controls/company-card/company-card.vue +35 -0
  14. package/components/wework-chat-panel/chat-panel-controls/expression/expression.vue +36 -0
  15. package/components/wework-chat-panel/chat-panel-controls/file-url/file-url.vue +35 -0
  16. package/components/wework-chat-panel/chat-panel-controls/image/image.vue +36 -0
  17. package/components/wework-chat-panel/chat-panel-controls/index.js +35 -0
  18. package/components/wework-chat-panel/chat-panel-controls/jx-sys-text/jx-sys-text.vue +28 -0
  19. package/components/wework-chat-panel/chat-panel-controls/link/link.vue +35 -0
  20. package/components/wework-chat-panel/chat-panel-controls/location/location.vue +35 -0
  21. package/components/wework-chat-panel/chat-panel-controls/text/text.vue +43 -0
  22. package/components/wework-chat-panel/chat-panel-controls/unkonw/unkonw.vue +39 -0
  23. package/components/wework-chat-panel/chat-panel-controls/video/video.vue +37 -0
  24. package/components/wework-chat-panel/chat-panel-controls/voice/voice.vue +35 -0
  25. package/components/wework-chat-panel/chat-panel-item.vue +35 -12
  26. package/components/wework-chat-panel/chat-panel.vue +12 -95
  27. package/package.json +1 -1
  28. package/services/client-chat/client-chat-wework/client-chat-concats.js +17 -81
  29. package/services/client-chat/client-chat-wework/client-chat-message.js +5 -5
  30. package/services/client-chat/client-chat-wework/client-chat-session.js +2 -50
  31. package/services/client-chat/client-chat-wework/client-chat-socket.js +1 -5
  32. package/services/client-chat/client-chat-wework/client-chat.js +6 -258
  33. package/services/client-chat/client-chat-wework/utils.js +5 -5
  34. package/components/wework-chat-control/wework-chat-control-config-item.vue +0 -24
  35. package/components/wework-chat-control/wework-chat-control-config-msg.vue +0 -25
  36. package/components/wework-chat-control/wework-chat-control-config.vue +0 -62
  37. package/components/wework-chat-panel/chat-panel-chat-status/chat-panel-chat-status.vue +0 -73
@@ -74,7 +74,7 @@ export default class ClientChatMessage {
74
74
  * "msgSvrId": "4319123759514541049",
75
75
  * "msgType": 1,
76
76
  * "origin": "0",
77
- * "status": 0,
77
+ * "sendStatus": 0,
78
78
  * "tenantId": "1761952223049924608",
79
79
  * "wechatAccountId": "ad9d9ae2a8be4f27311312cdd4af3549dc8427ef",
80
80
  * "wechatFriendId": "2089efcc7f8f40b00b7f05fa4c6dfd3bb642774d",
@@ -215,11 +215,11 @@ export default class ClientChatMessage {
215
215
  }, data, {
216
216
  cmdType: 'CmdQwSendMessage'
217
217
  })).then(({ data }) => {
218
- if (data.status === 0) {
218
+ if (data.sendStatus === 0) {
219
219
  // 发送成功
220
- } else if (data.status === 2) {
220
+ } else if (data.sendStatus === 2) {
221
221
  // 发送失败
222
- } else if (data.status === 1) {
222
+ } else if (data.sendStatus === 1) {
223
223
  // 发送中
224
224
  }
225
225
  // 如果返回的是对象,证明发送成功了
@@ -277,4 +277,4 @@ export default class ClientChatMessage {
277
277
  reset () {
278
278
  this.data.messageData = {}
279
279
  }
280
- }
280
+ }
@@ -82,8 +82,7 @@ export default class ClientChatSession {
82
82
  /**
83
83
  * 删除会话
84
84
  */
85
- deleteSessionMethod: null,
86
- modifiedAccountMap: {}
85
+ deleteSessionMethod: null
87
86
  })
88
87
 
89
88
  accountIds = []
@@ -120,23 +119,6 @@ export default class ClientChatSession {
120
119
  return this.data.loading
121
120
  }
122
121
 
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
-
140
122
  get loadAssignTaskSessioning () {
141
123
  return this.data.loadAssignTaskSessioning
142
124
  }
@@ -223,35 +205,6 @@ export default class ClientChatSession {
223
205
  getSessionByLocal (sessionId) {
224
206
  return this.sessionMap[sessionId]
225
207
  }
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
- }
255
208
 
256
209
  findSession (findFn) {
257
210
  let result
@@ -962,7 +915,6 @@ export default class ClientChatSession {
962
915
  this.data.sessionData = {}
963
916
  this.data.sessionGroupData = {}
964
917
  this.data.sessionMuteMap = {}
965
- this.data.modifiedAccountMap = {}
966
918
  // this.data.sessionUnreadCountMap = {}
967
919
  this.sessionMap = {}
968
920
  if (this.cancelLoadDataRequest) {
@@ -974,4 +926,4 @@ export default class ClientChatSession {
974
926
  this.cancelRefreshRequest = null
975
927
  }
976
928
  }
977
- }
929
+ }
@@ -15,8 +15,6 @@ export default class ClietChatSocket {
15
15
  // 执行回调事件前的方法
16
16
  beforeFireCallback: null,
17
17
  onCmdQwNewMessage: null,
18
- onCmdQwContactInfoChanged: null,
19
- onCmdQwRoomInfoChanged: null,
20
18
  onCmdSendMessageResult: null,
21
19
  onCmdFriendInfoChanged: null,
22
20
  onCmdDownloadVideoResult: null,
@@ -29,8 +27,6 @@ export default class ClietChatSocket {
29
27
  }
30
28
  this.socket = options.socket
31
29
  this.socket.event.on('onCmdQwNewMessage', options.onCmdQwNewMessage)
32
- this.socket.event.on('onCmdQwContactInfoChanged', options.onCmdQwContactInfoChanged)
33
- this.socket.event.on('onCmdQwRoomInfoChanged', options.onCmdQwRoomInfoChanged)
34
30
  this.socket.event.on('onHeartbeatCheck', ({ mergeParams }) => {
35
31
  options.onHeartbeatCheck && options.onHeartbeatCheck({
36
32
  mergeParams
@@ -66,4 +62,4 @@ export default class ClietChatSocket {
66
62
  setUrl (url) {
67
63
  this.socket.setUrl(url)
68
64
  }
69
- }
65
+ }
@@ -32,7 +32,6 @@ class ClientChat {
32
32
  getLoginUserIdMethod: null,
33
33
  getLoginUserTokenMethod: null,
34
34
  loadAccountDataMethod: null,
35
- getLoginAccountIdMethod: null, // 因为1.0有帮聊逻辑,帮聊消息以及通讯录的accountId不是登录用户的accountId,会导致找到的会话出现问题,所以这里提供一个方法让外部传入
36
35
  loadSessionDataMethod: null,
37
36
  updateSessionReadMethod: null,
38
37
  getSessionMethod: null,
@@ -58,9 +57,8 @@ class ClientChat {
58
57
  }
59
58
  if (!options.loadRoomMessageDataMethod) {
60
59
  throw new Error('loadRoomMessageDataMethod不能为空')
61
- }
60
+ }
62
61
  this.onOverwriteFriendInfoChange = options.onOverwriteFriendInfoChange
63
- this.getLoginAccountIdMethod = options.getLoginAccountIdMethod
64
62
  this.event = new Event({
65
63
  checkOnMethod: (name) => {
66
64
  if (name === 'ready') {
@@ -88,8 +86,7 @@ class ClientChat {
88
86
  sortField: 'sendTime',
89
87
  clientChat: this,
90
88
  onAddMessageSuccess: ({ data }) => {
91
- const accountId = this.getLoginAccountIdMethod ? this.getLoginAccountIdMethod() : data.qwAccountId
92
- let sessionId = createSessionId(accountId, data.contactId)
89
+ let sessionId = createSessionId(data.corpId, data.qwAccountId, data.contactId)
93
90
  // 更新会话
94
91
  if (!sessionId) {
95
92
  return
@@ -113,7 +110,7 @@ class ClientChat {
113
110
  } else {
114
111
  this.session.updateSession(sessionId, ({ session }) => {
115
112
  let unreadMsgCount = session.unreadMsgCount
116
- if (!data.send) {
113
+ if (!data.isSend) {
117
114
  unreadMsgCount = unreadMsgCount + 1
118
115
  }
119
116
  // 如果是当前会话,那么未读消息需要设置为0
@@ -158,8 +155,7 @@ class ClientChat {
158
155
  sortField: 'sendTime',
159
156
  clientChat: this,
160
157
  onAddMessageSuccess: ({ data }) => {
161
- const accountId = this.getLoginAccountIdMethod ? this.getLoginAccountIdMethod() : data.qwAccountId
162
- let sessionId = createSessionId(accountId, data.roomId)
158
+ let sessionId = createSessionId(data.corpId, data.qwAccountId, data.roomId)
163
159
  // 更新会话
164
160
  if (!sessionId) {
165
161
  return
@@ -184,7 +180,7 @@ class ClientChat {
184
180
  } else {
185
181
  this.session.updateSession(sessionId, ({ session }) => {
186
182
  let unreadMsgCount = session.unreadMsgCount
187
- if (!data.send) {
183
+ if (!data.isSend) {
188
184
  unreadMsgCount = unreadMsgCount + 1
189
185
  }
190
186
  // 如果是当前会话,那么未读消息需要设置为0
@@ -262,77 +258,6 @@ class ClientChat {
262
258
  })
263
259
  this.socket = new ClientChatSocket({
264
260
  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
- this.markAccountsModified(data && data.qwAccountIds)
271
- return
272
- }
273
- const tasks = []
274
- const removedTasks = []
275
- contacts.forEach(contact => {
276
- if (!contact) {
277
- return
278
- }
279
- const changeType = Number(contact.changeType)
280
- if (changeType === 1) {
281
- tasks.push(this.handleQwContactAdded(contact, data))
282
- } else if (changeType === 2) {
283
- tasks.push(this.handleQwContactUpdated(contact))
284
- } else if (changeType === 3) {
285
- removedTasks.push(this.handleQwContactRemoved(contact, data))
286
- }
287
- })
288
- return Promise.all(tasks.concat(removedTasks)).then(results => {
289
- const accountUnreadCountMap = {}
290
- removedTasks.forEach((task, index) => {
291
- const result = results[tasks.length + index]
292
- if (!result || !result.accountId || !result.unreadCount) {
293
- return
294
- }
295
- accountUnreadCountMap[result.accountId] = (accountUnreadCountMap[result.accountId] || 0) + result.unreadCount
296
- })
297
- return Promise.all(Object.keys(accountUnreadCountMap).map(accountId => {
298
- const removedUnreadCount = accountUnreadCountMap[accountId]
299
- return this.account.updateAccountUnreadMessageNum(accountId, ({ unreadMesasgeNum }) => {
300
- return Math.max(0, unreadMesasgeNum - removedUnreadCount)
301
- }).catch(error => {
302
- console.warn('[client-chat] update account unread count failed', error)
303
- })
304
- }))
305
- })
306
- },
307
- onCmdQwRoomInfoChanged: ({ data }) => {
308
- const rooms = data && (Array.isArray(data.rooms)
309
- ? data.rooms
310
- : (data.roomId ? [data] : []))
311
- if (!rooms || !rooms.length) {
312
- this.markAccountsModified(data && data.qwAccountIds)
313
- return
314
- }
315
- const tasks = []
316
- const removedTasks = []
317
- rooms.forEach(room => {
318
- if (!room) {
319
- return
320
- }
321
- const changeType = Number(room.changeType)
322
- if (changeType === 1) {
323
- tasks.push(this.handleQwRoomAdded(room, data))
324
- } else if (changeType === 2) {
325
- tasks.push(this.handleQwRoomUpdated(room))
326
- } else if (changeType === 3) {
327
- removedTasks.push(this.handleQwRoomRemoved(room, data))
328
- }
329
- })
330
- return Promise.all(tasks.concat(removedTasks)).then(results => {
331
- return this.updateRemovedSessionUnreadCounts(
332
- results.slice(tasks.length)
333
- )
334
- })
335
- },
336
261
  // 接受新消息
337
262
  onCmdQwNewMessage: ({ data }) => {
338
263
  // 插入消息
@@ -366,184 +291,7 @@ class ClientChat {
366
291
  }
367
292
  })
368
293
  }
369
-
370
- getQwAccountCorpId (qwAccountId, corpId) {
371
- if (corpId || !qwAccountId || !this.account) {
372
- return corpId
373
- }
374
- const account = this.account.getAccountData().find(item => item.id === qwAccountId)
375
- return account && account.corpId
376
- }
377
-
378
- markAccountsModified (qwAccountIds) {
379
- if (!Array.isArray(qwAccountIds) || !qwAccountIds.length) {
380
- return
381
- }
382
- this.session.markModify(qwAccountIds)
383
- this.contacts.markModify(qwAccountIds)
384
- }
385
-
386
- updateRemovedSessionUnreadCounts (results) {
387
- const accountUnreadCountMap = {}
388
- ;(results || []).forEach(result => {
389
- if (!result || !result.accountId || !result.unreadCount) {
390
- return
391
- }
392
- accountUnreadCountMap[result.accountId] = (accountUnreadCountMap[result.accountId] || 0) + result.unreadCount
393
- })
394
- return Promise.all(Object.keys(accountUnreadCountMap).map(accountId => {
395
- const removedUnreadCount = accountUnreadCountMap[accountId]
396
- return this.account.updateAccountUnreadMessageNum(accountId, ({ unreadMesasgeNum }) => {
397
- return Math.max(0, unreadMesasgeNum - removedUnreadCount)
398
- }).catch(error => {
399
- console.warn('[client-chat] update account unread count failed', error)
400
- })
401
- }))
402
- }
403
-
404
- handleQwContactAdded (contact, eventData) {
405
- const qwAccountId = contact.qwAccountId || (eventData && eventData.qwAccountId)
406
- const corpId = this.getQwAccountCorpId(
407
- qwAccountId,
408
- contact.corpId || (eventData && eventData.corpId)
409
- )
410
- const contactId = contact.contactId
411
- const accountId = this.getLoginAccountIdMethod ? this.getLoginAccountIdMethod() : qwAccountId
412
- const sessionId = createSessionId(accountId, contactId)
413
- if (!sessionId) {
414
- return Promise.resolve()
415
- }
416
- const localSession = this.session.getSessionByLocal(sessionId)
417
- const oldUnread = localSession ? (localSession.unreadMsgCount || 0) : 0
418
- return this.session.refreshSession(sessionId).then(rs => {
419
- const serverSession = rs && rs.data
420
- const newUnread = serverSession ? (serverSession.unreadMsgCount || 0) : 0
421
- const accountId = (serverSession && serverSession.qwAccountId) || qwAccountId
422
- const unreadDiff = newUnread - oldUnread
423
- if (accountId && unreadDiff) {
424
- return this.account.updateAccountUnreadMessageNum(accountId, ({ unreadMesasgeNum }) => {
425
- return Math.max(0, unreadMesasgeNum + unreadDiff)
426
- })
427
- }
428
- }).catch(error => {
429
- console.warn('[client-chat] refresh added contact session failed', error)
430
- })
431
- }
432
-
433
- handleQwContactUpdated (contact) {
434
- if (!contact.contactId) {
435
- return Promise.resolve()
436
- }
437
- return this.contacts.refreshFriend(contact.contactId).catch(error => {
438
- console.warn('[client-chat] refresh contact failed', error)
439
- })
440
- }
441
-
442
- handleQwContactRemoved (contact, eventData) {
443
- if (!contact.contactId) {
444
- return Promise.resolve()
445
- }
446
- this.contacts.removeFriend(contact.contactId)
447
- let session = this.session.findSession(({ session }) => {
448
- return String(session.type) === '0' &&
449
- session.targetId === contact.contactId &&
450
- (!contact.qwAccountId || session.qwAccountId === contact.qwAccountId)
451
- })
452
- if (!session) {
453
- const qwAccountId = contact.qwAccountId || (eventData && eventData.qwAccountId)
454
- const accountId = this.getLoginAccountIdMethod ? this.getLoginAccountIdMethod() : qwAccountId
455
- const sessionId = createSessionId(
456
- accountId,
457
- contact.contactId
458
- )
459
- session = sessionId && this.session.getSessionByLocal(sessionId)
460
- }
461
- if (!session) {
462
- return Promise.resolve()
463
- }
464
- if (this.session.currentSession && this.session.currentSession.id === session.id) {
465
- this.session.setCurrentSession(null)
466
- }
467
- const accountId = session.qwAccountId || contact.qwAccountId
468
- const unreadCount = session.unreadMsgCount || 0
469
- this.session.removeSession(session.id)
470
- return Promise.resolve({
471
- accountId,
472
- unreadCount
473
- })
474
- }
475
294
 
476
- handleQwRoomAdded (room, eventData) {
477
- if (!room.roomId) {
478
- return Promise.resolve()
479
- }
480
- const qwAccountId = room.qwAccountId || (eventData && eventData.qwAccountId)
481
- const accountId = this.getLoginAccountIdMethod ? this.getLoginAccountIdMethod() : qwAccountId
482
- const sessionId = createSessionId(accountId, room.roomId)
483
- const localSession = sessionId && this.session.getSessionByLocal(sessionId)
484
- const oldUnread = localSession ? (localSession.unreadMsgCount || 0) : 0
485
- const tasks = [this.contacts.refreshRoom(room.roomId).catch(error => {
486
- console.warn('[client-chat] refresh added room failed', error)
487
- })]
488
- if (sessionId) {
489
- tasks.push(this.session.refreshSession(sessionId).then(rs => {
490
- const serverSession = rs && rs.data
491
- const unreadDiff = (serverSession ? (serverSession.unreadMsgCount || 0) : 0) - oldUnread
492
- const changedAccountId = (serverSession && serverSession.qwAccountId) || qwAccountId
493
- if (changedAccountId && unreadDiff) {
494
- return this.account.updateAccountUnreadMessageNum(changedAccountId, ({ unreadMesasgeNum }) => {
495
- return Math.max(0, unreadMesasgeNum + unreadDiff)
496
- })
497
- }
498
- }).catch(error => {
499
- console.warn('[client-chat] refresh added room session failed', error)
500
- }))
501
- }
502
- return Promise.all(tasks)
503
- }
504
-
505
- handleQwRoomUpdated (room) {
506
- if (!room.roomId) {
507
- return Promise.resolve()
508
- }
509
- return this.contacts.refreshRoom(room.roomId).catch(error => {
510
- console.warn('[client-chat] refresh room failed', error)
511
- })
512
- }
513
-
514
- handleQwRoomRemoved (room, eventData) {
515
- if (!room.roomId) {
516
- return Promise.resolve()
517
- }
518
- this.contacts.removeRoom(room.roomId)
519
- this.event.emit('roomRemoved', {
520
- roomId: room.roomId
521
- })
522
- const qwAccountId = room.qwAccountId || (eventData && eventData.qwAccountId)
523
- let session = this.session.findSession(({ session }) => {
524
- return String(session.type) === '1' &&
525
- session.targetId === room.roomId &&
526
- (!qwAccountId || session.qwAccountId === qwAccountId)
527
- })
528
- if (!session) {
529
- const accountId = this.getLoginAccountIdMethod ? this.getLoginAccountIdMethod() : qwAccountId
530
- const sessionId = createSessionId(accountId, room.roomId)
531
- session = sessionId && this.session.getSessionByLocal(sessionId)
532
- }
533
- if (!session) {
534
- return Promise.resolve()
535
- }
536
- if (this.session.currentSession && this.session.currentSession.id === session.id) {
537
- this.session.setCurrentSession(null)
538
- }
539
- const unreadCount = session.unreadMsgCount || 0
540
- this.session.removeSession(session.id)
541
- return Promise.resolve({
542
- accountId: session.qwAccountId || qwAccountId,
543
- unreadCount
544
- })
545
- }
546
-
547
295
  connect () {
548
296
  if (this.data.connectStatus === CONNECT_STATUS.Complete) {
549
297
  return Promise.resolve()
@@ -580,4 +328,4 @@ class ClientChat {
580
328
  }
581
329
  }
582
330
 
583
- export default ClientChat
331
+ 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 (accountId, targetId) {
17
- if (!accountId || !targetId) {
16
+ export function createSessionId (corpId, accountId, targetId) {
17
+ if (!corpId || !accountId || !targetId) {
18
18
  return
19
19
  }
20
- return shajs('sha1').update(`${accountId}${targetId}`).digest('hex')
20
+ return shajs('sha1').update(`${corpId}${accountId}${targetId}`).digest('hex')
21
21
  }
22
22
 
23
23
  /**
@@ -54,7 +54,7 @@ export function createSessionId (accountId, targetId) {
54
54
  * "msgSvrId": "4319123759514541049",
55
55
  * "msgType": 1,
56
56
  * "origin": "0",
57
- * "status": 0,
57
+ * "sendStatus": 0,
58
58
  * "tenantId": "1761952223049924608",
59
59
  * "wechatAccountId": "ad9d9ae2a8be4f27311312cdd4af3549dc8427ef",
60
60
  * "wechatFriendId": "2089efcc7f8f40b00b7f05fa4c6dfd3bb642774d",
@@ -79,4 +79,4 @@ export function createSessionData (message) {
79
79
  wechatAccountId: message.wechatAccountId
80
80
  }
81
81
  return nextSession
82
- }
82
+ }
@@ -1,24 +0,0 @@
1
- <script>
2
- export default {
3
- name: 'SdkWeworkChatControlConfigItem',
4
- functional: true,
5
- inject: {
6
- SdkWeworkChatControlConfig: {
7
- default: null
8
- }
9
- },
10
- props: {
11
- /**
12
- * 消息类型
13
- */
14
- msgType: {
15
- type: [Number, String]
16
- }
17
- },
18
- render (h, c) {
19
- return c.scopedSlots.default({
20
- configData: c.injections.SdkWeworkChatControlConfig ? c.injections.SdkWeworkChatControlConfig.getControlConfig(c.props.msgType) : null
21
- })
22
- }
23
- }
24
- </script>
@@ -1,25 +0,0 @@
1
- <script>
2
- export default {
3
- name: 'SdkWeworkChatControlConfigMsg',
4
- functional: true,
5
- inject: {
6
- SdkWeworkChatControlConfig: {
7
- default: null
8
- }
9
- },
10
- props: {
11
- /**
12
- * 标准的企微客户端消息数据
13
- */
14
- msgData: {
15
- type: Object,
16
- required: true
17
- }
18
- },
19
- render (h, c) {
20
- return c.scopedSlots.default({
21
- configData: c.injections.SdkWeworkChatControlConfig ? c.injections.SdkWeworkChatControlConfig.getMessageConfig(c.props.msgData) : null
22
- })
23
- }
24
- }
25
- </script>
@@ -1,62 +0,0 @@
1
- <script>
2
- export default {
3
- name: 'SdkWeworkChatControlConfig',
4
- provide () {
5
- return {
6
- SdkWeworkChatControlConfig: this
7
- }
8
- },
9
- inject: {
10
- // 可以继承上级的
11
- SdkWeworkChatControlConfig: {
12
- default: null
13
- }
14
- },
15
- props: {
16
- /**
17
- * 这个是组件级别的配置,weworkChatPanel是消息级别的配置,后面是消息级别配置覆盖组件级别的配置
18
- * {
19
- * 1: {
20
- * formatter () {
21
- * xxx
22
- * }
23
- * }
24
- * }
25
- */
26
- controlConfig: {
27
- type: Object
28
- },
29
- /**
30
- * 消息级别配置,消息级别配置会覆盖控件级别配置
31
- * 主要是项目里面有几种实用场景,第一种聊天记录,第二种风控,第三种消息预览
32
- */
33
- messageConfig: {
34
- type: Function
35
- }
36
- },
37
- render () {
38
- return this.$slots.default
39
- },
40
- methods: {
41
- getControlConfig (msgType) {
42
- if (!this.controlConfig) {
43
- return
44
- }
45
- return this.controlConfig[msgType]
46
- },
47
- getMessageConfig (msgData) {
48
- const controlConfig = this.getControlConfig(msgData.msgType)
49
- if (!this.messageConfig) {
50
- return controlConfig
51
- }
52
- const messageConfig = this.messageConfig({
53
- item: msgData
54
- })
55
- if (!messageConfig) {
56
- return controlConfig
57
- }
58
- return Object.assign({}, controlConfig, messageConfig)
59
- }
60
- }
61
- }
62
- </script>
@@ -1,73 +0,0 @@
1
- <template>
2
- <div class="sdk-wework-panel-chat-status">
3
- <!-- status: 0 success, 1 sending, 2 failed, 3 timeout -->
4
- <template v-if="data.status === 1">
5
- <ui-loading size="mini"></ui-loading>
6
- </template>
7
- <template v-else-if="data.status === 2">
8
- <bi-tooltip :text="data.resultMsg || '发送失败'">
9
- <span class="sdk-wework-panel-chat-status__error">
10
- <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M512 938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667z m0-486.997334L391.338667 330.965333 330.965333 391.338667 451.669333 512l-120.704 120.661333 60.373334 60.373334L512 572.330667l120.661333 120.704 60.373334-60.373334L572.330667 512l120.704-120.661333-60.373334-60.373334L512 451.669333z" fill="currentColor"></path></svg>
11
- </span>
12
- </bi-tooltip>
13
- </template>
14
- <template v-else-if="data.status === 3">
15
- <bi-tooltip :text="data.resultMsg || '发送超时'">
16
- <span class="sdk-wework-panel-chat-status__error">
17
- <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M512 938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667z m42.666667-426.666667V298.666667h-85.333334v298.666666h256v-85.333333h-170.666666z" fill="currentColor"></path></svg>
18
- </span>
19
- </bi-tooltip>
20
- </template>
21
- <template v-if="data.recalled">
22
- <bi-tooltip text="消息已撤回">
23
- <span class="sdk-wework-panel-chat-status__error sdk-wework-panel-chat-status__recalled">
24
- <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M512 0c282.752 0 512 229.248 512 512s-229.248 512-512 512S0 794.752 0 512 229.248 0 512 0z m-50.261333 255.317333c-7.765333-39.338667-39.893333-15.36-39.893334-15.36l-213.76 192c-47.616 34.944-2.730667 60.458667-2.730666 60.458667l211.541333 190.933333c42.410667 33.066667 45.866667-17.749333 45.866667-17.749333v-86.442667c215.125333-70.144 303.36 208.341333 303.36 208.341334 7.936 15.957333 13.824 0 13.824 0C862.933333 368.682667 461.952 348.586667 461.952 348.586667z" fill="currentColor"></path></svg>
25
- </span>
26
- </bi-tooltip>
27
- </template>
28
- </div>
29
- </template>
30
-
31
- <script>
32
- import { Tooltip as BiTooltip } from '@aochuang/common/common'
33
- import { Loading as UiLoading } from '@aochuang/common/components'
34
-
35
- export default {
36
- name: 'SdkWeworkPanelChatStatus',
37
- components: {
38
- BiTooltip,
39
- UiLoading
40
- },
41
- props: {
42
- data: {
43
- type: Object,
44
- required: true
45
- },
46
- updateChatBoxProp: {
47
- type: Function
48
- }
49
- }
50
- }
51
- </script>
52
-
53
- <style lang="less">
54
- .sdk-wework-panel-chat-status__error {
55
- display: flex;
56
- flex-direction: row;
57
- align-items: center;
58
- font-size: 12px;
59
- color: #c00;
60
- width: 16px;
61
- height: 16px;
62
- svg {
63
- width: 100%;
64
- height: 100%;
65
- }
66
- }
67
- .sdk-wework-panel-chat-status__recalled {
68
- opacity: .6;
69
- }
70
- .sdk-wework-panel-chat-status {
71
- margin: 0 6px;
72
- }
73
- </style>