@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-vue3-ui",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
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="8">
21
+ <LeftSidebar :open="true" :uid="8719">
22
22
  <LeftSideToggle :mobileOnly="true" />
23
- <Author :uid="8" />
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 { getDecoration, getHonorJson } from "../../service/cms";
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.val}/${item.val}_${item.imgIndex}.${item.ext}`;
38
+ return __imgPath + `decoration/honor/${item.img}/${item.img}_${item.imgIndex}.${item.img_ext}`;
34
39
  }
35
- return __imgPath + `decoration/honor/${item.val}/${item.val}.${item.ext}`;
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
- getDecoration({ using: 1, user_id: user_id, type: "honor" }).then((data) => {
47
- let res = data.data.data || [];
48
- if (res.length == 0) {
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
- let honor = res[0];
54
- this.getHonorStyle(honor);
58
+ this.getHonorStyle(this.honor);
55
59
  });
56
60
  }
57
61
  },
58
62
  //有称号后,获取样式配置
59
- getHonorStyle(data) {
60
- getHonorJson().then((res) => {
61
- let honorList = res.data;
62
- let honorConfig = honorList[data.val];
63
- let prefix = honorConfig.prefix;
64
- let regPrefix = honorConfig.prefix.match(/\{([^{}]+?)\}/g);
65
- let ranking = honorConfig.ranking;
66
- let honorStr = honorConfig.year || "";
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
- if (ranking.length > 0) {
73
- data.imgIndex = 0;
74
- for (let i = 0; i < ranking.length; i++) {
75
- if (data.ranking !== undefined && inRange(Number(data.ranking), ranking[i][0], ranking[i][1])) {
76
- data.imgIndex = i;
77
- let str = ranking[i][2];
78
- let regStr = str.match(/\{([^{}]+?)\}/g);
79
- if (regStr) {
80
- honorStr =
81
- honorStr +
82
- str.replace(/\{([^{}]+?)\}/g, function (match, p1) {
83
- return data[p1] || "";
84
- });
85
- } else {
86
- honorStr = honorStr + str;
87
- }
88
- break;
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
- data.honor = honorStr + honorConfig.suffix;
93
- data.color = honorConfig.color;
94
- data.ext = honorConfig.ext;
95
- data.isHave = true;
96
- data.isImgIndex = ranking.length > 0;
97
- sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
98
- this.honor = data;
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
  };