@aochuang/client-sdk 1.0.370 → 1.0.372

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 (164) hide show
  1. package/common/.DS_Store +0 -0
  2. package/components/.DS_Store +0 -0
  3. package/components/index.js +6 -1
  4. package/components/session-select/session-select-item.vue +8 -9
  5. package/components/wechat-chat-control/.DS_Store +0 -0
  6. package/components/wechat-chat-control/transfer/.DS_Store +0 -0
  7. package/components/wechat-chat-control/url/.DS_Store +0 -0
  8. package/components/wechat-chat-control/voice/.DS_Store +0 -0
  9. package/components/wework-chat-control/channel-card/channel-card.vue +144 -0
  10. package/components/wework-chat-control/channel-live/channel-live.vue +7 -2
  11. package/components/wework-chat-control/company-card/company-card.vue +1 -1
  12. package/components/wework-chat-control/custom-expression/custom-expression.vue +2 -1
  13. package/components/wework-chat-control/file-url/file-url.vue +34 -16
  14. package/components/wework-chat-control/image/image.vue +137 -2
  15. package/components/wework-chat-control/index.js +15 -7
  16. package/components/wework-chat-control/link/.DS_Store +0 -0
  17. package/components/wework-chat-control/location/location.vue +3 -3
  18. package/components/wework-chat-control/merge-message/merge-message-panel.vue +63 -0
  19. package/components/wework-chat-control/merge-message/merge-message.vue +84 -0
  20. package/components/wework-chat-control/merge-message/util.js +59 -0
  21. package/components/wework-chat-control/metting/enterprise-wechat.png +0 -0
  22. package/components/wework-chat-control/metting/meeting-video.svg +4 -0
  23. package/components/wework-chat-control/metting/metting.vue +181 -0
  24. package/components/wework-chat-control/red-envelopes/red-envelopes.vue +3 -2
  25. package/components/wework-chat-control/text/text-default.vue +99 -0
  26. package/components/wework-chat-control/text/text-quote.vue +105 -0
  27. package/components/wework-chat-control/text/text.vue +24 -144
  28. package/components/wework-chat-control/url/url-channel-live.vue +53 -0
  29. package/components/wework-chat-control/url/url-miniprogram.vue +6 -7
  30. package/components/wework-chat-control/url/url.vue +26 -2
  31. package/components/wework-chat-control/util.js +26 -17
  32. package/components/wework-chat-control/video/.DS_Store +0 -0
  33. package/components/wework-chat-control/video/video.vue +10 -2
  34. package/components/wework-chat-control/voice/voice.vue +9 -2
  35. package/components/wework-chat-control/wework-chat-control-config-item.vue +24 -0
  36. package/components/wework-chat-control/wework-chat-control-config-msg.vue +25 -0
  37. package/{uni-components/chat-control/chat-control-config.vue → components/wework-chat-control/wework-chat-control-config.vue} +16 -13
  38. package/components/wework-chat-panel/chat-panel-chat-status/chat-panel-chat-status.vue +73 -0
  39. package/components/wework-chat-panel/chat-panel-item.vue +56 -25
  40. package/components/wework-chat-panel/chat-panel.vue +96 -13
  41. package/package.json +10 -3
  42. package/services/.DS_Store +0 -0
  43. package/services/client-chat/client-chat-wechat/client-chat.js +0 -6
  44. package/services/client-chat/client-chat-wework/client-chat-account.js +84 -1
  45. package/services/client-chat/client-chat-wework/client-chat-concats.js +81 -17
  46. package/services/client-chat/client-chat-wework/client-chat-message.js +45 -5
  47. package/services/client-chat/client-chat-wework/client-chat-session.js +59 -4
  48. package/services/client-chat/client-chat-wework/client-chat-socket.js +13 -1
  49. package/services/client-chat/client-chat-wework/client-chat.js +320 -11
  50. package/services/client-chat/client-chat-wework/utils.js +5 -5
  51. package/components/wework-chat-panel/chat-panel-controls/company-card/company-card.vue +0 -35
  52. package/components/wework-chat-panel/chat-panel-controls/expression/expression.vue +0 -36
  53. package/components/wework-chat-panel/chat-panel-controls/file-url/file-url.vue +0 -35
  54. package/components/wework-chat-panel/chat-panel-controls/image/image.vue +0 -36
  55. package/components/wework-chat-panel/chat-panel-controls/index.js +0 -35
  56. package/components/wework-chat-panel/chat-panel-controls/jx-sys-text/jx-sys-text.vue +0 -28
  57. package/components/wework-chat-panel/chat-panel-controls/link/link.vue +0 -35
  58. package/components/wework-chat-panel/chat-panel-controls/location/location.vue +0 -35
  59. package/components/wework-chat-panel/chat-panel-controls/text/text.vue +0 -43
  60. package/components/wework-chat-panel/chat-panel-controls/unkonw/unkonw.vue +0 -39
  61. package/components/wework-chat-panel/chat-panel-controls/video/video.vue +0 -37
  62. package/components/wework-chat-panel/chat-panel-controls/voice/voice.vue +0 -35
  63. package/uni-common/account-portray/account-portray.vue +0 -51
  64. package/uni-common/account-select/account-select-item.vue +0 -172
  65. package/uni-common/account-select/account-select.vue +0 -252
  66. package/uni-common/all-friend-avatar/all-friend-avatar.vue +0 -49
  67. package/uni-common/friend-avatar/default.svg +0 -1
  68. package/uni-common/friend-avatar/friend-avatar.vue +0 -27
  69. package/uni-common/friend-avatar/index.js +0 -3
  70. package/uni-common/friend-loader/friend-loader.vue +0 -53
  71. package/uni-common/friend-portray/friend-portray.vue +0 -56
  72. package/uni-common/group-avatar/default.svg +0 -1
  73. package/uni-common/group-avatar/group-avatar.vue +0 -18
  74. package/uni-common/group-avatar/index.js +0 -3
  75. package/uni-common/room-avatar/default.svg +0 -6
  76. package/uni-common/room-avatar/index.js +0 -3
  77. package/uni-common/room-avatar/room-avatar.vue +0 -27
  78. package/uni-common/room-loader/room-loader.vue +0 -53
  79. package/uni-common/room-portray/room-portray.vue +0 -56
  80. package/uni-components/chat-control/calling/calling.vue +0 -91
  81. package/uni-components/chat-control/calling/phone-fill.svg +0 -1
  82. package/uni-components/chat-control/calling/vidicon-fill.svg +0 -1
  83. package/uni-components/chat-control/channel-video/channel-video.vue +0 -89
  84. package/uni-components/chat-control/channel-video-card/channel-video-card.vue +0 -105
  85. package/uni-components/chat-control/channel-video-live/channel-video-live.vue +0 -92
  86. package/uni-components/chat-control/chat-control-config-item/chat-control-config-item.vue +0 -20
  87. package/uni-components/chat-control/chat-control-config-item/index.js +0 -3
  88. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-app.vue +0 -25
  89. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-h5.vue +0 -21
  90. package/uni-components/chat-control/chat-control.vue +0 -218
  91. package/uni-components/chat-control/company-card/company-card.vue +0 -123
  92. package/uni-components/chat-control/const.js +0 -28
  93. package/uni-components/chat-control/expression/expression.vue +0 -41
  94. package/uni-components/chat-control/image/image.vue +0 -68
  95. package/uni-components/chat-control/index.js +0 -89
  96. package/uni-components/chat-control/location/location.vue +0 -110
  97. package/uni-components/chat-control/member-change/member-change.vue +0 -32
  98. package/uni-components/chat-control/quote-message/quote-message.vue +0 -216
  99. package/uni-components/chat-control/real-time-position/real-time-position.vue +0 -62
  100. package/uni-components/chat-control/redpacket/red-envelope.svg +0 -1
  101. package/uni-components/chat-control/redpacket/redpacket.vue +0 -75
  102. package/uni-components/chat-control/share-card/share-card.vue +0 -101
  103. package/uni-components/chat-control/system/system.vue +0 -69
  104. package/uni-components/chat-control/system-batch-message/system-batch-message.vue +0 -30
  105. package/uni-components/chat-control/system-text/system-text.vue +0 -32
  106. package/uni-components/chat-control/text/text.vue +0 -67
  107. package/uni-components/chat-control/text-with-at/text-with-at.vue +0 -51
  108. package/uni-components/chat-control/transfer/red-transfer.svg +0 -1
  109. package/uni-components/chat-control/transfer/transfer.vue +0 -80
  110. package/uni-components/chat-control/unkonw/unkonw.vue +0 -37
  111. package/uni-components/chat-control/url/icons/file-excel-line.svg +0 -1
  112. package/uni-components/chat-control/url/icons/file-info-line.svg +0 -1
  113. package/uni-components/chat-control/url/icons/file-music-line.svg +0 -1
  114. package/uni-components/chat-control/url/icons/file-pdf-line.svg +0 -1
  115. package/uni-components/chat-control/url/icons/file-ppt-line.svg +0 -1
  116. package/uni-components/chat-control/url/icons/file-settings-line.svg +0 -1
  117. package/uni-components/chat-control/url/icons/file-text-line.svg +0 -1
  118. package/uni-components/chat-control/url/icons/file-unknow-line.svg +0 -1
  119. package/uni-components/chat-control/url/icons/file-word-line.svg +0 -1
  120. package/uni-components/chat-control/url/icons/file-zip-line.svg +0 -1
  121. package/uni-components/chat-control/url/icons/index.js +0 -24
  122. package/uni-components/chat-control/url/miniprogram.svg +0 -1
  123. package/uni-components/chat-control/url/url-miniprogram.vue +0 -116
  124. package/uni-components/chat-control/url/url.vue +0 -306
  125. package/uni-components/chat-control/url-new/icons/file-excel-line.svg +0 -1
  126. package/uni-components/chat-control/url-new/icons/file-info-line.svg +0 -1
  127. package/uni-components/chat-control/url-new/icons/file-music-line.svg +0 -1
  128. package/uni-components/chat-control/url-new/icons/file-pdf-line.svg +0 -1
  129. package/uni-components/chat-control/url-new/icons/file-ppt-line.svg +0 -1
  130. package/uni-components/chat-control/url-new/icons/file-settings-line.svg +0 -1
  131. package/uni-components/chat-control/url-new/icons/file-text-line.svg +0 -1
  132. package/uni-components/chat-control/url-new/icons/file-unknow-line.svg +0 -1
  133. package/uni-components/chat-control/url-new/icons/file-word-line.svg +0 -1
  134. package/uni-components/chat-control/url-new/icons/file-zip-line.svg +0 -1
  135. package/uni-components/chat-control/url-new/icons/index.js +0 -24
  136. package/uni-components/chat-control/url-new/url-new.vue +0 -110
  137. package/uni-components/chat-control/utils.js +0 -12
  138. package/uni-components/chat-control/video/video.vue +0 -156
  139. package/uni-components/chat-control/voice/voice.vue +0 -166
  140. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-collect.vue +0 -84
  141. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-system.vue +0 -28
  142. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet.vue +0 -85
  143. package/uni-components/chat-editor/chat-editor-func/chat-editor-func.vue +0 -157
  144. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at-panel.vue +0 -158
  145. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at.vue +0 -61
  146. package/uni-components/chat-editor/chat-editor-func-button/chat-editor-func-button.vue +0 -58
  147. package/uni-components/chat-editor/chat-editor-func-file/chat-editor-func-file.vue +0 -54
  148. package/uni-components/chat-editor/chat-editor-func-image/chat-editor-func-image.vue +0 -42
  149. package/uni-components/chat-editor/chat-editor-func-video/chat-editor-func-video.vue +0 -42
  150. package/uni-components/chat-editor/chat-editor-func-voice/chat-editor-func-voice.vue +0 -25
  151. package/uni-components/chat-editor/chat-editor-message-send/chat-editor-message-send.vue +0 -158
  152. package/uni-components/chat-editor/chat-editor-quote/chat-editor-quote.vue +0 -75
  153. package/uni-components/chat-editor/chat-editor.vue +0 -257
  154. package/uni-components/chat-editor/index.js +0 -10
  155. package/uni-components/chat-editor/util.js +0 -65
  156. package/uni-components/chat-panel/chat-panel-chats-box.vue +0 -238
  157. package/uni-components/chat-panel/chat-panel-chats-forward/chat-panel-chats-forward.vue +0 -273
  158. package/uni-components/chat-panel/chat-panel-chats-item.vue +0 -578
  159. package/uni-components/chat-panel/chat-panel-chats-status/chat-panel-chats-status.vue +0 -71
  160. package/uni-components/chat-panel/chat-panel-chats.vue +0 -368
  161. package/uni-components/chat-panel/chat-panel.vue +0 -227
  162. package/uni-components/contacts-group-select/contacts-group-select-item.vue +0 -85
  163. package/uni-components/contacts-group-select/contacts-group-select-panel.vue +0 -119
  164. package/uni-components/contacts-group-select/contacts-group-select.vue +0 -150
@@ -1,157 +1,37 @@
1
1
  <template>
2
- <div
3
- class="sdk-chat-wework-control-text"
4
- :class="['sdk-chat-wework-control-text--' + type]"
5
- >
6
- <div class="sdk-chat-wework-control-text__main">
7
- <template v-if="hasScroll">
8
- <ui-popover
9
- :value="showPopover"
10
- @input="handleShowPopoverChange"
11
- >
12
- <template slot="reference">
13
- <div class="sdk-chat-wework-control-text__content"
14
- v-html="html"
15
- ref="popoverContent"
16
- ></div>
17
- </template>
18
- <div class="sdk-chat-wework-control-text__popover" v-html="html" :style="{'width': popoverWidth}"></div>
19
- </ui-popover>
20
- </template>
21
- <template v-else>
22
- <div class="sdk-chat-wework-control-text__content"
23
- v-html="html"
24
- ref="content"
25
- ></div>
26
- </template>
27
- </div>
28
- </div>
2
+ <component
3
+ :is="contentObject && contentObject.quote ? quoteComponent : defaultComponent"
4
+ v-bind="componentProps"
5
+ ></component>
29
6
  </template>
30
7
  <script>
31
- import { Popover as UiPopover } from '@aochuang/common/components'
32
- import { html2Escape } from '../../../utils/string'
8
+ import TextDefault from './text-default.vue'
9
+ import TextQuote from './text-quote.vue'
10
+
11
+ function parseContent (content) {
12
+ if (typeof content !== 'string') return content
13
+ try { return JSON.parse(content) } catch (e) { return content }
14
+ }
33
15
 
34
16
  export default {
35
17
  name: 'SdkChatControlText',
36
- components: {
37
- UiPopover
38
- },
18
+ components: {TextDefault, TextQuote},
19
+ inheritAttrs: false,
39
20
  props: {
40
- id: {
41
- type: String
42
- },
43
- content: {
44
- type: String
45
- },
46
- type: {
47
- type: String,
48
- default: 'default',
49
- validator (value) {
50
- return ['quote', 'default', 'thumb'].includes(value)
51
- }
52
- },
53
- formatter: {
54
- type: Function
55
- }
56
- },
57
- data () {
58
- return {
59
- hasScroll: false,
60
- showPopover: false,
61
- popoverWidth: null
62
- }
21
+ id: {type: String},
22
+ content: {type: [String, Object]},
23
+ type: {type: String, default: 'default'},
24
+ formatter: {type: Function},
25
+ getQuoteMessage: {type: Function},
26
+ setChatBoxFootVnode: {type: Function}
63
27
  },
64
28
  computed: {
65
- nextContent () {
66
- return this.content
67
- },
68
- text () {
69
- return this.nextContent
70
- },
71
- html () {
72
- let content = this.nextContent
73
- if (this.formatter) {
74
- content = this.formatter({
75
- content: this.nextContent
76
- })
77
- } else {
78
- content = html2Escape(content)
79
- }
80
- if (!content) {
81
- return ''
82
- }
83
- content = content.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, item => {
84
- return `<a href="${item}" target='_blank'>${item}</a>`
85
- })
86
- return content.trim()
87
- }
88
- },
89
- mounted () {
90
- if (this.$refs.content) {
91
- this.hasScroll = this.$refs.content.scrollHeight > this.$refs.content.clientHeight
92
- }
93
- },
94
- methods: {
95
- handleShowPopoverChange (visible) {
96
- if (this.$refs.popoverContent && visible) {
97
- this.popoverWidth = this.$refs.popoverContent.offsetWidth + 'px'
98
- }
99
- this.$nextTick(() => {
100
- this.showPopover = visible
101
- })
29
+ contentObject () { return parseContent(this.content) },
30
+ defaultComponent () { return TextDefault },
31
+ quoteComponent () { return TextQuote },
32
+ componentProps () {
33
+ return Object.assign({}, this.$attrs, this.$props, {getQuoteMessage: this.getQuoteMessage})
102
34
  }
103
35
  }
104
36
  }
105
37
  </script>
106
- <style lang="less">
107
- .sdk-chat-wework-control-text--default {
108
- .sdk-chat-wework-control-text__main{
109
- padding: 10px;
110
- }
111
- }
112
- .sdk-chat-wework-control-text--quote {
113
- .sdk-chat-wework-control-text__content{
114
- display: -webkit-box;
115
- -webkit-box-orient: vertical;
116
- -webkit-line-clamp: 2; /* 限制显示3行 */
117
- overflow: hidden;
118
- max-width: 420px;
119
- }
120
- }
121
- .sdk-chat-wework-control-text--thumb {
122
- background-color: #fff;
123
- border: 1px solid #eee;
124
- border-radius: 3px;
125
- padding: 6px 10px;
126
- .sdk-chat-wework-control-text__content{
127
- display: -webkit-box;
128
- -webkit-box-orient: vertical;
129
- -webkit-line-clamp: 3; /* 限制显示3行 */
130
- overflow: hidden;
131
- }
132
- }
133
- .sdk-chat-wework-control-text__main{
134
- white-space: pre-wrap;
135
- line-height: 1.5em;
136
- word-break: break-all;
137
- img {
138
- vertical-align: top;
139
- }
140
- a {
141
- color: #4387ff;
142
- &:hover {
143
- color: #4387ff;
144
- text-decoration: underline;
145
- }
146
- }
147
- }
148
- .sdk-chat-wework-control-text__popover{
149
- white-space: pre-wrap;
150
- line-height: 1.5em;
151
- word-break: break-all;
152
- padding: 10px;
153
- img {
154
- vertical-align: top;
155
- }
156
- }
157
- </style>
@@ -0,0 +1,53 @@
1
+ <script>
2
+ import { parse } from '../../../utils/json'
3
+ import ChannelLive from '../channel-live/channel-live'
4
+
5
+ export default {
6
+ name: 'SdkWeworkControlUrlChannelLive',
7
+ props: {
8
+ id: {
9
+ type: String
10
+ },
11
+ content: {
12
+ type: [String, Object]
13
+ },
14
+ type: {
15
+ type: String,
16
+ default: 'default',
17
+ validator (value) {
18
+ return ['quote', 'default', 'thumb'].includes(value)
19
+ }
20
+ },
21
+ updateChatBoxProp: {
22
+ type: Function
23
+ }
24
+ },
25
+ computed: {
26
+ nextContent () {
27
+ return parse(this.content) || {}
28
+ },
29
+ channelLiveContent () {
30
+ return {
31
+ url: this.nextContent.url,
32
+ coverUrl: this.nextContent.imageUrl,
33
+ nickname: this.nextContent.desc,
34
+ desc: (this.nextContent.title || '').replace(/^\[视频号直播\]\s*/, '')
35
+ }
36
+ }
37
+ },
38
+ created () {
39
+ if (this.nextContent.url && this.updateChatBoxProp) {
40
+ this.updateChatBoxProp('href', this.nextContent.url)
41
+ }
42
+ },
43
+ render (h) {
44
+ return h(ChannelLive, {
45
+ props: {
46
+ id: this.id,
47
+ content: this.channelLiveContent,
48
+ type: this.type
49
+ }
50
+ })
51
+ }
52
+ }
53
+ </script>
@@ -50,7 +50,7 @@
50
50
  </div>
51
51
  </template>
52
52
  <script>
53
- import { parse, parseXml } from '../../../utils/json'
53
+ import { parse } from '../../../utils/json'
54
54
  import { formatOssPath } from '@aochuang/common/utils/oss'
55
55
 
56
56
  export default {
@@ -76,26 +76,25 @@ export default {
76
76
  return parse(this.content)
77
77
  },
78
78
  miniprogramData () {
79
- let data = null
80
79
  if (!this.nextContent) {
81
- return data
80
+ return {}
82
81
  }
83
82
  return this.nextContent
84
83
  },
85
84
  icon () {
86
- return this.miniprogramData.weappIconUrl
85
+ return formatOssPath(this.miniprogramData.iconUrl)
87
86
  },
88
87
  title () {
89
88
  return this.miniprogramData.title
90
89
  },
91
90
  url () {
92
- return this.miniprogramData.msg && this.miniprogramData.msg.appmsg ? this.miniprogramData.msg.appmsg.url : ''
91
+ return this.miniprogramData.url
93
92
  },
94
93
  desc () {
95
- return this.miniprogramData.appName
94
+ return this.miniprogramData.desc
96
95
  },
97
96
  cover () {
98
- return this.miniprogramData.thumbOssUrl
97
+ return formatOssPath(this.miniprogramData.resPath || this.miniprogramData.coverUrl)
99
98
  },
100
99
  border () {
101
100
  return !this.SdkChatPanelBox
@@ -4,6 +4,24 @@ import UrlMerge from './url-merge'
4
4
  import UrlMiniprogram from './url-miniprogram'
5
5
  import UrlFile from './url-file'
6
6
  import UrlLink from './url-link'
7
+ import UrlChannelLive from './url-channel-live'
8
+ import ChannelCard from '../channel-card/channel-card'
9
+
10
+ const CHANNEL_CARD_TITLE_PREFIX = '[视频号名片]'
11
+
12
+ function isChannelLiveUrl (url) {
13
+ try {
14
+ return new URL(url).hostname === 'channels.weixin.qq.com'
15
+ } catch (e) {
16
+ return false
17
+ }
18
+ }
19
+
20
+ function isChannelCardContent (content) {
21
+ return isChannelLiveUrl(content && content.url) &&
22
+ typeof content.title === 'string' &&
23
+ content.title.startsWith(CHANNEL_CARD_TITLE_PREFIX)
24
+ }
7
25
 
8
26
  export default {
9
27
  name: 'SdkChatPanelControlsUrl',
@@ -55,7 +73,7 @@ export default {
55
73
  beforeLoad: props.beforeLoadMergeMethod
56
74
  }
57
75
  })
58
- } else if (content.type === 2) {
76
+ } else if (content.contentType === 78) {
59
77
  return h(UrlMiniprogram, {
60
78
  props: {
61
79
  id: props.id,
@@ -88,7 +106,13 @@ export default {
88
106
  }
89
107
  }
90
108
  }
91
- return h(UrlLink, {
109
+ let component = UrlLink
110
+ if (isChannelCardContent(content)) {
111
+ component = ChannelCard
112
+ } else if (isChannelLiveUrl(content && content.url)) {
113
+ component = UrlChannelLive
114
+ }
115
+ return h(component, {
92
116
  props: {
93
117
  id: props.id,
94
118
  content,
@@ -1,14 +1,15 @@
1
1
  export const MESSAGE_TYPE = {
2
2
  TEXT: 0,
3
3
  TEXT_W: 1,
4
+ MERGE_MESSAGE: 4,
4
5
  IMAGE: 14,
6
+ URLFile: 15,
5
7
  VOICE: 16,
6
- VIDEO: 23,
8
+ VIDEO: 22,
7
9
  CUSTOM_EXPRESSION: 29,
8
- CUSTOM_EXPRESSION_W: 104,
9
10
  // MUSIC: 1040187441,
10
11
  // ROOM_CALLING: 64,
11
- SHARE_CARD: 41,
12
+ SHARE_CARD: 31,
12
13
  // COMPANY_CARD: 41,
13
14
  // VIDEO: 43,
14
15
  // CUSTOM_EXPRESSION: 47,
@@ -32,7 +33,8 @@ export const MESSAGE_TYPE = {
32
33
  // QUOTE_MESSAGE: 822083633,
33
34
  CHANNEL_VIDEO: 141,
34
35
  // CHANNEL_VIDEO_CARD: 771751985, // 视频号名片
35
- CHANNEL_VIDEO_LIVE: 146 // 视频号直播
36
+ CHANNEL_VIDEO_LIVE: 146, // 视频号直播
37
+ MEETING: 579
36
38
  }
37
39
 
38
40
  function html2Escape (sHtml) {
@@ -66,6 +68,14 @@ function toJson (data) {
66
68
  return data
67
69
  }
68
70
 
71
+ function getTextContent (content) {
72
+ const data = typeof content === 'string' ? toJson(content) : content
73
+ if (data && typeof data === 'object') {
74
+ return data.text || ''
75
+ }
76
+ return content
77
+ }
78
+
69
79
  /**
70
80
  * 格式化为短消息
71
81
  */
@@ -73,10 +83,8 @@ export function formatShortMessage (msgType, msgContent) {
73
83
  let shortMessage = msgContent
74
84
  switch (msgType) {
75
85
  case MESSAGE_TYPE.TEXT:
76
- shortMessage = msgContent
77
- break
78
86
  case MESSAGE_TYPE.TEXT_W:
79
- shortMessage = msgContent
87
+ shortMessage = getTextContent(msgContent)
80
88
  break
81
89
  case MESSAGE_TYPE.TEXT_WITH_AT:
82
90
  let {atId, content, text} = toJson(msgContent) || {}
@@ -85,6 +93,9 @@ export function formatShortMessage (msgType, msgContent) {
85
93
  case MESSAGE_TYPE.IMAGE:
86
94
  shortMessage = '[图片消息]'
87
95
  break
96
+ case MESSAGE_TYPE.MERGE_MESSAGE:
97
+ shortMessage = '[聊天记录]'
98
+ break
88
99
  case MESSAGE_TYPE.VIDEO:
89
100
  shortMessage = '[视频消息]'
90
101
  break
@@ -105,20 +116,15 @@ export function formatShortMessage (msgType, msgContent) {
105
116
  case MESSAGE_TYPE.SYSTEM:
106
117
  shortMessage = formatSystemMessage(msgContent)
107
118
  break
119
+ case MESSAGE_TYPE.URLFile:
120
+ shortMessage = '[文件消息]'
121
+ break
108
122
  case MESSAGE_TYPE.URL:
109
123
  case MESSAGE_TYPE.URLNew:
110
124
  const jsonObj = toJson(msgContent)
111
125
  if (typeof jsonObj === 'object') {
112
- if(jsonObj.type === 'file') {
113
- shortMessage = '[文件消息]'
114
- } else if(jsonObj.type === 'link') {
115
- shortMessage = '[链接消息]'
116
- } else if(jsonObj.type === 'miniprogram') {
126
+ if(jsonObj.contentType === 78) {
117
127
  shortMessage = '[小程序消息]'
118
- } else if (jsonObj.type === 'music') {
119
- shortMessage = '[音乐消息]'
120
- } else if (jsonObj.type === 'merged') {
121
- shortMessage = '[合并消息]'
122
128
  } else {
123
129
  shortMessage = '[链接消息]'
124
130
  }
@@ -160,6 +166,9 @@ export function formatShortMessage (msgType, msgContent) {
160
166
  case MESSAGE_TYPE.CHANNEL_VIDEO_LIVE:
161
167
  shortMessage = '[视频号直播]'
162
168
  break
169
+ case MESSAGE_TYPE.MEETING:
170
+ shortMessage = '[会议消息]'
171
+ break
163
172
  case MESSAGE_TYPE.ROOM_CALLING:
164
173
  case MESSAGE_TYPE.CALLING:
165
174
  shortMessage = '[语音通话消息]'
@@ -224,4 +233,4 @@ export function formatShortSessionMessage (session, contextFn) {
224
233
  }
225
234
  }
226
235
  return formatShortMessage(session.lastMsgType, session.lastMsgContent)
227
- }
236
+ }
@@ -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) {
@@ -53,6 +53,7 @@
53
53
  import { parse } from '../../../utils/json'
54
54
  import { unique } from '../../../utils/string'
55
55
  import AcVoicePlayer from '@aochuang/common/common/voice-player'
56
+ import { formatOssPath } from '@aochuang/common/utils/oss'
56
57
 
57
58
  const ConvertStatusEnum = {
58
59
  NORMAL: -1, // 没有转换
@@ -132,8 +133,14 @@ export default {
132
133
  return parse(this.content) || {}
133
134
  },
134
135
  voiceSrc () {
135
- let url = this.nextContent.url || this.nextContent.resUrl
136
- return url
136
+ if (typeof this.nextContent === 'string') {
137
+ return this.nextContent
138
+ }
139
+ const voiceSrc = this.nextContent.resPath
140
+ if (!voiceSrc) {
141
+ return
142
+ }
143
+ return formatOssPath(voiceSrc)
137
144
  },
138
145
  nextId () {
139
146
  return this.id || unique()
@@ -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>