@jx3box/jx3box-common-ui 7.0.4 → 7.0.5

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": "7.0.4",
3
+ "version": "7.0.5",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  <LeftSidebar :open="true" :uid="8">
17
17
  <LeftSideToggle :mobileOnly="true" />
18
- <Author :author="author" :uid="6037" />
18
+ <Author :author="author" :uid="37" />
19
19
  </LeftSidebar>
20
20
 
21
21
  <Main :withoutLeft="false" :withoutRight="false">
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="c-honor" :style="{ backgroundImage: `url(${imgUrl()})` }" v-if="honor">
2
+ <div class="c-author-honor" :style="{ backgroundImage: `url(${imgUrl()})` }" v-if="honor">
3
3
  <span :style="{ color: honor.color }">{{ honor.honor }}</span>
4
4
  </div>
5
5
  </template>
@@ -58,31 +58,29 @@ export default {
58
58
  getHonorStyle(data) {
59
59
  getHonorJson().then((res) => {
60
60
  let honorList = res.data;
61
- //过滤称号信息
62
61
  let honorConfig = honorList[data.val];
63
- //正则取出前缀
64
62
  let prefix = honorConfig.prefix;
65
- let regPrefix = honorConfig.prefix.match(/(?<=\{)(.+?)(?=\})/g);
63
+ let regPrefix = honorConfig.prefix.match(/\{([^{}]+?)\}/g);
66
64
  let ranking = honorConfig.ranking;
67
65
  let honorStr = honorConfig.year || "";
68
66
  if (regPrefix) {
69
- honorStr = honorStr + (data[regPrefix[0]] || "");
67
+ honorStr = honorStr + (data[regPrefix[0].slice(1, -1)] || "");
70
68
  } else {
71
69
  honorStr = honorStr + prefix;
72
70
  }
73
- //排名处理
74
71
  if (ranking.length > 0) {
75
72
  data.imgIndex = 0;
76
73
  for (let i = 0; i < ranking.length; i++) {
77
- //处在范围内取数组第三个值进行称号拼接
78
- if (data.ranking != undefined && inRange(Number(data.ranking), ranking[i][0], ranking[i][1])) {
74
+ if (data.ranking !== undefined && inRange(Number(data.ranking), ranking[i][0], ranking[i][1])) {
79
75
  data.imgIndex = i;
80
76
  let str = ranking[i][2];
81
- //正则取出需替换值,如果没有则直接拼接
82
- let regStr = str.match(/(?<=\{)(.+?)(?=\})/g);
77
+ let regStr = str.match(/\{([^{}]+?)\}/g);
83
78
  if (regStr) {
84
- //包含花括号替换
85
- honorStr = honorStr + str.replace(/\{(.+?)\}/g, data[regStr[0]]);
79
+ honorStr =
80
+ honorStr +
81
+ str.replace(/\{([^{}]+?)\}/g, function (match, p1) {
82
+ return data[p1] || "";
83
+ });
86
84
  } else {
87
85
  honorStr = honorStr + str;
88
86
  }
@@ -94,7 +92,7 @@ export default {
94
92
  data.color = honorConfig.color;
95
93
  data.ext = honorConfig.ext;
96
94
  data.isHave = true;
97
- data.isImgIndex = honorConfig.ranking.length > 0 ? true : false;
95
+ data.isImgIndex = ranking.length > 0;
98
96
  sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
99
97
  this.honor = data;
100
98
  });
@@ -103,14 +101,14 @@ export default {
103
101
  };
104
102
  </script>
105
103
  <style lang="less">
106
- .c-honor {
104
+ .c-author-honor {
107
105
  .dbi;
108
106
  text-align: center;
109
107
  .mb(10px);
110
108
  .size(220px,45px);
111
- // background-color: #494038;
112
109
  color: #ffffff;
113
110
  .fz(10px,45px);
114
111
  .r(2px);
112
+ background-size: 100% 100%;
115
113
  }
116
114
  </style>