@jx3box/jx3box-editor 1.7.2 → 1.7.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/assets/css/resource.less +1 -2
- package/assets/js/img.js +4 -0
- package/package.json +1 -1
- package/service/cms.js +13 -8
- package/src/components/Author.vue +127 -103
package/assets/css/resource.less
CHANGED
package/assets/js/img.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// 图片地址&懒加载
|
|
2
2
|
import { resolveImagePath } from "@jx3box/jx3box-common/js/utils";
|
|
3
|
+
import { __cdn } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
3
4
|
function lazyLoad(str) {
|
|
4
5
|
if (!str) return;
|
|
5
6
|
|
|
@@ -9,6 +10,9 @@ function lazyLoad(str) {
|
|
|
9
10
|
let origin = item[0];
|
|
10
11
|
let prefix = item[1];
|
|
11
12
|
let src = resolveImagePath(item[2]);
|
|
13
|
+
if (src.includes('https://console.cnyixun.com/')) {
|
|
14
|
+
src = src.replace('https://console.cnyixun.com/', __cdn)
|
|
15
|
+
}
|
|
12
16
|
let suffix = item[3];
|
|
13
17
|
let output = `<img ${prefix} loading="lazy" src="${src}" ${suffix}>`;
|
|
14
18
|
str = str.replace(origin, output);
|
package/package.json
CHANGED
package/service/cms.js
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import { $cms } from "@jx3box/jx3box-common/js/https";
|
|
2
|
-
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
3
4
|
function uploadFile(data) {
|
|
4
5
|
return $cms().post(`/api/cms/upload`, data);
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
// 获取用户列表
|
|
8
|
-
function loadAuthors(params){
|
|
9
|
+
function loadAuthors(params) {
|
|
9
10
|
return $cms().get(`/api/cms/user/list`, {
|
|
10
|
-
params: params
|
|
11
|
+
params: params,
|
|
11
12
|
});
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
// 获取表情列表
|
|
15
|
-
function loadEmotions(params){
|
|
16
|
+
function loadEmotions(params) {
|
|
16
17
|
return $cms().get(`/api/cms/post/emotions`, {
|
|
17
|
-
params: params
|
|
18
|
+
params: params,
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
//获取装扮
|
|
21
22
|
function getDecoration(params) {
|
|
22
|
-
return $cms().get(`/api/cms/user/decoration`,{
|
|
23
|
-
params
|
|
23
|
+
return $cms().get(`/api/cms/user/decoration`, {
|
|
24
|
+
params,
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
function getDecorationJson() {
|
|
28
|
+
let url = __imgPath + "decoration/index.json";
|
|
29
|
+
return axios.get(url);
|
|
30
|
+
}
|
|
31
|
+
export { uploadFile, loadAuthors, loadEmotions, getDecoration, getDecorationJson };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="w-author" v-loading="loading">
|
|
3
|
-
<div
|
|
4
|
-
class="w-author-wrapper el-popover"
|
|
5
|
-
v-if="data"
|
|
6
|
-
:style="{ backgroundImage: bg }"
|
|
7
|
-
>
|
|
3
|
+
<div class="w-author-wrapper el-popover" v-if="data" :style="{ backgroundImage: `url(${bg})` }">
|
|
8
4
|
<div class="u-author">
|
|
9
5
|
<Avatar
|
|
10
6
|
class="u-avatar"
|
|
@@ -15,34 +11,17 @@
|
|
|
15
11
|
/>
|
|
16
12
|
<div class="u-info">
|
|
17
13
|
<a class="u-name" :href="authorLink(uid)" target="_blank">
|
|
18
|
-
<el-tooltip
|
|
19
|
-
class="
|
|
20
|
-
|
|
21
|
-
content="签约作者"
|
|
22
|
-
placement="top"
|
|
23
|
-
v-if="isSuperAuthor"
|
|
24
|
-
>
|
|
25
|
-
<a
|
|
26
|
-
class="u-superauthor"
|
|
27
|
-
href="/dashboard/cooperation"
|
|
28
|
-
target="_blank"
|
|
29
|
-
>
|
|
30
|
-
<img
|
|
31
|
-
:src="super_author_icon"
|
|
32
|
-
alt="superauthor"
|
|
33
|
-
/>
|
|
14
|
+
<el-tooltip class="item" effect="dark" content="签约作者" placement="top" v-if="isSuperAuthor">
|
|
15
|
+
<a class="u-superauthor" href="/dashboard/cooperation" target="_blank">
|
|
16
|
+
<img :src="super_author_icon" alt="superauthor" />
|
|
34
17
|
</a>
|
|
35
18
|
</el-tooltip>
|
|
36
|
-
<span class="u-displayname" :title="data.display_name">{{
|
|
37
|
-
data.display_name || "未知"
|
|
38
|
-
}}</span>
|
|
19
|
+
<span class="u-displayname" :title="data.display_name">{{ data.display_name || "未知" }}</span>
|
|
39
20
|
</a>
|
|
40
21
|
<div class="u-extend">
|
|
41
22
|
<el-tooltip class="item" effect="dark" placement="top">
|
|
42
23
|
<div slot="content">
|
|
43
|
-
<span class="u-tips"
|
|
44
|
-
>经验值:{{ data.experience }}</span
|
|
45
|
-
>
|
|
24
|
+
<span class="u-tips">经验值:{{ data.experience }}</span>
|
|
46
25
|
</div>
|
|
47
26
|
<span
|
|
48
27
|
class="u-level"
|
|
@@ -53,44 +32,24 @@
|
|
|
53
32
|
>Lv.{{ level }}</span
|
|
54
33
|
>
|
|
55
34
|
</el-tooltip>
|
|
56
|
-
<el-tooltip
|
|
57
|
-
class="
|
|
58
|
-
effect="dark"
|
|
59
|
-
:content="vipTypeTitle"
|
|
60
|
-
placement="top"
|
|
61
|
-
v-if="isVip"
|
|
62
|
-
>
|
|
63
|
-
<a
|
|
64
|
-
class="u-vip"
|
|
65
|
-
href="/vip/premium?from=sidebar_author"
|
|
66
|
-
target="_blank"
|
|
67
|
-
>
|
|
35
|
+
<el-tooltip class="item" effect="dark" :content="vipTypeTitle" placement="top" v-if="isVip">
|
|
36
|
+
<a class="u-vip" href="/vip/premium?from=sidebar_author" target="_blank">
|
|
68
37
|
<i class="i-icon-vip on">{{ vipType }}</i>
|
|
69
38
|
</a>
|
|
70
39
|
</el-tooltip>
|
|
71
40
|
</div>
|
|
72
41
|
</div>
|
|
73
42
|
</div>
|
|
43
|
+
<div class="u-honor" :style="honorStyle" v-if="honor">{{ honor }}</div>
|
|
74
44
|
<div class="u-trophy" v-if="hasTrophy">
|
|
75
45
|
<div class="u-medals" v-if="medals && medals.length">
|
|
76
46
|
<medal :medals="medals" :showIcon="showMedalIcon"></medal>
|
|
77
47
|
</div>
|
|
78
48
|
</div>
|
|
79
49
|
<div class="u-teams" v-if="teams && teams.length">
|
|
80
|
-
<a
|
|
81
|
-
class="u-team"
|
|
82
|
-
|
|
83
|
-
:key="i"
|
|
84
|
-
:href="teamLink(item.team_id)"
|
|
85
|
-
target="_blank"
|
|
86
|
-
>
|
|
87
|
-
<img
|
|
88
|
-
class="u-team-logo"
|
|
89
|
-
:src="showTeamLogo(item.team_logo)"
|
|
90
|
-
/>
|
|
91
|
-
<span class="u-team-name"
|
|
92
|
-
>{{ item.team_name }}@{{ item.team_server }}</span
|
|
93
|
-
>
|
|
50
|
+
<a class="u-team" v-for="(item, i) in teams" :key="i" :href="teamLink(item.team_id)" target="_blank">
|
|
51
|
+
<img class="u-team-logo" :src="showTeamLogo(item.team_logo)" />
|
|
52
|
+
<span class="u-team-name">{{ item.team_name }}@{{ item.team_server }}</span>
|
|
94
53
|
</a>
|
|
95
54
|
</div>
|
|
96
55
|
</div>
|
|
@@ -98,26 +57,18 @@
|
|
|
98
57
|
</template>
|
|
99
58
|
|
|
100
59
|
<script>
|
|
101
|
-
import {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
} from "@jx3box/jx3box-common/js/utils";
|
|
106
|
-
import {
|
|
107
|
-
getUserInfo,
|
|
108
|
-
getUserMedals,
|
|
109
|
-
getUserPublicTeams,
|
|
110
|
-
} from "../../service/author";
|
|
111
|
-
import { getDecoration } from "../../service/cms";
|
|
112
|
-
import {
|
|
113
|
-
__server,
|
|
114
|
-
__imgPath,
|
|
115
|
-
__userLevelColor,
|
|
116
|
-
} from "@jx3box/jx3box-common/data/jx3box.json";
|
|
60
|
+
import { authorLink, getLink, getThumbnail } from "@jx3box/jx3box-common/js/utils";
|
|
61
|
+
import { getUserInfo, getUserMedals, getUserPublicTeams } from "../../service/author";
|
|
62
|
+
import { getDecoration, getDecorationJson } from "../../service/cms";
|
|
63
|
+
import { __server, __imgPath, __userLevelColor } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
117
64
|
import User from "@jx3box/jx3box-common/js/user";
|
|
118
65
|
import { __userLevel } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
119
66
|
import Avatar from "./Avatar.vue";
|
|
120
67
|
import medal from "./medal.vue";
|
|
68
|
+
const ATCARD_KEY = "decoration_atcard";
|
|
69
|
+
const DECORATION_JSON = "decoration_json";
|
|
70
|
+
const DECORATION_KEY = "decoration_me";
|
|
71
|
+
const HONOR_KEY = "honor_me";
|
|
121
72
|
export default {
|
|
122
73
|
name: "Author",
|
|
123
74
|
components: {
|
|
@@ -131,6 +82,8 @@ export default {
|
|
|
131
82
|
teams: [],
|
|
132
83
|
loading: false,
|
|
133
84
|
bg: "",
|
|
85
|
+
honor: "",
|
|
86
|
+
honorStyle: {},
|
|
134
87
|
}),
|
|
135
88
|
computed: {
|
|
136
89
|
super_author_icon: function () {
|
|
@@ -161,18 +114,15 @@ export default {
|
|
|
161
114
|
handler(val) {
|
|
162
115
|
if (val) {
|
|
163
116
|
this.loadData();
|
|
164
|
-
this.
|
|
117
|
+
this.getAtcard();
|
|
118
|
+
this.getHonor();
|
|
165
119
|
}
|
|
166
120
|
},
|
|
167
121
|
},
|
|
168
122
|
},
|
|
169
123
|
methods: {
|
|
170
124
|
loadData: function () {
|
|
171
|
-
const promises = [
|
|
172
|
-
getUserInfo(this.uid),
|
|
173
|
-
getUserMedals(this.uid),
|
|
174
|
-
getUserPublicTeams(this.uid),
|
|
175
|
-
];
|
|
125
|
+
const promises = [getUserInfo(this.uid), getUserMedals(this.uid), getUserPublicTeams(this.uid)];
|
|
176
126
|
this.loading = true;
|
|
177
127
|
Promise.all(promises).then((res) => {
|
|
178
128
|
this.data = res[0];
|
|
@@ -196,45 +146,108 @@ export default {
|
|
|
196
146
|
this.teams = data && data.slice(0, 5);
|
|
197
147
|
});
|
|
198
148
|
},
|
|
199
|
-
|
|
200
|
-
let decoration_atcard = sessionStorage.getItem(
|
|
201
|
-
"decoration_atcard" + this.uid
|
|
202
|
-
);
|
|
149
|
+
getAtcard() {
|
|
150
|
+
let decoration_atcard = sessionStorage.getItem(ATCARD_KEY + this.uid);
|
|
203
151
|
if (decoration_atcard == "no") {
|
|
204
152
|
this.bg = "";
|
|
205
153
|
return;
|
|
206
154
|
}
|
|
207
155
|
//已有缓存,读取解析
|
|
208
156
|
if (decoration_atcard) {
|
|
209
|
-
this.setDecoration(
|
|
157
|
+
this.setDecoration(decoration_atcard);
|
|
210
158
|
return;
|
|
211
159
|
}
|
|
212
|
-
getDecoration({ using: 1, user_id: this.uid, type: "atcard" }).then(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
"no"
|
|
220
|
-
);
|
|
221
|
-
this.bg = "";
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
sessionStorage.setItem(
|
|
225
|
-
"decoration_atcard" + this.uid,
|
|
226
|
-
JSON.stringify(res[0])
|
|
227
|
-
);
|
|
228
|
-
this.setDecoration(res[0]);
|
|
160
|
+
getDecoration({ using: 1, user_id: this.uid, type: "atcard" }).then((data) => {
|
|
161
|
+
let res = data.data.data;
|
|
162
|
+
if (res.length == 0) {
|
|
163
|
+
//空 则为无主题,不再加载接口,界面设No
|
|
164
|
+
sessionStorage.setItem(ATCARD_KEY + this.uid, "no");
|
|
165
|
+
this.bg = "";
|
|
166
|
+
return;
|
|
229
167
|
}
|
|
230
|
-
|
|
168
|
+
sessionStorage.setItem(ATCARD_KEY + this.uid, res[0].val);
|
|
169
|
+
this.setDecoration(res[0].val);
|
|
170
|
+
});
|
|
231
171
|
},
|
|
232
|
-
setDecoration(
|
|
233
|
-
this.bg =
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
172
|
+
setDecoration(val) {
|
|
173
|
+
this.bg = this.showDecoration(val, "atcard");
|
|
174
|
+
},
|
|
175
|
+
getHonor() {
|
|
176
|
+
this.honor = "";
|
|
177
|
+
let user_id = this.uid;
|
|
178
|
+
if (!user_id) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
let honor_local = sessionStorage.getItem(HONOR_KEY + user_id);
|
|
182
|
+
if (honor_local == "no") return;
|
|
183
|
+
//已有缓存,读取解析
|
|
184
|
+
if (honor_local) {
|
|
185
|
+
this.honor = honor_local;
|
|
186
|
+
this.getHonorStyle();
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
getDecoration({ using: 1, user_id: user_id, type: "honor" }).then((data) => {
|
|
190
|
+
let res = data.data.data;
|
|
191
|
+
if (res.length == 0) {
|
|
192
|
+
//空 则为无主题,不再加载接口,界面设No
|
|
193
|
+
sessionStorage.setItem(HONOR_KEY + user_id, "no");
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
let honor = res[0];
|
|
197
|
+
sessionStorage.setItem(HONOR_KEY + user_id, honor.val);
|
|
198
|
+
this.honor = honor.val;
|
|
199
|
+
this.getHonorStyle();
|
|
200
|
+
});
|
|
237
201
|
},
|
|
202
|
+
//有称号后,获取样式配置
|
|
203
|
+
getHonorStyle() {
|
|
204
|
+
let user_id = this.uid;
|
|
205
|
+
let decoration_local = sessionStorage.getItem(DECORATION_KEY + user_id);
|
|
206
|
+
if (decoration_local) {
|
|
207
|
+
//解析本地缓存
|
|
208
|
+
let decoration_parse = JSON.parse(decoration_local);
|
|
209
|
+
if (!decoration_parse.status) return;
|
|
210
|
+
|
|
211
|
+
if (decoration_parse) {
|
|
212
|
+
this.setHonorStyle(decoration_parse);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
getDecoration({ using: 1, user_id: user_id, type: "homebg" }).then((data) => {
|
|
217
|
+
let res = data.data.data;
|
|
218
|
+
if (res.length == 0) {
|
|
219
|
+
//空 则为无主题,不再加载接口,界面设No
|
|
220
|
+
sessionStorage.setItem(DECORATION_KEY + user_id, JSON.stringify({ status: false }));
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
let decoration = res[0];
|
|
224
|
+
let decorationJson = sessionStorage.getItem(DECORATION_JSON);
|
|
225
|
+
if (!decorationJson) {
|
|
226
|
+
//加载远程json,用于Honor颜色配置
|
|
227
|
+
getDecorationJson().then((json) => {
|
|
228
|
+
let decoration_json = json.data;
|
|
229
|
+
let theme = JSON.parse(JSON.stringify(decoration_json[decoration.val]));
|
|
230
|
+
theme.status = true;
|
|
231
|
+
sessionStorage.setItem(DECORATION_KEY + this.uid, JSON.stringify(theme));
|
|
232
|
+
//缓存远程JSON文件
|
|
233
|
+
sessionStorage.setItem(DECORATION_JSON, JSON.stringify(decoration_json));
|
|
234
|
+
this.setHonorStyle(theme);
|
|
235
|
+
});
|
|
236
|
+
} else {
|
|
237
|
+
let theme = JSON.parse(decorationJson)[decoration.val];
|
|
238
|
+
theme.status = true;
|
|
239
|
+
sessionStorage.setItem(DECORATION_KEY + this.uid, JSON.stringify(theme));
|
|
240
|
+
this.setHonorStyle(theme);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
setHonorStyle(style) {
|
|
245
|
+
this.honorStyle = {
|
|
246
|
+
"background-color": style.buttoncolor,
|
|
247
|
+
color: style.buttontextcolor,
|
|
248
|
+
};
|
|
249
|
+
},
|
|
250
|
+
|
|
238
251
|
showMedalIcon: function (val) {
|
|
239
252
|
return __imgPath + "image/medals/user/" + val + ".gif";
|
|
240
253
|
},
|
|
@@ -294,5 +307,16 @@ export default {
|
|
|
294
307
|
.bold;
|
|
295
308
|
}
|
|
296
309
|
}
|
|
310
|
+
.u-honor {
|
|
311
|
+
.mt(2px);
|
|
312
|
+
.dbi;
|
|
313
|
+
.h(18px);
|
|
314
|
+
background-color: #494038;
|
|
315
|
+
color: #ffffff;
|
|
316
|
+
.fz(12px,14px);
|
|
317
|
+
padding: 2px 50px 2px 10px;
|
|
318
|
+
.mb(15px);
|
|
319
|
+
.r(2px);
|
|
320
|
+
}
|
|
297
321
|
}
|
|
298
322
|
</style>
|