@jx3box/jx3box-vue3-ui 0.6.1 → 0.6.2
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/App.vue +2 -2
- package/src/author/AuthorHonor.vue +54 -41
package/package.json
CHANGED
package/service/cms.js
CHANGED
|
@@ -45,6 +45,11 @@ function upload(formData) {
|
|
|
45
45
|
return $cms().post(`/api/cms/upload`, formData);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
function getUserHonor(uid) {
|
|
49
|
+
return $cms({ mute: true })
|
|
50
|
+
.get(`/api/cms/user/honor/${uid}/using`)
|
|
51
|
+
}
|
|
52
|
+
|
|
48
53
|
function getSliders(source_type, source_ids, client='std') {
|
|
49
54
|
let _params = {
|
|
50
55
|
type: "slider",
|
|
@@ -66,4 +71,4 @@ function getCollection(id) {
|
|
|
66
71
|
return $cms({ mute: true }).get(`/api/cms/post/collection/${id}`);
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, getHonorJson, getSliders, loadAuthors, loadEmotions, uploadFile, getCollection };
|
|
74
|
+
export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, getHonorJson, getSliders, loadAuthors, loadEmotions, uploadFile, getCollection, getUserHonor };
|
package/src/App.vue
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
<AdminDirectMessage :user-id="8" :sourceId="19382" sourceType="macro"></AdminDirectMessage>
|
|
19
19
|
</template>
|
|
20
20
|
</breadcrumb>
|
|
21
|
-
<LeftSidebar :open="true" :uid="
|
|
21
|
+
<LeftSidebar :open="true" :uid="8719">
|
|
22
22
|
<LeftSideToggle :mobileOnly="true" />
|
|
23
|
-
<Author :uid="
|
|
23
|
+
<Author :uid="8719" />
|
|
24
24
|
</LeftSidebar>
|
|
25
25
|
|
|
26
26
|
<Main :withoutLeft="false" :withoutRight="false">
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
<script>
|
|
7
7
|
import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
|
|
8
|
-
import {
|
|
8
|
+
import { getUserHonor } from "../../service/cms";
|
|
9
9
|
import { inRange } from "lodash";
|
|
10
10
|
|
|
11
11
|
const { __imgPath } = JX3BOX;
|
|
@@ -25,14 +25,19 @@ export default {
|
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
|
+
computed: {
|
|
29
|
+
isJdt() {
|
|
30
|
+
return this.honor?.val?.toLowerCase()?.includes("jdt");
|
|
31
|
+
},
|
|
32
|
+
},
|
|
28
33
|
methods: {
|
|
29
34
|
imgUrl: function () {
|
|
30
35
|
let item = this.honor;
|
|
31
36
|
if (!item) return;
|
|
32
37
|
if (item.isImgIndex) {
|
|
33
|
-
return __imgPath + `decoration/honor/${item.
|
|
38
|
+
return __imgPath + `decoration/honor/${item.img}/${item.img}_${item.imgIndex}.${item.img_ext}`;
|
|
34
39
|
}
|
|
35
|
-
return __imgPath + `decoration/honor/${item.
|
|
40
|
+
return __imgPath + `decoration/honor/${item.img}/${item.img}.${item.img_ext}`;
|
|
36
41
|
},
|
|
37
42
|
getHonor() {
|
|
38
43
|
let user_id = this.uid;
|
|
@@ -43,60 +48,68 @@ export default {
|
|
|
43
48
|
try {
|
|
44
49
|
this.honor = JSON.parse(honor_local);
|
|
45
50
|
} catch (err) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (
|
|
51
|
+
getUserHonor(user_id).then((res) => {
|
|
52
|
+
this.honor = res.data.data;
|
|
53
|
+
if (!this.honor) {
|
|
49
54
|
//空 则为无主题,不再加载接口,界面设No
|
|
50
55
|
sessionStorage.setItem(HONOR_IMG_KEY + user_id, "no");
|
|
51
56
|
return;
|
|
52
57
|
}
|
|
53
|
-
|
|
54
|
-
this.getHonorStyle(honor);
|
|
58
|
+
this.getHonorStyle(this.honor);
|
|
55
59
|
});
|
|
56
60
|
}
|
|
57
61
|
},
|
|
58
62
|
//有称号后,获取样式配置
|
|
59
|
-
getHonorStyle(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
getHonorStyle(honor) {
|
|
64
|
+
const data = honor
|
|
65
|
+
let honorConfig = honor?.honor_info;
|
|
66
|
+
let only = honorConfig.only;
|
|
67
|
+
let prefix = honorConfig.prefix;
|
|
68
|
+
let regPrefix = honorConfig.prefix.match(/\{([^{}]+?)\}/g);
|
|
69
|
+
let ranking = honorConfig.ranking;
|
|
70
|
+
let honorStr = honorConfig.year || "";
|
|
71
|
+
|
|
72
|
+
console.log(honorConfig, regPrefix)
|
|
73
|
+
if (!only) {
|
|
67
74
|
if (regPrefix) {
|
|
68
75
|
honorStr = honorStr + (data[regPrefix[0].slice(1, -1)] || "");
|
|
69
76
|
} else {
|
|
70
77
|
honorStr = honorStr + prefix;
|
|
71
78
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
} else {
|
|
80
|
+
honorStr = prefix;
|
|
81
|
+
}
|
|
82
|
+
if (ranking.length > 0) {
|
|
83
|
+
data.imgIndex = 0;
|
|
84
|
+
for (let i = 0; i < ranking.length; i++) {
|
|
85
|
+
if (
|
|
86
|
+
honor.ranking !== undefined &&
|
|
87
|
+
inRange(Number(honor.ranking), ranking[i][0], ranking[i][1])
|
|
88
|
+
) {
|
|
89
|
+
data.imgIndex = i;
|
|
90
|
+
let str = ranking[i][2];
|
|
91
|
+
let regStr = str.match(/\{([^{}]+?)\}/g);
|
|
92
|
+
if (regStr) {
|
|
93
|
+
honorStr =
|
|
94
|
+
honorStr +
|
|
95
|
+
str.replace(/\{([^{}]+?)\}/g, function (match, p1) {
|
|
96
|
+
return data[p1] || "";
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
honorStr = honorStr + str;
|
|
89
100
|
}
|
|
101
|
+
break;
|
|
90
102
|
}
|
|
91
103
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
}
|
|
105
|
+
data.honor = honorStr + honorConfig.suffix;
|
|
106
|
+
data.color = honorConfig.color;
|
|
107
|
+
data.img = honorConfig.img;
|
|
108
|
+
data.img_ext = honorConfig.img_ext;
|
|
109
|
+
data.isHave = true;
|
|
110
|
+
data.isImgIndex = ranking.length > 0;
|
|
111
|
+
sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
|
|
112
|
+
this.honor = data;
|
|
100
113
|
},
|
|
101
114
|
},
|
|
102
115
|
};
|