@jx3box/jx3box-common-ui 8.2.2 → 8.2.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "8.2.2",
3
+ "version": "8.2.3",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/service/author.js CHANGED
@@ -46,10 +46,19 @@ function getDouyu(ids) {
46
46
  return res.data.data;
47
47
  });
48
48
  }
49
-
49
+ // 获取用户勋章
50
50
  function getUserMedals(uid) {
51
51
  return $next({ mute: true })
52
- .get("/api/user/" + uid + "/medals")
52
+ .get("/api/next2/user/" + uid + "/medals")
53
+ .then((res) => {
54
+ return res.data.data;
55
+ });
56
+ }
57
+
58
+ // 获取用户称号
59
+ function getUserHonors(uid) {
60
+ return $next({ mute: true })
61
+ .get("/api/next2/user/" + uid + "/honors")
53
62
  .then((res) => {
54
63
  return res.data.data;
55
64
  });
@@ -92,5 +101,6 @@ export {
92
101
  getMyInfo,
93
102
  userSignIn,
94
103
  getFansList,
95
- getUserInfoByUidOrName
104
+ getUserInfoByUidOrName,
105
+ getUserHonors
96
106
  };
package/service/cms.js CHANGED
@@ -18,10 +18,6 @@ function getDecorationJson() {
18
18
  let url = __imgPath + "decoration/index.json";
19
19
  return axios.get(url);
20
20
  }
21
- function getHonorJson() {
22
- let url = __imgPath + "decoration/honor.json";
23
- return axios.get(url);
24
- }
25
21
  // 通用上传
26
22
  function upload(formData) {
27
23
  return $cms().post(`/api/cms/upload`, formData);
@@ -77,4 +73,5 @@ function setUserMeta(key,data) {
77
73
  return $cms().post(`/api/cms/user/my/meta?key=${key}`, data);
78
74
  }
79
75
 
80
- export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, checkTeamMember, getHonorJson, getSliders, getCollection, getTopicBucket, getConfig, getUserMeta, setUserMeta };
76
+ export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, checkTeamMember,
77
+ getSliders, getCollection, getTopicBucket, getConfig, getUserMeta, setUserMeta };
package/src/App.vue CHANGED
@@ -15,9 +15,9 @@
15
15
  bread info
16
16
  </Breadcrumb>
17
17
 
18
- <LeftSidebar :open="true" :uid="2">
18
+ <LeftSidebar :open="true" :uid="1005">
19
19
  <LeftSideToggle :mobileOnly="true" />
20
- <Author :author="author" :uid="2" />
20
+ <Author :author="author" :uid="1005" />
21
21
  </LeftSidebar>
22
22
 
23
23
  <Main :withoutLeft="false" :withoutRight="false">
@@ -1,12 +1,11 @@
1
1
  <template>
2
2
  <div class="c-author-honor" :style="{ backgroundImage: `url(${imgUrl()})` }" v-if="honor">
3
- <span v-if="!isJdt" :style="{ color: honor.color }">{{ honor.honor }}</span>
3
+ <span v-if="!isJdt" :style="{ color: honor.color }">{{ honorName }}</span>
4
4
  </div>
5
5
  </template>
6
6
  <script>
7
7
  import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
8
- import { getDecoration, getHonorJson } from "../../service/cms";
9
- import { inRange } from "lodash";
8
+ import { getUserHonors } from "../../service/author";
10
9
  const HONOR_IMG_KEY = "honor_img";
11
10
  export default {
12
11
  props: ["uid"],
@@ -26,16 +25,16 @@ export default {
26
25
  computed: {
27
26
  isJdt() {
28
27
  return this.honor?.val?.toLowerCase()?.includes('jdt')
28
+ },
29
+ honorName({ honor }) {
30
+ return `${honor.year}${honor.prefix}${honor.suffix}`
29
31
  }
30
32
  },
31
33
  methods: {
32
34
  imgUrl: function () {
33
35
  let item = this.honor;
34
36
  if (!item) return;
35
- if (item.isImgIndex) {
36
- return __imgPath + `decoration/honor/${item.val}/${item.val}_${item.imgIndex}.${item.ext}`;
37
- }
38
- return __imgPath + `decoration/honor/${item.val}/${item.val}.${item.ext}`;
37
+ return __imgPath + `decoration/honor/${item.img}/${item.img}.${item.img_ext}`;
39
38
  },
40
39
  getHonor() {
41
40
  let user_id = this.uid;
@@ -46,8 +45,8 @@ export default {
46
45
  try {
47
46
  this.honor = JSON.parse(honor_local);
48
47
  } catch (err) {
49
- getDecoration({ using: 1, user_id: user_id, type: "honor" }).then((data) => {
50
- let res = data.data.data || [];
48
+ getUserHonors(user_id).then((data) => {
49
+ let res = data?.filter(item => item.using);
51
50
  if (res.length == 0) {
52
51
  //空 则为无主题,不再加载接口,界面设No
53
52
  sessionStorage.setItem(HONOR_IMG_KEY + user_id, "no");
@@ -60,46 +59,9 @@ export default {
60
59
  },
61
60
  //有称号后,获取样式配置
62
61
  getHonorStyle(data) {
63
- getHonorJson().then((res) => {
64
- let honorList = res.data;
65
- let honorConfig = honorList[data.val];
66
- let prefix = honorConfig.prefix;
67
- let regPrefix = honorConfig.prefix.match(/\{([^{}]+?)\}/g);
68
- let ranking = honorConfig.ranking;
69
- let honorStr = honorConfig.year || "";
70
- if (regPrefix) {
71
- honorStr = honorStr + (data[regPrefix[0].slice(1, -1)] || "");
72
- } else {
73
- honorStr = honorStr + prefix;
74
- }
75
- if (ranking.length > 0) {
76
- data.imgIndex = 0;
77
- for (let i = 0; i < ranking.length; i++) {
78
- if (data.ranking !== undefined && inRange(Number(data.ranking), ranking[i][0], ranking[i][1])) {
79
- data.imgIndex = i;
80
- let str = ranking[i][2];
81
- let regStr = str.match(/\{([^{}]+?)\}/g);
82
- if (regStr) {
83
- honorStr =
84
- honorStr +
85
- str.replace(/\{([^{}]+?)\}/g, function (match, p1) {
86
- return data[p1] || "";
87
- });
88
- } else {
89
- honorStr = honorStr + str;
90
- }
91
- break;
92
- }
93
- }
94
- }
95
- data.honor = honorStr + honorConfig.suffix;
96
- data.color = honorConfig.color;
97
- data.ext = honorConfig.ext;
98
- data.isHave = true;
99
- data.isImgIndex = ranking.length > 0;
100
- sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
101
- this.honor = data;
102
- });
62
+ data = data.honor;
63
+ sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
64
+ this.honor = data;
103
65
  },
104
66
  },
105
67
  };
@@ -45,11 +45,8 @@ import { __server, __imgPath, __userLevel, __userLevelColor } from "@jx3box/jx3b
45
45
  import { authorLink } from "@jx3box/jx3box-common/js/utils";
46
46
  import User from "@jx3box/jx3box-common/js/user";
47
47
  import { getUserInfo } from "../../service/author";
48
- import { getDecoration, getHonorJson } from "../../service/cms";
49
48
  import Avatar from "./Avatar.vue";
50
49
  import Honor from "./AuthorHonor.vue";
51
- import { cloneDeep, inRange } from "lodash";
52
- const HONOR_IMG_KEY = "honor_img";
53
50
  export default {
54
51
  name: "AuthorInfo",
55
52
  props: ["uid"],