@jx3box/jx3box-common-ui 8.2.2 → 8.2.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/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.4",
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
@@ -77,4 +77,5 @@ function setUserMeta(key,data) {
77
77
  return $cms().post(`/api/cms/user/my/meta?key=${key}`, data);
78
78
  }
79
79
 
80
- export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, checkTeamMember, getHonorJson, getSliders, getCollection, getTopicBucket, getConfig, getUserMeta, setUserMeta };
80
+ export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, getHonorJson, checkTeamMember,
81
+ 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="8">
19
19
  <LeftSideToggle :mobileOnly="true" />
20
- <Author :author="author" :uid="2" />
20
+ <Author :author="author" :uid="8" />
21
21
  </LeftSidebar>
22
22
 
23
23
  <Main :withoutLeft="false" :withoutRight="false">
@@ -5,7 +5,8 @@
5
5
  </template>
6
6
  <script>
7
7
  import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
8
- import { getDecoration, getHonorJson } from "../../service/cms";
8
+ import { getHonorJson } from "../../service/cms";
9
+ import { getUserHonors } from "../../service/author";
9
10
  import { inRange } from "lodash";
10
11
  const HONOR_IMG_KEY = "honor_img";
11
12
  export default {
@@ -33,9 +34,9 @@ export default {
33
34
  let item = this.honor;
34
35
  if (!item) return;
35
36
  if (item.isImgIndex) {
36
- return __imgPath + `decoration/honor/${item.val}/${item.val}_${item.imgIndex}.${item.ext}`;
37
+ return __imgPath + `decoration/honor/${item.img}/${item.img}_${item.imgIndex}.${item.img_ext}`;
37
38
  }
38
- return __imgPath + `decoration/honor/${item.val}/${item.val}.${item.ext}`;
39
+ return __imgPath + `decoration/honor/${item.img}/${item.img}.${item.img_ext}`;
39
40
  },
40
41
  getHonor() {
41
42
  let user_id = this.uid;
@@ -46,8 +47,8 @@ export default {
46
47
  try {
47
48
  this.honor = JSON.parse(honor_local);
48
49
  } catch (err) {
49
- getDecoration({ using: 1, user_id: user_id, type: "honor" }).then((data) => {
50
- let res = data.data.data || [];
50
+ getUserHonors(user_id).then((data) => {
51
+ let res = data?.filter((item) => item.using);
51
52
  if (res.length == 0) {
52
53
  //空 则为无主题,不再加载接口,界面设No
53
54
  sessionStorage.setItem(HONOR_IMG_KEY + user_id, "no");
@@ -59,10 +60,11 @@ export default {
59
60
  }
60
61
  },
61
62
  //有称号后,获取样式配置
62
- getHonorStyle(data) {
63
+ getHonorStyle(honor) {
64
+ const data = honor?.honor || {};
63
65
  getHonorJson().then((res) => {
64
66
  let honorList = res.data;
65
- let honorConfig = honorList[data.val];
67
+ let honorConfig = honorList[data.img];
66
68
  let prefix = honorConfig.prefix;
67
69
  let regPrefix = honorConfig.prefix.match(/\{([^{}]+?)\}/g);
68
70
  let ranking = honorConfig.ranking;
@@ -75,7 +77,7 @@ export default {
75
77
  if (ranking.length > 0) {
76
78
  data.imgIndex = 0;
77
79
  for (let i = 0; i < ranking.length; i++) {
78
- if (data.ranking !== undefined && inRange(Number(data.ranking), ranking[i][0], ranking[i][1])) {
80
+ if (honor.ranking !== undefined && inRange(Number(honor.ranking), ranking[i][0], ranking[i][1])) {
79
81
  data.imgIndex = i;
80
82
  let str = ranking[i][2];
81
83
  let regStr = str.match(/\{([^{}]+?)\}/g);
@@ -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"],