@jx3box/jx3box-common-ui 8.9.21 → 8.9.22
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/package.json +1 -1
- package/src/header/alternate.vue +32 -18
package/package.json
CHANGED
package/src/header/alternate.vue
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-dialog
|
|
3
|
-
append-to-body
|
|
4
|
-
:visible.sync="visible"
|
|
5
|
-
custom-class="c-alternate"
|
|
6
|
-
width="320px"
|
|
7
|
-
:show-close="false"
|
|
8
|
-
title="切换马甲"
|
|
9
|
-
>
|
|
2
|
+
<el-dialog append-to-body :visible.sync="visible" custom-class="c-alternate" width="320px" title="切换马甲">
|
|
10
3
|
<div class="c-alternate__content">
|
|
11
4
|
<div
|
|
12
5
|
class="c-alternate-item"
|
|
@@ -32,11 +25,11 @@
|
|
|
32
25
|
</span>
|
|
33
26
|
</div>
|
|
34
27
|
|
|
35
|
-
<div class="u-remove" @click.stop="onRemoveAlternate(item)">
|
|
28
|
+
<div class="u-remove" @click.stop="onRemoveAlternate(item)" v-if="profile.uid != item.uid">
|
|
36
29
|
<i class="el-icon-close"></i>
|
|
37
30
|
</div>
|
|
38
31
|
</div>
|
|
39
|
-
<div class="c-alternate-btn" :class="{'is-disabled': overLength}" @click="onAddAlternate">+</div>
|
|
32
|
+
<div class="c-alternate-btn" :class="{ 'is-disabled': overLength }" @click="onAddAlternate">+</div>
|
|
40
33
|
</div>
|
|
41
34
|
</el-dialog>
|
|
42
35
|
</template>
|
|
@@ -88,6 +81,23 @@ export default {
|
|
|
88
81
|
return JSON.parse(localStorage.getItem(key));
|
|
89
82
|
});
|
|
90
83
|
|
|
84
|
+
// 如果当前号码不在马甲列表中,添加到列表中
|
|
85
|
+
if (!this.alternate.find((alt) => alt.uid == this.profile.uid)) {
|
|
86
|
+
const data = {
|
|
87
|
+
uid: this.profile.uid,
|
|
88
|
+
name: this.profile.name,
|
|
89
|
+
avatar: localStorage.getItem("avatar"),
|
|
90
|
+
created_at: Number(localStorage.getItem("created_at")),
|
|
91
|
+
group: ~~this.profile.group,
|
|
92
|
+
bind_wx: ~~this.profile.bind_wx,
|
|
93
|
+
token: localStorage.getItem("token"),
|
|
94
|
+
status: ~~this.profile.status,
|
|
95
|
+
};
|
|
96
|
+
this.alternate.unshift(data);
|
|
97
|
+
|
|
98
|
+
localStorage.setItem("jx3box-alternate-" + this.profile.uid, JSON.stringify(data));
|
|
99
|
+
}
|
|
100
|
+
|
|
91
101
|
// 当前激活的排在第一
|
|
92
102
|
this.alternate.sort((a, b) => {
|
|
93
103
|
return a.uid == this.profile.uid ? -1 : 1;
|
|
@@ -96,7 +106,9 @@ export default {
|
|
|
96
106
|
console.error(error);
|
|
97
107
|
}
|
|
98
108
|
},
|
|
99
|
-
showAvatar
|
|
109
|
+
showAvatar(url) {
|
|
110
|
+
return showAvatar(url, "m");
|
|
111
|
+
},
|
|
100
112
|
getFormatTime(time) {
|
|
101
113
|
return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
|
|
102
114
|
},
|
|
@@ -110,6 +122,9 @@ export default {
|
|
|
110
122
|
this.$message.error("该马甲已过期,请重新登录");
|
|
111
123
|
return;
|
|
112
124
|
}
|
|
125
|
+
if (this.profile.uid == item.uid) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
113
128
|
this.$confirm("确定要切换到该马甲吗?", "提示", {
|
|
114
129
|
confirmButtonText: "确定",
|
|
115
130
|
cancelButtonText: "取消",
|
|
@@ -159,16 +174,15 @@ export default {
|
|
|
159
174
|
|
|
160
175
|
<style lang="less">
|
|
161
176
|
.c-alternate {
|
|
162
|
-
.el-dialog__title{
|
|
177
|
+
.el-dialog__title {
|
|
163
178
|
.fz(12px);
|
|
164
179
|
}
|
|
165
180
|
.el-dialog__body {
|
|
166
181
|
padding: 0;
|
|
167
182
|
}
|
|
168
183
|
.el-dialog__header {
|
|
169
|
-
padding: 10px;
|
|
184
|
+
// padding: 10px;
|
|
170
185
|
border-bottom: #dcdfe6 1px solid;
|
|
171
|
-
|
|
172
186
|
}
|
|
173
187
|
.c-alternate__content {
|
|
174
188
|
max-height: 600px;
|
|
@@ -251,10 +265,10 @@ export default {
|
|
|
251
265
|
// border-radius: 0;
|
|
252
266
|
.size(100%,74px);
|
|
253
267
|
.fz(40px,74px);
|
|
254
|
-
color
|
|
255
|
-
&:hover{
|
|
256
|
-
background-color
|
|
257
|
-
color
|
|
268
|
+
color: #999;
|
|
269
|
+
&:hover {
|
|
270
|
+
background-color: @bg-light;
|
|
271
|
+
color: #888;
|
|
258
272
|
}
|
|
259
273
|
}
|
|
260
274
|
}
|