@aochuang/client-sdk 1.0.348 → 1.0.349

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 (144) 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/url/url-miniprogram.vue +5 -1
  4. package/components/wework-chat-control/company-card/company-card.vue +1 -1
  5. package/components/wework-chat-control/file-url/file-url.vue +5 -2
  6. package/components/wework-chat-control/image/image.vue +2 -137
  7. package/components/wework-chat-control/index.js +6 -6
  8. package/components/wework-chat-control/text/text.vue +3 -22
  9. package/components/wework-chat-control/util.js +6 -12
  10. package/components/wework-chat-control/video/video.vue +2 -10
  11. package/components/wework-chat-control/voice/voice.vue +1 -1
  12. package/components/wework-chat-panel/chat-panel-controls/company-card/company-card.vue +35 -0
  13. package/components/wework-chat-panel/chat-panel-controls/expression/expression.vue +36 -0
  14. package/components/wework-chat-panel/chat-panel-controls/file-url/file-url.vue +35 -0
  15. package/components/wework-chat-panel/chat-panel-controls/image/image.vue +36 -0
  16. package/components/wework-chat-panel/chat-panel-controls/index.js +35 -0
  17. package/components/wework-chat-panel/chat-panel-controls/jx-sys-text/jx-sys-text.vue +28 -0
  18. package/components/wework-chat-panel/chat-panel-controls/link/link.vue +35 -0
  19. package/components/wework-chat-panel/chat-panel-controls/location/location.vue +35 -0
  20. package/components/wework-chat-panel/chat-panel-controls/text/text.vue +43 -0
  21. package/components/wework-chat-panel/chat-panel-controls/unkonw/unkonw.vue +39 -0
  22. package/components/wework-chat-panel/chat-panel-controls/video/video.vue +37 -0
  23. package/components/wework-chat-panel/chat-panel-controls/voice/voice.vue +35 -0
  24. package/components/wework-chat-panel/chat-panel-item.vue +35 -12
  25. package/components/wework-chat-panel/chat-panel.vue +12 -95
  26. package/package.json +3 -10
  27. package/services/client-chat/client-chat-wework/client-chat-concats.js +17 -81
  28. package/services/client-chat/client-chat-wework/client-chat-message.js +6 -46
  29. package/services/client-chat/client-chat-wework/client-chat-session.js +2 -50
  30. package/services/client-chat/client-chat-wework/client-chat-socket.js +1 -9
  31. package/services/client-chat/client-chat-wework/client-chat.js +13 -283
  32. package/services/client-chat/client-chat-wework/utils.js +5 -5
  33. package/uni-common/account-portray/account-portray.vue +51 -0
  34. package/uni-common/account-select/account-select-item.vue +172 -0
  35. package/uni-common/account-select/account-select.vue +252 -0
  36. package/uni-common/all-friend-avatar/all-friend-avatar.vue +49 -0
  37. package/uni-common/friend-avatar/default.svg +1 -0
  38. package/uni-common/friend-avatar/friend-avatar.vue +27 -0
  39. package/uni-common/friend-avatar/index.js +3 -0
  40. package/uni-common/friend-loader/friend-loader.vue +53 -0
  41. package/uni-common/friend-portray/friend-portray.vue +56 -0
  42. package/uni-common/group-avatar/default.svg +1 -0
  43. package/uni-common/group-avatar/group-avatar.vue +18 -0
  44. package/uni-common/group-avatar/index.js +3 -0
  45. package/uni-common/room-avatar/default.svg +6 -0
  46. package/uni-common/room-avatar/index.js +3 -0
  47. package/uni-common/room-avatar/room-avatar.vue +27 -0
  48. package/uni-common/room-loader/room-loader.vue +53 -0
  49. package/uni-common/room-portray/room-portray.vue +56 -0
  50. package/uni-components/chat-control/calling/calling.vue +91 -0
  51. package/uni-components/chat-control/calling/phone-fill.svg +1 -0
  52. package/uni-components/chat-control/calling/vidicon-fill.svg +1 -0
  53. package/uni-components/chat-control/channel-video/channel-video.vue +89 -0
  54. package/uni-components/chat-control/channel-video-card/channel-video-card.vue +105 -0
  55. package/uni-components/chat-control/channel-video-live/channel-video-live.vue +92 -0
  56. package/uni-components/chat-control/chat-control-config-item/chat-control-config-item.vue +20 -0
  57. package/uni-components/chat-control/chat-control-config-item/index.js +3 -0
  58. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-app.vue +25 -0
  59. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-h5.vue +21 -0
  60. package/{components/wework-chat-control/wework-chat-control-config.vue → uni-components/chat-control/chat-control-config.vue} +13 -16
  61. package/uni-components/chat-control/chat-control.vue +218 -0
  62. package/uni-components/chat-control/company-card/company-card.vue +123 -0
  63. package/uni-components/chat-control/const.js +28 -0
  64. package/uni-components/chat-control/expression/expression.vue +41 -0
  65. package/uni-components/chat-control/image/image.vue +68 -0
  66. package/uni-components/chat-control/index.js +89 -0
  67. package/uni-components/chat-control/location/location.vue +110 -0
  68. package/uni-components/chat-control/member-change/member-change.vue +32 -0
  69. package/uni-components/chat-control/quote-message/quote-message.vue +216 -0
  70. package/uni-components/chat-control/real-time-position/real-time-position.vue +62 -0
  71. package/uni-components/chat-control/redpacket/red-envelope.svg +1 -0
  72. package/uni-components/chat-control/redpacket/redpacket.vue +75 -0
  73. package/uni-components/chat-control/share-card/share-card.vue +101 -0
  74. package/uni-components/chat-control/system/system.vue +69 -0
  75. package/uni-components/chat-control/system-batch-message/system-batch-message.vue +30 -0
  76. package/uni-components/chat-control/system-text/system-text.vue +32 -0
  77. package/uni-components/chat-control/text/text.vue +67 -0
  78. package/uni-components/chat-control/text-with-at/text-with-at.vue +51 -0
  79. package/uni-components/chat-control/transfer/red-transfer.svg +1 -0
  80. package/uni-components/chat-control/transfer/transfer.vue +80 -0
  81. package/uni-components/chat-control/unkonw/unkonw.vue +37 -0
  82. package/uni-components/chat-control/url/icons/file-excel-line.svg +1 -0
  83. package/uni-components/chat-control/url/icons/file-info-line.svg +1 -0
  84. package/uni-components/chat-control/url/icons/file-music-line.svg +1 -0
  85. package/uni-components/chat-control/url/icons/file-pdf-line.svg +1 -0
  86. package/uni-components/chat-control/url/icons/file-ppt-line.svg +1 -0
  87. package/uni-components/chat-control/url/icons/file-settings-line.svg +1 -0
  88. package/uni-components/chat-control/url/icons/file-text-line.svg +1 -0
  89. package/uni-components/chat-control/url/icons/file-unknow-line.svg +1 -0
  90. package/uni-components/chat-control/url/icons/file-word-line.svg +1 -0
  91. package/uni-components/chat-control/url/icons/file-zip-line.svg +1 -0
  92. package/uni-components/chat-control/url/icons/index.js +24 -0
  93. package/uni-components/chat-control/url/miniprogram.svg +1 -0
  94. package/uni-components/chat-control/url/url-miniprogram.vue +116 -0
  95. package/uni-components/chat-control/url/url.vue +306 -0
  96. package/uni-components/chat-control/url-new/icons/file-excel-line.svg +1 -0
  97. package/uni-components/chat-control/url-new/icons/file-info-line.svg +1 -0
  98. package/uni-components/chat-control/url-new/icons/file-music-line.svg +1 -0
  99. package/uni-components/chat-control/url-new/icons/file-pdf-line.svg +1 -0
  100. package/uni-components/chat-control/url-new/icons/file-ppt-line.svg +1 -0
  101. package/uni-components/chat-control/url-new/icons/file-settings-line.svg +1 -0
  102. package/uni-components/chat-control/url-new/icons/file-text-line.svg +1 -0
  103. package/uni-components/chat-control/url-new/icons/file-unknow-line.svg +1 -0
  104. package/uni-components/chat-control/url-new/icons/file-word-line.svg +1 -0
  105. package/uni-components/chat-control/url-new/icons/file-zip-line.svg +1 -0
  106. package/uni-components/chat-control/url-new/icons/index.js +24 -0
  107. package/uni-components/chat-control/url-new/url-new.vue +110 -0
  108. package/uni-components/chat-control/utils.js +12 -0
  109. package/uni-components/chat-control/video/video.vue +156 -0
  110. package/uni-components/chat-control/voice/voice.vue +166 -0
  111. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-collect.vue +84 -0
  112. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-system.vue +28 -0
  113. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet.vue +85 -0
  114. package/uni-components/chat-editor/chat-editor-func/chat-editor-func.vue +157 -0
  115. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at-panel.vue +158 -0
  116. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at.vue +61 -0
  117. package/uni-components/chat-editor/chat-editor-func-button/chat-editor-func-button.vue +58 -0
  118. package/uni-components/chat-editor/chat-editor-func-file/chat-editor-func-file.vue +54 -0
  119. package/uni-components/chat-editor/chat-editor-func-image/chat-editor-func-image.vue +42 -0
  120. package/uni-components/chat-editor/chat-editor-func-video/chat-editor-func-video.vue +42 -0
  121. package/uni-components/chat-editor/chat-editor-func-voice/chat-editor-func-voice.vue +25 -0
  122. package/uni-components/chat-editor/chat-editor-message-send/chat-editor-message-send.vue +158 -0
  123. package/uni-components/chat-editor/chat-editor-quote/chat-editor-quote.vue +75 -0
  124. package/uni-components/chat-editor/chat-editor.vue +257 -0
  125. package/uni-components/chat-editor/index.js +10 -0
  126. package/uni-components/chat-editor/util.js +65 -0
  127. package/uni-components/chat-panel/chat-panel-chats-box.vue +238 -0
  128. package/uni-components/chat-panel/chat-panel-chats-forward/chat-panel-chats-forward.vue +273 -0
  129. package/uni-components/chat-panel/chat-panel-chats-item.vue +578 -0
  130. package/uni-components/chat-panel/chat-panel-chats-status/chat-panel-chats-status.vue +71 -0
  131. package/uni-components/chat-panel/chat-panel-chats.vue +368 -0
  132. package/uni-components/chat-panel/chat-panel.vue +227 -0
  133. package/uni-components/contacts-group-select/contacts-group-select-item.vue +85 -0
  134. package/uni-components/contacts-group-select/contacts-group-select-panel.vue +119 -0
  135. package/uni-components/contacts-group-select/contacts-group-select.vue +150 -0
  136. package/components/wechat-chat-control/.DS_Store +0 -0
  137. package/components/wechat-chat-control/transfer/.DS_Store +0 -0
  138. package/components/wechat-chat-control/url/.DS_Store +0 -0
  139. package/components/wechat-chat-control/voice/.DS_Store +0 -0
  140. package/components/wework-chat-control/link/.DS_Store +0 -0
  141. package/components/wework-chat-control/video/.DS_Store +0 -0
  142. package/components/wework-chat-control/wework-chat-control-config-item.vue +0 -24
  143. package/components/wework-chat-control/wework-chat-control-config-msg.vue +0 -25
  144. package/components/wework-chat-panel/chat-panel-chat-status/chat-panel-chat-status.vue +0 -73
@@ -11,7 +11,6 @@ import ChatLayout from './chat-layout'
11
11
  import ChatFriendProfile from './chat-friend-profile'
12
12
  import ChatRoomProfile from './chat-room-profile'
13
13
  import { chatControls as WechatChatControls, WechatChatControlConfig, WechatChatControlConfigMsg, WechatChatControlConfigItem } from './wechat-chat-control'
14
- import { chatControls as WeworkChatControls, WeworkChatControlConfig, WeworkChatControlConfigMsg, WeworkChatControlConfigItem } from './wework-chat-control'
15
14
  import { MESSAGE_TYPE, formatShortMessage, formatShortSessionMessage } from './wechat-chat-control/util'
16
15
  import { MESSAGE_TYPE as MESSAGE_TYPE_W } from './wework-chat-control/util'
17
16
 
@@ -22,10 +21,6 @@ export default {
22
21
  WechatChatControlConfig,
23
22
  WechatChatControlConfigMsg,
24
23
  WechatChatControlConfigItem,
25
- WeworkChatControls,
26
- WeworkChatControlConfig,
27
- WeworkChatControlConfigMsg,
28
- WeworkChatControlConfigItem,
29
24
  MESSAGE_TYPE,
30
25
  MESSAGE_TYPE_W,
31
26
  AccountSelect,
@@ -45,4 +40,4 @@ export default {
45
40
  ChatRoomProfile,
46
41
  WechatChatPanel,
47
42
  WeworkChatPanel
48
- }
43
+ }
@@ -5,13 +5,14 @@
5
5
  <div class="sdk-session-item__avatar-image">
6
6
  <slot name="avatar"></slot>
7
7
  </div>
8
- <span v-if="data[unreadMsgCountField]" class="sdk-session-item__avatar-badge" :class="{'is-mute': data[muteField]}">
9
- <sdk-badge
10
- :is-dot="data[muteField]"
11
- :value="data[unreadMsgCountField]"
12
- :max="99"
13
- ></sdk-badge>
14
- </span>
8
+ <sdk-badge
9
+ class="sdk-session-item__avatar-badge"
10
+ :class="{'is-mute': data[muteField]}"
11
+ v-if="data[unreadMsgCountField]"
12
+ :is-dot="data[muteField]"
13
+ :value="data[unreadMsgCountField]"
14
+ :max="99"
15
+ ></sdk-badge>
15
16
  </div>
16
17
  <div class="sdk-session-item__main">
17
18
  <div class="sdk-session-item__row">
@@ -141,7 +142,7 @@ export default {
141
142
  border-radius: 3px;
142
143
  }
143
144
  .sdk-session-item__avatar-badge{
144
- position: absolute;
145
+ position: absolute;
145
146
  &.is-mute {
146
147
  left: calc(~'100% - 7px');
147
148
  top: -6px;
@@ -13,7 +13,7 @@
13
13
  {{title}}
14
14
  </div>
15
15
  <div class="sdk-chat-panel-control-url-miniprogram__content">
16
- <div v-if="cover" :style="{width: '100%', height: '100%', 'background-image': 'url('+ cover +')'}"></div>
16
+ <ui-image v-if="cover" :style="{width: '100%', height: '100%'}" :src="cover"></ui-image>
17
17
  </div>
18
18
  </div>
19
19
  <div class="sdk-chat-panel-control-url-miniprogram__foot">小程序</div>
@@ -50,11 +50,15 @@
50
50
  </div>
51
51
  </template>
52
52
  <script>
53
+ import { Image as UiImage } from '@aochuang/common/components'
53
54
  import { parse, parseXml } from '../../../utils/json'
54
55
  import { formatOssPath } from '@aochuang/common/utils/oss'
55
56
 
56
57
  export default {
57
58
  name: 'SdkChatPanelControlUrlMiniprogram',
59
+ components: {
60
+ UiImage
61
+ },
58
62
  props: {
59
63
  id: {
60
64
  type: String
@@ -62,7 +62,7 @@ export default {
62
62
  return formatOssPath(this.nextContent.bigheadimgurl)
63
63
  },
64
64
  category () {
65
- return '微名片'
65
+ return '企业微名片'
66
66
  }
67
67
  }
68
68
  }
@@ -71,10 +71,13 @@ export default {
71
71
  },
72
72
  computed: {
73
73
  url () {
74
- return this.nextContent.resPath || this.nextContent.url || this.nextContent.resUrl
74
+ return this.nextContent.url || this.nextContent.resUrl
75
75
  },
76
76
  name () {
77
- return this.nextContent.fileName || this.nextContent.title || this.url
77
+ if (!this.nextContent.title) {
78
+ return this.url
79
+ }
80
+ return this.nextContent.title
78
81
  },
79
82
  size () {
80
83
  return this.nextContent.totalLen
@@ -1,24 +1,7 @@
1
1
  <template>
2
2
  <div class="sdk-chat-control-image" @click="handleClick">
3
3
  <div class="sdk-chat-control-image__main" :style="{'height': innerHeight, 'max-height': innerMaxHeight + 'px'}">
4
- <template v-if="showDownloadBox">
5
- <div class="sdk-chat-control-image__download" :class="{'is-downloading': downloading}" @click.stop="handleDownloadClick">
6
- <template v-if="downloading">
7
- <div class="sdk-chat-control-image__download-icon">
8
- <ui-loading size="mini"></ui-loading>
9
- </div>
10
- <div class="sdk-chat-control-image__download-text">下载中...</div>
11
- </template>
12
- <template v-else>
13
- <div class="sdk-chat-control-image__download-icon">
14
- <ui-icon name="download-line"></ui-icon>
15
- </div>
16
- <div class="sdk-chat-control-image__download-text">下载</div>
17
- </template>
18
- </div>
19
- <div class="sdk-chat-control-image__download-placeholder"></div>
20
- </template>
21
- <template v-else-if="allowDefrost">
4
+ <template v-if="allowDefrost">
22
5
  <template v-if="defrostMsg">
23
6
  <div class="sdk-chat-control-image__defrost">
24
7
  <div class="sdk-chat-control-image__defrost-icon">
@@ -93,7 +76,6 @@
93
76
  </template>
94
77
  <script>
95
78
  import { Image as UiImage, Button as UiButton, Icon as UiIcon, Loading as UiLoading } from '@aochuang/common/components'
96
- import { parse } from '../../../utils/json'
97
79
  import { isOriginImage, getNewImageSrc} from './util'
98
80
 
99
81
  export default {
@@ -116,17 +98,7 @@ export default {
116
98
  }
117
99
  },
118
100
  content: {
119
- type: [String, Object]
120
- },
121
- allowDownload: {
122
- type: [Boolean, Function],
123
- default: false
124
- },
125
- downloadMethod: {
126
- type: Function
127
- },
128
- cancelDownloadMethod: {
129
- type: Function
101
+ type: String
130
102
  },
131
103
  maxWidth: {
132
104
  type: Number,
@@ -178,35 +150,12 @@ export default {
178
150
  },
179
151
  data () {
180
152
  return {
181
- downloading: false,
182
- downloaded: false,
183
- nextContent: null,
184
153
  defrostMsg: null,
185
154
  errorMsg: null
186
155
  }
187
156
  },
188
157
  computed: {
189
- isDownloadContent () {
190
- return !!(this.nextContent && typeof this.nextContent === 'object' && !Array.isArray(this.nextContent))
191
- },
192
- innerAllowDownload () {
193
- if (typeof this.allowDownload === 'function') {
194
- return this.allowDownload({
195
- content: this.nextContent
196
- })
197
- }
198
- return this.allowDownload
199
- },
200
- showDownloadBox () {
201
- return this.type === 'default' && this.innerAllowDownload && this.isDownloadContent && !this.nextContent.resPath && !this.downloaded
202
- },
203
158
  src () {
204
- if (typeof this.nextContent === 'string') {
205
- return this.nextContent
206
- }
207
- if (this.nextContent && typeof this.nextContent === 'object') {
208
- return this.nextContent.resPath || this.nextContent.url || this.nextContent.thumbnailPath || this.nextContent.midThumbnailPath || ''
209
- }
210
159
  return this.content
211
160
  },
212
161
  innerWidth () {
@@ -261,9 +210,6 @@ export default {
261
210
  return !!this.defrostMethod
262
211
  }
263
212
  },
264
- created () {
265
- this.syncContentState()
266
- },
267
213
  methods: {
268
214
  handleClick () {
269
215
  this.$emit('click')
@@ -271,39 +217,6 @@ export default {
271
217
  handleImageClick () {
272
218
  this.imageClickMethod && this.imageClickMethod()
273
219
  },
274
- handleDownloadClick () {
275
- if (this.downloading) {
276
- return
277
- }
278
- if (!this.downloadMethod) {
279
- return
280
- }
281
- const rs = this.downloadMethod({
282
- content: this.nextContent,
283
- updateContentProp: (prop, value) => {
284
- if (!['url'].includes(prop)) {
285
- throw new Error('不支持的更新属性' + prop)
286
- }
287
- this.$set(this.nextContent, prop, value)
288
- },
289
- updateContentProps: (data) => {
290
- if (!data || typeof data !== 'object' || Array.isArray(data)) {
291
- throw new Error('updateContentProps只支持更新数据对象')
292
- }
293
- this.nextContent = data
294
- }
295
- })
296
- if (rs && rs.finally) {
297
- this.downloading = true
298
- rs.then(() => {
299
- this.downloaded = true
300
- }).finally(() => {
301
- this.downloading = false
302
- })
303
- } else {
304
- this.downloaded = true
305
- }
306
- },
307
220
  handleError () {
308
221
  if (!this.defrostMethod) {
309
222
  return
@@ -323,22 +236,7 @@ export default {
323
236
  handleRefreshClick () {
324
237
  this.errorMsg = null
325
238
  this.defrostMsg = null
326
- },
327
- syncContentState () {
328
- this.nextContent = parse(this.content)
329
- this.downloaded = false
330
- this.downloading = false
331
- this.errorMsg = null
332
- this.defrostMsg = null
333
239
  }
334
- },
335
- watch: {
336
- content () {
337
- this.syncContentState()
338
- }
339
- },
340
- beforeDestroy () {
341
- this.cancelDownloadMethod && this.cancelDownloadMethod()
342
240
  }
343
241
  }
344
242
  </script>
@@ -379,39 +277,6 @@ export default {
379
277
  display: inline-block;
380
278
  line-height: 1em;
381
279
  vertical-align: top;
382
- position: relative;
383
- }
384
- .sdk-chat-control-image__download{
385
- position: absolute;
386
- left: 0;
387
- top: 0;
388
- z-index: 10;
389
- width: 100%;
390
- height: 100%;
391
- background: #000;
392
- display: flex;
393
- flex-direction: column;
394
- align-items: center;
395
- justify-content: center;
396
- color: #ccc;
397
- cursor: pointer;
398
- &:not(.is-downloading):hover {
399
- color: #fff;
400
- }
401
- }
402
- .sdk-chat-control-image__download.is-downloading{
403
- cursor: default;
404
- }
405
- .sdk-chat-control-image__download-icon{
406
- line-height: 1;
407
- margin-bottom: 6px;
408
- }
409
- .sdk-chat-control-image__download-text{
410
- font-size: 12px;
411
- }
412
- .sdk-chat-control-image__download-placeholder{
413
- width: 100%;
414
- height: 100%;
415
280
  }
416
281
  .sdk-chat-control-image__hd{
417
282
  position: absolute;
@@ -26,9 +26,9 @@ import url from './url/url.vue'
26
26
  // import quoteMessage from './quote-message/quote-message.vue'
27
27
  import empty from './empty/empty.vue'
28
28
  import unknow from './unknow/unknow.vue'
29
- import WeworkChatControlConfig from './wework-chat-control-config.vue'
30
- import WeworkChatControlConfigMsg from './wework-chat-control-config-msg.vue'
31
- import WeworkChatControlConfigItem from './wework-chat-control-config-item.vue'
29
+ // import WechatChatControlConfig from './wechat-chat-control-config.vue'
30
+ // import WechatChatControlConfigMsg from './wechat-chat-control-config-msg.vue'
31
+ // import WechatChatControlConfigItem from './wechat-chat-control-config-item.vue'
32
32
  // import revokeMeMessage from './revoke-me-message/revoke-me-message.vue'
33
33
  // import revokeOtherMessage from './revoke-other-message/revoke-other-message.vue'
34
34
  // import revokeYouMessage from './revoke-you-message/revoke-you-message.vue'
@@ -100,7 +100,7 @@ export {
100
100
  // revokeMeMessage,
101
101
  // revokeOtherMessage,
102
102
  // revokeYouMessage,
103
- WeworkChatControlConfig,
104
- WeworkChatControlConfigMsg,
105
- WeworkChatControlConfigItem
103
+ // WechatChatControlConfig,
104
+ // WechatChatControlConfigMsg,
105
+ // WechatChatControlConfigItem
106
106
  }
@@ -31,21 +31,6 @@
31
31
  import { Popover as UiPopover } from '@aochuang/common/components'
32
32
  import { html2Escape } from '../../../utils/string'
33
33
 
34
- function parseTextContent (content) {
35
- if (typeof content !== 'string') {
36
- return content
37
- }
38
- try {
39
- const data = JSON.parse(content)
40
- if (data && typeof data === 'object') {
41
- return data
42
- }
43
- } catch (e) {
44
- return content
45
- }
46
- return content
47
- }
48
-
49
34
  export default {
50
35
  name: 'SdkChatControlText',
51
36
  components: {
@@ -78,27 +63,23 @@ export default {
78
63
  },
79
64
  computed: {
80
65
  nextContent () {
81
- return parseTextContent(this.content)
66
+ return this.content
82
67
  },
83
68
  text () {
84
- if (this.nextContent && typeof this.nextContent === 'object') {
85
- return this.nextContent.text || ''
86
- }
87
69
  return this.nextContent
88
70
  },
89
71
  html () {
90
- let content = this.text
72
+ let content = this.nextContent
91
73
  if (this.formatter) {
92
74
  content = this.formatter({
93
75
  content: this.nextContent
94
76
  })
95
77
  } else {
96
- content = html2Escape(String(content || ''))
78
+ content = html2Escape(content)
97
79
  }
98
80
  if (!content) {
99
81
  return ''
100
82
  }
101
- content = String(content)
102
83
  content = content.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, item => {
103
84
  return `<a href="${item}" target='_blank'>${item}</a>`
104
85
  })
@@ -3,12 +3,12 @@ export const MESSAGE_TYPE = {
3
3
  TEXT_W: 1,
4
4
  IMAGE: 14,
5
5
  VOICE: 16,
6
- VIDEO: 22,
6
+ VIDEO: 23,
7
7
  CUSTOM_EXPRESSION: 29,
8
8
  CUSTOM_EXPRESSION_W: 104,
9
9
  // MUSIC: 1040187441,
10
10
  // ROOM_CALLING: 64,
11
- SHARE_CARD: 31,
11
+ SHARE_CARD: 41,
12
12
  // COMPANY_CARD: 41,
13
13
  // VIDEO: 43,
14
14
  // CUSTOM_EXPRESSION: 47,
@@ -66,14 +66,6 @@ function toJson (data) {
66
66
  return data
67
67
  }
68
68
 
69
- function getTextContent (content) {
70
- const data = typeof content === 'string' ? toJson(content) : content
71
- if (data && typeof data === 'object') {
72
- return data.text || ''
73
- }
74
- return content
75
- }
76
-
77
69
  /**
78
70
  * 格式化为短消息
79
71
  */
@@ -81,8 +73,10 @@ export function formatShortMessage (msgType, msgContent) {
81
73
  let shortMessage = msgContent
82
74
  switch (msgType) {
83
75
  case MESSAGE_TYPE.TEXT:
76
+ shortMessage = msgContent
77
+ break
84
78
  case MESSAGE_TYPE.TEXT_W:
85
- shortMessage = getTextContent(msgContent)
79
+ shortMessage = msgContent
86
80
  break
87
81
  case MESSAGE_TYPE.TEXT_WITH_AT:
88
82
  let {atId, content, text} = toJson(msgContent) || {}
@@ -230,4 +224,4 @@ export function formatShortSessionMessage (session, contextFn) {
230
224
  }
231
225
  }
232
226
  return formatShortMessage(session.lastMsgType, session.lastMsgContent)
233
- }
227
+ }
@@ -147,9 +147,7 @@ export default {
147
147
  if (typeof this.nextContent === 'string') {
148
148
  url = this.nextContent
149
149
  } else if (this.nextContent && typeof this.nextContent === 'object') {
150
- if (this.nextContent.resPath) {
151
- url = this.nextContent.resPath
152
- } else if (this.nextContent.videoPath) {
150
+ if (this.nextContent.videoPath) {
153
151
  url = this.nextContent.videoPath
154
152
  } else {
155
153
  url = this.nextContent.tencentUrl
@@ -165,7 +163,7 @@ export default {
165
163
  if (!this.nextContent) {
166
164
  return
167
165
  }
168
- return this.nextContent.resCoverPath || this.nextContent.previewImgUrl
166
+ return this.nextContent.previewImgUrl
169
167
  },
170
168
  innerCover () {
171
169
  return formatOssPath(this.cover)
@@ -204,12 +202,6 @@ export default {
204
202
  throw new Error('不支持的更新属性' + prop)
205
203
  }
206
204
  this.$set(this.nextContent, prop, value)
207
- },
208
- updateContentProps: (data) => {
209
- if (!data || typeof data !== 'object' || Array.isArray(data)) {
210
- throw new Error('updateContentProps只支持更新数据对象')
211
- }
212
- this.nextContent = data
213
205
  }
214
206
  })
215
207
  if (rs && rs.finally) {
@@ -132,7 +132,7 @@ export default {
132
132
  return parse(this.content) || {}
133
133
  },
134
134
  voiceSrc () {
135
- let url = this.nextContent.resPath
135
+ let url = this.nextContent.url || this.nextContent.resUrl
136
136
  return url
137
137
  },
138
138
  nextId () {
@@ -0,0 +1,35 @@
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>
@@ -0,0 +1,36 @@
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>
@@ -0,0 +1,35 @@
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>
@@ -0,0 +1,36 @@
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>
@@ -0,0 +1,35 @@
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
+ }
@@ -0,0 +1,28 @@
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>