@aochuang/client-sdk 1.0.351 → 1.0.353

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 (156) hide show
  1. package/components/index.js +6 -1
  2. package/components/session-select/session-select-item.vue +8 -9
  3. package/components/wechat-chat-control/.DS_Store +0 -0
  4. package/components/wechat-chat-control/transfer/.DS_Store +0 -0
  5. package/components/wechat-chat-control/url/.DS_Store +0 -0
  6. package/components/wechat-chat-control/url/url-miniprogram.vue +1 -5
  7. package/components/wechat-chat-control/voice/.DS_Store +0 -0
  8. package/components/wework-chat-control/channel-card/channel-card.vue +144 -0
  9. package/components/wework-chat-control/channel-live/channel-live.vue +7 -2
  10. package/components/wework-chat-control/company-card/company-card.vue +1 -1
  11. package/components/wework-chat-control/custom-expression/custom-expression.vue +2 -1
  12. package/components/wework-chat-control/file-url/file-url.vue +2 -5
  13. package/components/wework-chat-control/image/image.vue +137 -2
  14. package/components/wework-chat-control/index.js +9 -7
  15. package/components/wework-chat-control/link/.DS_Store +0 -0
  16. package/components/wework-chat-control/location/location.vue +3 -3
  17. package/components/wework-chat-control/metting/enterprise-wechat.png +0 -0
  18. package/components/wework-chat-control/metting/meeting-video.svg +4 -0
  19. package/components/wework-chat-control/metting/metting.vue +181 -0
  20. package/components/wework-chat-control/text/text.vue +23 -3
  21. package/components/wework-chat-control/url/url-channel-live.vue +53 -0
  22. package/components/wework-chat-control/url/url-miniprogram.vue +6 -7
  23. package/components/wework-chat-control/url/url.vue +26 -2
  24. package/components/wework-chat-control/util.js +17 -8
  25. package/components/wework-chat-control/video/.DS_Store +0 -0
  26. package/components/wework-chat-control/video/video.vue +10 -2
  27. package/components/wework-chat-control/voice/voice.vue +1 -1
  28. package/components/wework-chat-control/wework-chat-control-config-item.vue +24 -0
  29. package/components/wework-chat-control/wework-chat-control-config-msg.vue +25 -0
  30. package/{uni-components/chat-control/chat-control-config.vue → components/wework-chat-control/wework-chat-control-config.vue} +16 -13
  31. package/components/wework-chat-panel/chat-panel-chat-status/chat-panel-chat-status.vue +73 -0
  32. package/components/wework-chat-panel/chat-panel-item.vue +25 -41
  33. package/components/wework-chat-panel/chat-panel.vue +96 -13
  34. package/package.json +10 -3
  35. package/services/client-chat/client-chat-wechat/client-chat-session.js +92 -196
  36. package/services/client-chat/client-chat-wechat/client-chat.js +33 -20
  37. package/services/client-chat/client-chat-wework/client-chat-concats.js +81 -17
  38. package/services/client-chat/client-chat-wework/client-chat-message.js +45 -5
  39. package/services/client-chat/client-chat-wework/client-chat-session.js +50 -2
  40. package/services/client-chat/client-chat-wework/client-chat-socket.js +9 -1
  41. package/services/client-chat/client-chat-wework/client-chat.js +281 -11
  42. package/services/client-chat/client-chat-wework/utils.js +5 -5
  43. package/components/wework-chat-panel/chat-panel-controls/company-card/company-card.vue +0 -35
  44. package/components/wework-chat-panel/chat-panel-controls/expression/expression.vue +0 -36
  45. package/components/wework-chat-panel/chat-panel-controls/file-url/file-url.vue +0 -35
  46. package/components/wework-chat-panel/chat-panel-controls/image/image.vue +0 -36
  47. package/components/wework-chat-panel/chat-panel-controls/index.js +0 -35
  48. package/components/wework-chat-panel/chat-panel-controls/jx-sys-text/jx-sys-text.vue +0 -28
  49. package/components/wework-chat-panel/chat-panel-controls/link/link.vue +0 -35
  50. package/components/wework-chat-panel/chat-panel-controls/location/location.vue +0 -35
  51. package/components/wework-chat-panel/chat-panel-controls/text/text.vue +0 -43
  52. package/components/wework-chat-panel/chat-panel-controls/unkonw/unkonw.vue +0 -39
  53. package/components/wework-chat-panel/chat-panel-controls/video/video.vue +0 -37
  54. package/components/wework-chat-panel/chat-panel-controls/voice/voice.vue +0 -35
  55. package/uni-common/account-portray/account-portray.vue +0 -51
  56. package/uni-common/account-select/account-select-item.vue +0 -172
  57. package/uni-common/account-select/account-select.vue +0 -252
  58. package/uni-common/all-friend-avatar/all-friend-avatar.vue +0 -49
  59. package/uni-common/friend-avatar/default.svg +0 -1
  60. package/uni-common/friend-avatar/friend-avatar.vue +0 -27
  61. package/uni-common/friend-avatar/index.js +0 -3
  62. package/uni-common/friend-loader/friend-loader.vue +0 -53
  63. package/uni-common/friend-portray/friend-portray.vue +0 -56
  64. package/uni-common/group-avatar/default.svg +0 -1
  65. package/uni-common/group-avatar/group-avatar.vue +0 -18
  66. package/uni-common/group-avatar/index.js +0 -3
  67. package/uni-common/room-avatar/default.svg +0 -6
  68. package/uni-common/room-avatar/index.js +0 -3
  69. package/uni-common/room-avatar/room-avatar.vue +0 -27
  70. package/uni-common/room-loader/room-loader.vue +0 -53
  71. package/uni-common/room-portray/room-portray.vue +0 -56
  72. package/uni-components/chat-control/calling/calling.vue +0 -91
  73. package/uni-components/chat-control/calling/phone-fill.svg +0 -1
  74. package/uni-components/chat-control/calling/vidicon-fill.svg +0 -1
  75. package/uni-components/chat-control/channel-video/channel-video.vue +0 -89
  76. package/uni-components/chat-control/channel-video-card/channel-video-card.vue +0 -105
  77. package/uni-components/chat-control/channel-video-live/channel-video-live.vue +0 -92
  78. package/uni-components/chat-control/chat-control-config-item/chat-control-config-item.vue +0 -20
  79. package/uni-components/chat-control/chat-control-config-item/index.js +0 -3
  80. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-app.vue +0 -25
  81. package/uni-components/chat-control/chat-control-config-msg/chat-control-config-msg-h5.vue +0 -21
  82. package/uni-components/chat-control/chat-control.vue +0 -218
  83. package/uni-components/chat-control/company-card/company-card.vue +0 -123
  84. package/uni-components/chat-control/const.js +0 -28
  85. package/uni-components/chat-control/expression/expression.vue +0 -41
  86. package/uni-components/chat-control/image/image.vue +0 -68
  87. package/uni-components/chat-control/index.js +0 -89
  88. package/uni-components/chat-control/location/location.vue +0 -110
  89. package/uni-components/chat-control/member-change/member-change.vue +0 -32
  90. package/uni-components/chat-control/quote-message/quote-message.vue +0 -216
  91. package/uni-components/chat-control/real-time-position/real-time-position.vue +0 -62
  92. package/uni-components/chat-control/redpacket/red-envelope.svg +0 -1
  93. package/uni-components/chat-control/redpacket/redpacket.vue +0 -75
  94. package/uni-components/chat-control/share-card/share-card.vue +0 -101
  95. package/uni-components/chat-control/system/system.vue +0 -69
  96. package/uni-components/chat-control/system-batch-message/system-batch-message.vue +0 -30
  97. package/uni-components/chat-control/system-text/system-text.vue +0 -32
  98. package/uni-components/chat-control/text/text.vue +0 -67
  99. package/uni-components/chat-control/text-with-at/text-with-at.vue +0 -51
  100. package/uni-components/chat-control/transfer/red-transfer.svg +0 -1
  101. package/uni-components/chat-control/transfer/transfer.vue +0 -80
  102. package/uni-components/chat-control/unkonw/unkonw.vue +0 -37
  103. package/uni-components/chat-control/url/icons/file-excel-line.svg +0 -1
  104. package/uni-components/chat-control/url/icons/file-info-line.svg +0 -1
  105. package/uni-components/chat-control/url/icons/file-music-line.svg +0 -1
  106. package/uni-components/chat-control/url/icons/file-pdf-line.svg +0 -1
  107. package/uni-components/chat-control/url/icons/file-ppt-line.svg +0 -1
  108. package/uni-components/chat-control/url/icons/file-settings-line.svg +0 -1
  109. package/uni-components/chat-control/url/icons/file-text-line.svg +0 -1
  110. package/uni-components/chat-control/url/icons/file-unknow-line.svg +0 -1
  111. package/uni-components/chat-control/url/icons/file-word-line.svg +0 -1
  112. package/uni-components/chat-control/url/icons/file-zip-line.svg +0 -1
  113. package/uni-components/chat-control/url/icons/index.js +0 -24
  114. package/uni-components/chat-control/url/miniprogram.svg +0 -1
  115. package/uni-components/chat-control/url/url-miniprogram.vue +0 -116
  116. package/uni-components/chat-control/url/url.vue +0 -306
  117. package/uni-components/chat-control/url-new/icons/file-excel-line.svg +0 -1
  118. package/uni-components/chat-control/url-new/icons/file-info-line.svg +0 -1
  119. package/uni-components/chat-control/url-new/icons/file-music-line.svg +0 -1
  120. package/uni-components/chat-control/url-new/icons/file-pdf-line.svg +0 -1
  121. package/uni-components/chat-control/url-new/icons/file-ppt-line.svg +0 -1
  122. package/uni-components/chat-control/url-new/icons/file-settings-line.svg +0 -1
  123. package/uni-components/chat-control/url-new/icons/file-text-line.svg +0 -1
  124. package/uni-components/chat-control/url-new/icons/file-unknow-line.svg +0 -1
  125. package/uni-components/chat-control/url-new/icons/file-word-line.svg +0 -1
  126. package/uni-components/chat-control/url-new/icons/file-zip-line.svg +0 -1
  127. package/uni-components/chat-control/url-new/icons/index.js +0 -24
  128. package/uni-components/chat-control/url-new/url-new.vue +0 -110
  129. package/uni-components/chat-control/utils.js +0 -12
  130. package/uni-components/chat-control/video/video.vue +0 -156
  131. package/uni-components/chat-control/voice/voice.vue +0 -166
  132. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-collect.vue +0 -84
  133. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet-system.vue +0 -28
  134. package/uni-components/chat-editor/chat-editor-chartlet/chat-editor-chartlet.vue +0 -85
  135. package/uni-components/chat-editor/chat-editor-func/chat-editor-func.vue +0 -157
  136. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at-panel.vue +0 -158
  137. package/uni-components/chat-editor/chat-editor-func-at/chat-editor-func-at.vue +0 -61
  138. package/uni-components/chat-editor/chat-editor-func-button/chat-editor-func-button.vue +0 -58
  139. package/uni-components/chat-editor/chat-editor-func-file/chat-editor-func-file.vue +0 -54
  140. package/uni-components/chat-editor/chat-editor-func-image/chat-editor-func-image.vue +0 -42
  141. package/uni-components/chat-editor/chat-editor-func-video/chat-editor-func-video.vue +0 -42
  142. package/uni-components/chat-editor/chat-editor-func-voice/chat-editor-func-voice.vue +0 -25
  143. package/uni-components/chat-editor/chat-editor-message-send/chat-editor-message-send.vue +0 -158
  144. package/uni-components/chat-editor/chat-editor-quote/chat-editor-quote.vue +0 -75
  145. package/uni-components/chat-editor/chat-editor.vue +0 -257
  146. package/uni-components/chat-editor/index.js +0 -10
  147. package/uni-components/chat-editor/util.js +0 -65
  148. package/uni-components/chat-panel/chat-panel-chats-box.vue +0 -238
  149. package/uni-components/chat-panel/chat-panel-chats-forward/chat-panel-chats-forward.vue +0 -273
  150. package/uni-components/chat-panel/chat-panel-chats-item.vue +0 -578
  151. package/uni-components/chat-panel/chat-panel-chats-status/chat-panel-chats-status.vue +0 -71
  152. package/uni-components/chat-panel/chat-panel-chats.vue +0 -368
  153. package/uni-components/chat-panel/chat-panel.vue +0 -227
  154. package/uni-components/contacts-group-select/contacts-group-select-item.vue +0 -85
  155. package/uni-components/contacts-group-select/contacts-group-select-panel.vue +0 -119
  156. package/uni-components/contacts-group-select/contacts-group-select.vue +0 -150
@@ -0,0 +1,181 @@
1
+ <template>
2
+ <div class="sdk-chat-wework-control-metting" :class="'sdk-chat-wework-control-metting--' + type">
3
+ <template v-if="type === 'default' || type === 'thumb'">
4
+ <div class="sdk-chat-wework-control-metting__card">
5
+ <div class="sdk-chat-wework-control-metting__main">
6
+ <div class="sdk-chat-wework-control-metting__info">
7
+ <div class="sdk-chat-wework-control-metting__title">{{ title }}</div>
8
+ <div class="sdk-chat-wework-control-metting__description">{{ description }}</div>
9
+ <div class="sdk-chat-wework-control-metting__initiator" v-if="initiatorText">{{ initiatorText }}</div>
10
+ </div>
11
+ <div class="sdk-chat-wework-control-metting__video-icon">
12
+ <img src="./meeting-video.svg" alt="会议" />
13
+ </div>
14
+ </div>
15
+ <div class="sdk-chat-wework-control-metting__brand">
16
+ <img src="./enterprise-wechat.png" alt="" />
17
+ <span>企业微信</span>
18
+ </div>
19
+ </div>
20
+ </template>
21
+ <template v-else-if="type === 'quote'">
22
+ <div class="sdk-chat-wework-control-metting__quote-icon">
23
+ <img src="./meeting-video.svg" alt="会议" />
24
+ </div>
25
+ <div class="sdk-chat-wework-control-metting__quote-title">{{ title }}</div>
26
+ </template>
27
+ </div>
28
+ </template>
29
+ <script>
30
+ import { parse } from '../../../utils/json'
31
+
32
+ export default {
33
+ name: 'SdkChatControlMetting',
34
+ props: {
35
+ id: {
36
+ type: String
37
+ },
38
+ content: {
39
+ type: [String, Object]
40
+ },
41
+ initiator: {
42
+ type: String
43
+ },
44
+ updateChatBoxProp: {
45
+ type: Function
46
+ },
47
+ type: {
48
+ type: String,
49
+ default: 'default',
50
+ validator (value) {
51
+ return ['quote', 'default', 'thumb'].includes(value)
52
+ }
53
+ }
54
+ },
55
+ computed: {
56
+ nextContent () {
57
+ return parse(this.content) || {}
58
+ },
59
+ title () {
60
+ return this.nextContent.title || '企业微信会议'
61
+ },
62
+ description () {
63
+ return this.nextContent.desc || '会议已开始,请尽快入会'
64
+ },
65
+ initiatorText () {
66
+ return this.initiator ? `发起人:${this.initiator}` : ''
67
+ },
68
+ url () {
69
+ return this.nextContent.url
70
+ }
71
+ },
72
+ created () {
73
+ if (this.url && this.updateChatBoxProp) {
74
+ this.updateChatBoxProp('href', this.url)
75
+ }
76
+ }
77
+ }
78
+ </script>
79
+ <style lang="less">
80
+ .sdk-chat-wework-control-metting {
81
+ display: inline-block;
82
+ max-width: 100%;
83
+ color: #222;
84
+ }
85
+ .sdk-chat-wework-control-metting__card {
86
+ width: 248px;
87
+ max-width: 100%;
88
+ padding: 10px 10px 8px;
89
+ box-sizing: border-box;
90
+ border-radius: 6px;
91
+ background-color: #f1f1f3;
92
+ }
93
+ .sdk-chat-wework-control-metting__main {
94
+ display: flex;
95
+ align-items: center;
96
+ }
97
+ .sdk-chat-wework-control-metting__info {
98
+ flex: 1;
99
+ min-width: 0;
100
+ min-height: 64px;
101
+ }
102
+ .sdk-chat-wework-control-metting__title {
103
+ overflow: hidden;
104
+ color: #222;
105
+ font-size: 14px;
106
+ font-weight: 500;
107
+ line-height: 20px;
108
+ text-overflow: ellipsis;
109
+ white-space: nowrap;
110
+ margin-bottom: 6px;
111
+ }
112
+ .sdk-chat-wework-control-metting__description,
113
+ .sdk-chat-wework-control-metting__initiator {
114
+ overflow: hidden;
115
+ color: #8a8a8a;
116
+ font-size: 12px;
117
+ line-height: 17px;
118
+ text-overflow: ellipsis;
119
+ white-space: nowrap;
120
+ }
121
+ .sdk-chat-wework-control-metting__video-icon {
122
+ display: flex;
123
+ align-items: center;
124
+ justify-content: center;
125
+ width: 48px;
126
+ height: 48px;
127
+ min-width: 48px;
128
+ margin-left: 10px;
129
+ border-radius: 3px;
130
+ background-color: #4b91f1;
131
+ img {
132
+ width: 26px;
133
+ height: 26px;
134
+ }
135
+ }
136
+ .sdk-chat-wework-control-metting__brand {
137
+ display: flex;
138
+ align-items: center;
139
+ height: 18px;
140
+ margin-top: 6px;
141
+ color: #999;
142
+ font-size: 12px;
143
+ line-height: 18px;
144
+ img {
145
+ width: 15px;
146
+ height: 15px;
147
+ margin-right: 4px;
148
+ }
149
+ }
150
+ .sdk-chat-wework-control-metting--thumb {
151
+ width: 100%;
152
+ .sdk-chat-wework-control-metting__card {
153
+ width: 100%;
154
+ }
155
+ }
156
+ .sdk-chat-wework-control-metting--quote {
157
+ display: flex;
158
+ align-items: center;
159
+ max-width: 320px;
160
+ .sdk-chat-wework-control-metting__quote-icon {
161
+ display: flex;
162
+ align-items: center;
163
+ justify-content: center;
164
+ width: 22px;
165
+ height: 22px;
166
+ min-width: 22px;
167
+ margin-right: 6px;
168
+ border-radius: 2px;
169
+ background-color: #4b91f1;
170
+ img {
171
+ width: 14px;
172
+ height: 14px;
173
+ }
174
+ }
175
+ .sdk-chat-wework-control-metting__quote-title {
176
+ overflow: hidden;
177
+ text-overflow: ellipsis;
178
+ white-space: nowrap;
179
+ }
180
+ }
181
+ </style>
@@ -29,8 +29,24 @@
29
29
  </template>
30
30
  <script>
31
31
  import { Popover as UiPopover } from '@aochuang/common/components'
32
+ import { parseWechatEmoji } from '@aochuang/common/common/wechat-emoji'
32
33
  import { html2Escape } from '../../../utils/string'
33
34
 
35
+ function parseTextContent (content) {
36
+ if (typeof content !== 'string') {
37
+ return content
38
+ }
39
+ try {
40
+ const data = JSON.parse(content)
41
+ if (data && typeof data === 'object') {
42
+ return data
43
+ }
44
+ } catch (e) {
45
+ return content
46
+ }
47
+ return content
48
+ }
49
+
34
50
  export default {
35
51
  name: 'SdkChatControlText',
36
52
  components: {
@@ -63,23 +79,27 @@ export default {
63
79
  },
64
80
  computed: {
65
81
  nextContent () {
66
- return this.content
82
+ return parseTextContent(this.content)
67
83
  },
68
84
  text () {
85
+ if (this.nextContent && typeof this.nextContent === 'object') {
86
+ return this.nextContent.text || ''
87
+ }
69
88
  return this.nextContent
70
89
  },
71
90
  html () {
72
- let content = this.nextContent
91
+ let content = this.text
73
92
  if (this.formatter) {
74
93
  content = this.formatter({
75
94
  content: this.nextContent
76
95
  })
77
96
  } else {
78
- content = html2Escape(content)
97
+ content = parseWechatEmoji(html2Escape(String(content || '')), false)
79
98
  }
80
99
  if (!content) {
81
100
  return ''
82
101
  }
102
+ content = String(content)
83
103
  content = content.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, item => {
84
104
  return `<a href="${item}" target='_blank'>${item}</a>`
85
105
  })
@@ -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,
@@ -3,12 +3,11 @@ 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
- CUSTOM_EXPRESSION_W: 104,
9
8
  // MUSIC: 1040187441,
10
9
  // ROOM_CALLING: 64,
11
- SHARE_CARD: 41,
10
+ SHARE_CARD: 31,
12
11
  // COMPANY_CARD: 41,
13
12
  // VIDEO: 43,
14
13
  // CUSTOM_EXPRESSION: 47,
@@ -32,7 +31,8 @@ export const MESSAGE_TYPE = {
32
31
  // QUOTE_MESSAGE: 822083633,
33
32
  CHANNEL_VIDEO: 141,
34
33
  // CHANNEL_VIDEO_CARD: 771751985, // 视频号名片
35
- CHANNEL_VIDEO_LIVE: 146 // 视频号直播
34
+ CHANNEL_VIDEO_LIVE: 146, // 视频号直播
35
+ MEETING: 579
36
36
  }
37
37
 
38
38
  function html2Escape (sHtml) {
@@ -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) || {}
@@ -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) {
@@ -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>