@jx3box/jx3box-vue3-ui 0.6.3 → 0.6.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-vue3-ui",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,14 +1,14 @@
1
1
  <template>
2
- <div class="c-author-honor" :style="{ backgroundImage: `url(${imgUrl()})` }" v-if="honor">
2
+ <a class="c-author-honor" :style="{ backgroundImage: `url(${imgUrl()})` }" v-if="honor" :href="url" target="_blank">
3
3
  <span :style="{ color: honor.color }">{{ honor.honor }}</span>
4
- </div>
4
+ </a>
5
5
  </template>
6
6
  <script>
7
7
  import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
8
8
  import { getUserHonor } from "../../service/cms";
9
9
  import { inRange } from "lodash";
10
10
 
11
- const { __imgPath } = JX3BOX;
11
+ const { __imgPath, __Root } = JX3BOX;
12
12
  const HONOR_IMG_KEY = "honor_img";
13
13
  export default {
14
14
  props: ["uid"],
@@ -29,6 +29,9 @@ export default {
29
29
  isJdt() {
30
30
  return this.honor?.val?.toLowerCase()?.includes("jdt");
31
31
  },
32
+ url() {
33
+ return this.honor?.honor_info?.url ? __Root + this.honor?.honor_info?.url : "";
34
+ },
32
35
  },
33
36
  methods: {
34
37
  imgUrl: function () {
@@ -61,7 +64,7 @@ export default {
61
64
  },
62
65
  //有称号后,获取样式配置
63
66
  getHonorStyle(honor) {
64
- const data = honor
67
+ const data = honor;
65
68
  let honorConfig = honor?.honor_info;
66
69
  let only = honorConfig.only;
67
70
  let prefix = honorConfig.prefix;
@@ -69,7 +72,7 @@ export default {
69
72
  let ranking = honorConfig.ranking;
70
73
  let honorStr = honorConfig.year || "";
71
74
 
72
- console.log(honorConfig, regPrefix)
75
+ console.log(honorConfig, regPrefix);
73
76
  if (!only) {
74
77
  if (regPrefix) {
75
78
  honorStr = honorStr + (data[regPrefix[0].slice(1, -1)] || "");
@@ -82,10 +85,7 @@ export default {
82
85
  if (ranking.length > 0) {
83
86
  data.imgIndex = 0;
84
87
  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
- ) {
88
+ if (honor.ranking !== undefined && inRange(Number(honor.ranking), ranking[i][0], ranking[i][1])) {
89
89
  data.imgIndex = i;
90
90
  let str = ranking[i][2];
91
91
  let regStr = str.match(/\{([^{}]+?)\}/g);
@@ -107,7 +107,7 @@ export default {
107
107
  data.img = honorConfig.img;
108
108
  data.img_ext = honorConfig.img_ext;
109
109
  data.isHave = true;
110
- data.isImgIndex = ranking.length > 0;
110
+ data.isImgIndex = ranking?.length > 0;
111
111
  sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
112
112
  this.honor = data;
113
113
  },
@@ -25,7 +25,7 @@
25
25
  import { getMedalLink } from "@jx3box/jx3box-common/js/utils";
26
26
  import { getUserMedals } from "../../service/author";
27
27
  import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
28
- const { __imgPath } = JX3BOX;
28
+ const { __imgPath, __Root } = JX3BOX;
29
29
 
30
30
  export default {
31
31
  name: "AuthorMedals",
@@ -59,6 +59,7 @@ export default {
59
59
  return __imgPath + "image/medals/user/" + medal + ".gif";
60
60
  },
61
61
  getMedalLink(medal) {
62
+ if (medal.medal_url) return `${__Root}${medal.medal_url}`;
62
63
  return getMedalLink(medal.rank_id, medal.medal_type || "rank");
63
64
  },
64
65
  },