@aochuang/client-sdk 1.0.344 → 1.0.346

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 (141) 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 +3 -10
  28. package/services/client-chat/client-chat-wechat/client-chat-session.js +19 -6
  29. package/services/client-chat/client-chat-wechat/client-chat.js +87 -25
  30. package/services/client-chat/client-chat-wework/client-chat-concats.js +17 -81
  31. package/services/client-chat/client-chat-wework/client-chat-message.js +5 -5
  32. package/services/client-chat/client-chat-wework/client-chat-session.js +2 -50
  33. package/services/client-chat/client-chat-wework/client-chat-socket.js +1 -9
  34. package/services/client-chat/client-chat-wework/client-chat.js +11 -278
  35. package/services/client-chat/client-chat-wework/utils.js +5 -5
  36. package/uni-common/account-portray/account-portray.vue +51 -0
  37. package/uni-common/account-select/account-select-item.vue +172 -0
  38. package/uni-common/account-select/account-select.vue +252 -0
  39. package/uni-common/all-friend-avatar/all-friend-avatar.vue +49 -0
  40. package/uni-common/friend-avatar/default.svg +1 -0
  41. package/uni-common/friend-avatar/friend-avatar.vue +27 -0
  42. package/uni-common/friend-avatar/index.js +3 -0
  43. package/uni-common/friend-loader/friend-loader.vue +53 -0
  44. package/uni-common/friend-portray/friend-portray.vue +56 -0
  45. package/uni-common/group-avatar/default.svg +1 -0
  46. package/uni-common/group-avatar/group-avatar.vue +18 -0
  47. package/uni-common/group-avatar/index.js +3 -0
  48. package/uni-common/room-avatar/default.svg +6 -0
  49. package/uni-common/room-avatar/index.js +3 -0
  50. package/uni-common/room-avatar/room-avatar.vue +27 -0
  51. package/uni-common/room-loader/room-loader.vue +53 -0
  52. package/uni-common/room-portray/room-portray.vue +56 -0
  53. package/uni-components/chat-control/calling/calling.vue +91 -0
  54. package/uni-components/chat-control/calling/phone-fill.svg +1 -0
  55. package/uni-components/chat-control/calling/vidicon-fill.svg +1 -0
  56. package/uni-components/chat-control/channel-video/channel-video.vue +89 -0
  57. package/uni-components/chat-control/channel-video-card/channel-video-card.vue +105 -0
  58. package/uni-components/chat-control/channel-video-live/channel-video-live.vue +92 -0
  59. package/uni-components/chat-control/chat-control-config-item/chat-control-config-item.vue +20 -0
  60. package/uni-components/chat-control/chat-control-config-item/index.js +3 -0
  61. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-app.vue +25 -0
  62. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-h5.vue +21 -0
  63. package/{components/wework-chat-control/wework-chat-control-config.vue → uni-components/chat-control/chat-control-config.vue} +13 -16
  64. package/uni-components/chat-control/chat-control.vue +218 -0
  65. package/uni-components/chat-control/company-card/company-card.vue +123 -0
  66. package/uni-components/chat-control/const.js +28 -0
  67. package/uni-components/chat-control/expression/expression.vue +41 -0
  68. package/uni-components/chat-control/image/image.vue +68 -0
  69. package/uni-components/chat-control/index.js +89 -0
  70. package/uni-components/chat-control/location/location.vue +110 -0
  71. package/uni-components/chat-control/member-change/member-change.vue +32 -0
  72. package/uni-components/chat-control/quote-message/quote-message.vue +216 -0
  73. package/uni-components/chat-control/real-time-position/real-time-position.vue +62 -0
  74. package/uni-components/chat-control/redpacket/red-envelope.svg +1 -0
  75. package/uni-components/chat-control/redpacket/redpacket.vue +75 -0
  76. package/uni-components/chat-control/share-card/share-card.vue +101 -0
  77. package/uni-components/chat-control/system/system.vue +69 -0
  78. package/uni-components/chat-control/system-batch-message/system-batch-message.vue +30 -0
  79. package/uni-components/chat-control/system-text/system-text.vue +32 -0
  80. package/uni-components/chat-control/text/text.vue +67 -0
  81. package/uni-components/chat-control/text-with-at/text-with-at.vue +51 -0
  82. package/uni-components/chat-control/transfer/red-transfer.svg +1 -0
  83. package/uni-components/chat-control/transfer/transfer.vue +80 -0
  84. package/uni-components/chat-control/unkonw/unkonw.vue +37 -0
  85. package/uni-components/chat-control/url/icons/file-excel-line.svg +1 -0
  86. package/uni-components/chat-control/url/icons/file-info-line.svg +1 -0
  87. package/uni-components/chat-control/url/icons/file-music-line.svg +1 -0
  88. package/uni-components/chat-control/url/icons/file-pdf-line.svg +1 -0
  89. package/uni-components/chat-control/url/icons/file-ppt-line.svg +1 -0
  90. package/uni-components/chat-control/url/icons/file-settings-line.svg +1 -0
  91. package/uni-components/chat-control/url/icons/file-text-line.svg +1 -0
  92. package/uni-components/chat-control/url/icons/file-unknow-line.svg +1 -0
  93. package/uni-components/chat-control/url/icons/file-word-line.svg +1 -0
  94. package/uni-components/chat-control/url/icons/file-zip-line.svg +1 -0
  95. package/uni-components/chat-control/url/icons/index.js +24 -0
  96. package/uni-components/chat-control/url/miniprogram.svg +1 -0
  97. package/uni-components/chat-control/url/url-miniprogram.vue +116 -0
  98. package/uni-components/chat-control/url/url.vue +306 -0
  99. package/uni-components/chat-control/url-new/icons/file-excel-line.svg +1 -0
  100. package/uni-components/chat-control/url-new/icons/file-info-line.svg +1 -0
  101. package/uni-components/chat-control/url-new/icons/file-music-line.svg +1 -0
  102. package/uni-components/chat-control/url-new/icons/file-pdf-line.svg +1 -0
  103. package/uni-components/chat-control/url-new/icons/file-ppt-line.svg +1 -0
  104. package/uni-components/chat-control/url-new/icons/file-settings-line.svg +1 -0
  105. package/uni-components/chat-control/url-new/icons/file-text-line.svg +1 -0
  106. package/uni-components/chat-control/url-new/icons/file-unknow-line.svg +1 -0
  107. package/uni-components/chat-control/url-new/icons/file-word-line.svg +1 -0
  108. package/uni-components/chat-control/url-new/icons/file-zip-line.svg +1 -0
  109. package/uni-components/chat-control/url-new/icons/index.js +24 -0
  110. package/uni-components/chat-control/url-new/url-new.vue +110 -0
  111. package/uni-components/chat-control/utils.js +12 -0
  112. package/uni-components/chat-control/video/video.vue +156 -0
  113. package/uni-components/chat-control/voice/voice.vue +166 -0
  114. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-collect.vue +84 -0
  115. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-system.vue +28 -0
  116. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet.vue +85 -0
  117. package/uni-components/chat-editor/chat-editor-func/chat-editor-func.vue +157 -0
  118. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at-panel.vue +158 -0
  119. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at.vue +61 -0
  120. package/uni-components/chat-editor/chat-editor-func-button/chat-editor-func-button.vue +58 -0
  121. package/uni-components/chat-editor/chat-editor-func-file/chat-editor-func-file.vue +54 -0
  122. package/uni-components/chat-editor/chat-editor-func-image/chat-editor-func-image.vue +42 -0
  123. package/uni-components/chat-editor/chat-editor-func-video/chat-editor-func-video.vue +42 -0
  124. package/uni-components/chat-editor/chat-editor-func-voice/chat-editor-func-voice.vue +25 -0
  125. package/uni-components/chat-editor/chat-editor-message-send/chat-editor-message-send.vue +158 -0
  126. package/uni-components/chat-editor/chat-editor-quote/chat-editor-quote.vue +75 -0
  127. package/uni-components/chat-editor/chat-editor.vue +257 -0
  128. package/uni-components/chat-editor/index.js +10 -0
  129. package/uni-components/chat-editor/util.js +65 -0
  130. package/uni-components/chat-panel/chat-panel-chats-box.vue +238 -0
  131. package/uni-components/chat-panel/chat-panel-chats-forward/chat-panel-chats-forward.vue +273 -0
  132. package/uni-components/chat-panel/chat-panel-chats-item.vue +578 -0
  133. package/uni-components/chat-panel/chat-panel-chats-status/chat-panel-chats-status.vue +71 -0
  134. package/uni-components/chat-panel/chat-panel-chats.vue +368 -0
  135. package/uni-components/chat-panel/chat-panel.vue +227 -0
  136. package/uni-components/contacts-group-select/contacts-group-select-item.vue +85 -0
  137. package/uni-components/contacts-group-select/contacts-group-select-panel.vue +119 -0
  138. package/uni-components/contacts-group-select/contacts-group-select.vue +150 -0
  139. package/components/wework-chat-control/wework-chat-control-config-item.vue +0 -24
  140. package/components/wework-chat-control/wework-chat-control-config-msg.vue +0 -25
  141. package/components/wework-chat-panel/chat-panel-chat-status/chat-panel-chat-status.vue +0 -73
@@ -0,0 +1,35 @@
1
+ <script>
2
+ import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
3
+ import { link } from '../../../wework-chat-control'
4
+
5
+ export default {
6
+ name: 'SdkWeworkChatPanelControlsLink',
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(link, {
29
+ props: {
30
+ data: props.data
31
+ }
32
+ })])
33
+ }
34
+ }
35
+ </script>
@@ -0,0 +1,35 @@
1
+ <script>
2
+ import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
3
+ import { location } from '../../../wework-chat-control'
4
+
5
+ export default {
6
+ name: 'SdkWeworkChatPanelControlsLocation',
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(location, {
29
+ props: {
30
+ content: props.data.content
31
+ }
32
+ })])
33
+ }
34
+ }
35
+ </script>
@@ -0,0 +1,43 @@
1
+ <script>
2
+ import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
3
+ import { text } from '../../../wework-chat-control'
4
+
5
+ export default {
6
+ name: 'SdkWeworkChatPanelControlsText',
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
+ class: 'sdk-chat-panel-controls-text',
24
+ props: {
25
+ dir: props.dir,
26
+ data: props.data,
27
+ fetchUserMethod: props.fetchUserMethod
28
+ }
29
+ }, [h('div', {
30
+ class: 'sdk-chat-panel-controls-text__main'
31
+ }, [h(text, {
32
+ props: {
33
+ data: props.data
34
+ }
35
+ })])])
36
+ }
37
+ }
38
+ </script>
39
+ <style>
40
+ .sdk-chat-panel-controls-text__main{
41
+ padding: 10px;
42
+ }
43
+ </style>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <sdk-chat-panel-box
3
+ :data="data"
4
+ :dir="dir"
5
+ :fetch-user-method="fetchUserMethod"
6
+ >
7
+ <div class="sdk-wework-chat-panel-controls-unkonw__main">
8
+ 未知消息
9
+ </div>
10
+ </sdk-chat-panel-box>
11
+ </template>
12
+ <script>
13
+ import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
14
+
15
+ export default {
16
+ name: 'SdkWeworkChatPanelControlsUnkonw',
17
+ components: {
18
+ SdkChatPanelBox
19
+ },
20
+ props: {
21
+ dir: {
22
+ type: String
23
+ },
24
+ data: {
25
+ type: Object,
26
+ required: true
27
+ },
28
+ fetchUserMethod: {
29
+ type: Function
30
+ }
31
+ }
32
+ }
33
+ </script>
34
+ <style lang="less">
35
+ .sdk-wework-chat-panel-controls-unkonw__main{
36
+ padding: 12px;
37
+ color: #999;
38
+ }
39
+ </style>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <sdk-chat-panel-box
3
+ :data="data"
4
+ :dir="dir"
5
+ :fetch-user-method="fetchUserMethod"
6
+ >
7
+ <sdk-chat-control-video
8
+ :data="data"
9
+ width="240px"
10
+ height="180px"
11
+ ></sdk-chat-control-video>
12
+ </sdk-chat-panel-box>
13
+ </template>
14
+ <script>
15
+ import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
16
+ import { video } from '../../../wework-chat-control'
17
+
18
+ export default {
19
+ name: 'SdkWeworkChatPanelControlsVideo',
20
+ components: {
21
+ SdkChatPanelBox,
22
+ SdkChatControlVideo: video
23
+ },
24
+ props: {
25
+ dir: {
26
+ type: String
27
+ },
28
+ data: {
29
+ type: Object,
30
+ required: true
31
+ },
32
+ fetchUserMethod: {
33
+ type: Function
34
+ }
35
+ }
36
+ }
37
+ </script>
@@ -0,0 +1,35 @@
1
+ <script>
2
+ import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
3
+ import { voice } from '../../../wework-chat-control'
4
+
5
+ export default {
6
+ name: 'SdkWeworkChatPanelControlsVoice',
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(voice, {
29
+ props: {
30
+ content: props.data.content
31
+ }
32
+ })])
33
+ }
34
+ }
35
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <wework-chat-control-config-msg
2
+ <wechat-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="item.msgType === MESSAGE_TYPE.TEXT || item.msgType === MESSAGE_TYPE.TEXT_W">
10
+ <template v-if="[0, 1, 2].includes(item.msgType)">
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="item.msgType === MESSAGE_TYPE.IMAGE">
29
+ <template v-else-if="[14, 101].includes(item.msgType)">
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="item.msgType === MESSAGE_TYPE.VIDEO">
48
+ <template v-else-if="[22, 23, 103].includes(item.msgType)">
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 || item.msgType == MESSAGE_TYPE.URLNew">
292
+ <template v-else-if="item.msgType == MESSAGE_TYPE.URL">
293
293
  <sdk-chat-panel-box
294
294
  :dir="dir"
295
295
  :data="item"
@@ -312,6 +312,29 @@
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>
315
338
  <template v-else-if="item.msgType == MESSAGE_TYPE.CUSTOM_EXPRESSION">
316
339
  <sdk-chat-panel-box
317
340
  :dir="dir"
@@ -487,7 +510,7 @@
487
510
  :content="msgContent"
488
511
  ></sdk-chat-control-empty>
489
512
  </template>
490
- <template v-else>
513
+ <!-- <template v-else>
491
514
  <sdk-chat-panel-box
492
515
  :dir="dir"
493
516
  :data="item"
@@ -500,10 +523,10 @@
500
523
  :content="msgContent"
501
524
  ></sdk-chat-control-unknow>
502
525
  </sdk-chat-panel-box>
503
- </template>
526
+ </template> -->
504
527
  </div>
505
528
  </template>
506
- </wework-chat-control-config-msg>
529
+ </wechat-chat-control-config-msg>
507
530
  </template>
508
531
  <script>
509
532
  import SdkChatPanelBox from '../chat-panel/chat-panel-box'
@@ -541,10 +564,10 @@ import {
541
564
  unknow as SdkChatControlUnknow
542
565
  } from '../wework-chat-control'
543
566
  import { MESSAGE_TYPE } from '../wework-chat-control/util'
544
- import WeworkChatControlConfigMsg from '../wework-chat-control/wework-chat-control-config-msg.vue'
567
+ import WechatChatControlConfigMsg from '../wechat-chat-control/wechat-chat-control-config-msg.vue'
545
568
 
546
569
  export default {
547
- name: 'SdkWeworkPanelItem',
570
+ name: 'SdkWechatPanelItem',
548
571
  components: {
549
572
  SdkChatPanelBox,
550
573
  SdkChatControlText,
@@ -578,7 +601,7 @@ export default {
578
601
  // SdkChatControlRevokeMeMessage,
579
602
  // SdkChatControlRevokeOtherMessage,
580
603
  // SdkChatControlRevokeYouMessage,
581
- WeworkChatControlConfigMsg
604
+ WechatChatControlConfigMsg
582
605
  },
583
606
  props: {
584
607
  dir: {
@@ -624,4 +647,4 @@ export default {
624
647
  }
625
648
  }
626
649
  }
627
- </script>
650
+ </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,23 +37,18 @@
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>
43
40
  </template>
44
41
  </sdk-chat-panel>
45
42
  </template>
46
43
  <script>
47
44
  import SdkChatPanel from '../chat-panel'
48
45
  import ChatPanelItem from './chat-panel-item.vue'
49
- import ChatPanelChatStatus from './chat-panel-chat-status/chat-panel-chat-status.vue'
50
46
 
51
47
  export default {
52
48
  name: 'SdkWeworkChatPanel',
53
49
  components: {
54
50
  SdkChatPanel,
55
- ChatPanelItem,
56
- ChatPanelChatStatus
51
+ ChatPanelItem
57
52
  },
58
53
  props: {
59
54
  mode: {
@@ -64,8 +59,7 @@ export default {
64
59
  }
65
60
  },
66
61
  keyField: {
67
- type: String,
68
- default: 'id'
62
+ type: String
69
63
  },
70
64
  startDate: {
71
65
  type: Number
@@ -94,6 +88,9 @@ export default {
94
88
  type: Boolean,
95
89
  default: true
96
90
  },
91
+ renderControl: {
92
+ type: Function
93
+ },
97
94
  fetchUserMethod: {
98
95
  type: Function
99
96
  },
@@ -129,33 +126,12 @@ export default {
129
126
  },
130
127
  contextChatId: {
131
128
  type: String
132
- },
133
- onBeforeSelectionChange: {
134
- type: Function
135
- }
136
- },
137
- data () {
138
- return {
139
- checkMsgMap: {}
140
- }
141
- },
142
- computed: {
143
- props () {
144
- const { config, ...nextProps } = this.$props
145
- return nextProps
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
129
  }
157
130
  },
158
131
  methods: {
132
+ handleRenderControl ({ item }) {
133
+ return ChatControls[item.msgType] || ChatControls.unkonw
134
+ },
159
135
  handleIsSenderMethod ({ item }) {
160
136
  return !!item.send
161
137
  },
@@ -172,67 +148,8 @@ export default {
172
148
  this.currentContextChat = null
173
149
  return this.$refs.panel && this.$refs.panel.reload()
174
150
  },
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
- },
232
151
  handleChatContext (item, evt) {
233
- this.$emit('chat-contextmenu', {
234
- item
235
- }, evt)
152
+ this.$emit('chat-contextmenu', item, evt)
236
153
  },
237
154
  handleChatViewContext ({ item }) {
238
155
  this.$emit('chat-view-context', {
package/package.json CHANGED
@@ -1,16 +1,9 @@
1
1
  {
2
2
  "name": "@aochuang/client-sdk",
3
- "version": "1.0.344",
3
+ "version": "1.0.346",
4
4
  "description": "",
5
- "files": [
6
- "common",
7
- "components",
8
- "services",
9
- "utils",
10
- "dist"
11
- ],
12
- "exports": {
13
- ".": "./components/index.js"
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
14
7
  },
15
8
  "repository": {
16
9
  "type": "git",
@@ -228,15 +228,24 @@ export default class ClientChatSession {
228
228
  })
229
229
  }
230
230
 
231
- getSession (sessionId, serializeMethod) {
232
- if (this.sessionMap[sessionId]) {
231
+ getSession (sessionId, serializeMethod, callback = null, isCache = true) {
232
+ if (typeof callback === 'boolean') {
233
+ isCache = callback
234
+ callback = null
235
+ }
236
+ if (this.sessionMap[sessionId]) {
233
237
  return Promise.resolve({
234
238
  data: this.sessionMap[sessionId]
235
239
  })
236
240
  }
237
241
  // 这里需要轮询从后端获取会话,后端会话更新和创建是异步的,所以要多轮训请求几次
238
242
  if (this.pollRequestMap[sessionId]) {
239
- this.pollRequestMap[sessionId].stop()
243
+ // 因为有的地方要复用缓存,有的地方不能缓存,比如onAddMessagSuccess的时候不能缓存
244
+ if (isCache) {
245
+ return this.pollRequestMap[sessionId].ps
246
+ } else {
247
+ this.pollRequestMap[sessionId].stop()
248
+ }
240
249
  }
241
250
  const pollRequest = createPollRequest(({ done, fail }) => {
242
251
  return this.getSessionMethod({
@@ -248,12 +257,12 @@ export default class ClientChatSession {
248
257
  })
249
258
  })
250
259
  this.pollRequestMap[sessionId] = pollRequest
251
- return pollRequest.start().then(rs => {
260
+ this.pollRequestMap[sessionId].ps = pollRequest.start().then(rs => {
252
261
  if (serializeMethod) {
253
262
  rs = serializeMethod(rs)
254
263
  }
255
264
  if (rs.data) {
256
- this.addSession(rs.data)
265
+ this.addSession(rs.data, null, callback)
257
266
  return rs
258
267
  } else {
259
268
  return Promise.reject('未找到会话' + sessionId)
@@ -263,6 +272,7 @@ export default class ClientChatSession {
263
272
  delete this.pollRequestMap[sessionId]
264
273
  }
265
274
  })
275
+ return this.pollRequestMap[sessionId].ps
266
276
  }
267
277
 
268
278
  findSession (findFn) {
@@ -387,7 +397,7 @@ export default class ClientChatSession {
387
397
  * "wechatAccountId": "2a39a725814acf07502299ab2285fff8d44377f5"
388
398
  * }
389
399
  */
390
- addSession (data, wechatAccountId) {
400
+ addSession (data, wechatAccountId, callback) {
391
401
  if (!data || !data.conversationId) {
392
402
  throw new Error('缺少必须参数conversationId')
393
403
  }
@@ -488,6 +498,9 @@ export default class ClientChatSession {
488
498
  if (virtualSessionIndex > -1) {
489
499
  this.data.virtualSessionData.splice(virtualSessionIndex, 1)
490
500
  }
501
+ callback && callback({
502
+ session: data
503
+ })
491
504
  this.onAddSession && this.onAddSession({
492
505
  session: data
493
506
  })