@jx3box/jx3box-common-ui 8.9.21 → 8.9.23
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/service/cms.js +6 -1
- package/src/header/alternate.vue +35 -19
package/package.json
CHANGED
package/service/cms.js
CHANGED
|
@@ -77,5 +77,10 @@ function setUserMeta(key,data) {
|
|
|
77
77
|
return $cms().post(`/api/cms/user/my/meta?key=${key}`, data);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
// 刷新凭证
|
|
81
|
+
function refreshAuth() {
|
|
82
|
+
return $cms().post(`/api/cms/user/account/email/refresh`);
|
|
83
|
+
}
|
|
84
|
+
|
|
80
85
|
export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, checkTeamMember,
|
|
81
|
-
getSliders,getSlider, getCollection, getTopicBucket, getConfig, getUserMeta, setUserMeta };
|
|
86
|
+
getSliders,getSlider, getCollection, getTopicBucket, getConfig, getUserMeta, setUserMeta, refreshAuth };
|
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>
|
|
@@ -47,6 +40,7 @@ import { showAvatar } from "@jx3box/jx3box-common/js/utils";
|
|
|
47
40
|
import dayjs from "dayjs";
|
|
48
41
|
import User from "@jx3box/jx3box-common/js/user";
|
|
49
42
|
import { __Links } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
43
|
+
import { refreshAuth } from "../../service/cms"
|
|
50
44
|
export default {
|
|
51
45
|
name: "alternate",
|
|
52
46
|
data() {
|
|
@@ -88,6 +82,23 @@ export default {
|
|
|
88
82
|
return JSON.parse(localStorage.getItem(key));
|
|
89
83
|
});
|
|
90
84
|
|
|
85
|
+
// 如果当前号码不在马甲列表中,添加到列表中
|
|
86
|
+
if (!this.alternate.find((alt) => alt.uid == this.profile.uid)) {
|
|
87
|
+
const data = {
|
|
88
|
+
uid: this.profile.uid,
|
|
89
|
+
name: this.profile.name,
|
|
90
|
+
avatar: localStorage.getItem("avatar"),
|
|
91
|
+
created_at: Number(localStorage.getItem("created_at")),
|
|
92
|
+
group: ~~this.profile.group,
|
|
93
|
+
bind_wx: ~~this.profile.bind_wx,
|
|
94
|
+
token: localStorage.getItem("token"),
|
|
95
|
+
status: ~~this.profile.status,
|
|
96
|
+
};
|
|
97
|
+
this.alternate.unshift(data);
|
|
98
|
+
|
|
99
|
+
localStorage.setItem("jx3box-alternate-" + this.profile.uid, JSON.stringify(data));
|
|
100
|
+
}
|
|
101
|
+
|
|
91
102
|
// 当前激活的排在第一
|
|
92
103
|
this.alternate.sort((a, b) => {
|
|
93
104
|
return a.uid == this.profile.uid ? -1 : 1;
|
|
@@ -96,7 +107,9 @@ export default {
|
|
|
96
107
|
console.error(error);
|
|
97
108
|
}
|
|
98
109
|
},
|
|
99
|
-
showAvatar
|
|
110
|
+
showAvatar(url) {
|
|
111
|
+
return showAvatar(url, "m");
|
|
112
|
+
},
|
|
100
113
|
getFormatTime(time) {
|
|
101
114
|
return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
|
|
102
115
|
},
|
|
@@ -110,13 +123,16 @@ export default {
|
|
|
110
123
|
this.$message.error("该马甲已过期,请重新登录");
|
|
111
124
|
return;
|
|
112
125
|
}
|
|
126
|
+
if (this.profile.uid == item.uid) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
113
129
|
this.$confirm("确定要切换到该马甲吗?", "提示", {
|
|
114
130
|
confirmButtonText: "确定",
|
|
115
131
|
cancelButtonText: "取消",
|
|
116
132
|
type: "warning",
|
|
117
133
|
})
|
|
118
134
|
.then(() => {
|
|
119
|
-
User.update(item).then(() => {
|
|
135
|
+
User.update(item).then(async () => {
|
|
120
136
|
localStorage.setItem(
|
|
121
137
|
"jx3box-alternate-" + item.uid,
|
|
122
138
|
JSON.stringify({
|
|
@@ -124,6 +140,7 @@ export default {
|
|
|
124
140
|
created_at: Number(localStorage.getItem("created_at")),
|
|
125
141
|
})
|
|
126
142
|
);
|
|
143
|
+
await refreshAuth();
|
|
127
144
|
location.reload();
|
|
128
145
|
this.visible = false;
|
|
129
146
|
});
|
|
@@ -159,16 +176,15 @@ export default {
|
|
|
159
176
|
|
|
160
177
|
<style lang="less">
|
|
161
178
|
.c-alternate {
|
|
162
|
-
.el-dialog__title{
|
|
179
|
+
.el-dialog__title {
|
|
163
180
|
.fz(12px);
|
|
164
181
|
}
|
|
165
182
|
.el-dialog__body {
|
|
166
183
|
padding: 0;
|
|
167
184
|
}
|
|
168
185
|
.el-dialog__header {
|
|
169
|
-
padding: 10px;
|
|
186
|
+
// padding: 10px;
|
|
170
187
|
border-bottom: #dcdfe6 1px solid;
|
|
171
|
-
|
|
172
188
|
}
|
|
173
189
|
.c-alternate__content {
|
|
174
190
|
max-height: 600px;
|
|
@@ -251,10 +267,10 @@ export default {
|
|
|
251
267
|
// border-radius: 0;
|
|
252
268
|
.size(100%,74px);
|
|
253
269
|
.fz(40px,74px);
|
|
254
|
-
color
|
|
255
|
-
&:hover{
|
|
256
|
-
background-color
|
|
257
|
-
color
|
|
270
|
+
color: #999;
|
|
271
|
+
&:hover {
|
|
272
|
+
background-color: @bg-light;
|
|
273
|
+
color: #888;
|
|
258
274
|
}
|
|
259
275
|
}
|
|
260
276
|
}
|