@aochuang/client-sdk 1.0.340 → 1.0.342
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 +1 -6
- package/components/session-select/session-select-item.vue +9 -8
- package/components/wechat-chat-control/calling/calling.vue +3 -0
- package/components/wechat-chat-control/voice/voice.vue +4 -0
- package/components/wework-chat-control/company-card/company-card.vue +1 -1
- package/components/wework-chat-control/file-url/file-url.vue +5 -2
- package/components/wework-chat-control/image/image.vue +2 -137
- package/components/wework-chat-control/index.js +6 -6
- package/components/wework-chat-control/text/text.vue +3 -22
- package/components/wework-chat-control/util.js +6 -12
- package/components/wework-chat-control/video/video.vue +2 -10
- package/components/wework-chat-control/voice/voice.vue +1 -1
- package/components/wework-chat-panel/chat-panel-controls/company-card/company-card.vue +35 -0
- package/components/wework-chat-panel/chat-panel-controls/expression/expression.vue +36 -0
- package/components/wework-chat-panel/chat-panel-controls/file-url/file-url.vue +35 -0
- package/components/wework-chat-panel/chat-panel-controls/image/image.vue +36 -0
- package/components/wework-chat-panel/chat-panel-controls/index.js +35 -0
- package/components/wework-chat-panel/chat-panel-controls/jx-sys-text/jx-sys-text.vue +28 -0
- package/components/wework-chat-panel/chat-panel-controls/link/link.vue +35 -0
- package/components/wework-chat-panel/chat-panel-controls/location/location.vue +35 -0
- package/components/wework-chat-panel/chat-panel-controls/text/text.vue +43 -0
- package/components/wework-chat-panel/chat-panel-controls/unkonw/unkonw.vue +39 -0
- package/components/wework-chat-panel/chat-panel-controls/video/video.vue +37 -0
- package/components/wework-chat-panel/chat-panel-controls/voice/voice.vue +35 -0
- package/components/wework-chat-panel/chat-panel-item.vue +35 -12
- package/components/wework-chat-panel/chat-panel.vue +12 -95
- package/package.json +1 -1
- package/services/client-chat/client-chat-wechat/client-chat.js +20 -8
- package/services/client-chat/client-chat-wework/client-chat-concats.js +17 -81
- package/services/client-chat/client-chat-wework/client-chat-message.js +5 -5
- package/services/client-chat/client-chat-wework/client-chat-session.js +2 -50
- package/services/client-chat/client-chat-wework/client-chat-socket.js +1 -5
- package/services/client-chat/client-chat-wework/client-chat.js +6 -258
- package/services/client-chat/client-chat-wework/utils.js +5 -5
- package/components/wework-chat-control/wework-chat-control-config-item.vue +0 -24
- package/components/wework-chat-control/wework-chat-control-config-msg.vue +0 -25
- package/components/wework-chat-control/wework-chat-control-config.vue +0 -62
- package/components/wework-chat-panel/chat-panel-chat-status/chat-panel-chat-status.vue +0 -73
|
@@ -0,0 +1,35 @@
|
|
|
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>
|
|
@@ -0,0 +1,35 @@
|
|
|
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>
|
|
@@ -0,0 +1,43 @@
|
|
|
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>
|
|
@@ -0,0 +1,39 @@
|
|
|
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>
|
|
@@ -0,0 +1,37 @@
|
|
|
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>
|
|
@@ -0,0 +1,35 @@
|
|
|
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>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<wechat-chat-control-config-msg
|
|
3
3
|
:msgData="item"
|
|
4
4
|
>
|
|
5
5
|
<template slot-scope="{ configData }">
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<template v-if="item.msgType !== '_EMPTY_'">
|
|
8
8
|
<slot name="chat-prefix" :item="item"></slot>
|
|
9
9
|
</template>
|
|
10
|
-
<template v-if="
|
|
10
|
+
<template v-if="[0, 1, 2].includes(item.msgType)">
|
|
11
11
|
<sdk-chat-panel-box
|
|
12
12
|
:dir="dir"
|
|
13
13
|
:data="item"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
</sdk-chat-panel-box>
|
|
28
28
|
</template>
|
|
29
|
-
<template v-else-if="item.msgType
|
|
29
|
+
<template v-else-if="[14, 101].includes(item.msgType)">
|
|
30
30
|
<sdk-chat-panel-box
|
|
31
31
|
:dir="dir"
|
|
32
32
|
:data="item"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
</template>
|
|
46
46
|
</sdk-chat-panel-box>
|
|
47
47
|
</template>
|
|
48
|
-
<template v-else-if="item.msgType
|
|
48
|
+
<template v-else-if="[22, 23, 103].includes(item.msgType)">
|
|
49
49
|
<sdk-chat-panel-box
|
|
50
50
|
:dir="dir"
|
|
51
51
|
:data="item"
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
</template>
|
|
290
290
|
</sdk-chat-panel-box>
|
|
291
291
|
</template>
|
|
292
|
-
<template v-else-if="item.msgType == MESSAGE_TYPE.URL
|
|
292
|
+
<template v-else-if="item.msgType == MESSAGE_TYPE.URL">
|
|
293
293
|
<sdk-chat-panel-box
|
|
294
294
|
:dir="dir"
|
|
295
295
|
:data="item"
|
|
@@ -312,6 +312,29 @@
|
|
|
312
312
|
</template>
|
|
313
313
|
</sdk-chat-panel-box>
|
|
314
314
|
</template>
|
|
315
|
+
<template v-else-if="[13, 15, 20, 102].includes(item.msgType)">
|
|
316
|
+
<sdk-chat-panel-box
|
|
317
|
+
:dir="dir"
|
|
318
|
+
:data="item"
|
|
319
|
+
:fetchUserMethod="fetchUserMethod"
|
|
320
|
+
bg-color="#fff"
|
|
321
|
+
br-color="#ddd"
|
|
322
|
+
@user-avatar-click="handleUserAvatarClick"
|
|
323
|
+
@user-avatar-contextmenu="handleUserAvatarContextmenu"
|
|
324
|
+
>
|
|
325
|
+
<template slot-scope="{ updateProp }">
|
|
326
|
+
<sdk-chat-control-file-url
|
|
327
|
+
v-bind="configData"
|
|
328
|
+
:id="item.id"
|
|
329
|
+
:content="msgContent"
|
|
330
|
+
:update-chat-box-prop="updateProp"
|
|
331
|
+
></sdk-chat-control-file-url>
|
|
332
|
+
</template>
|
|
333
|
+
<template slot="append" slot-scope="{ updateProp }">
|
|
334
|
+
<slot name="chat-append" :item="item" :update-chat-box-prop="updateProp"></slot>
|
|
335
|
+
</template>
|
|
336
|
+
</sdk-chat-panel-box>
|
|
337
|
+
</template>
|
|
315
338
|
<template v-else-if="item.msgType == MESSAGE_TYPE.CUSTOM_EXPRESSION">
|
|
316
339
|
<sdk-chat-panel-box
|
|
317
340
|
:dir="dir"
|
|
@@ -487,7 +510,7 @@
|
|
|
487
510
|
:content="msgContent"
|
|
488
511
|
></sdk-chat-control-empty>
|
|
489
512
|
</template>
|
|
490
|
-
<template v-else>
|
|
513
|
+
<!-- <template v-else>
|
|
491
514
|
<sdk-chat-panel-box
|
|
492
515
|
:dir="dir"
|
|
493
516
|
:data="item"
|
|
@@ -500,10 +523,10 @@
|
|
|
500
523
|
:content="msgContent"
|
|
501
524
|
></sdk-chat-control-unknow>
|
|
502
525
|
</sdk-chat-panel-box>
|
|
503
|
-
</template>
|
|
526
|
+
</template> -->
|
|
504
527
|
</div>
|
|
505
528
|
</template>
|
|
506
|
-
</
|
|
529
|
+
</wechat-chat-control-config-msg>
|
|
507
530
|
</template>
|
|
508
531
|
<script>
|
|
509
532
|
import SdkChatPanelBox from '../chat-panel/chat-panel-box'
|
|
@@ -541,10 +564,10 @@ import {
|
|
|
541
564
|
unknow as SdkChatControlUnknow
|
|
542
565
|
} from '../wework-chat-control'
|
|
543
566
|
import { MESSAGE_TYPE } from '../wework-chat-control/util'
|
|
544
|
-
import
|
|
567
|
+
import WechatChatControlConfigMsg from '../wechat-chat-control/wechat-chat-control-config-msg.vue'
|
|
545
568
|
|
|
546
569
|
export default {
|
|
547
|
-
name: '
|
|
570
|
+
name: 'SdkWechatPanelItem',
|
|
548
571
|
components: {
|
|
549
572
|
SdkChatPanelBox,
|
|
550
573
|
SdkChatControlText,
|
|
@@ -578,7 +601,7 @@ export default {
|
|
|
578
601
|
// SdkChatControlRevokeMeMessage,
|
|
579
602
|
// SdkChatControlRevokeOtherMessage,
|
|
580
603
|
// SdkChatControlRevokeYouMessage,
|
|
581
|
-
|
|
604
|
+
WechatChatControlConfigMsg
|
|
582
605
|
},
|
|
583
606
|
props: {
|
|
584
607
|
dir: {
|
|
@@ -624,4 +647,4 @@ export default {
|
|
|
624
647
|
}
|
|
625
648
|
}
|
|
626
649
|
}
|
|
627
|
-
</script>
|
|
650
|
+
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<sdk-chat-panel
|
|
3
3
|
ref="panel"
|
|
4
|
-
v-bind="props"
|
|
4
|
+
v-bind="$props"
|
|
5
5
|
:is-sender-method="handleIsSenderMethod"
|
|
6
6
|
@initloaded="handleChatsInitLoaded"
|
|
7
7
|
@chat-contextmenu="handleChatContext"
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
:fetch-user-method="fetchUserMethod"
|
|
18
18
|
:config="config"
|
|
19
19
|
>
|
|
20
|
-
<template slot="chat-append" slot-scope="{ item, updateProp }">
|
|
20
|
+
<!-- <template slot="chat-append" slot-scope="{ item, updateProp }">
|
|
21
21
|
<chat-panel-chat-status
|
|
22
22
|
:data="item"
|
|
23
23
|
:update-chat-box-prop="updateProp"
|
|
24
24
|
></chat-panel-chat-status>
|
|
25
|
-
</template>
|
|
25
|
+
</template> -->
|
|
26
26
|
<template slot="chat-prefix" slot-scope="{ item }">
|
|
27
27
|
<template v-if="selectable && handleFilterSelectMessageMethod(item)">
|
|
28
28
|
<div class="sdk-wechat-chat-panel__checkbox">
|
|
@@ -37,23 +37,18 @@
|
|
|
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>
|
|
43
40
|
</template>
|
|
44
41
|
</sdk-chat-panel>
|
|
45
42
|
</template>
|
|
46
43
|
<script>
|
|
47
44
|
import SdkChatPanel from '../chat-panel'
|
|
48
45
|
import ChatPanelItem from './chat-panel-item.vue'
|
|
49
|
-
import ChatPanelChatStatus from './chat-panel-chat-status/chat-panel-chat-status.vue'
|
|
50
46
|
|
|
51
47
|
export default {
|
|
52
48
|
name: 'SdkWeworkChatPanel',
|
|
53
49
|
components: {
|
|
54
50
|
SdkChatPanel,
|
|
55
|
-
ChatPanelItem
|
|
56
|
-
ChatPanelChatStatus
|
|
51
|
+
ChatPanelItem
|
|
57
52
|
},
|
|
58
53
|
props: {
|
|
59
54
|
mode: {
|
|
@@ -64,8 +59,7 @@ export default {
|
|
|
64
59
|
}
|
|
65
60
|
},
|
|
66
61
|
keyField: {
|
|
67
|
-
type: String
|
|
68
|
-
default: 'id'
|
|
62
|
+
type: String
|
|
69
63
|
},
|
|
70
64
|
startDate: {
|
|
71
65
|
type: Number
|
|
@@ -94,6 +88,9 @@ export default {
|
|
|
94
88
|
type: Boolean,
|
|
95
89
|
default: true
|
|
96
90
|
},
|
|
91
|
+
renderControl: {
|
|
92
|
+
type: Function
|
|
93
|
+
},
|
|
97
94
|
fetchUserMethod: {
|
|
98
95
|
type: Function
|
|
99
96
|
},
|
|
@@ -129,33 +126,12 @@ export default {
|
|
|
129
126
|
},
|
|
130
127
|
contextChatId: {
|
|
131
128
|
type: String
|
|
132
|
-
},
|
|
133
|
-
onBeforeSelectionChange: {
|
|
134
|
-
type: Function
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
data () {
|
|
138
|
-
return {
|
|
139
|
-
checkMsgMap: {}
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
computed: {
|
|
143
|
-
props () {
|
|
144
|
-
const { config, ...nextProps } = this.$props
|
|
145
|
-
return nextProps
|
|
146
|
-
},
|
|
147
|
-
checkTotal () {
|
|
148
|
-
return Object.keys(this.checkMsgMap).length
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
watch: {
|
|
152
|
-
selectable () {
|
|
153
|
-
if (!this.selectable) {
|
|
154
|
-
this.checkMsgMap = {}
|
|
155
|
-
}
|
|
156
129
|
}
|
|
157
130
|
},
|
|
158
131
|
methods: {
|
|
132
|
+
handleRenderControl ({ item }) {
|
|
133
|
+
return ChatControls[item.msgType] || ChatControls.unkonw
|
|
134
|
+
},
|
|
159
135
|
handleIsSenderMethod ({ item }) {
|
|
160
136
|
return !!item.send
|
|
161
137
|
},
|
|
@@ -172,67 +148,8 @@ export default {
|
|
|
172
148
|
this.currentContextChat = null
|
|
173
149
|
return this.$refs.panel && this.$refs.panel.reload()
|
|
174
150
|
},
|
|
175
|
-
handleFilterSelectMessageMethod (msg) {
|
|
176
|
-
if (!this.filterSelectMessageMethod) {
|
|
177
|
-
return true
|
|
178
|
-
}
|
|
179
|
-
return this.filterSelectMessageMethod({
|
|
180
|
-
item: msg
|
|
181
|
-
})
|
|
182
|
-
},
|
|
183
|
-
handleMsgCheckboxChange (msg, value) {
|
|
184
|
-
if (value) {
|
|
185
|
-
this.selectChat(msg)
|
|
186
|
-
} else {
|
|
187
|
-
this.unselectChat(msg)
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
selectChat (chat) {
|
|
191
|
-
if (!chat) {
|
|
192
|
-
return
|
|
193
|
-
}
|
|
194
|
-
if (!this.selectable) {
|
|
195
|
-
console.warn('未开启选择')
|
|
196
|
-
return
|
|
197
|
-
}
|
|
198
|
-
if (this.onBeforeSelectionChange && this.onBeforeSelectionChange({
|
|
199
|
-
chat,
|
|
200
|
-
value: true
|
|
201
|
-
}) === false) {
|
|
202
|
-
return
|
|
203
|
-
}
|
|
204
|
-
this.$set(this.checkMsgMap, chat[this.keyField], chat)
|
|
205
|
-
},
|
|
206
|
-
unselectChat (chat) {
|
|
207
|
-
if (!chat) {
|
|
208
|
-
return
|
|
209
|
-
}
|
|
210
|
-
if (!this.selectable) {
|
|
211
|
-
console.warn('未开启选择')
|
|
212
|
-
return
|
|
213
|
-
}
|
|
214
|
-
if (this.onBeforeSelectionChange && this.onBeforeSelectionChange({
|
|
215
|
-
chat,
|
|
216
|
-
value: false
|
|
217
|
-
}) === false) {
|
|
218
|
-
return
|
|
219
|
-
}
|
|
220
|
-
this.$delete(this.checkMsgMap, chat[this.keyField])
|
|
221
|
-
},
|
|
222
|
-
unselectAllChat () {
|
|
223
|
-
return Object.keys(this.checkMsgMap).map(key => {
|
|
224
|
-
return this.unselectChat(this.checkMsgMap[key])
|
|
225
|
-
})
|
|
226
|
-
},
|
|
227
|
-
getSelectChats () {
|
|
228
|
-
return Object.keys(this.checkMsgMap).map(key => {
|
|
229
|
-
return this.checkMsgMap[key]
|
|
230
|
-
})
|
|
231
|
-
},
|
|
232
151
|
handleChatContext (item, evt) {
|
|
233
|
-
this.$emit('chat-contextmenu',
|
|
234
|
-
item
|
|
235
|
-
}, evt)
|
|
152
|
+
this.$emit('chat-contextmenu', item, evt)
|
|
236
153
|
},
|
|
237
154
|
handleChatViewContext ({ item }) {
|
|
238
155
|
this.$emit('chat-view-context', {
|
package/package.json
CHANGED
|
@@ -452,9 +452,15 @@ class ClientChat {
|
|
|
452
452
|
}
|
|
453
453
|
})
|
|
454
454
|
})
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
455
|
+
} else {
|
|
456
|
+
this.session.updateSession(sessionId, ({ session }) => {
|
|
457
|
+
// listChange/getSession may already include this message in unreadMsgCount.
|
|
458
|
+
// Only count messages newer than the session watermark.
|
|
459
|
+
const isNewerMessage = data.wechatTime > (session.lastMsgTime || 0)
|
|
460
|
+
if (!isNewerMessage) {
|
|
461
|
+
return {}
|
|
462
|
+
}
|
|
463
|
+
const nextSession = {
|
|
458
464
|
lastMsgContent: data.content,
|
|
459
465
|
lastMsgType: data.msgType,
|
|
460
466
|
lastMsgTime: data.wechatTime,
|
|
@@ -462,7 +468,7 @@ class ClientChat {
|
|
|
462
468
|
lastUpdateTime: data.updateDate,
|
|
463
469
|
unreadMsgCount: session.unreadMsgCount
|
|
464
470
|
}
|
|
465
|
-
|
|
471
|
+
if (!data.isSend && isNewerMessage) {
|
|
466
472
|
if (this.sessionManage.currentSession && this.sessionManage.currentSession.conversationId === sessionId && this.shouldMarkCurrentSessionRead(sessionId, data)) {
|
|
467
473
|
// 标记已读
|
|
468
474
|
this.session.setSessionRead(sessionId)
|
|
@@ -594,9 +600,15 @@ class ClientChat {
|
|
|
594
600
|
}
|
|
595
601
|
})
|
|
596
602
|
})
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
603
|
+
} else {
|
|
604
|
+
this.session.updateSession(sessionId, ({ session }) => {
|
|
605
|
+
// listChange/getSession may already include this message in unreadMsgCount.
|
|
606
|
+
// Only count messages newer than the session watermark.
|
|
607
|
+
const isNewerMessage = data.wechatTime > (session.lastMsgTime || 0)
|
|
608
|
+
if (!isNewerMessage) {
|
|
609
|
+
return {}
|
|
610
|
+
}
|
|
611
|
+
const nextSession = {
|
|
600
612
|
lastMsgContent: data.content,
|
|
601
613
|
lastMsgType: data.msgType,
|
|
602
614
|
lastMsgTime: data.wechatTime,
|
|
@@ -604,7 +616,7 @@ class ClientChat {
|
|
|
604
616
|
lastUpdateTime: data.updateDate,
|
|
605
617
|
unreadMsgCount: session.unreadMsgCount
|
|
606
618
|
}
|
|
607
|
-
|
|
619
|
+
if (!data.isSend && isNewerMessage) {
|
|
608
620
|
if (this.sessionManage.currentSession && this.sessionManage.currentSession.conversationId === sessionId && this.shouldMarkCurrentSessionRead(sessionId, data)) {
|
|
609
621
|
// 标记已读
|
|
610
622
|
this.session.setSessionRead(sessionId)
|