@aochuang/client-sdk 1.0.329 → 1.0.330
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.
- package/components/index.js +6 -1
- package/components/wework-chat-control/image/image.vue +131 -2
- package/components/wework-chat-control/index.js +6 -6
- package/components/wework-chat-control/util.js +1 -1
- package/components/wework-chat-control/video/video.vue +3 -3
- package/components/wework-chat-control/wework-chat-control-config-item.vue +24 -0
- package/components/wework-chat-control/wework-chat-control-config-msg.vue +25 -0
- package/components/wework-chat-control/wework-chat-control-config.vue +57 -0
- package/components/wework-chat-panel/chat-panel-item.vue +7 -7
- package/components/wework-chat-panel/chat-panel.vue +90 -9
- package/package.json +1 -1
- package/components/wework-chat-panel/chat-panel-controls/company-card/company-card.vue +0 -35
- package/components/wework-chat-panel/chat-panel-controls/expression/expression.vue +0 -36
- package/components/wework-chat-panel/chat-panel-controls/file-url/file-url.vue +0 -35
- package/components/wework-chat-panel/chat-panel-controls/image/image.vue +0 -36
- package/components/wework-chat-panel/chat-panel-controls/index.js +0 -35
- package/components/wework-chat-panel/chat-panel-controls/jx-sys-text/jx-sys-text.vue +0 -28
- package/components/wework-chat-panel/chat-panel-controls/link/link.vue +0 -35
- package/components/wework-chat-panel/chat-panel-controls/location/location.vue +0 -35
- package/components/wework-chat-panel/chat-panel-controls/text/text.vue +0 -43
- package/components/wework-chat-panel/chat-panel-controls/unkonw/unkonw.vue +0 -39
- package/components/wework-chat-panel/chat-panel-controls/video/video.vue +0 -37
- package/components/wework-chat-panel/chat-panel-controls/voice/voice.vue +0 -35
package/components/index.js
CHANGED
|
@@ -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
|
+
}
|
|
@@ -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="
|
|
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.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.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,33 @@ 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
|
+
})
|
|
290
|
+
if (rs && rs.finally) {
|
|
291
|
+
this.downloading = true
|
|
292
|
+
rs.then(() => {
|
|
293
|
+
this.downloaded = true
|
|
294
|
+
}).finally(() => {
|
|
295
|
+
this.downloading = false
|
|
296
|
+
})
|
|
297
|
+
} else {
|
|
298
|
+
this.downloaded = true
|
|
299
|
+
}
|
|
300
|
+
},
|
|
220
301
|
handleError () {
|
|
221
302
|
if (!this.defrostMethod) {
|
|
222
303
|
return
|
|
@@ -236,7 +317,22 @@ export default {
|
|
|
236
317
|
handleRefreshClick () {
|
|
237
318
|
this.errorMsg = null
|
|
238
319
|
this.defrostMsg = null
|
|
320
|
+
},
|
|
321
|
+
syncContentState () {
|
|
322
|
+
this.nextContent = parse(this.content)
|
|
323
|
+
this.downloaded = false
|
|
324
|
+
this.downloading = false
|
|
325
|
+
this.errorMsg = null
|
|
326
|
+
this.defrostMsg = null
|
|
239
327
|
}
|
|
328
|
+
},
|
|
329
|
+
watch: {
|
|
330
|
+
content () {
|
|
331
|
+
this.syncContentState()
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
beforeDestroy () {
|
|
335
|
+
this.cancelDownloadMethod && this.cancelDownloadMethod()
|
|
240
336
|
}
|
|
241
337
|
}
|
|
242
338
|
</script>
|
|
@@ -277,6 +373,39 @@ export default {
|
|
|
277
373
|
display: inline-block;
|
|
278
374
|
line-height: 1em;
|
|
279
375
|
vertical-align: top;
|
|
376
|
+
position: relative;
|
|
377
|
+
}
|
|
378
|
+
.sdk-chat-control-image__download{
|
|
379
|
+
position: absolute;
|
|
380
|
+
left: 0;
|
|
381
|
+
top: 0;
|
|
382
|
+
z-index: 10;
|
|
383
|
+
width: 100%;
|
|
384
|
+
height: 100%;
|
|
385
|
+
background: #000;
|
|
386
|
+
display: flex;
|
|
387
|
+
flex-direction: column;
|
|
388
|
+
align-items: center;
|
|
389
|
+
justify-content: center;
|
|
390
|
+
color: #ccc;
|
|
391
|
+
cursor: pointer;
|
|
392
|
+
&:not(.is-downloading):hover {
|
|
393
|
+
color: #fff;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
.sdk-chat-control-image__download.is-downloading{
|
|
397
|
+
cursor: default;
|
|
398
|
+
}
|
|
399
|
+
.sdk-chat-control-image__download-icon{
|
|
400
|
+
line-height: 1;
|
|
401
|
+
margin-bottom: 6px;
|
|
402
|
+
}
|
|
403
|
+
.sdk-chat-control-image__download-text{
|
|
404
|
+
font-size: 12px;
|
|
405
|
+
}
|
|
406
|
+
.sdk-chat-control-image__download-placeholder{
|
|
407
|
+
width: 100%;
|
|
408
|
+
height: 100%;
|
|
280
409
|
}
|
|
281
410
|
.sdk-chat-control-image__hd{
|
|
282
411
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
WeworkChatControlConfig,
|
|
104
|
+
WeworkChatControlConfigMsg,
|
|
105
|
+
WeworkChatControlConfigItem
|
|
106
106
|
}
|
|
@@ -147,8 +147,8 @@ 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.
|
|
151
|
-
url = this.nextContent.
|
|
150
|
+
if (this.nextContent.videoPath) {
|
|
151
|
+
url = this.nextContent.videoPath
|
|
152
152
|
} else {
|
|
153
153
|
url = this.nextContent.tencentUrl
|
|
154
154
|
// 如果tencentUrl不是一个有效的地址,就设置为null,后面好识别需要下载
|
|
@@ -163,7 +163,7 @@ export default {
|
|
|
163
163
|
if (!this.nextContent) {
|
|
164
164
|
return
|
|
165
165
|
}
|
|
166
|
-
return this.nextContent.
|
|
166
|
+
return this.nextContent.previewImgUrl
|
|
167
167
|
},
|
|
168
168
|
innerCover () {
|
|
169
169
|
return formatOssPath(this.cover)
|
|
@@ -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>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export default {
|
|
3
|
+
name: 'SdkWeworkChatControlConfig',
|
|
4
|
+
provide () {
|
|
5
|
+
return {
|
|
6
|
+
SdkWeworkChatControlConfig: this
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
inject: {
|
|
10
|
+
// 可以继承上级的
|
|
11
|
+
SdkWeworkChatControlConfig: {
|
|
12
|
+
default: null
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
/**
|
|
17
|
+
* 这个是组件级别的配置,weworkChatPanel是消息级别的配置,后面是消息级别配置覆盖组件级别的配置
|
|
18
|
+
* {
|
|
19
|
+
* 1: {
|
|
20
|
+
* formatter () {
|
|
21
|
+
* xxx
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
controlConfig: {
|
|
27
|
+
type: Object
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* 消息级别配置,消息级别配置会覆盖控件级别配置
|
|
31
|
+
* 主要是项目里面有几种实用场景,第一种聊天记录,第二种风控,第三种消息预览
|
|
32
|
+
*/
|
|
33
|
+
messageConfig: {
|
|
34
|
+
type: Function
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
render () {
|
|
38
|
+
return this.$slots.default
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
getControlConfig (msgType) {
|
|
42
|
+
if (!this.controlConfig) {
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
return this.controlConfig[msgType]
|
|
46
|
+
},
|
|
47
|
+
getMessageConfig (msgData) {
|
|
48
|
+
if (!this.messageConfig) {
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
return this.messageConfig({
|
|
52
|
+
item: msgData
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<wework-chat-control-config-msg
|
|
3
3
|
:msgData="item"
|
|
4
4
|
>
|
|
5
5
|
<template slot-scope="{ configData }">
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
</template>
|
|
46
46
|
</sdk-chat-panel-box>
|
|
47
47
|
</template>
|
|
48
|
-
<template v-else-if="
|
|
48
|
+
<template v-else-if="item.msgType === MESSAGE_TYPE.VIDEO">
|
|
49
49
|
<sdk-chat-panel-box
|
|
50
50
|
:dir="dir"
|
|
51
51
|
:data="item"
|
|
@@ -526,7 +526,7 @@
|
|
|
526
526
|
</template> -->
|
|
527
527
|
</div>
|
|
528
528
|
</template>
|
|
529
|
-
</
|
|
529
|
+
</wework-chat-control-config-msg>
|
|
530
530
|
</template>
|
|
531
531
|
<script>
|
|
532
532
|
import SdkChatPanelBox from '../chat-panel/chat-panel-box'
|
|
@@ -564,10 +564,10 @@ import {
|
|
|
564
564
|
unknow as SdkChatControlUnknow
|
|
565
565
|
} from '../wework-chat-control'
|
|
566
566
|
import { MESSAGE_TYPE } from '../wework-chat-control/util'
|
|
567
|
-
import
|
|
567
|
+
import WeworkChatControlConfigMsg from '../wework-chat-control/wework-chat-control-config-msg.vue'
|
|
568
568
|
|
|
569
569
|
export default {
|
|
570
|
-
name: '
|
|
570
|
+
name: 'SdkWeworkPanelItem',
|
|
571
571
|
components: {
|
|
572
572
|
SdkChatPanelBox,
|
|
573
573
|
SdkChatControlText,
|
|
@@ -601,7 +601,7 @@ export default {
|
|
|
601
601
|
// SdkChatControlRevokeMeMessage,
|
|
602
602
|
// SdkChatControlRevokeOtherMessage,
|
|
603
603
|
// SdkChatControlRevokeYouMessage,
|
|
604
|
-
|
|
604
|
+
WeworkChatControlConfigMsg
|
|
605
605
|
},
|
|
606
606
|
props: {
|
|
607
607
|
dir: {
|
|
@@ -647,4 +647,4 @@ export default {
|
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
|
-
</script>
|
|
650
|
+
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<sdk-chat-panel
|
|
3
3
|
ref="panel"
|
|
4
|
-
v-bind="
|
|
4
|
+
v-bind="props"
|
|
5
5
|
:is-sender-method="handleIsSenderMethod"
|
|
6
6
|
@initloaded="handleChatsInitLoaded"
|
|
7
7
|
@chat-contextmenu="handleChatContext"
|
|
@@ -37,6 +37,9 @@
|
|
|
37
37
|
</template>
|
|
38
38
|
<template slot="main">
|
|
39
39
|
<slot name="main"></slot>
|
|
40
|
+
<template v-if="selectable">
|
|
41
|
+
<slot name="selection" :total="checkTotal"></slot>
|
|
42
|
+
</template>
|
|
40
43
|
</template>
|
|
41
44
|
</sdk-chat-panel>
|
|
42
45
|
</template>
|
|
@@ -59,7 +62,8 @@ export default {
|
|
|
59
62
|
}
|
|
60
63
|
},
|
|
61
64
|
keyField: {
|
|
62
|
-
type: String
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'id'
|
|
63
67
|
},
|
|
64
68
|
startDate: {
|
|
65
69
|
type: Number
|
|
@@ -88,9 +92,6 @@ export default {
|
|
|
88
92
|
type: Boolean,
|
|
89
93
|
default: true
|
|
90
94
|
},
|
|
91
|
-
renderControl: {
|
|
92
|
-
type: Function
|
|
93
|
-
},
|
|
94
95
|
fetchUserMethod: {
|
|
95
96
|
type: Function
|
|
96
97
|
},
|
|
@@ -126,12 +127,33 @@ export default {
|
|
|
126
127
|
},
|
|
127
128
|
contextChatId: {
|
|
128
129
|
type: String
|
|
130
|
+
},
|
|
131
|
+
onBeforeSelectionChange: {
|
|
132
|
+
type: Function
|
|
129
133
|
}
|
|
130
134
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
data () {
|
|
136
|
+
return {
|
|
137
|
+
checkMsgMap: {}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
computed: {
|
|
141
|
+
props () {
|
|
142
|
+
const { config, ...nextProps } = this.$props
|
|
143
|
+
return nextProps
|
|
134
144
|
},
|
|
145
|
+
checkTotal () {
|
|
146
|
+
return Object.keys(this.checkMsgMap).length
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
watch: {
|
|
150
|
+
selectable () {
|
|
151
|
+
if (!this.selectable) {
|
|
152
|
+
this.checkMsgMap = {}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
methods: {
|
|
135
157
|
handleIsSenderMethod ({ item }) {
|
|
136
158
|
return !!item.send
|
|
137
159
|
},
|
|
@@ -148,8 +170,67 @@ export default {
|
|
|
148
170
|
this.currentContextChat = null
|
|
149
171
|
return this.$refs.panel && this.$refs.panel.reload()
|
|
150
172
|
},
|
|
173
|
+
handleFilterSelectMessageMethod (msg) {
|
|
174
|
+
if (!this.filterSelectMessageMethod) {
|
|
175
|
+
return true
|
|
176
|
+
}
|
|
177
|
+
return this.filterSelectMessageMethod({
|
|
178
|
+
item: msg
|
|
179
|
+
})
|
|
180
|
+
},
|
|
181
|
+
handleMsgCheckboxChange (msg, value) {
|
|
182
|
+
if (value) {
|
|
183
|
+
this.selectChat(msg)
|
|
184
|
+
} else {
|
|
185
|
+
this.unselectChat(msg)
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
selectChat (chat) {
|
|
189
|
+
if (!chat) {
|
|
190
|
+
return
|
|
191
|
+
}
|
|
192
|
+
if (!this.selectable) {
|
|
193
|
+
console.warn('未开启选择')
|
|
194
|
+
return
|
|
195
|
+
}
|
|
196
|
+
if (this.onBeforeSelectionChange && this.onBeforeSelectionChange({
|
|
197
|
+
chat,
|
|
198
|
+
value: true
|
|
199
|
+
}) === false) {
|
|
200
|
+
return
|
|
201
|
+
}
|
|
202
|
+
this.$set(this.checkMsgMap, chat[this.keyField], chat)
|
|
203
|
+
},
|
|
204
|
+
unselectChat (chat) {
|
|
205
|
+
if (!chat) {
|
|
206
|
+
return
|
|
207
|
+
}
|
|
208
|
+
if (!this.selectable) {
|
|
209
|
+
console.warn('未开启选择')
|
|
210
|
+
return
|
|
211
|
+
}
|
|
212
|
+
if (this.onBeforeSelectionChange && this.onBeforeSelectionChange({
|
|
213
|
+
chat,
|
|
214
|
+
value: false
|
|
215
|
+
}) === false) {
|
|
216
|
+
return
|
|
217
|
+
}
|
|
218
|
+
this.$delete(this.checkMsgMap, chat[this.keyField])
|
|
219
|
+
},
|
|
220
|
+
unselectAllChat () {
|
|
221
|
+
return Object.keys(this.checkMsgMap).map(key => {
|
|
222
|
+
return this.unselectChat(this.checkMsgMap[key])
|
|
223
|
+
})
|
|
224
|
+
},
|
|
225
|
+
getSelectChats () {
|
|
226
|
+
return Object.keys(this.checkMsgMap).map(key => {
|
|
227
|
+
return this.checkMsgMap[key]
|
|
228
|
+
})
|
|
229
|
+
},
|
|
151
230
|
handleChatContext (item, evt) {
|
|
152
|
-
this.$emit('chat-contextmenu',
|
|
231
|
+
this.$emit('chat-contextmenu', {
|
|
232
|
+
item
|
|
233
|
+
}, evt)
|
|
153
234
|
},
|
|
154
235
|
handleChatViewContext ({ item }) {
|
|
155
236
|
this.$emit('chat-view-context', {
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
3
|
-
import { companyCard } from '../../../wework-chat-control'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsCompanyCard',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(companyCard, {
|
|
29
|
-
props: {
|
|
30
|
-
data: props.data
|
|
31
|
-
}
|
|
32
|
-
})])
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { expression } from '../../../wework-chat-control'
|
|
3
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsExpression',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
default: () => ({})
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(expression, {
|
|
29
|
-
props: {
|
|
30
|
-
data: props.data
|
|
31
|
-
},
|
|
32
|
-
key: c.data.key
|
|
33
|
-
})])
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
</script>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
3
|
-
import { fileUrl } from '../../../wework-chat-control'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsFileUrl',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(fileUrl, {
|
|
29
|
-
props: {
|
|
30
|
-
content: props.data.content
|
|
31
|
-
}
|
|
32
|
-
})])
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { image } from '../../../wework-chat-control'
|
|
3
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsImage',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
default: () => ({})
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(image, {
|
|
29
|
-
props: {
|
|
30
|
-
data: props.data
|
|
31
|
-
},
|
|
32
|
-
key: c.data.key
|
|
33
|
-
})])
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
</script>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import text from './text/text.vue'
|
|
2
|
-
import link from './link/link.vue'
|
|
3
|
-
import companyCard from './company-card/company-card.vue'
|
|
4
|
-
import video from './video/video.vue'
|
|
5
|
-
import image from './image/image.vue'
|
|
6
|
-
import unkonw from './unkonw/unkonw.vue'
|
|
7
|
-
import expression from './expression/expression.vue'
|
|
8
|
-
import voice from './voice/voice.vue'
|
|
9
|
-
import jxSysText from './jx-sys-text/jx-sys-text.vue'
|
|
10
|
-
import fileUrl from './file-url/file-url.vue'
|
|
11
|
-
import location from './location/location.vue'
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
0: text,
|
|
15
|
-
2: text,
|
|
16
|
-
14: image,
|
|
17
|
-
101: image,
|
|
18
|
-
// '49': link,
|
|
19
|
-
22: video,
|
|
20
|
-
23: video,
|
|
21
|
-
103: video,
|
|
22
|
-
29: expression,
|
|
23
|
-
104: expression,
|
|
24
|
-
16: voice,
|
|
25
|
-
40: voice,
|
|
26
|
-
1011: jxSysText,
|
|
27
|
-
1022: jxSysText,
|
|
28
|
-
41: companyCard,
|
|
29
|
-
13: fileUrl,
|
|
30
|
-
15: fileUrl,
|
|
31
|
-
20: fileUrl,
|
|
32
|
-
102: fileUrl,
|
|
33
|
-
6: location,
|
|
34
|
-
unkonw
|
|
35
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { jxSysText } from '../../../wework-chat-control'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
name: 'SdkWeworkChatPanelControlsJxSysText',
|
|
6
|
-
functional: true,
|
|
7
|
-
props: {
|
|
8
|
-
dir: {
|
|
9
|
-
type: String
|
|
10
|
-
},
|
|
11
|
-
data: {
|
|
12
|
-
type: Object,
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
fetchUserMethod: {
|
|
16
|
-
type: Function
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
render (h, c) {
|
|
20
|
-
const { props } = c
|
|
21
|
-
return h(jxSysText, {
|
|
22
|
-
props: {
|
|
23
|
-
content: props.data.content
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
</script>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
3
|
-
import { link } from '../../../wework-chat-control'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsLink',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(link, {
|
|
29
|
-
props: {
|
|
30
|
-
data: props.data
|
|
31
|
-
}
|
|
32
|
-
})])
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
3
|
-
import { location } from '../../../wework-chat-control'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsLocation',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(location, {
|
|
29
|
-
props: {
|
|
30
|
-
content: props.data.content
|
|
31
|
-
}
|
|
32
|
-
})])
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
3
|
-
import { text } from '../../../wework-chat-control'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsText',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
class: 'sdk-chat-panel-controls-text',
|
|
24
|
-
props: {
|
|
25
|
-
dir: props.dir,
|
|
26
|
-
data: props.data,
|
|
27
|
-
fetchUserMethod: props.fetchUserMethod
|
|
28
|
-
}
|
|
29
|
-
}, [h('div', {
|
|
30
|
-
class: 'sdk-chat-panel-controls-text__main'
|
|
31
|
-
}, [h(text, {
|
|
32
|
-
props: {
|
|
33
|
-
data: props.data
|
|
34
|
-
}
|
|
35
|
-
})])])
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
</script>
|
|
39
|
-
<style>
|
|
40
|
-
.sdk-chat-panel-controls-text__main{
|
|
41
|
-
padding: 10px;
|
|
42
|
-
}
|
|
43
|
-
</style>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<sdk-chat-panel-box
|
|
3
|
-
:data="data"
|
|
4
|
-
:dir="dir"
|
|
5
|
-
:fetch-user-method="fetchUserMethod"
|
|
6
|
-
>
|
|
7
|
-
<div class="sdk-wework-chat-panel-controls-unkonw__main">
|
|
8
|
-
未知消息
|
|
9
|
-
</div>
|
|
10
|
-
</sdk-chat-panel-box>
|
|
11
|
-
</template>
|
|
12
|
-
<script>
|
|
13
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
name: 'SdkWeworkChatPanelControlsUnkonw',
|
|
17
|
-
components: {
|
|
18
|
-
SdkChatPanelBox
|
|
19
|
-
},
|
|
20
|
-
props: {
|
|
21
|
-
dir: {
|
|
22
|
-
type: String
|
|
23
|
-
},
|
|
24
|
-
data: {
|
|
25
|
-
type: Object,
|
|
26
|
-
required: true
|
|
27
|
-
},
|
|
28
|
-
fetchUserMethod: {
|
|
29
|
-
type: Function
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
</script>
|
|
34
|
-
<style lang="less">
|
|
35
|
-
.sdk-wework-chat-panel-controls-unkonw__main{
|
|
36
|
-
padding: 12px;
|
|
37
|
-
color: #999;
|
|
38
|
-
}
|
|
39
|
-
</style>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<sdk-chat-panel-box
|
|
3
|
-
:data="data"
|
|
4
|
-
:dir="dir"
|
|
5
|
-
:fetch-user-method="fetchUserMethod"
|
|
6
|
-
>
|
|
7
|
-
<sdk-chat-control-video
|
|
8
|
-
:data="data"
|
|
9
|
-
width="240px"
|
|
10
|
-
height="180px"
|
|
11
|
-
></sdk-chat-control-video>
|
|
12
|
-
</sdk-chat-panel-box>
|
|
13
|
-
</template>
|
|
14
|
-
<script>
|
|
15
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
16
|
-
import { video } from '../../../wework-chat-control'
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
name: 'SdkWeworkChatPanelControlsVideo',
|
|
20
|
-
components: {
|
|
21
|
-
SdkChatPanelBox,
|
|
22
|
-
SdkChatControlVideo: video
|
|
23
|
-
},
|
|
24
|
-
props: {
|
|
25
|
-
dir: {
|
|
26
|
-
type: String
|
|
27
|
-
},
|
|
28
|
-
data: {
|
|
29
|
-
type: Object,
|
|
30
|
-
required: true
|
|
31
|
-
},
|
|
32
|
-
fetchUserMethod: {
|
|
33
|
-
type: Function
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import SdkChatPanelBox from '../../../chat-panel/chat-panel-box'
|
|
3
|
-
import { voice } from '../../../wework-chat-control'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'SdkWeworkChatPanelControlsVoice',
|
|
7
|
-
functional: true,
|
|
8
|
-
props: {
|
|
9
|
-
dir: {
|
|
10
|
-
type: String
|
|
11
|
-
},
|
|
12
|
-
data: {
|
|
13
|
-
type: Object,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
fetchUserMethod: {
|
|
17
|
-
type: Function
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
render (h, c) {
|
|
21
|
-
const { props } = c
|
|
22
|
-
return h(SdkChatPanelBox, {
|
|
23
|
-
props: {
|
|
24
|
-
dir: props.dir,
|
|
25
|
-
data: props.data,
|
|
26
|
-
fetchUserMethod: props.fetchUserMethod
|
|
27
|
-
}
|
|
28
|
-
}, [h(voice, {
|
|
29
|
-
props: {
|
|
30
|
-
content: props.data.content
|
|
31
|
-
}
|
|
32
|
-
})])
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</script>
|