@aochuang/client-sdk 1.0.346 → 1.0.348

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 (143) 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/voice/.DS_Store +0 -0
  7. package/components/wework-chat-control/company-card/company-card.vue +1 -1
  8. package/components/wework-chat-control/file-url/file-url.vue +2 -5
  9. package/components/wework-chat-control/image/image.vue +137 -2
  10. package/components/wework-chat-control/index.js +6 -6
  11. package/components/wework-chat-control/link/.DS_Store +0 -0
  12. package/components/wework-chat-control/text/text.vue +22 -3
  13. package/components/wework-chat-control/util.js +12 -6
  14. package/components/wework-chat-control/video/.DS_Store +0 -0
  15. package/components/wework-chat-control/video/video.vue +10 -2
  16. package/components/wework-chat-control/voice/voice.vue +1 -1
  17. package/components/wework-chat-control/wework-chat-control-config-item.vue +24 -0
  18. package/components/wework-chat-control/wework-chat-control-config-msg.vue +25 -0
  19. package/{uni-components/chat-control/chat-control-config.vue → components/wework-chat-control/wework-chat-control-config.vue} +16 -13
  20. package/components/wework-chat-panel/chat-panel-chat-status/chat-panel-chat-status.vue +73 -0
  21. package/components/wework-chat-panel/chat-panel-item.vue +12 -35
  22. package/components/wework-chat-panel/chat-panel.vue +95 -12
  23. package/package.json +10 -3
  24. package/services/client-chat/client-chat-wework/client-chat-concats.js +81 -17
  25. package/services/client-chat/client-chat-wework/client-chat-message.js +46 -6
  26. package/services/client-chat/client-chat-wework/client-chat-session.js +50 -2
  27. package/services/client-chat/client-chat-wework/client-chat-socket.js +9 -1
  28. package/services/client-chat/client-chat-wework/client-chat.js +283 -13
  29. package/services/client-chat/client-chat-wework/utils.js +5 -5
  30. package/components/wework-chat-panel/chat-panel-controls/company-card/company-card.vue +0 -35
  31. package/components/wework-chat-panel/chat-panel-controls/expression/expression.vue +0 -36
  32. package/components/wework-chat-panel/chat-panel-controls/file-url/file-url.vue +0 -35
  33. package/components/wework-chat-panel/chat-panel-controls/image/image.vue +0 -36
  34. package/components/wework-chat-panel/chat-panel-controls/index.js +0 -35
  35. package/components/wework-chat-panel/chat-panel-controls/jx-sys-text/jx-sys-text.vue +0 -28
  36. package/components/wework-chat-panel/chat-panel-controls/link/link.vue +0 -35
  37. package/components/wework-chat-panel/chat-panel-controls/location/location.vue +0 -35
  38. package/components/wework-chat-panel/chat-panel-controls/text/text.vue +0 -43
  39. package/components/wework-chat-panel/chat-panel-controls/unkonw/unkonw.vue +0 -39
  40. package/components/wework-chat-panel/chat-panel-controls/video/video.vue +0 -37
  41. package/components/wework-chat-panel/chat-panel-controls/voice/voice.vue +0 -35
  42. package/uni-common/account-portray/account-portray.vue +0 -51
  43. package/uni-common/account-select/account-select-item.vue +0 -172
  44. package/uni-common/account-select/account-select.vue +0 -252
  45. package/uni-common/all-friend-avatar/all-friend-avatar.vue +0 -49
  46. package/uni-common/friend-avatar/default.svg +0 -1
  47. package/uni-common/friend-avatar/friend-avatar.vue +0 -27
  48. package/uni-common/friend-avatar/index.js +0 -3
  49. package/uni-common/friend-loader/friend-loader.vue +0 -53
  50. package/uni-common/friend-portray/friend-portray.vue +0 -56
  51. package/uni-common/group-avatar/default.svg +0 -1
  52. package/uni-common/group-avatar/group-avatar.vue +0 -18
  53. package/uni-common/group-avatar/index.js +0 -3
  54. package/uni-common/room-avatar/default.svg +0 -6
  55. package/uni-common/room-avatar/index.js +0 -3
  56. package/uni-common/room-avatar/room-avatar.vue +0 -27
  57. package/uni-common/room-loader/room-loader.vue +0 -53
  58. package/uni-common/room-portray/room-portray.vue +0 -56
  59. package/uni-components/chat-control/calling/calling.vue +0 -91
  60. package/uni-components/chat-control/calling/phone-fill.svg +0 -1
  61. package/uni-components/chat-control/calling/vidicon-fill.svg +0 -1
  62. package/uni-components/chat-control/channel-video/channel-video.vue +0 -89
  63. package/uni-components/chat-control/channel-video-card/channel-video-card.vue +0 -105
  64. package/uni-components/chat-control/channel-video-live/channel-video-live.vue +0 -92
  65. package/uni-components/chat-control/chat-control-config-item/chat-control-config-item.vue +0 -20
  66. package/uni-components/chat-control/chat-control-config-item/index.js +0 -3
  67. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-app.vue +0 -25
  68. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-h5.vue +0 -21
  69. package/uni-components/chat-control/chat-control.vue +0 -218
  70. package/uni-components/chat-control/company-card/company-card.vue +0 -123
  71. package/uni-components/chat-control/const.js +0 -28
  72. package/uni-components/chat-control/expression/expression.vue +0 -41
  73. package/uni-components/chat-control/image/image.vue +0 -68
  74. package/uni-components/chat-control/index.js +0 -89
  75. package/uni-components/chat-control/location/location.vue +0 -110
  76. package/uni-components/chat-control/member-change/member-change.vue +0 -32
  77. package/uni-components/chat-control/quote-message/quote-message.vue +0 -216
  78. package/uni-components/chat-control/real-time-position/real-time-position.vue +0 -62
  79. package/uni-components/chat-control/redpacket/red-envelope.svg +0 -1
  80. package/uni-components/chat-control/redpacket/redpacket.vue +0 -75
  81. package/uni-components/chat-control/share-card/share-card.vue +0 -101
  82. package/uni-components/chat-control/system/system.vue +0 -69
  83. package/uni-components/chat-control/system-batch-message/system-batch-message.vue +0 -30
  84. package/uni-components/chat-control/system-text/system-text.vue +0 -32
  85. package/uni-components/chat-control/text/text.vue +0 -67
  86. package/uni-components/chat-control/text-with-at/text-with-at.vue +0 -51
  87. package/uni-components/chat-control/transfer/red-transfer.svg +0 -1
  88. package/uni-components/chat-control/transfer/transfer.vue +0 -80
  89. package/uni-components/chat-control/unkonw/unkonw.vue +0 -37
  90. package/uni-components/chat-control/url/icons/file-excel-line.svg +0 -1
  91. package/uni-components/chat-control/url/icons/file-info-line.svg +0 -1
  92. package/uni-components/chat-control/url/icons/file-music-line.svg +0 -1
  93. package/uni-components/chat-control/url/icons/file-pdf-line.svg +0 -1
  94. package/uni-components/chat-control/url/icons/file-ppt-line.svg +0 -1
  95. package/uni-components/chat-control/url/icons/file-settings-line.svg +0 -1
  96. package/uni-components/chat-control/url/icons/file-text-line.svg +0 -1
  97. package/uni-components/chat-control/url/icons/file-unknow-line.svg +0 -1
  98. package/uni-components/chat-control/url/icons/file-word-line.svg +0 -1
  99. package/uni-components/chat-control/url/icons/file-zip-line.svg +0 -1
  100. package/uni-components/chat-control/url/icons/index.js +0 -24
  101. package/uni-components/chat-control/url/miniprogram.svg +0 -1
  102. package/uni-components/chat-control/url/url-miniprogram.vue +0 -116
  103. package/uni-components/chat-control/url/url.vue +0 -306
  104. package/uni-components/chat-control/url-new/icons/file-excel-line.svg +0 -1
  105. package/uni-components/chat-control/url-new/icons/file-info-line.svg +0 -1
  106. package/uni-components/chat-control/url-new/icons/file-music-line.svg +0 -1
  107. package/uni-components/chat-control/url-new/icons/file-pdf-line.svg +0 -1
  108. package/uni-components/chat-control/url-new/icons/file-ppt-line.svg +0 -1
  109. package/uni-components/chat-control/url-new/icons/file-settings-line.svg +0 -1
  110. package/uni-components/chat-control/url-new/icons/file-text-line.svg +0 -1
  111. package/uni-components/chat-control/url-new/icons/file-unknow-line.svg +0 -1
  112. package/uni-components/chat-control/url-new/icons/file-word-line.svg +0 -1
  113. package/uni-components/chat-control/url-new/icons/file-zip-line.svg +0 -1
  114. package/uni-components/chat-control/url-new/icons/index.js +0 -24
  115. package/uni-components/chat-control/url-new/url-new.vue +0 -110
  116. package/uni-components/chat-control/utils.js +0 -12
  117. package/uni-components/chat-control/video/video.vue +0 -156
  118. package/uni-components/chat-control/voice/voice.vue +0 -166
  119. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-collect.vue +0 -84
  120. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-system.vue +0 -28
  121. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet.vue +0 -85
  122. package/uni-components/chat-editor/chat-editor-func/chat-editor-func.vue +0 -157
  123. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at-panel.vue +0 -158
  124. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at.vue +0 -61
  125. package/uni-components/chat-editor/chat-editor-func-button/chat-editor-func-button.vue +0 -58
  126. package/uni-components/chat-editor/chat-editor-func-file/chat-editor-func-file.vue +0 -54
  127. package/uni-components/chat-editor/chat-editor-func-image/chat-editor-func-image.vue +0 -42
  128. package/uni-components/chat-editor/chat-editor-func-video/chat-editor-func-video.vue +0 -42
  129. package/uni-components/chat-editor/chat-editor-func-voice/chat-editor-func-voice.vue +0 -25
  130. package/uni-components/chat-editor/chat-editor-message-send/chat-editor-message-send.vue +0 -158
  131. package/uni-components/chat-editor/chat-editor-quote/chat-editor-quote.vue +0 -75
  132. package/uni-components/chat-editor/chat-editor.vue +0 -257
  133. package/uni-components/chat-editor/index.js +0 -10
  134. package/uni-components/chat-editor/util.js +0 -65
  135. package/uni-components/chat-panel/chat-panel-chats-box.vue +0 -238
  136. package/uni-components/chat-panel/chat-panel-chats-forward/chat-panel-chats-forward.vue +0 -273
  137. package/uni-components/chat-panel/chat-panel-chats-item.vue +0 -578
  138. package/uni-components/chat-panel/chat-panel-chats-status/chat-panel-chats-status.vue +0 -71
  139. package/uni-components/chat-panel/chat-panel-chats.vue +0 -368
  140. package/uni-components/chat-panel/chat-panel.vue +0 -227
  141. package/uni-components/contacts-group-select/contacts-group-select-item.vue +0 -85
  142. package/uni-components/contacts-group-select/contacts-group-select-panel.vue +0 -119
  143. package/uni-components/contacts-group-select/contacts-group-select.vue +0 -150
@@ -11,6 +11,7 @@ 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'
14
15
  import { MESSAGE_TYPE, formatShortMessage, formatShortSessionMessage } from './wechat-chat-control/util'
15
16
  import { MESSAGE_TYPE as MESSAGE_TYPE_W } from './wework-chat-control/util'
16
17
 
@@ -21,6 +22,10 @@ export default {
21
22
  WechatChatControlConfig,
22
23
  WechatChatControlConfigMsg,
23
24
  WechatChatControlConfigItem,
25
+ WeworkChatControls,
26
+ WeworkChatControlConfig,
27
+ WeworkChatControlConfigMsg,
28
+ WeworkChatControlConfigItem,
24
29
  MESSAGE_TYPE,
25
30
  MESSAGE_TYPE_W,
26
31
  AccountSelect,
@@ -40,4 +45,4 @@ export default {
40
45
  ChatRoomProfile,
41
46
  WechatChatPanel,
42
47
  WeworkChatPanel
43
- }
48
+ }
@@ -5,14 +5,13 @@
5
5
  <div class="sdk-session-item__avatar-image">
6
6
  <slot name="avatar"></slot>
7
7
  </div>
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>
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>
16
15
  </div>
17
16
  <div class="sdk-session-item__main">
18
17
  <div class="sdk-session-item__row">
@@ -142,7 +141,7 @@ export default {
142
141
  border-radius: 3px;
143
142
  }
144
143
  .sdk-session-item__avatar-badge{
145
- position: absolute;
144
+ position: absolute;
146
145
  &.is-mute {
147
146
  left: calc(~'100% - 7px');
148
147
  top: -6px;
@@ -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,13 +71,10 @@ export default {
71
71
  },
72
72
  computed: {
73
73
  url () {
74
- return this.nextContent.url || this.nextContent.resUrl
74
+ return this.nextContent.resPath || this.nextContent.url || this.nextContent.resUrl
75
75
  },
76
76
  name () {
77
- if (!this.nextContent.title) {
78
- return this.url
79
- }
80
- return this.nextContent.title
77
+ return this.nextContent.fileName || this.nextContent.title || this.url
81
78
  },
82
79
  size () {
83
80
  return this.nextContent.totalLen
@@ -1,7 +1,24 @@
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="allowDefrost">
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">
5
22
  <template v-if="defrostMsg">
6
23
  <div class="sdk-chat-control-image__defrost">
7
24
  <div class="sdk-chat-control-image__defrost-icon">
@@ -76,6 +93,7 @@
76
93
  </template>
77
94
  <script>
78
95
  import { Image as UiImage, Button as UiButton, Icon as UiIcon, Loading as UiLoading } from '@aochuang/common/components'
96
+ import { parse } from '../../../utils/json'
79
97
  import { isOriginImage, getNewImageSrc} from './util'
80
98
 
81
99
  export default {
@@ -98,7 +116,17 @@ export default {
98
116
  }
99
117
  },
100
118
  content: {
101
- type: String
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
102
130
  },
103
131
  maxWidth: {
104
132
  type: Number,
@@ -150,12 +178,35 @@ export default {
150
178
  },
151
179
  data () {
152
180
  return {
181
+ downloading: false,
182
+ downloaded: false,
183
+ nextContent: null,
153
184
  defrostMsg: null,
154
185
  errorMsg: null
155
186
  }
156
187
  },
157
188
  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
+ },
158
203
  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
+ }
159
210
  return this.content
160
211
  },
161
212
  innerWidth () {
@@ -210,6 +261,9 @@ export default {
210
261
  return !!this.defrostMethod
211
262
  }
212
263
  },
264
+ created () {
265
+ this.syncContentState()
266
+ },
213
267
  methods: {
214
268
  handleClick () {
215
269
  this.$emit('click')
@@ -217,6 +271,39 @@ export default {
217
271
  handleImageClick () {
218
272
  this.imageClickMethod && this.imageClickMethod()
219
273
  },
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
+ },
220
307
  handleError () {
221
308
  if (!this.defrostMethod) {
222
309
  return
@@ -236,7 +323,22 @@ export default {
236
323
  handleRefreshClick () {
237
324
  this.errorMsg = null
238
325
  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
239
333
  }
334
+ },
335
+ watch: {
336
+ content () {
337
+ this.syncContentState()
338
+ }
339
+ },
340
+ beforeDestroy () {
341
+ this.cancelDownloadMethod && this.cancelDownloadMethod()
240
342
  }
241
343
  }
242
344
  </script>
@@ -277,6 +379,39 @@ export default {
277
379
  display: inline-block;
278
380
  line-height: 1em;
279
381
  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%;
280
415
  }
281
416
  .sdk-chat-control-image__hd{
282
417
  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 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'
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'
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
- // WechatChatControlConfig,
104
- // WechatChatControlConfigMsg,
105
- // WechatChatControlConfigItem
103
+ WeworkChatControlConfig,
104
+ WeworkChatControlConfigMsg,
105
+ WeworkChatControlConfigItem
106
106
  }
@@ -31,6 +31,21 @@
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
+
34
49
  export default {
35
50
  name: 'SdkChatControlText',
36
51
  components: {
@@ -63,23 +78,27 @@ export default {
63
78
  },
64
79
  computed: {
65
80
  nextContent () {
66
- return this.content
81
+ return parseTextContent(this.content)
67
82
  },
68
83
  text () {
84
+ if (this.nextContent && typeof this.nextContent === 'object') {
85
+ return this.nextContent.text || ''
86
+ }
69
87
  return this.nextContent
70
88
  },
71
89
  html () {
72
- let content = this.nextContent
90
+ let content = this.text
73
91
  if (this.formatter) {
74
92
  content = this.formatter({
75
93
  content: this.nextContent
76
94
  })
77
95
  } else {
78
- content = html2Escape(content)
96
+ content = html2Escape(String(content || ''))
79
97
  }
80
98
  if (!content) {
81
99
  return ''
82
100
  }
101
+ content = String(content)
83
102
  content = content.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, item => {
84
103
  return `<a href="${item}" target='_blank'>${item}</a>`
85
104
  })
@@ -3,12 +3,12 @@ export const MESSAGE_TYPE = {
3
3
  TEXT_W: 1,
4
4
  IMAGE: 14,
5
5
  VOICE: 16,
6
- VIDEO: 23,
6
+ VIDEO: 22,
7
7
  CUSTOM_EXPRESSION: 29,
8
8
  CUSTOM_EXPRESSION_W: 104,
9
9
  // MUSIC: 1040187441,
10
10
  // ROOM_CALLING: 64,
11
- SHARE_CARD: 41,
11
+ SHARE_CARD: 31,
12
12
  // COMPANY_CARD: 41,
13
13
  // VIDEO: 43,
14
14
  // CUSTOM_EXPRESSION: 47,
@@ -66,6 +66,14 @@ 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
+
69
77
  /**
70
78
  * 格式化为短消息
71
79
  */
@@ -73,10 +81,8 @@ export function formatShortMessage (msgType, msgContent) {
73
81
  let shortMessage = msgContent
74
82
  switch (msgType) {
75
83
  case MESSAGE_TYPE.TEXT:
76
- shortMessage = msgContent
77
- break
78
84
  case MESSAGE_TYPE.TEXT_W:
79
- shortMessage = msgContent
85
+ shortMessage = getTextContent(msgContent)
80
86
  break
81
87
  case MESSAGE_TYPE.TEXT_WITH_AT:
82
88
  let {atId, content, text} = toJson(msgContent) || {}
@@ -224,4 +230,4 @@ export function formatShortSessionMessage (session, contextFn) {
224
230
  }
225
231
  }
226
232
  return formatShortMessage(session.lastMsgType, session.lastMsgContent)
227
- }
233
+ }
@@ -147,7 +147,9 @@ 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.videoPath) {
150
+ if (this.nextContent.resPath) {
151
+ url = this.nextContent.resPath
152
+ } else if (this.nextContent.videoPath) {
151
153
  url = this.nextContent.videoPath
152
154
  } else {
153
155
  url = this.nextContent.tencentUrl
@@ -163,7 +165,7 @@ export default {
163
165
  if (!this.nextContent) {
164
166
  return
165
167
  }
166
- return this.nextContent.previewImgUrl
168
+ return this.nextContent.resCoverPath || this.nextContent.previewImgUrl
167
169
  },
168
170
  innerCover () {
169
171
  return formatOssPath(this.cover)
@@ -202,6 +204,12 @@ export default {
202
204
  throw new Error('不支持的更新属性' + prop)
203
205
  }
204
206
  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
205
213
  }
206
214
  })
207
215
  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.url || this.nextContent.resUrl
135
+ let url = this.nextContent.resPath
136
136
  return url
137
137
  },
138
138
  nextId () {
@@ -0,0 +1,24 @@
1
+ <script>
2
+ export default {
3
+ name: 'SdkWeworkChatControlConfigItem',
4
+ functional: true,
5
+ inject: {
6
+ SdkWeworkChatControlConfig: {
7
+ default: null
8
+ }
9
+ },
10
+ props: {
11
+ /**
12
+ * 消息类型
13
+ */
14
+ msgType: {
15
+ type: [Number, String]
16
+ }
17
+ },
18
+ render (h, c) {
19
+ return c.scopedSlots.default({
20
+ configData: c.injections.SdkWeworkChatControlConfig ? c.injections.SdkWeworkChatControlConfig.getControlConfig(c.props.msgType) : null
21
+ })
22
+ }
23
+ }
24
+ </script>
@@ -0,0 +1,25 @@
1
+ <script>
2
+ export default {
3
+ name: 'SdkWeworkChatControlConfigMsg',
4
+ functional: true,
5
+ inject: {
6
+ SdkWeworkChatControlConfig: {
7
+ default: null
8
+ }
9
+ },
10
+ props: {
11
+ /**
12
+ * 标准的企微客户端消息数据
13
+ */
14
+ msgData: {
15
+ type: Object,
16
+ required: true
17
+ }
18
+ },
19
+ render (h, c) {
20
+ return c.scopedSlots.default({
21
+ configData: c.injections.SdkWeworkChatControlConfig ? c.injections.SdkWeworkChatControlConfig.getMessageConfig(c.props.msgData) : null
22
+ })
23
+ }
24
+ }
25
+ </script>
@@ -1,25 +1,20 @@
1
- <template>
2
- <view class="sdk-wechat-chat-control-config">
3
- <slot></slot>
4
- </view>
5
- </template>
6
1
  <script>
7
2
  export default {
8
- name: 'SdkWechatChatControlConfig',
3
+ name: 'SdkWeworkChatControlConfig',
9
4
  provide () {
10
5
  return {
11
- SdkWechatChatControlConfig: this
6
+ SdkWeworkChatControlConfig: this
12
7
  }
13
8
  },
14
9
  inject: {
15
10
  // 可以继承上级的
16
- SdkWechatChatControlConfig: {
11
+ SdkWeworkChatControlConfig: {
17
12
  default: null
18
13
  }
19
- },
14
+ },
20
15
  props: {
21
16
  /**
22
- * 这个是组件级别的配置,wechatChatPanel是消息级别的配置,后面是消息级别配置覆盖组件级别的配置
17
+ * 这个是组件级别的配置,weworkChatPanel是消息级别的配置,后面是消息级别配置覆盖组件级别的配置
23
18
  * {
24
19
  * 1: {
25
20
  * formatter () {
@@ -39,6 +34,9 @@ export default {
39
34
  type: Function
40
35
  }
41
36
  },
37
+ render () {
38
+ return this.$slots.default
39
+ },
42
40
  methods: {
43
41
  getControlConfig (msgType) {
44
42
  if (!this.controlConfig) {
@@ -47,13 +45,18 @@ export default {
47
45
  return this.controlConfig[msgType]
48
46
  },
49
47
  getMessageConfig (msgData) {
48
+ const controlConfig = this.getControlConfig(msgData.msgType)
50
49
  if (!this.messageConfig) {
51
- return
50
+ return controlConfig
52
51
  }
53
- return this.messageConfig({
52
+ const messageConfig = this.messageConfig({
54
53
  item: msgData
55
54
  })
55
+ if (!messageConfig) {
56
+ return controlConfig
57
+ }
58
+ return Object.assign({}, controlConfig, messageConfig)
56
59
  }
57
60
  }
58
61
  }
59
- </script>
62
+ </script>
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <div class="sdk-wework-panel-chat-status">
3
+ <!-- status: 0 success, 1 sending, 2 failed, 3 timeout -->
4
+ <template v-if="data.status === 1">
5
+ <ui-loading size="mini"></ui-loading>
6
+ </template>
7
+ <template v-else-if="data.status === 2">
8
+ <bi-tooltip :text="data.resultMsg || '发送失败'">
9
+ <span class="sdk-wework-panel-chat-status__error">
10
+ <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M512 938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667z m0-486.997334L391.338667 330.965333 330.965333 391.338667 451.669333 512l-120.704 120.661333 60.373334 60.373334L512 572.330667l120.661333 120.704 60.373334-60.373334L572.330667 512l120.704-120.661333-60.373334-60.373334L512 451.669333z" fill="currentColor"></path></svg>
11
+ </span>
12
+ </bi-tooltip>
13
+ </template>
14
+ <template v-else-if="data.status === 3">
15
+ <bi-tooltip :text="data.resultMsg || '发送超时'">
16
+ <span class="sdk-wework-panel-chat-status__error">
17
+ <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M512 938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667z m42.666667-426.666667V298.666667h-85.333334v298.666666h256v-85.333333h-170.666666z" fill="currentColor"></path></svg>
18
+ </span>
19
+ </bi-tooltip>
20
+ </template>
21
+ <template v-if="data.recalled">
22
+ <bi-tooltip text="消息已撤回">
23
+ <span class="sdk-wework-panel-chat-status__error sdk-wework-panel-chat-status__recalled">
24
+ <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M512 0c282.752 0 512 229.248 512 512s-229.248 512-512 512S0 794.752 0 512 229.248 0 512 0z m-50.261333 255.317333c-7.765333-39.338667-39.893333-15.36-39.893334-15.36l-213.76 192c-47.616 34.944-2.730667 60.458667-2.730666 60.458667l211.541333 190.933333c42.410667 33.066667 45.866667-17.749333 45.866667-17.749333v-86.442667c215.125333-70.144 303.36 208.341333 303.36 208.341334 7.936 15.957333 13.824 0 13.824 0C862.933333 368.682667 461.952 348.586667 461.952 348.586667z" fill="currentColor"></path></svg>
25
+ </span>
26
+ </bi-tooltip>
27
+ </template>
28
+ </div>
29
+ </template>
30
+
31
+ <script>
32
+ import { Tooltip as BiTooltip } from '@aochuang/common/common'
33
+ import { Loading as UiLoading } from '@aochuang/common/components'
34
+
35
+ export default {
36
+ name: 'SdkWeworkPanelChatStatus',
37
+ components: {
38
+ BiTooltip,
39
+ UiLoading
40
+ },
41
+ props: {
42
+ data: {
43
+ type: Object,
44
+ required: true
45
+ },
46
+ updateChatBoxProp: {
47
+ type: Function
48
+ }
49
+ }
50
+ }
51
+ </script>
52
+
53
+ <style lang="less">
54
+ .sdk-wework-panel-chat-status__error {
55
+ display: flex;
56
+ flex-direction: row;
57
+ align-items: center;
58
+ font-size: 12px;
59
+ color: #c00;
60
+ width: 16px;
61
+ height: 16px;
62
+ svg {
63
+ width: 100%;
64
+ height: 100%;
65
+ }
66
+ }
67
+ .sdk-wework-panel-chat-status__recalled {
68
+ opacity: .6;
69
+ }
70
+ .sdk-wework-panel-chat-status {
71
+ margin: 0 6px;
72
+ }
73
+ </style>