xs-common-plugins 1.2.1 → 1.2.4
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/README.md +298 -294
- package/common.js +110 -110
- package/index.js +1 -1
- package/package.json +16 -16
- package/src/common/common.js +548 -548
- package/src/components/CheckBox_Cmp/index.vue +62 -62
- package/src/components/FormItem/index.vue +92 -92
- package/src/components/ReportCmp/index.vue +76 -76
- package/src/components/Search/index.scss +219 -219
- package/src/components/Search/index.vue +410 -410
- package/src/components/Search/product_option/index.scss +1 -1
- package/src/components/Search_filter/index.scss +104 -104
- package/src/components/TableItem/TableItem.vue +55 -55
- package/src/components/TextOVer/index.vue +55 -55
- package/src/components/UploadImg/index.vue +177 -177
- package/src/components/im/index.vue +155 -155
- package/src/components/im/pages/chatList/index.vue +45 -45
- package/src/components/im/pages/chatRoom/index.vue +159 -159
- package/src/components/xsSelect/index.vue +125 -125
- package/src/mixin/keepAlive.js +53 -0
- package/src/plugins/im/components/chat/index.scss +163 -163
- package/src/plugins/im/components/chat/index.vue +144 -144
- package/src/plugins/im/components/chat/methods.js +149 -149
- package/src/plugins/im/components/msg-image/index.vue +40 -40
- package/src/plugins/im/components/send-msg/index.scss +164 -164
- package/src/plugins/im/components/send-msg/index.vue +107 -107
- package/src/plugins/im/components/send-msg/methods.js +125 -125
- package/src/plugins/im/components/template-message/index.vue +76 -76
- package/src/plugins/im/components/without.vue +19 -19
- package/src/plugins/im/index.js +31 -31
- package/src/plugins/im/utils/services.js +625 -625
- package/src/plugins/index.js +60 -60
- package/src/plugins/row-col-cmp/index.js +20 -20
- package/src/router/permission.js +126 -126
- package/src/store/modules/dic.js +74 -74
- package/src/store/modules/oss.js +40 -40
- package/src/styles/index.scss +91 -91
- package/src/styles/table.scss +90 -90
- package/src/utils/api.js +54 -54
- package/src/utils/auth.js +38 -38
- package/src/utils/concat_batch_btns.js +88 -88
- package/src/utils/enum.js +150 -150
- package/src/utils/filter.js +5 -5
- package/src/utils/filterRules.js +55 -55
- package/src/utils/getMenu.js +82 -82
- package/src/utils/global_directive.js +10 -0
- package/src/utils/ossService.js +55 -55
- package/src/utils/prototype.js +46 -46
- package/src/utils/search.js +33 -33
- package/src/utils/signalR.js +24 -24
- package/src/views/callback/index.vue +35 -35
- package/src/views/home/index.vue +25 -25
- package/src/views/layout/components/AppMain.vue +21 -5
- package/src/views/layout/components/Navbar.vue +20 -13
- package/src/views/layout/components/TagsView/index.vue +130 -91
- package/src/views/slienceAuth/index.vue +42 -42
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const MIX_KEEPALIVE = {
|
|
2
|
+
inject: ["reload"],
|
|
3
|
+
activated() {
|
|
4
|
+
// 切换其他选项卡后,删除当前页面选项卡
|
|
5
|
+
if (this.$route.meta && this.$route.meta.upload) {
|
|
6
|
+
delete this.$route.meta.upload;
|
|
7
|
+
this.findDataIsKeepAlive(this.$vnode)
|
|
8
|
+
this.reload();
|
|
9
|
+
} else {
|
|
10
|
+
// 切换选项卡 还原 el-table 滚动条位置
|
|
11
|
+
const t = this.$el.getAttribute("scrollTop") || 0;
|
|
12
|
+
const selectWrap = this.$el.querySelector(".el-table__body-wrapper");
|
|
13
|
+
setTimeout(() => {
|
|
14
|
+
selectWrap.scrollTo(0, t);
|
|
15
|
+
}, 0);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
deactivated() {
|
|
19
|
+
// 当前选项卡关闭, window.nnav 标识,启动清楚当前组件缓存,并删除标识
|
|
20
|
+
console.log('deactivated');
|
|
21
|
+
if (window.nnav) {
|
|
22
|
+
delete window.nnav;
|
|
23
|
+
this.findDataIsKeepAlive(this.$vnode);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
// 关闭当前选项卡 - 清楚 keep-alive 缓存
|
|
28
|
+
findDataIsKeepAlive(el) {
|
|
29
|
+
if (el && el.data.keepAlive) {
|
|
30
|
+
var key =
|
|
31
|
+
el.key == null
|
|
32
|
+
? el.componentOptions.Ctor.cid +
|
|
33
|
+
(el.componentOptions.tag ? `::${el.componentOptions.tag}` : "")
|
|
34
|
+
: el.key;
|
|
35
|
+
var cache = el.parent.componentInstance.cache;
|
|
36
|
+
var keys = el.parent.componentInstance.keys;
|
|
37
|
+
if (cache[key]) {
|
|
38
|
+
if (keys.length) {
|
|
39
|
+
var index = keys.indexOf(key);
|
|
40
|
+
if (index > -1) {
|
|
41
|
+
keys.splice(index, 1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
delete cache[key];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
this.$destroy();
|
|
48
|
+
} else {
|
|
49
|
+
this.findDataIsKeepAlive(el.parent);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
}
|
|
@@ -1,164 +1,164 @@
|
|
|
1
|
-
.rong-chat {
|
|
2
|
-
position: absolute;
|
|
3
|
-
width: 100%;
|
|
4
|
-
min-height: 100vh;
|
|
5
|
-
top: 0;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
overflow: auto;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
#rong-messages {
|
|
11
|
-
position: absolute;
|
|
12
|
-
top: 0;
|
|
13
|
-
bottom: 50px;
|
|
14
|
-
width: 100%;
|
|
15
|
-
overflow-y: auto;
|
|
16
|
-
padding: 0 10px;
|
|
17
|
-
padding-top: 45px;
|
|
18
|
-
padding-bottom: 80px;
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
#rong-messages::-webkit-scrollbar {
|
|
24
|
-
width: 4px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.sentTime {
|
|
28
|
-
text-align: center;
|
|
29
|
-
font-size: 10px;
|
|
30
|
-
color: #8e969f;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
#rong-messages::-webkit-scrollbar-thumb {
|
|
34
|
-
border-radius: 10px;
|
|
35
|
-
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
36
|
-
background: rgba(0, 0, 0, 0.2);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
#rong-messages::-webkit-scrollbar-track {
|
|
40
|
-
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
41
|
-
border-radius: 0;
|
|
42
|
-
background: rgba(0, 0, 0, 0.1);
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.rong-message {
|
|
47
|
-
margin: 20px 0 25px 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.rong-messages-getbtn {
|
|
51
|
-
margin: 10px;
|
|
52
|
-
position: relative;
|
|
53
|
-
left: 50%;
|
|
54
|
-
transform: translateX(-50%);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.rong-message-avatar {
|
|
58
|
-
height: 40px;
|
|
59
|
-
width: 40px;
|
|
60
|
-
border-radius: 10px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.rong-message-name {
|
|
64
|
-
color: #8e969f;
|
|
65
|
-
width: 40px;
|
|
66
|
-
overflow: hidden;
|
|
67
|
-
text-align: center;
|
|
68
|
-
font-size: 12px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.rong-message-avatar-receiver {
|
|
72
|
-
float: left;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.rong-message-avatar-sender {
|
|
76
|
-
float: right;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.rong-message-content {
|
|
80
|
-
max-width: 65%;
|
|
81
|
-
box-sizing: border-box;
|
|
82
|
-
display: inline-block;
|
|
83
|
-
border-radius: 5px;
|
|
84
|
-
word-wrap: break-word;
|
|
85
|
-
position: relative;
|
|
86
|
-
// top: 15px;
|
|
87
|
-
margin: 0 5px;
|
|
88
|
-
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.05);
|
|
89
|
-
font-size: 15px;
|
|
90
|
-
font-family: 'PingFang SC';
|
|
91
|
-
color: #000000;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.rong-message-content-receiver::after,
|
|
95
|
-
.rong-message-content-receiver::before,
|
|
96
|
-
.rong-message-content-sender::after,
|
|
97
|
-
.rong-message-content-sender::before {
|
|
98
|
-
content: "";
|
|
99
|
-
border: 15px solid;
|
|
100
|
-
position: absolute;
|
|
101
|
-
top: 20px;
|
|
102
|
-
border-color: transparent;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.rong-message-content-receiver::after {
|
|
106
|
-
// border-color: transparent #fff transparent transparent;
|
|
107
|
-
left: -23px;
|
|
108
|
-
z-index: 0;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.rong-message-content-receiver::before {
|
|
112
|
-
border-color: transparent transparent transparent transparent;
|
|
113
|
-
left: -26.5px;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.rong-message-content-receiver {
|
|
117
|
-
float: left;
|
|
118
|
-
// background-color: #CBE7FC;
|
|
119
|
-
background-color: #fff;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.rong-message-content-sender::after {
|
|
123
|
-
// border-color: transparent transparent transparent #fff;
|
|
124
|
-
right: -24px;
|
|
125
|
-
z-index: 0;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.rong-message-content-sender {
|
|
129
|
-
float: right;
|
|
130
|
-
background-color: #FFF;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.rong-clearfix {
|
|
134
|
-
clear: both;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.rong-message-content-image-sender {
|
|
138
|
-
float: right;
|
|
139
|
-
margin-right: 19px;
|
|
140
|
-
margin-top: -16px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.rong-message-content-image-receiver {
|
|
144
|
-
margin-top: -16px;
|
|
145
|
-
margin-left: 16px;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.fixed-top {
|
|
149
|
-
position: fixed;
|
|
150
|
-
width: 100%;
|
|
151
|
-
left: 0;
|
|
152
|
-
top: 20px;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.fixed-bottom {
|
|
156
|
-
position: fixed;
|
|
157
|
-
left: 0;
|
|
158
|
-
bottom: 110px;
|
|
159
|
-
width: 100%;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.fixedWhite {
|
|
163
|
-
top: 80px!important
|
|
1
|
+
.rong-chat {
|
|
2
|
+
position: absolute;
|
|
3
|
+
width: 100%;
|
|
4
|
+
min-height: 100vh;
|
|
5
|
+
top: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
overflow: auto;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
#rong-messages {
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: 0;
|
|
13
|
+
bottom: 50px;
|
|
14
|
+
width: 100%;
|
|
15
|
+
overflow-y: auto;
|
|
16
|
+
padding: 0 10px;
|
|
17
|
+
padding-top: 45px;
|
|
18
|
+
padding-bottom: 80px;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#rong-messages::-webkit-scrollbar {
|
|
24
|
+
width: 4px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.sentTime {
|
|
28
|
+
text-align: center;
|
|
29
|
+
font-size: 10px;
|
|
30
|
+
color: #8e969f;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#rong-messages::-webkit-scrollbar-thumb {
|
|
34
|
+
border-radius: 10px;
|
|
35
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
36
|
+
background: rgba(0, 0, 0, 0.2);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#rong-messages::-webkit-scrollbar-track {
|
|
40
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
41
|
+
border-radius: 0;
|
|
42
|
+
background: rgba(0, 0, 0, 0.1);
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.rong-message {
|
|
47
|
+
margin: 20px 0 25px 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.rong-messages-getbtn {
|
|
51
|
+
margin: 10px;
|
|
52
|
+
position: relative;
|
|
53
|
+
left: 50%;
|
|
54
|
+
transform: translateX(-50%);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.rong-message-avatar {
|
|
58
|
+
height: 40px;
|
|
59
|
+
width: 40px;
|
|
60
|
+
border-radius: 10px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.rong-message-name {
|
|
64
|
+
color: #8e969f;
|
|
65
|
+
width: 40px;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
text-align: center;
|
|
68
|
+
font-size: 12px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.rong-message-avatar-receiver {
|
|
72
|
+
float: left;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.rong-message-avatar-sender {
|
|
76
|
+
float: right;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.rong-message-content {
|
|
80
|
+
max-width: 65%;
|
|
81
|
+
box-sizing: border-box;
|
|
82
|
+
display: inline-block;
|
|
83
|
+
border-radius: 5px;
|
|
84
|
+
word-wrap: break-word;
|
|
85
|
+
position: relative;
|
|
86
|
+
// top: 15px;
|
|
87
|
+
margin: 0 5px;
|
|
88
|
+
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.05);
|
|
89
|
+
font-size: 15px;
|
|
90
|
+
font-family: 'PingFang SC';
|
|
91
|
+
color: #000000;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.rong-message-content-receiver::after,
|
|
95
|
+
.rong-message-content-receiver::before,
|
|
96
|
+
.rong-message-content-sender::after,
|
|
97
|
+
.rong-message-content-sender::before {
|
|
98
|
+
content: "";
|
|
99
|
+
border: 15px solid;
|
|
100
|
+
position: absolute;
|
|
101
|
+
top: 20px;
|
|
102
|
+
border-color: transparent;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.rong-message-content-receiver::after {
|
|
106
|
+
// border-color: transparent #fff transparent transparent;
|
|
107
|
+
left: -23px;
|
|
108
|
+
z-index: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.rong-message-content-receiver::before {
|
|
112
|
+
border-color: transparent transparent transparent transparent;
|
|
113
|
+
left: -26.5px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.rong-message-content-receiver {
|
|
117
|
+
float: left;
|
|
118
|
+
// background-color: #CBE7FC;
|
|
119
|
+
background-color: #fff;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.rong-message-content-sender::after {
|
|
123
|
+
// border-color: transparent transparent transparent #fff;
|
|
124
|
+
right: -24px;
|
|
125
|
+
z-index: 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.rong-message-content-sender {
|
|
129
|
+
float: right;
|
|
130
|
+
background-color: #FFF;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.rong-clearfix {
|
|
134
|
+
clear: both;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.rong-message-content-image-sender {
|
|
138
|
+
float: right;
|
|
139
|
+
margin-right: 19px;
|
|
140
|
+
margin-top: -16px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.rong-message-content-image-receiver {
|
|
144
|
+
margin-top: -16px;
|
|
145
|
+
margin-left: 16px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.fixed-top {
|
|
149
|
+
position: fixed;
|
|
150
|
+
width: 100%;
|
|
151
|
+
left: 0;
|
|
152
|
+
top: 20px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.fixed-bottom {
|
|
156
|
+
position: fixed;
|
|
157
|
+
left: 0;
|
|
158
|
+
bottom: 110px;
|
|
159
|
+
width: 100%;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.fixedWhite {
|
|
163
|
+
top: 80px!important
|
|
164
164
|
}
|
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: your name
|
|
3
|
-
* @Date: 2021-01-15 11:24:40
|
|
4
|
-
* @LastEditTime: 2021-01-16 08:50:23
|
|
5
|
-
* @LastEditors: Please set LastEditors
|
|
6
|
-
* @Description: In User Settings Edit
|
|
7
|
-
* @FilePath: \dev\src\plugins\im\components\chat\index.vue
|
|
8
|
-
-->
|
|
9
|
-
<template>
|
|
10
|
-
<div class="rong-chat" id="rong-chat-id" :style="{ bottom: bottom + 'px' }">
|
|
11
|
-
<div id="rong-messages" ref="rongMessageWrapEl" :class="getFixClass">
|
|
12
|
-
<div id="rong-message-wrap-el" ref="rongMessageWrapMainEl">
|
|
13
|
-
<button
|
|
14
|
-
v-if="hasMore"
|
|
15
|
-
class="rong-messages-getbtn"
|
|
16
|
-
type="primary"
|
|
17
|
-
size="mini"
|
|
18
|
-
@click="getMoreMessages"
|
|
19
|
-
>
|
|
20
|
-
加载更多
|
|
21
|
-
</button>
|
|
22
|
-
<loading v-if="!isAllowScroll"></loading>
|
|
23
|
-
<withoutmessage
|
|
24
|
-
v-if="!hasMore"
|
|
25
|
-
id="message-notify-without"
|
|
26
|
-
></withoutmessage>
|
|
27
|
-
<div
|
|
28
|
-
v-for="(message, i) in messageList"
|
|
29
|
-
v-if="message.messageType != 'RC:ReadNtf'"
|
|
30
|
-
:key="message.uId"
|
|
31
|
-
:id="'U-' + message.uId"
|
|
32
|
-
class="rong-message uni-page-wrapper"
|
|
33
|
-
>
|
|
34
|
-
<p class="sentTime" v-if="i % 3 === 0">
|
|
35
|
-
{{ getTime(message.sentTime) }}
|
|
36
|
-
</p>
|
|
37
|
-
<div :class="['rong-message-avatar-' + message.direction]" v-if="message.name!=='XS:TextMsg'">
|
|
38
|
-
<!-- <div class="rong-message-name">{{ message.sender.name }}</div> -->
|
|
39
|
-
<img
|
|
40
|
-
v-if="message.direction !== 'sender' && message.content.userInfo && message.content.userInfo.avatarUrl"
|
|
41
|
-
class="rong-avatar rong-message-avatar"
|
|
42
|
-
:src="message.content.userInfo.avatarUrl"
|
|
43
|
-
/>
|
|
44
|
-
<img
|
|
45
|
-
v-else
|
|
46
|
-
class="rong-avatar rong-message-avatar"
|
|
47
|
-
:src="
|
|
48
|
-
message.direction == 'sender'
|
|
49
|
-
? message.sender.avatar1
|
|
50
|
-
: message.sender.avatar2
|
|
51
|
-
"
|
|
52
|
-
/>
|
|
53
|
-
</div>
|
|
54
|
-
<div
|
|
55
|
-
:class="['rong-message-content rong-message-content-' + message.direction, ]"
|
|
56
|
-
>
|
|
57
|
-
<slot name="message" :message="message"></slot>
|
|
58
|
-
</div>
|
|
59
|
-
<TemplateMessage
|
|
60
|
-
v-if="message.name == 'XS:TextMsg'"
|
|
61
|
-
:message="message"
|
|
62
|
-
/>
|
|
63
|
-
<div class="rong-clearfix"></div>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
<!-- 顶部插槽 -->
|
|
68
|
-
<div class="fixed-top">
|
|
69
|
-
<slot name="slot-top" :list="messageList" />
|
|
70
|
-
</div>
|
|
71
|
-
<!-- 底部插槽 -->
|
|
72
|
-
<div class="fixed-bottom">
|
|
73
|
-
<slot name="slot-bottom"></slot>
|
|
74
|
-
</div>
|
|
75
|
-
<!-- 发送消息 -->
|
|
76
|
-
<send-msg
|
|
77
|
-
@sendMsgEvent="sendMsgEvent"
|
|
78
|
-
:targetId="targetId"
|
|
79
|
-
:type="type"
|
|
80
|
-
:targetName="targetName"
|
|
81
|
-
:userName="chatObj.latestMessage.content.userInfo ? chatObj.latestMessage.content.userInfo.userName : ''"
|
|
82
|
-
:avatarUrl="chatObj.latestMessage.content.userInfo ? chatObj.latestMessage.content.userInfo.avatarUrl : ''"
|
|
83
|
-
:chatObj="chatObj"
|
|
84
|
-
>
|
|
85
|
-
<div slot="slot-tool">
|
|
86
|
-
<slot name="slot-tool"></slot>
|
|
87
|
-
</div>
|
|
88
|
-
</send-msg>
|
|
89
|
-
</div>
|
|
90
|
-
</template>
|
|
91
|
-
<script>
|
|
92
|
-
import loading from "../loading/loading.vue";
|
|
93
|
-
import withoutmessage from "../without.vue";
|
|
94
|
-
import SendMsg from "../send-msg/index.vue";
|
|
95
|
-
import methods from "./methods";
|
|
96
|
-
import TemplateMessage from "../template-message/index.vue"
|
|
97
|
-
export default {
|
|
98
|
-
name: "chatCom",
|
|
99
|
-
data() {
|
|
100
|
-
return {
|
|
101
|
-
messageList: [],
|
|
102
|
-
bottom: 0,
|
|
103
|
-
adapterHeight: 0,
|
|
104
|
-
isShowEmojiSent: false,
|
|
105
|
-
hasMore: true,
|
|
106
|
-
todiv: "",
|
|
107
|
-
isAllowScroll: true,
|
|
108
|
-
isScrollTop: false,
|
|
109
|
-
isCurrent: false,
|
|
110
|
-
};
|
|
111
|
-
},
|
|
112
|
-
components: {
|
|
113
|
-
withoutmessage,
|
|
114
|
-
loading,
|
|
115
|
-
SendMsg,
|
|
116
|
-
TemplateMessage
|
|
117
|
-
},
|
|
118
|
-
props: {
|
|
119
|
-
targetId: [String, Number],
|
|
120
|
-
type: [String, Number],
|
|
121
|
-
targetName: [String, Number],
|
|
122
|
-
chatObj: [Object],
|
|
123
|
-
},
|
|
124
|
-
methods,
|
|
125
|
-
computed: {
|
|
126
|
-
getFixClass () {
|
|
127
|
-
const goodsList = this.messageList.filter(item => item.content && item.content.OutGoodsId)
|
|
128
|
-
return goodsList.length > 0 ? 'fixedWhite' : '';
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
mounted() {
|
|
132
|
-
const timer = setInterval(() => {
|
|
133
|
-
if (this.targetId) {
|
|
134
|
-
clearInterval(timer);
|
|
135
|
-
this.onloadEvent();
|
|
136
|
-
}
|
|
137
|
-
}, 100);
|
|
138
|
-
},
|
|
139
|
-
beforeDestroy() {
|
|
140
|
-
this.isCurrent = false;
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
</script>
|
|
144
|
-
<style lang="scss" src='./index.scss'></style>
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: your name
|
|
3
|
+
* @Date: 2021-01-15 11:24:40
|
|
4
|
+
* @LastEditTime: 2021-01-16 08:50:23
|
|
5
|
+
* @LastEditors: Please set LastEditors
|
|
6
|
+
* @Description: In User Settings Edit
|
|
7
|
+
* @FilePath: \dev\src\plugins\im\components\chat\index.vue
|
|
8
|
+
-->
|
|
9
|
+
<template>
|
|
10
|
+
<div class="rong-chat" id="rong-chat-id" :style="{ bottom: bottom + 'px' }">
|
|
11
|
+
<div id="rong-messages" ref="rongMessageWrapEl" :class="getFixClass">
|
|
12
|
+
<div id="rong-message-wrap-el" ref="rongMessageWrapMainEl">
|
|
13
|
+
<button
|
|
14
|
+
v-if="hasMore"
|
|
15
|
+
class="rong-messages-getbtn"
|
|
16
|
+
type="primary"
|
|
17
|
+
size="mini"
|
|
18
|
+
@click="getMoreMessages"
|
|
19
|
+
>
|
|
20
|
+
加载更多
|
|
21
|
+
</button>
|
|
22
|
+
<loading v-if="!isAllowScroll"></loading>
|
|
23
|
+
<withoutmessage
|
|
24
|
+
v-if="!hasMore"
|
|
25
|
+
id="message-notify-without"
|
|
26
|
+
></withoutmessage>
|
|
27
|
+
<div
|
|
28
|
+
v-for="(message, i) in messageList"
|
|
29
|
+
v-if="message.messageType != 'RC:ReadNtf'"
|
|
30
|
+
:key="message.uId"
|
|
31
|
+
:id="'U-' + message.uId"
|
|
32
|
+
class="rong-message uni-page-wrapper"
|
|
33
|
+
>
|
|
34
|
+
<p class="sentTime" v-if="i % 3 === 0">
|
|
35
|
+
{{ getTime(message.sentTime) }}
|
|
36
|
+
</p>
|
|
37
|
+
<div :class="['rong-message-avatar-' + message.direction]" v-if="message.name!=='XS:TextMsg'">
|
|
38
|
+
<!-- <div class="rong-message-name">{{ message.sender.name }}</div> -->
|
|
39
|
+
<img
|
|
40
|
+
v-if="message.direction !== 'sender' && message.content.userInfo && message.content.userInfo.avatarUrl"
|
|
41
|
+
class="rong-avatar rong-message-avatar"
|
|
42
|
+
:src="message.content.userInfo.avatarUrl"
|
|
43
|
+
/>
|
|
44
|
+
<img
|
|
45
|
+
v-else
|
|
46
|
+
class="rong-avatar rong-message-avatar"
|
|
47
|
+
:src="
|
|
48
|
+
message.direction == 'sender'
|
|
49
|
+
? message.sender.avatar1
|
|
50
|
+
: message.sender.avatar2
|
|
51
|
+
"
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
<div
|
|
55
|
+
:class="['rong-message-content rong-message-content-' + message.direction, ]"
|
|
56
|
+
>
|
|
57
|
+
<slot name="message" :message="message"></slot>
|
|
58
|
+
</div>
|
|
59
|
+
<TemplateMessage
|
|
60
|
+
v-if="message.name == 'XS:TextMsg'"
|
|
61
|
+
:message="message"
|
|
62
|
+
/>
|
|
63
|
+
<div class="rong-clearfix"></div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<!-- 顶部插槽 -->
|
|
68
|
+
<div class="fixed-top">
|
|
69
|
+
<slot name="slot-top" :list="messageList" />
|
|
70
|
+
</div>
|
|
71
|
+
<!-- 底部插槽 -->
|
|
72
|
+
<div class="fixed-bottom">
|
|
73
|
+
<slot name="slot-bottom"></slot>
|
|
74
|
+
</div>
|
|
75
|
+
<!-- 发送消息 -->
|
|
76
|
+
<send-msg
|
|
77
|
+
@sendMsgEvent="sendMsgEvent"
|
|
78
|
+
:targetId="targetId"
|
|
79
|
+
:type="type"
|
|
80
|
+
:targetName="targetName"
|
|
81
|
+
:userName="chatObj.latestMessage.content.userInfo ? chatObj.latestMessage.content.userInfo.userName : ''"
|
|
82
|
+
:avatarUrl="chatObj.latestMessage.content.userInfo ? chatObj.latestMessage.content.userInfo.avatarUrl : ''"
|
|
83
|
+
:chatObj="chatObj"
|
|
84
|
+
>
|
|
85
|
+
<div slot="slot-tool">
|
|
86
|
+
<slot name="slot-tool"></slot>
|
|
87
|
+
</div>
|
|
88
|
+
</send-msg>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
91
|
+
<script>
|
|
92
|
+
import loading from "../loading/loading.vue";
|
|
93
|
+
import withoutmessage from "../without.vue";
|
|
94
|
+
import SendMsg from "../send-msg/index.vue";
|
|
95
|
+
import methods from "./methods";
|
|
96
|
+
import TemplateMessage from "../template-message/index.vue"
|
|
97
|
+
export default {
|
|
98
|
+
name: "chatCom",
|
|
99
|
+
data() {
|
|
100
|
+
return {
|
|
101
|
+
messageList: [],
|
|
102
|
+
bottom: 0,
|
|
103
|
+
adapterHeight: 0,
|
|
104
|
+
isShowEmojiSent: false,
|
|
105
|
+
hasMore: true,
|
|
106
|
+
todiv: "",
|
|
107
|
+
isAllowScroll: true,
|
|
108
|
+
isScrollTop: false,
|
|
109
|
+
isCurrent: false,
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
components: {
|
|
113
|
+
withoutmessage,
|
|
114
|
+
loading,
|
|
115
|
+
SendMsg,
|
|
116
|
+
TemplateMessage
|
|
117
|
+
},
|
|
118
|
+
props: {
|
|
119
|
+
targetId: [String, Number],
|
|
120
|
+
type: [String, Number],
|
|
121
|
+
targetName: [String, Number],
|
|
122
|
+
chatObj: [Object],
|
|
123
|
+
},
|
|
124
|
+
methods,
|
|
125
|
+
computed: {
|
|
126
|
+
getFixClass () {
|
|
127
|
+
const goodsList = this.messageList.filter(item => item.content && item.content.OutGoodsId)
|
|
128
|
+
return goodsList.length > 0 ? 'fixedWhite' : '';
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
mounted() {
|
|
132
|
+
const timer = setInterval(() => {
|
|
133
|
+
if (this.targetId) {
|
|
134
|
+
clearInterval(timer);
|
|
135
|
+
this.onloadEvent();
|
|
136
|
+
}
|
|
137
|
+
}, 100);
|
|
138
|
+
},
|
|
139
|
+
beforeDestroy() {
|
|
140
|
+
this.isCurrent = false;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
</script>
|
|
144
|
+
<style lang="scss" src='./index.scss'></style>
|