@jx3box/jx3box-common-ui 8.2.4 → 8.2.6

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.4",
3
+ "version": "8.2.6",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -33,7 +33,7 @@
33
33
  "@jx3box/jx3box-comment-ui": "^1.8.7",
34
34
  "@jx3box/jx3box-common": "^8.2.4",
35
35
  "@jx3box/jx3box-data": "^3.5.6",
36
- "@jx3box/jx3box-editor": "^2.1.6",
36
+ "@jx3box/jx3box-editor": "^2.1.7",
37
37
  "@jx3box/reporter": "^0.0.4",
38
38
  "axios": "^0.26.1",
39
39
  "dayjs": "^1.11.0",
package/service/author.js CHANGED
@@ -64,6 +64,11 @@ function getUserHonors(uid) {
64
64
  });
65
65
  }
66
66
 
67
+ function getUserHonor(uid) {
68
+ return $cms({ mute: true })
69
+ .get(`/api/cms/user/honor/${uid}/using`)
70
+ }
71
+
67
72
  function getFrames() {
68
73
  return axios.get(__imgPath + "avatar/index.json");
69
74
  }
@@ -102,5 +107,6 @@ export {
102
107
  userSignIn,
103
108
  getFansList,
104
109
  getUserInfoByUidOrName,
105
- getUserHonors
110
+ getUserHonors,
111
+ getUserHonor
106
112
  };
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,5 +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, getHonorJson, checkTeamMember,
76
+ export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, checkTeamMember,
81
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="8">
18
+ <LeftSidebar :open="true" :uid="8719">
19
19
  <LeftSideToggle :mobileOnly="true" />
20
- <Author :author="author" :uid="8" />
20
+ <Author :author="author" :uid="8719" />
21
21
  </LeftSidebar>
22
22
 
23
23
  <Main :withoutLeft="false" :withoutRight="false">
@@ -5,8 +5,7 @@
5
5
  </template>
6
6
  <script>
7
7
  import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
8
- import { getHonorJson } from "../../service/cms";
9
- import { getUserHonors } from "../../service/author";
8
+ import { getUserHonor } from "../../service/author";
10
9
  import { inRange } from "lodash";
11
10
  const HONOR_IMG_KEY = "honor_img";
12
11
  export default {
@@ -26,8 +25,8 @@ export default {
26
25
  },
27
26
  computed: {
28
27
  isJdt() {
29
- return this.honor?.val?.toLowerCase()?.includes('jdt')
30
- }
28
+ return this.honor?.val?.toLowerCase()?.includes("jdt");
29
+ },
31
30
  },
32
31
  methods: {
33
32
  imgUrl: function () {
@@ -47,61 +46,68 @@ export default {
47
46
  try {
48
47
  this.honor = JSON.parse(honor_local);
49
48
  } catch (err) {
50
- getUserHonors(user_id).then((data) => {
51
- let res = data?.filter((item) => item.using);
52
- if (res.length == 0) {
49
+ getUserHonor(user_id).then((res) => {
50
+ this.honor = res.data.data;
51
+ if (!this.honor) {
53
52
  //空 则为无主题,不再加载接口,界面设No
54
53
  sessionStorage.setItem(HONOR_IMG_KEY + user_id, "no");
55
54
  return;
56
55
  }
57
- let honor = res[0];
58
- this.getHonorStyle(honor);
56
+ this.getHonorStyle(this.honor);
59
57
  });
60
58
  }
61
59
  },
62
60
  //有称号后,获取样式配置
63
61
  getHonorStyle(honor) {
64
- const data = honor?.honor || {};
65
- getHonorJson().then((res) => {
66
- let honorList = res.data;
67
- let honorConfig = honorList[data.img];
68
- let prefix = honorConfig.prefix;
69
- let regPrefix = honorConfig.prefix.match(/\{([^{}]+?)\}/g);
70
- let ranking = honorConfig.ranking;
71
- let honorStr = honorConfig.year || "";
62
+ const data = honor
63
+ let honorConfig = honor?.honor_info;
64
+ let only = honorConfig.only;
65
+ let prefix = honorConfig.prefix;
66
+ let regPrefix = honorConfig.prefix.match(/\{([^{}]+?)\}/g);
67
+ let ranking = honorConfig.ranking;
68
+ let honorStr = honorConfig.year || "";
69
+
70
+ console.log(honorConfig, regPrefix)
71
+ if (!only) {
72
72
  if (regPrefix) {
73
73
  honorStr = honorStr + (data[regPrefix[0].slice(1, -1)] || "");
74
74
  } else {
75
75
  honorStr = honorStr + prefix;
76
76
  }
77
- if (ranking.length > 0) {
78
- data.imgIndex = 0;
79
- for (let i = 0; i < ranking.length; i++) {
80
- if (honor.ranking !== undefined && inRange(Number(honor.ranking), ranking[i][0], ranking[i][1])) {
81
- data.imgIndex = i;
82
- let str = ranking[i][2];
83
- let regStr = str.match(/\{([^{}]+?)\}/g);
84
- if (regStr) {
85
- honorStr =
86
- honorStr +
87
- str.replace(/\{([^{}]+?)\}/g, function (match, p1) {
88
- return data[p1] || "";
89
- });
90
- } else {
91
- honorStr = honorStr + str;
92
- }
93
- break;
77
+ } else {
78
+ honorStr = prefix;
79
+ }
80
+ if (ranking.length > 0) {
81
+ data.imgIndex = 0;
82
+ for (let i = 0; i < ranking.length; i++) {
83
+ if (
84
+ honor.ranking !== undefined &&
85
+ inRange(Number(honor.ranking), ranking[i][0], ranking[i][1])
86
+ ) {
87
+ data.imgIndex = i;
88
+ let str = ranking[i][2];
89
+ let regStr = str.match(/\{([^{}]+?)\}/g);
90
+ if (regStr) {
91
+ honorStr =
92
+ honorStr +
93
+ str.replace(/\{([^{}]+?)\}/g, function (match, p1) {
94
+ return data[p1] || "";
95
+ });
96
+ } else {
97
+ honorStr = honorStr + str;
94
98
  }
99
+ break;
95
100
  }
96
101
  }
97
- data.honor = honorStr + honorConfig.suffix;
98
- data.color = honorConfig.color;
99
- data.ext = honorConfig.ext;
100
- data.isHave = true;
101
- data.isImgIndex = ranking.length > 0;
102
- sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
103
- this.honor = data;
104
- });
102
+ }
103
+ data.honor = honorStr + honorConfig.suffix;
104
+ data.color = honorConfig.color;
105
+ data.img = honorConfig.img;
106
+ data.img_ext = honorConfig.img_ext;
107
+ data.isHave = true;
108
+ data.isImgIndex = ranking.length > 0;
109
+ sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
110
+ this.honor = data;
105
111
  },
106
112
  },
107
113
  };