@jx3box/jx3box-common-ui 8.9.18 → 8.9.20
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg t="1726565101981" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10379" width="200" height="200"><path d="M544.234145 146.178267c-202.342428 0-366.335433 163.993005-366.335433 366.335433 0 202.343451 163.993005 366.332363 366.335433 366.332363 202.366987 0 366.331339-163.988912 366.331339-366.332363C910.565485 310.171272 746.577596 146.178267 544.234145 146.178267L544.234145 146.178267zM475.964272 690.441065 312.25984 526.736633l37.042661-37.042661L475.964272 616.355743l263.221983-263.225053 37.042661 37.042661L475.964272 690.441065 475.964272 690.441065zM475.964272 690.441065" fill="#67C23A" p-id="10380"></path></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jx3box/jx3box-common-ui",
|
|
3
|
-
"version": "8.9.
|
|
3
|
+
"version": "8.9.20",
|
|
4
4
|
"description": "JX3BOX UI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@jx3box/jx3box-comment-ui": "^1.9.3",
|
|
34
|
-
"@jx3box/jx3box-common": "^8.
|
|
34
|
+
"@jx3box/jx3box-common": "^8.3.5",
|
|
35
35
|
"@jx3box/jx3box-data": "^3.5.8",
|
|
36
36
|
"@jx3box/jx3box-editor": "^2.1.9",
|
|
37
37
|
"@jx3box/reporter": "^0.0.4",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
>
|
|
145
145
|
</div>
|
|
146
146
|
<div class="c-community-buttons_right">
|
|
147
|
-
<el-button type="primary" size="small" @click="submit" :loading="pushing"
|
|
147
|
+
<el-button type="primary" size="small" @click="submit" :loading="pushing">提交</el-button>
|
|
148
148
|
<el-button type="plain" size="small" @click="close">取消</el-button>
|
|
149
149
|
</div>
|
|
150
150
|
</div>
|
|
@@ -253,7 +253,7 @@ export default {
|
|
|
253
253
|
this.$message.error("ID不存在!");
|
|
254
254
|
return;
|
|
255
255
|
}
|
|
256
|
-
this.$confirm(
|
|
256
|
+
this.$confirm(`此操作将该数据转为【待审核】状态, 是否继续?`, "提示", {
|
|
257
257
|
confirmButtonText: "确定",
|
|
258
258
|
cancelButtonText: "取消",
|
|
259
259
|
type: "warning",
|
|
@@ -337,7 +337,7 @@ export default {
|
|
|
337
337
|
this.$message.error("ID不存在!");
|
|
338
338
|
return;
|
|
339
339
|
}
|
|
340
|
-
this.$confirm("
|
|
340
|
+
this.$confirm("此操作将【删除】该数据, 是否继续?", "提示", {
|
|
341
341
|
confirmButtonText: "确定",
|
|
342
342
|
cancelButtonText: "取消",
|
|
343
343
|
type: "warning",
|
|
@@ -492,11 +492,13 @@ export default {
|
|
|
492
492
|
@media screen and (max-width: @phone) {
|
|
493
493
|
.c-community-admin {
|
|
494
494
|
.c-community-buttons {
|
|
495
|
-
|
|
495
|
+
width: 100%;
|
|
496
496
|
justify-content: space-between;
|
|
497
|
+
.pr;
|
|
498
|
+
bottom: 0;
|
|
497
499
|
}
|
|
498
500
|
|
|
499
|
-
.u-delete {
|
|
501
|
+
.u-delete, .u-check {
|
|
500
502
|
span {
|
|
501
503
|
display: none !important;
|
|
502
504
|
}
|
|
@@ -0,0 +1,261 @@
|
|
|
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
|
+
>
|
|
10
|
+
<div class="c-alternate__content">
|
|
11
|
+
<div
|
|
12
|
+
class="c-alternate-item"
|
|
13
|
+
:class="{ 'is-active': profile.uid == item.uid, 'is-expired': isExpired(item.created_at) }"
|
|
14
|
+
v-for="item in alternate"
|
|
15
|
+
:key="item.uid"
|
|
16
|
+
@click="onSelectAlternate(item)"
|
|
17
|
+
>
|
|
18
|
+
<div class="m-avatar">
|
|
19
|
+
<img
|
|
20
|
+
class="u-active"
|
|
21
|
+
v-if="profile.uid == item.uid"
|
|
22
|
+
src="../../assets/img/header/check.svg"
|
|
23
|
+
alt=""
|
|
24
|
+
/>
|
|
25
|
+
<img class="u-avatar" :src="showAvatar(item.avatar)" alt="" />
|
|
26
|
+
</div>
|
|
27
|
+
<div class="m-misc">
|
|
28
|
+
<span class="u-name"><span class="u-label">用户昵称:</span>{{ item.name }}</span>
|
|
29
|
+
<span class="u-time">
|
|
30
|
+
<span class="u-label">上次登录:</span>{{ getFormatTime(item.created_at) }}
|
|
31
|
+
<span class="u-extra" v-if="isExpired(item.created_at)">(已过期)</span>
|
|
32
|
+
</span>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div class="u-remove" @click.stop="onRemoveAlternate(item)">
|
|
36
|
+
<i class="el-icon-close"></i>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="c-alternate-btn" :class="{'is-disabled': overLength}" @click="onAddAlternate">+</div>
|
|
40
|
+
</div>
|
|
41
|
+
</el-dialog>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
import Bus from "../../service/bus";
|
|
46
|
+
import { showAvatar } from "@jx3box/jx3box-common/js/utils";
|
|
47
|
+
import dayjs from "dayjs";
|
|
48
|
+
import User from "@jx3box/jx3box-common/js/user";
|
|
49
|
+
import { __Links } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
50
|
+
export default {
|
|
51
|
+
name: "alternate",
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
visible: false,
|
|
55
|
+
|
|
56
|
+
alternate: [
|
|
57
|
+
// {
|
|
58
|
+
// uid: 100,
|
|
59
|
+
// name: "马甲1",
|
|
60
|
+
// avatar: "https://avatar.jx3box.com/avatar/1",
|
|
61
|
+
// created_at: 1620000000000,
|
|
62
|
+
// },
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
computed: {
|
|
67
|
+
profile() {
|
|
68
|
+
return User.getInfo();
|
|
69
|
+
},
|
|
70
|
+
overLength() {
|
|
71
|
+
return this.alternate.length > 5;
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
mounted() {
|
|
75
|
+
Bus.$on("showAlternate", () => {
|
|
76
|
+
this.visible = true;
|
|
77
|
+
});
|
|
78
|
+
this.init();
|
|
79
|
+
},
|
|
80
|
+
methods: {
|
|
81
|
+
init() {
|
|
82
|
+
// 获取localStorage中以jx3box-alternate-开头的数据
|
|
83
|
+
try {
|
|
84
|
+
let keys = Object.keys(localStorage);
|
|
85
|
+
let alternate = keys.filter((key) => key.startsWith("jx3box-alternate-"));
|
|
86
|
+
|
|
87
|
+
this.alternate = alternate.map((key) => {
|
|
88
|
+
return JSON.parse(localStorage.getItem(key));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// 当前激活的排在第一
|
|
92
|
+
this.alternate.sort((a, b) => {
|
|
93
|
+
return a.uid == this.profile.uid ? -1 : 1;
|
|
94
|
+
});
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error(error);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
showAvatar,
|
|
100
|
+
getFormatTime(time) {
|
|
101
|
+
return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
|
|
102
|
+
},
|
|
103
|
+
// 判断是否已过期
|
|
104
|
+
isExpired(time) {
|
|
105
|
+
return User.isExpired(time);
|
|
106
|
+
},
|
|
107
|
+
// 选择马甲
|
|
108
|
+
onSelectAlternate(item) {
|
|
109
|
+
if (this.isExpired(item.created_at)) {
|
|
110
|
+
this.$message.error("该马甲已过期,请重新登录");
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.$confirm("确定要切换到该马甲吗?", "提示", {
|
|
114
|
+
confirmButtonText: "确定",
|
|
115
|
+
cancelButtonText: "取消",
|
|
116
|
+
type: "warning",
|
|
117
|
+
})
|
|
118
|
+
.then(() => {
|
|
119
|
+
User.update(item).then(() => {
|
|
120
|
+
localStorage.setItem(
|
|
121
|
+
"jx3box-alternate-" + item.uid,
|
|
122
|
+
JSON.stringify({
|
|
123
|
+
...item,
|
|
124
|
+
created_at: Number(localStorage.getItem("created_at")),
|
|
125
|
+
})
|
|
126
|
+
);
|
|
127
|
+
location.reload();
|
|
128
|
+
this.visible = false;
|
|
129
|
+
});
|
|
130
|
+
})
|
|
131
|
+
.catch(() => {});
|
|
132
|
+
},
|
|
133
|
+
// 删除马甲
|
|
134
|
+
onRemoveAlternate(item) {
|
|
135
|
+
this.$confirm("确定要删除该马甲吗?", "提示", {
|
|
136
|
+
confirmButtonText: "确定",
|
|
137
|
+
cancelButtonText: "取消",
|
|
138
|
+
type: "warning",
|
|
139
|
+
})
|
|
140
|
+
.then(() => {
|
|
141
|
+
localStorage.removeItem("jx3box-alternate-" + item.uid);
|
|
142
|
+
|
|
143
|
+
this.alternate = this.alternate.filter((alt) => alt.uid != item.uid);
|
|
144
|
+
})
|
|
145
|
+
.catch(() => {});
|
|
146
|
+
},
|
|
147
|
+
// 新增马甲
|
|
148
|
+
onAddAlternate() {
|
|
149
|
+
if (this.overLength) {
|
|
150
|
+
this.$message.error("最多只能添加5个马甲");
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
// 跳转至登录页
|
|
154
|
+
location.href = __Links.account.login + "?alternate=1";
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
</script>
|
|
159
|
+
|
|
160
|
+
<style lang="less">
|
|
161
|
+
.c-alternate {
|
|
162
|
+
.el-dialog__title{
|
|
163
|
+
.fz(12px);
|
|
164
|
+
}
|
|
165
|
+
.el-dialog__body {
|
|
166
|
+
padding: 0;
|
|
167
|
+
}
|
|
168
|
+
.el-dialog__header {
|
|
169
|
+
padding: 10px;
|
|
170
|
+
border-bottom: #dcdfe6 1px solid;
|
|
171
|
+
|
|
172
|
+
}
|
|
173
|
+
.c-alternate__content {
|
|
174
|
+
max-height: 600px;
|
|
175
|
+
overflow-y: auto;
|
|
176
|
+
}
|
|
177
|
+
.c-alternate-item {
|
|
178
|
+
.flex;
|
|
179
|
+
gap: 10px;
|
|
180
|
+
.pointer;
|
|
181
|
+
padding: 10px;
|
|
182
|
+
.pr;
|
|
183
|
+
border-bottom: 1px solid #eee;
|
|
184
|
+
|
|
185
|
+
&:hover {
|
|
186
|
+
background-color: @bg-light;
|
|
187
|
+
|
|
188
|
+
.u-remove {
|
|
189
|
+
display: block;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.u-remove {
|
|
195
|
+
.pa;
|
|
196
|
+
right: 10px;
|
|
197
|
+
top: 5px;
|
|
198
|
+
color: #999;
|
|
199
|
+
.pointer;
|
|
200
|
+
font-size: 16px;
|
|
201
|
+
|
|
202
|
+
&:hover {
|
|
203
|
+
color: #333;
|
|
204
|
+
}
|
|
205
|
+
.none;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.m-avatar {
|
|
209
|
+
.pr;
|
|
210
|
+
}
|
|
211
|
+
.u-avatar {
|
|
212
|
+
width: 50px;
|
|
213
|
+
height: 50px;
|
|
214
|
+
border-radius: 50%;
|
|
215
|
+
}
|
|
216
|
+
.u-active {
|
|
217
|
+
.pa;
|
|
218
|
+
right: -2px;
|
|
219
|
+
top: -6px;
|
|
220
|
+
width: 20px;
|
|
221
|
+
height: 20px;
|
|
222
|
+
fill: #fff;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.m-misc {
|
|
226
|
+
.flex;
|
|
227
|
+
flex-direction: column;
|
|
228
|
+
gap: 10px;
|
|
229
|
+
}
|
|
230
|
+
.u-label {
|
|
231
|
+
font-size: 12px;
|
|
232
|
+
color: #999;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.u-extra {
|
|
236
|
+
font-size: 12px;
|
|
237
|
+
color: #999;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.is-expired {
|
|
241
|
+
.u-time {
|
|
242
|
+
color: #c00;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.c-alternate-btn {
|
|
247
|
+
// padding: 10px;
|
|
248
|
+
text-align: center;
|
|
249
|
+
.pointer;
|
|
250
|
+
// width: 100%;
|
|
251
|
+
// border-radius: 0;
|
|
252
|
+
.size(100%,74px);
|
|
253
|
+
.fz(40px,74px);
|
|
254
|
+
color:#999;
|
|
255
|
+
&:hover{
|
|
256
|
+
background-color:@bg-light;
|
|
257
|
+
color:#888;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
</style>
|
package/src/header/userInfo.vue
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
|
|
69
69
|
<el-button-group class="u-actions">
|
|
70
70
|
<a class="el-button el-button--default is-plain" href="/dashboard">个人中心</a>
|
|
71
|
-
<a class="el-button el-button--default is-plain"
|
|
71
|
+
<a class="el-button el-button--default is-plain" @click="changeAlternate">切换马甲</a>
|
|
72
72
|
<a class="el-button el-button--default is-plain" href="/dashboard/frame">主题风格</a>
|
|
73
73
|
</el-button-group>
|
|
74
74
|
|
|
@@ -89,6 +89,8 @@
|
|
|
89
89
|
</div>
|
|
90
90
|
</template>
|
|
91
91
|
</div>
|
|
92
|
+
|
|
93
|
+
<alternate></alternate>
|
|
92
94
|
</div>
|
|
93
95
|
</template>
|
|
94
96
|
|
|
@@ -100,10 +102,16 @@ import { showDate } from "@jx3box/jx3box-common/js/moment";
|
|
|
100
102
|
import { __Links, __Root, __imgPath, __OriginRoot } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
101
103
|
import { copyText } from "../../assets/js/utils";
|
|
102
104
|
import { getMenu } from "../../service/header";
|
|
105
|
+
import Bus from "../../service/bus";
|
|
106
|
+
|
|
107
|
+
import alternate from "./alternate.vue";
|
|
103
108
|
export default {
|
|
104
109
|
name: "info",
|
|
105
110
|
props: ["asset"],
|
|
106
111
|
emits: ["update"],
|
|
112
|
+
components: {
|
|
113
|
+
alternate,
|
|
114
|
+
},
|
|
107
115
|
data() {
|
|
108
116
|
return {
|
|
109
117
|
isPhone: window.innerWidth < 768,
|
|
@@ -215,6 +223,9 @@ export default {
|
|
|
215
223
|
console.log("loadPanel error", e);
|
|
216
224
|
}
|
|
217
225
|
},
|
|
226
|
+
changeAlternate: function() {
|
|
227
|
+
Bus.$emit("showAlternate");
|
|
228
|
+
}
|
|
218
229
|
},
|
|
219
230
|
};
|
|
220
231
|
</script>
|