@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.
Files changed (155) hide show
  1. package/components/index.js +6 -1
  2. package/components/session-select/session-select-item.vue +8 -9
  3. package/components/wechat-chat-control/.DS_Store +0 -0
  4. package/components/wechat-chat-control/transfer/.DS_Store +0 -0
  5. package/components/wechat-chat-control/url/.DS_Store +0 -0
  6. package/components/wechat-chat-control/url/url-miniprogram.vue +1 -5
  7. package/components/wechat-chat-control/voice/.DS_Store +0 -0
  8. package/components/wework-chat-control/channel-card/channel-card.vue +144 -0
  9. package/components/wework-chat-control/channel-live/channel-live.vue +7 -2
  10. package/components/wework-chat-control/company-card/company-card.vue +1 -1
  11. package/components/wework-chat-control/custom-expression/custom-expression.vue +2 -1
  12. package/components/wework-chat-control/file-url/file-url.vue +2 -5
  13. package/components/wework-chat-control/image/image.vue +137 -2
  14. package/components/wework-chat-control/index.js +9 -7
  15. package/components/wework-chat-control/link/.DS_Store +0 -0
  16. package/components/wework-chat-control/location/location.vue +3 -3
  17. package/components/wework-chat-control/metting/enterprise-wechat.png +0 -0
  18. package/components/wework-chat-control/metting/meeting-video.svg +4 -0
  19. package/components/wework-chat-control/metting/metting.vue +181 -0
  20. package/components/wework-chat-control/text/text.vue +23 -3
  21. package/components/wework-chat-control/url/url-channel-live.vue +53 -0
  22. package/components/wework-chat-control/url/url-miniprogram.vue +6 -7
  23. package/components/wework-chat-control/url/url.vue +26 -2
  24. package/components/wework-chat-control/util.js +17 -8
  25. package/components/wework-chat-control/video/.DS_Store +0 -0
  26. package/components/wework-chat-control/video/video.vue +10 -2
  27. package/components/wework-chat-control/voice/voice.vue +1 -1
  28. package/components/wework-chat-control/wework-chat-control-config-item.vue +24 -0
  29. package/components/wework-chat-control/wework-chat-control-config-msg.vue +25 -0
  30. package/{uni-components/chat-control/chat-control-config.vue → components/wework-chat-control/wework-chat-control-config.vue} +16 -13
  31. package/components/wework-chat-panel/chat-panel-chat-status/chat-panel-chat-status.vue +73 -0
  32. package/components/wework-chat-panel/chat-panel-item.vue +25 -41
  33. package/components/wework-chat-panel/chat-panel.vue +95 -12
  34. package/package.json +10 -3
  35. package/services/client-chat/client-chat-wechat/client-chat-session.js +54 -170
  36. package/services/client-chat/client-chat-wework/client-chat-concats.js +81 -17
  37. package/services/client-chat/client-chat-wework/client-chat-message.js +46 -6
  38. package/services/client-chat/client-chat-wework/client-chat-session.js +50 -2
  39. package/services/client-chat/client-chat-wework/client-chat-socket.js +9 -1
  40. package/services/client-chat/client-chat-wework/client-chat.js +283 -13
  41. package/services/client-chat/client-chat-wework/utils.js +5 -5
  42. package/components/wework-chat-panel/chat-panel-controls/company-card/company-card.vue +0 -35
  43. package/components/wework-chat-panel/chat-panel-controls/expression/expression.vue +0 -36
  44. package/components/wework-chat-panel/chat-panel-controls/file-url/file-url.vue +0 -35
  45. package/components/wework-chat-panel/chat-panel-controls/image/image.vue +0 -36
  46. package/components/wework-chat-panel/chat-panel-controls/index.js +0 -35
  47. package/components/wework-chat-panel/chat-panel-controls/jx-sys-text/jx-sys-text.vue +0 -28
  48. package/components/wework-chat-panel/chat-panel-controls/link/link.vue +0 -35
  49. package/components/wework-chat-panel/chat-panel-controls/location/location.vue +0 -35
  50. package/components/wework-chat-panel/chat-panel-controls/text/text.vue +0 -43
  51. package/components/wework-chat-panel/chat-panel-controls/unkonw/unkonw.vue +0 -39
  52. package/components/wework-chat-panel/chat-panel-controls/video/video.vue +0 -37
  53. package/components/wework-chat-panel/chat-panel-controls/voice/voice.vue +0 -35
  54. package/uni-common/account-portray/account-portray.vue +0 -51
  55. package/uni-common/account-select/account-select-item.vue +0 -172
  56. package/uni-common/account-select/account-select.vue +0 -252
  57. package/uni-common/all-friend-avatar/all-friend-avatar.vue +0 -49
  58. package/uni-common/friend-avatar/default.svg +0 -1
  59. package/uni-common/friend-avatar/friend-avatar.vue +0 -27
  60. package/uni-common/friend-avatar/index.js +0 -3
  61. package/uni-common/friend-loader/friend-loader.vue +0 -53
  62. package/uni-common/friend-portray/friend-portray.vue +0 -56
  63. package/uni-common/group-avatar/default.svg +0 -1
  64. package/uni-common/group-avatar/group-avatar.vue +0 -18
  65. package/uni-common/group-avatar/index.js +0 -3
  66. package/uni-common/room-avatar/default.svg +0 -6
  67. package/uni-common/room-avatar/index.js +0 -3
  68. package/uni-common/room-avatar/room-avatar.vue +0 -27
  69. package/uni-common/room-loader/room-loader.vue +0 -53
  70. package/uni-common/room-portray/room-portray.vue +0 -56
  71. package/uni-components/chat-control/calling/calling.vue +0 -91
  72. package/uni-components/chat-control/calling/phone-fill.svg +0 -1
  73. package/uni-components/chat-control/calling/vidicon-fill.svg +0 -1
  74. package/uni-components/chat-control/channel-video/channel-video.vue +0 -89
  75. package/uni-components/chat-control/channel-video-card/channel-video-card.vue +0 -105
  76. package/uni-components/chat-control/channel-video-live/channel-video-live.vue +0 -92
  77. package/uni-components/chat-control/chat-control-config-item/chat-control-config-item.vue +0 -20
  78. package/uni-components/chat-control/chat-control-config-item/index.js +0 -3
  79. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-app.vue +0 -25
  80. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-h5.vue +0 -21
  81. package/uni-components/chat-control/chat-control.vue +0 -218
  82. package/uni-components/chat-control/company-card/company-card.vue +0 -123
  83. package/uni-components/chat-control/const.js +0 -28
  84. package/uni-components/chat-control/expression/expression.vue +0 -41
  85. package/uni-components/chat-control/image/image.vue +0 -68
  86. package/uni-components/chat-control/index.js +0 -89
  87. package/uni-components/chat-control/location/location.vue +0 -110
  88. package/uni-components/chat-control/member-change/member-change.vue +0 -32
  89. package/uni-components/chat-control/quote-message/quote-message.vue +0 -216
  90. package/uni-components/chat-control/real-time-position/real-time-position.vue +0 -62
  91. package/uni-components/chat-control/redpacket/red-envelope.svg +0 -1
  92. package/uni-components/chat-control/redpacket/redpacket.vue +0 -75
  93. package/uni-components/chat-control/share-card/share-card.vue +0 -101
  94. package/uni-components/chat-control/system/system.vue +0 -69
  95. package/uni-components/chat-control/system-batch-message/system-batch-message.vue +0 -30
  96. package/uni-components/chat-control/system-text/system-text.vue +0 -32
  97. package/uni-components/chat-control/text/text.vue +0 -67
  98. package/uni-components/chat-control/text-with-at/text-with-at.vue +0 -51
  99. package/uni-components/chat-control/transfer/red-transfer.svg +0 -1
  100. package/uni-components/chat-control/transfer/transfer.vue +0 -80
  101. package/uni-components/chat-control/unkonw/unkonw.vue +0 -37
  102. package/uni-components/chat-control/url/icons/file-excel-line.svg +0 -1
  103. package/uni-components/chat-control/url/icons/file-info-line.svg +0 -1
  104. package/uni-components/chat-control/url/icons/file-music-line.svg +0 -1
  105. package/uni-components/chat-control/url/icons/file-pdf-line.svg +0 -1
  106. package/uni-components/chat-control/url/icons/file-ppt-line.svg +0 -1
  107. package/uni-components/chat-control/url/icons/file-settings-line.svg +0 -1
  108. package/uni-components/chat-control/url/icons/file-text-line.svg +0 -1
  109. package/uni-components/chat-control/url/icons/file-unknow-line.svg +0 -1
  110. package/uni-components/chat-control/url/icons/file-word-line.svg +0 -1
  111. package/uni-components/chat-control/url/icons/file-zip-line.svg +0 -1
  112. package/uni-components/chat-control/url/icons/index.js +0 -24
  113. package/uni-components/chat-control/url/miniprogram.svg +0 -1
  114. package/uni-components/chat-control/url/url-miniprogram.vue +0 -116
  115. package/uni-components/chat-control/url/url.vue +0 -306
  116. package/uni-components/chat-control/url-new/icons/file-excel-line.svg +0 -1
  117. package/uni-components/chat-control/url-new/icons/file-info-line.svg +0 -1
  118. package/uni-components/chat-control/url-new/icons/file-music-line.svg +0 -1
  119. package/uni-components/chat-control/url-new/icons/file-pdf-line.svg +0 -1
  120. package/uni-components/chat-control/url-new/icons/file-ppt-line.svg +0 -1
  121. package/uni-components/chat-control/url-new/icons/file-settings-line.svg +0 -1
  122. package/uni-components/chat-control/url-new/icons/file-text-line.svg +0 -1
  123. package/uni-components/chat-control/url-new/icons/file-unknow-line.svg +0 -1
  124. package/uni-components/chat-control/url-new/icons/file-word-line.svg +0 -1
  125. package/uni-components/chat-control/url-new/icons/file-zip-line.svg +0 -1
  126. package/uni-components/chat-control/url-new/icons/index.js +0 -24
  127. package/uni-components/chat-control/url-new/url-new.vue +0 -110
  128. package/uni-components/chat-control/utils.js +0 -12
  129. package/uni-components/chat-control/video/video.vue +0 -156
  130. package/uni-components/chat-control/voice/voice.vue +0 -166
  131. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-collect.vue +0 -84
  132. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-system.vue +0 -28
  133. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet.vue +0 -85
  134. package/uni-components/chat-editor/chat-editor-func/chat-editor-func.vue +0 -157
  135. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at-panel.vue +0 -158
  136. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at.vue +0 -61
  137. package/uni-components/chat-editor/chat-editor-func-button/chat-editor-func-button.vue +0 -58
  138. package/uni-components/chat-editor/chat-editor-func-file/chat-editor-func-file.vue +0 -54
  139. package/uni-components/chat-editor/chat-editor-func-image/chat-editor-func-image.vue +0 -42
  140. package/uni-components/chat-editor/chat-editor-func-video/chat-editor-func-video.vue +0 -42
  141. package/uni-components/chat-editor/chat-editor-func-voice/chat-editor-func-voice.vue +0 -25
  142. package/uni-components/chat-editor/chat-editor-message-send/chat-editor-message-send.vue +0 -158
  143. package/uni-components/chat-editor/chat-editor-quote/chat-editor-quote.vue +0 -75
  144. package/uni-components/chat-editor/chat-editor.vue +0 -257
  145. package/uni-components/chat-editor/index.js +0 -10
  146. package/uni-components/chat-editor/util.js +0 -65
  147. package/uni-components/chat-panel/chat-panel-chats-box.vue +0 -238
  148. package/uni-components/chat-panel/chat-panel-chats-forward/chat-panel-chats-forward.vue +0 -273
  149. package/uni-components/chat-panel/chat-panel-chats-item.vue +0 -578
  150. package/uni-components/chat-panel/chat-panel-chats-status/chat-panel-chats-status.vue +0 -71
  151. package/uni-components/chat-panel/chat-panel-chats.vue +0 -368
  152. package/uni-components/chat-panel/chat-panel.vue +0 -227
  153. package/uni-components/contacts-group-select/contacts-group-select-item.vue +0 -85
  154. package/uni-components/contacts-group-select/contacts-group-select-panel.vue +0 -119
  155. package/uni-components/contacts-group-select/contacts-group-select.vue +0 -150
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <wechat-chat-control-config-msg
2
+ <wework-chat-control-config-msg
3
3
  :msgData="item"
4
4
  >
5
5
  <template slot-scope="{ configData }">
@@ -7,7 +7,7 @@
7
7
  <template v-if="item.msgType !== '_EMPTY_'">
8
8
  <slot name="chat-prefix" :item="item"></slot>
9
9
  </template>
10
- <template v-if="[0, 1, 2].includes(item.msgType)">
10
+ <template v-if="item.msgType === MESSAGE_TYPE.TEXT || item.msgType === MESSAGE_TYPE.TEXT_W">
11
11
  <sdk-chat-panel-box
12
12
  :dir="dir"
13
13
  :data="item"
@@ -26,7 +26,7 @@
26
26
  </template>
27
27
  </sdk-chat-panel-box>
28
28
  </template>
29
- <template v-else-if="[14, 101].includes(item.msgType)">
29
+ <template v-else-if="item.msgType === MESSAGE_TYPE.IMAGE">
30
30
  <sdk-chat-panel-box
31
31
  :dir="dir"
32
32
  :data="item"
@@ -45,7 +45,7 @@
45
45
  </template>
46
46
  </sdk-chat-panel-box>
47
47
  </template>
48
- <template v-else-if="[22, 23, 103].includes(item.msgType)">
48
+ <template v-else-if="item.msgType === MESSAGE_TYPE.VIDEO">
49
49
  <sdk-chat-panel-box
50
50
  :dir="dir"
51
51
  :data="item"
@@ -289,7 +289,7 @@
289
289
  </template>
290
290
  </sdk-chat-panel-box>
291
291
  </template>
292
- <template v-else-if="item.msgType == MESSAGE_TYPE.URL">
292
+ <template v-else-if="item.msgType == MESSAGE_TYPE.URL || item.msgType == MESSAGE_TYPE.URLNew">
293
293
  <sdk-chat-panel-box
294
294
  :dir="dir"
295
295
  :data="item"
@@ -312,29 +312,6 @@
312
312
  </template>
313
313
  </sdk-chat-panel-box>
314
314
  </template>
315
- <template v-else-if="[13, 15, 20, 102].includes(item.msgType)">
316
- <sdk-chat-panel-box
317
- :dir="dir"
318
- :data="item"
319
- :fetchUserMethod="fetchUserMethod"
320
- bg-color="#fff"
321
- br-color="#ddd"
322
- @user-avatar-click="handleUserAvatarClick"
323
- @user-avatar-contextmenu="handleUserAvatarContextmenu"
324
- >
325
- <template slot-scope="{ updateProp }">
326
- <sdk-chat-control-file-url
327
- v-bind="configData"
328
- :id="item.id"
329
- :content="msgContent"
330
- :update-chat-box-prop="updateProp"
331
- ></sdk-chat-control-file-url>
332
- </template>
333
- <template slot="append" slot-scope="{ updateProp }">
334
- <slot name="chat-append" :item="item" :update-chat-box-prop="updateProp"></slot>
335
- </template>
336
- </sdk-chat-panel-box>
337
- </template>
338
315
  <template v-else-if="item.msgType == MESSAGE_TYPE.CUSTOM_EXPRESSION">
339
316
  <sdk-chat-panel-box
340
317
  :dir="dir"
@@ -353,19 +330,24 @@
353
330
  </template>
354
331
  </sdk-chat-panel-box>
355
332
  </template>
356
- <template v-else-if="item.msgType == MESSAGE_TYPE.CUSTOM_EXPRESSION_W">
333
+ <template v-else-if="item.msgType === MESSAGE_TYPE.MEETING">
357
334
  <sdk-chat-panel-box
358
335
  :dir="dir"
359
336
  :data="item"
360
337
  :fetchUserMethod="fetchUserMethod"
338
+ :blank="true"
361
339
  @user-avatar-click="handleUserAvatarClick"
362
340
  @user-avatar-contextmenu="handleUserAvatarContextmenu"
363
341
  >
364
- <sdk-chat-control-custom-expression
365
- v-bind="configData"
366
- :id="item.id"
367
- :content="msgContent"
368
- ></sdk-chat-control-custom-expression>
342
+ <template slot-scope="{ updateProp }">
343
+ <sdk-chat-control-metting
344
+ v-bind="configData"
345
+ :id="item.id"
346
+ :content="msgContent"
347
+ :initiator="item.qwAccountName || item.contactName || item.ownerAccountUserName"
348
+ :update-chat-box-prop="updateProp"
349
+ ></sdk-chat-control-metting>
350
+ </template>
369
351
  <template slot="append" slot-scope="{ updateProp }">
370
352
  <slot name="chat-append" :item="item" :update-chat-box-prop="updateProp"></slot>
371
353
  </template>
@@ -510,7 +492,7 @@
510
492
  :content="msgContent"
511
493
  ></sdk-chat-control-empty>
512
494
  </template>
513
- <!-- <template v-else>
495
+ <template v-else>
514
496
  <sdk-chat-panel-box
515
497
  :dir="dir"
516
498
  :data="item"
@@ -523,10 +505,10 @@
523
505
  :content="msgContent"
524
506
  ></sdk-chat-control-unknow>
525
507
  </sdk-chat-panel-box>
526
- </template> -->
508
+ </template>
527
509
  </div>
528
510
  </template>
529
- </wechat-chat-control-config-msg>
511
+ </wework-chat-control-config-msg>
530
512
  </template>
531
513
  <script>
532
514
  import SdkChatPanelBox from '../chat-panel/chat-panel-box'
@@ -545,6 +527,7 @@ import {
545
527
  channelVideo as SdkChatControlChannelVideo,
546
528
  // channelVideoCard as SdkChatControlChannelVideoCard,
547
529
  channelLive as SdkChatControlChannelLive,
530
+ metting as SdkChatControlMetting,
548
531
  url as SdkChatControlUrl,
549
532
  fileUrl as SdkChatControlFileUrl,
550
533
  jxSysText as SdkChatControlJxSysText,
@@ -564,10 +547,10 @@ import {
564
547
  unknow as SdkChatControlUnknow
565
548
  } from '../wework-chat-control'
566
549
  import { MESSAGE_TYPE } from '../wework-chat-control/util'
567
- import WechatChatControlConfigMsg from '../wechat-chat-control/wechat-chat-control-config-msg.vue'
550
+ import WeworkChatControlConfigMsg from '../wework-chat-control/wework-chat-control-config-msg.vue'
568
551
 
569
552
  export default {
570
- name: 'SdkWechatPanelItem',
553
+ name: 'SdkWeworkPanelItem',
571
554
  components: {
572
555
  SdkChatPanelBox,
573
556
  SdkChatControlText,
@@ -583,6 +566,7 @@ export default {
583
566
  SdkChatControlChannelVideo,
584
567
  // SdkChatControlChannelVideoCard,
585
568
  SdkChatControlChannelLive,
569
+ SdkChatControlMetting,
586
570
  SdkChatControlFileUrl,
587
571
  // SdkChatControlTextWithAt,
588
572
  SdkChatControlUrl,
@@ -601,7 +585,7 @@ export default {
601
585
  // SdkChatControlRevokeMeMessage,
602
586
  // SdkChatControlRevokeOtherMessage,
603
587
  // SdkChatControlRevokeYouMessage,
604
- WechatChatControlConfigMsg
588
+ WeworkChatControlConfigMsg
605
589
  },
606
590
  props: {
607
591
  dir: {
@@ -647,4 +631,4 @@ export default {
647
631
  }
648
632
  }
649
633
  }
650
- </script>
634
+ </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <sdk-chat-panel
3
3
  ref="panel"
4
- v-bind="$props"
4
+ v-bind="props"
5
5
  :is-sender-method="handleIsSenderMethod"
6
6
  @initloaded="handleChatsInitLoaded"
7
7
  @chat-contextmenu="handleChatContext"
@@ -17,12 +17,12 @@
17
17
  :fetch-user-method="fetchUserMethod"
18
18
  :config="config"
19
19
  >
20
- <!-- <template slot="chat-append" slot-scope="{ item, updateProp }">
20
+ <template slot="chat-append" slot-scope="{ item, updateProp }">
21
21
  <chat-panel-chat-status
22
22
  :data="item"
23
23
  :update-chat-box-prop="updateProp"
24
24
  ></chat-panel-chat-status>
25
- </template> -->
25
+ </template>
26
26
  <template slot="chat-prefix" slot-scope="{ item }">
27
27
  <template v-if="selectable && handleFilterSelectMessageMethod(item)">
28
28
  <div class="sdk-wechat-chat-panel__checkbox">
@@ -37,18 +37,23 @@
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>
43
46
  <script>
44
47
  import SdkChatPanel from '../chat-panel'
45
48
  import ChatPanelItem from './chat-panel-item.vue'
49
+ import ChatPanelChatStatus from './chat-panel-chat-status/chat-panel-chat-status.vue'
46
50
 
47
51
  export default {
48
52
  name: 'SdkWeworkChatPanel',
49
53
  components: {
50
54
  SdkChatPanel,
51
- ChatPanelItem
55
+ ChatPanelItem,
56
+ ChatPanelChatStatus
52
57
  },
53
58
  props: {
54
59
  mode: {
@@ -59,7 +64,8 @@ export default {
59
64
  }
60
65
  },
61
66
  keyField: {
62
- type: String
67
+ type: String,
68
+ default: 'id'
63
69
  },
64
70
  startDate: {
65
71
  type: Number
@@ -88,9 +94,6 @@ export default {
88
94
  type: Boolean,
89
95
  default: true
90
96
  },
91
- renderControl: {
92
- type: Function
93
- },
94
97
  fetchUserMethod: {
95
98
  type: Function
96
99
  },
@@ -126,12 +129,33 @@ export default {
126
129
  },
127
130
  contextChatId: {
128
131
  type: String
132
+ },
133
+ onBeforeSelectionChange: {
134
+ type: Function
129
135
  }
130
136
  },
131
- methods: {
132
- handleRenderControl ({ item }) {
133
- return ChatControls[item.msgType] || ChatControls.unkonw
137
+ data () {
138
+ return {
139
+ checkMsgMap: {}
140
+ }
141
+ },
142
+ computed: {
143
+ props () {
144
+ const { config, ...nextProps } = this.$props
145
+ return nextProps
134
146
  },
147
+ checkTotal () {
148
+ return Object.keys(this.checkMsgMap).length
149
+ }
150
+ },
151
+ watch: {
152
+ selectable () {
153
+ if (!this.selectable) {
154
+ this.checkMsgMap = {}
155
+ }
156
+ }
157
+ },
158
+ methods: {
135
159
  handleIsSenderMethod ({ item }) {
136
160
  return !!item.send
137
161
  },
@@ -148,8 +172,67 @@ export default {
148
172
  this.currentContextChat = null
149
173
  return this.$refs.panel && this.$refs.panel.reload()
150
174
  },
175
+ handleFilterSelectMessageMethod (msg) {
176
+ if (!this.filterSelectMessageMethod) {
177
+ return true
178
+ }
179
+ return this.filterSelectMessageMethod({
180
+ item: msg
181
+ })
182
+ },
183
+ handleMsgCheckboxChange (msg, value) {
184
+ if (value) {
185
+ this.selectChat(msg)
186
+ } else {
187
+ this.unselectChat(msg)
188
+ }
189
+ },
190
+ selectChat (chat) {
191
+ if (!chat) {
192
+ return
193
+ }
194
+ if (!this.selectable) {
195
+ console.warn('未开启选择')
196
+ return
197
+ }
198
+ if (this.onBeforeSelectionChange && this.onBeforeSelectionChange({
199
+ chat,
200
+ value: true
201
+ }) === false) {
202
+ return
203
+ }
204
+ this.$set(this.checkMsgMap, chat[this.keyField], chat)
205
+ },
206
+ unselectChat (chat) {
207
+ if (!chat) {
208
+ return
209
+ }
210
+ if (!this.selectable) {
211
+ console.warn('未开启选择')
212
+ return
213
+ }
214
+ if (this.onBeforeSelectionChange && this.onBeforeSelectionChange({
215
+ chat,
216
+ value: false
217
+ }) === false) {
218
+ return
219
+ }
220
+ this.$delete(this.checkMsgMap, chat[this.keyField])
221
+ },
222
+ unselectAllChat () {
223
+ return Object.keys(this.checkMsgMap).map(key => {
224
+ return this.unselectChat(this.checkMsgMap[key])
225
+ })
226
+ },
227
+ getSelectChats () {
228
+ return Object.keys(this.checkMsgMap).map(key => {
229
+ return this.checkMsgMap[key]
230
+ })
231
+ },
151
232
  handleChatContext (item, evt) {
152
- this.$emit('chat-contextmenu', item, evt)
233
+ this.$emit('chat-contextmenu', {
234
+ item
235
+ }, evt)
153
236
  },
154
237
  handleChatViewContext ({ item }) {
155
238
  this.$emit('chat-view-context', {
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "@aochuang/client-sdk",
3
- "version": "1.0.350",
3
+ "version": "1.0.352",
4
4
  "description": "",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
5
+ "files": [
6
+ "common",
7
+ "components",
8
+ "services",
9
+ "utils",
10
+ "dist"
11
+ ],
12
+ "exports": {
13
+ ".": "./components/index.js"
7
14
  },
8
15
  "repository": {
9
16
  "type": "git",
@@ -412,53 +412,56 @@ export default class ClientChatSession {
412
412
  }) === false) {
413
413
  return
414
414
  }
415
- if (wechatAccountId && wechatAccountId !== ALL_WECHAT_ACCOUNT_ID && data.wechatAccountId !== wechatAccountId) {
416
- throw new Error('会话的wechatAccount和加载分组的wechatAccountId不一致')
417
- }
418
- let nextData = null
419
- let isRefreshAll = false
420
- let groupIds = []
415
+ let nextData = data
421
416
  // 如果会话已经存在,那么取已经存在的,以后有需要可以用data更新已经存在的会话,保持引用关系
422
- // 一般比较容易出现,例如all的时候,分配的时候有可能会出现,例如以前的会话没有正确删除,后面有分配过来了
423
417
  if (this.sessionMap[data.conversationId]) {
424
- // 如果会话比较老,就不更新属性
425
- if (this.sessionMap[data.conversationId].lastMsgTime && data.lastMsgTime && this.sessionMap[data.conversationId].lastMsgTime <= data.lastMsgTime) {
426
- // 先删后插
427
- this._removeSessionBySessionGroup(this.sessionMap[data.conversationId].conversationId)
428
- // 更新属性
429
- Object.keys(data).forEach(k => {
430
- Vue.set(this.sessionMap[data.conversationId], k, data[k])
431
- })
432
- }
433
418
  nextData = this.sessionMap[data.conversationId]
434
- isRefreshAll = true
435
419
  } else {
436
- nextData = data
420
+ this.sessionMap[data.conversationId] = nextData
437
421
  }
438
- if (!nextData) {
439
- return
422
+ const topField = nextData.stickyOnTop ? 0 : 1 // 置顶
423
+ if (wechatAccountId && wechatAccountId !== ALL_WECHAT_ACCOUNT_ID && nextData.wechatAccountId !== wechatAccountId) {
424
+ throw new Error('会话的wechatAccount和加载分组的wechatAccountId不一致')
440
425
  }
426
+ const groupIds = []
427
+ // 传了wechatAccountId,是分页加载的,这里要保持分页加载数据的链路不受动态加载的影响
441
428
  if (wechatAccountId) {
442
- // 传了wechatAccountId,是分页加载的,这里要保持分页加载数据的链路不受动态加载的影响
443
- // 加载会话是新的在上面,老的在下面,所以一定要记录好上次分页加载的时间点
444
- if (isRefreshAll) {
445
- groupIds.push(nextData.wechatAccountId)
446
- groupIds.push(ALL_WECHAT_ACCOUNT_ID)
447
- } else {
448
- groupIds.push(wechatAccountId)
449
- }
450
- // 先把老的删除掉
451
- this._removeLastUpdateSessionMap(nextData.conversationId, wechatAccountId)
452
- // 再插入新的
453
- this._updateLastUpdateSessionMap([wechatAccountId], nextData)
429
+ groupIds.push(wechatAccountId)
430
+ // 传了wechatAccountId才记录lastMsgTime和lastUpdateTime
431
+ const lastFields = ['lastMsgTime', 'lastUpdateTime']
432
+ groupIds.forEach(groupId => {
433
+ lastFields.forEach(lastField => {
434
+ const lastUpdateSortFields = this.getSortField(nextData[lastField])
435
+ if (!lastUpdateSortFields) {
436
+ return
437
+ }
438
+ if (!this._lastUpdateSessionMap) {
439
+ this._lastUpdateSessionMap = {}
440
+ }
441
+ if (!this._lastUpdateSessionMap[groupId]) {
442
+ this._lastUpdateSessionMap[groupId] = {}
443
+ }
444
+ if (!this._lastUpdateSessionMap[groupId][lastField]) {
445
+ this._lastUpdateSessionMap[groupId][lastField] = {}
446
+ }
447
+ if (!this._lastUpdateSessionMap[groupId][lastField][topField]) {
448
+ this._lastUpdateSessionMap[groupId][lastField][topField] = {}
449
+ }
450
+ if (!this._lastUpdateSessionMap[groupId][lastField][topField][lastUpdateSortFields.day]) {
451
+ this._lastUpdateSessionMap[groupId][lastField][topField][lastUpdateSortFields.day] = {}
452
+ }
453
+ if (!this._lastUpdateSessionMap[groupId][lastField][topField][lastUpdateSortFields.day][lastUpdateSortFields.milliseconds]) {
454
+ this._lastUpdateSessionMap[groupId][lastField][topField][lastUpdateSortFields.day][lastUpdateSortFields.milliseconds] = []
455
+ }
456
+ this._lastUpdateSessionMap[groupId][lastField][topField][lastUpdateSortFields.day][lastUpdateSortFields.milliseconds].push(nextData)
457
+ })
458
+ })
454
459
  } else {
455
460
  groupIds.push(nextData.wechatAccountId)
456
461
  groupIds.push(ALL_WECHAT_ACCOUNT_ID)
457
462
  }
458
- this.sessionMap[data.conversationId] = nextData
459
463
  // 分组的
460
464
  const sortFields = this.getSortField(nextData.lastMsgTime)
461
- const topField = nextData.stickyOnTop ? 0 : 1 // 置顶
462
465
  groupIds.forEach(groupId => {
463
466
  // 如果已经在分组里面了,就不新增了,
464
467
  if (this._getSessionBySessionGroup(nextData.conversationId, groupId)) {
@@ -489,10 +492,6 @@ export default class ClientChatSession {
489
492
  Vue.set(this.data.sessionMuteMap, nextData.wechatAccountId, {})
490
493
  }
491
494
  Vue.set(this.data.sessionMuteMap[nextData.wechatAccountId], nextData.conversationId, nextData)
492
- } else {
493
- if (this.data.sessionMuteMap[nextData.wechatAccountId]) {
494
- Vue.delete(this.data.sessionMuteMap[nextData.wechatAccountId], nextData.conversationId)
495
- }
496
495
  }
497
496
  // 检测一下是不是存在一样的虚拟会话,存在的话就删除
498
497
  const virtualSessionIndex = this.data.virtualSessionData.findIndex(v => v.conversationId === nextData.conversationId)
@@ -500,53 +499,14 @@ export default class ClientChatSession {
500
499
  this.data.virtualSessionData.splice(virtualSessionIndex, 1)
501
500
  }
502
501
  callback && callback({
503
- session: nextData
502
+ session: data
504
503
  })
505
504
  this.onAddSession && this.onAddSession({
506
- session: nextData
505
+ session: data
507
506
  })
508
507
  }
509
-
510
- _updateLastUpdateSessionMap (groupIds, nextData) {
511
- if (!groupIds || !groupIds.length || !nextData) {
512
- return
513
- }
514
- // 传了wechatAccountId才记录lastMsgTime
515
- const lastFields = ['lastMsgTime']
516
- const topField = nextData.stickyOnTop ? 0 : 1 // 置顶
517
- groupIds.forEach(groupId => {
518
- lastFields.forEach(lastField => {
519
- const lastUpdateSortFields = this.getSortField(nextData[lastField])
520
- if (!lastUpdateSortFields) {
521
- return
522
- }
523
- if (!this._lastUpdateSessionMap) {
524
- this._lastUpdateSessionMap = {}
525
- }
526
- if (!this._lastUpdateSessionMap[groupId]) {
527
- this._lastUpdateSessionMap[groupId] = {}
528
- }
529
- if (!this._lastUpdateSessionMap[groupId][lastField]) {
530
- this._lastUpdateSessionMap[groupId][lastField] = {}
531
- }
532
- if (!this._lastUpdateSessionMap[groupId][lastField][topField]) {
533
- this._lastUpdateSessionMap[groupId][lastField][topField] = {}
534
- }
535
- if (!this._lastUpdateSessionMap[groupId][lastField][topField][lastUpdateSortFields.day]) {
536
- this._lastUpdateSessionMap[groupId][lastField][topField][lastUpdateSortFields.day] = {}
537
- }
538
- if (!this._lastUpdateSessionMap[groupId][lastField][topField][lastUpdateSortFields.day][lastUpdateSortFields.milliseconds]) {
539
- this._lastUpdateSessionMap[groupId][lastField][topField][lastUpdateSortFields.day][lastUpdateSortFields.milliseconds] = []
540
- }
541
- this._lastUpdateSessionMap[groupId][lastField][topField][lastUpdateSortFields.day][lastUpdateSortFields.milliseconds].push({
542
- conversationId: nextData.conversationId,
543
- lastMsgTime: nextData.lastMsgTime
544
- })
545
- })
546
- })
547
- }
548
-
549
- _removeSessionBySessionGroup (conversationId, wechatAccountId) {
508
+
509
+ removeSession (conversationId) {
550
510
  if (!this.sessionMap[conversationId]) {
551
511
  return
552
512
  }
@@ -555,7 +515,7 @@ export default class ClientChatSession {
555
515
  return
556
516
  }
557
517
  const topField = session.stickyOnTop ? 0 : 1 // 置顶
558
- const groupIds = wechatAccountId ? [wechatAccountId] : [session.wechatAccountId, ALL_WECHAT_ACCOUNT_ID]
518
+ const groupIds = [session.wechatAccountId, ALL_WECHAT_ACCOUNT_ID]
559
519
  const sortFields = this.getSortField(session.lastMsgTime)
560
520
  groupIds.forEach(groupId => {
561
521
  if (!this.data.sessionGroupData[groupId] || !this.data.sessionGroupData[groupId][topField]) {
@@ -563,7 +523,7 @@ export default class ClientChatSession {
563
523
  }
564
524
  const groupSession = this.data.sessionGroupData[groupId][topField]
565
525
  if (groupSession[sortFields.day] && groupSession[sortFields.day][sortFields.milliseconds]) {
566
- const groupIndex = groupSession[sortFields.day][sortFields.milliseconds].indexOf(session)
526
+ const groupIndex = groupSession[sortFields.day][sortFields.milliseconds].indexOf(this.sessionMap[conversationId])
567
527
  if (groupIndex >= 0) {
568
528
  groupSession[sortFields.day][sortFields.milliseconds].splice(groupIndex, 1)
569
529
  }
@@ -581,19 +541,10 @@ export default class ClientChatSession {
581
541
  }
582
542
  }
583
543
  })
584
- }
585
-
586
- _removeLastUpdateSessionMap (conversationId, wechatAccountId) {
587
- if (!this.sessionMap[conversationId]) {
588
- return
589
- }
590
- const session = this.sessionMap[conversationId]
591
- if (!session) {
592
- return
544
+ if (this.data.sessionMuteMap[session.wechatAccountId]) {
545
+ delete this.data.sessionMuteMap[session.wechatAccountId][conversationId]
593
546
  }
594
- let isDeleted = false
595
- const lastFields = ['lastMsgTime']
596
- const groupIds = wechatAccountId ? [wechatAccountId] : [session.wechatAccountId, ALL_WECHAT_ACCOUNT_ID]
547
+ const lastFields = ['lastMsgTime', 'lastUpdateTime']
597
548
  groupIds.forEach(groupId => {
598
549
  if (!this._lastUpdateSessionMap || !this._lastUpdateSessionMap[groupId]) {
599
550
  return
@@ -602,93 +553,26 @@ export default class ClientChatSession {
602
553
  if (!this._lastUpdateSessionMap[groupId][lastField]) {
603
554
  return
604
555
  }
605
- const loastUpdateSortFields = this.getSortField(session[lastField])
606
556
  Object.keys(this._lastUpdateSessionMap[groupId][lastField]).forEach(topField => {
607
557
  if (!this._lastUpdateSessionMap[groupId][lastField][topField]) {
608
558
  return
609
559
  }
560
+ const loastUpdateSortFields = this.getSortField(session.lastUpdateTime)
610
561
  if (this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day] && this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day][loastUpdateSortFields.milliseconds]) {
611
- let index = -1
612
- this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day][loastUpdateSortFields.milliseconds].some((v, i) => {
613
- if (v.conversationId === session.conversationId) {
614
- index = i
615
- return true
616
- }
617
- })
562
+ const index = this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day][loastUpdateSortFields.milliseconds].indexOf(session)
618
563
  if (index >= 0) {
619
564
  this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day][loastUpdateSortFields.milliseconds].splice(index, 1)
620
- if (!this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day][loastUpdateSortFields.milliseconds].length) {
621
- Vue.delete(this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day], loastUpdateSortFields.milliseconds)
622
- }
623
- if (isEmptyObject(this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day])) {
624
- Vue.delete(this._lastUpdateSessionMap[groupId][lastField][topField], loastUpdateSortFields.day)
625
- }
626
- isDeleted = true
565
+ }
566
+ if (!this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day][loastUpdateSortFields.milliseconds].length) {
567
+ Vue.delete(this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day], loastUpdateSortFields.milliseconds)
568
+ }
569
+ if (isEmptyObject(this._lastUpdateSessionMap[groupId][lastField][topField][loastUpdateSortFields.day])) {
570
+ Vue.delete(this._lastUpdateSessionMap[groupId][lastField][topField], loastUpdateSortFields.day)
627
571
  }
628
572
  }
629
573
  })
630
574
  })
631
575
  })
632
- if (!isDeleted) {
633
- groupIds.some(groupId => {
634
- if (!this._lastUpdateSessionMap || !this._lastUpdateSessionMap[groupId]) {
635
- return
636
- }
637
- return lastFields.some(lastField => {
638
- if (!this._lastUpdateSessionMap[groupId][lastField]) {
639
- return
640
- }
641
- return Object.keys(this._lastUpdateSessionMap[groupId][lastField]).some(topField => {
642
- if (!this._lastUpdateSessionMap[groupId][lastField][topField]) {
643
- return
644
- }
645
- return Object.keys(this._lastUpdateSessionMap[groupId][lastField][topField]).some(day => {
646
- if (!this._lastUpdateSessionMap[groupId][lastField][topField][day]) {
647
- return
648
- }
649
- return Object.keys(this._lastUpdateSessionMap[groupId][lastField][topField][day]).some(milliseconds => {
650
- if (!this._lastUpdateSessionMap[groupId][lastField][topField][day][milliseconds]) {
651
- return
652
- }
653
- let index = -1
654
- this._lastUpdateSessionMap[groupId][lastField][topField][day][milliseconds].some((v, i) => {
655
- if (v.conversationId === session.conversationId) {
656
- index = i
657
- return true
658
- }
659
- })
660
- if (index >= 0) {
661
- this._lastUpdateSessionMap[groupId][lastField][topField][day][milliseconds].splice(index, 1)
662
- if (!this._lastUpdateSessionMap[groupId][lastField][topField][day][milliseconds].length) {
663
- Vue.delete(this._lastUpdateSessionMap[groupId][lastField][topField][day], milliseconds)
664
- }
665
- if (isEmptyObject(this._lastUpdateSessionMap[groupId][lastField][topField][day])) {
666
- Vue.delete(this._lastUpdateSessionMap[groupId][lastField][topField], day)
667
- }
668
- isDeleted = true
669
- return true
670
- }
671
- })
672
- })
673
- })
674
- })
675
- })
676
- }
677
- }
678
-
679
- removeSession (conversationId) {
680
- if (!this.sessionMap[conversationId]) {
681
- return
682
- }
683
- const session = this.sessionMap[conversationId]
684
- if (!session) {
685
- return
686
- }
687
- this._removeSessionBySessionGroup(conversationId)
688
- this._removeLastUpdateSessionMap(conversationId)
689
- if (this.data.sessionMuteMap[session.wechatAccountId]) {
690
- delete this.data.sessionMuteMap[session.wechatAccountId][conversationId]
691
- }
692
576
  delete this.sessionMap[conversationId]
693
577
  this.onRemoveSession && this.onRemoveSession({
694
578
  session