@jx3box/jx3box-common-ui 7.0.1 → 7.0.3

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.
@@ -0,0 +1,19 @@
1
+ .w-filter-tags {
2
+ display: inline-block;
3
+ .u-toggle {
4
+ color: #606266;
5
+ font-size: 14px;
6
+ .pointer;
7
+ }
8
+ }
9
+
10
+ .w-filter-tag__pop {
11
+ .u-group-title {
12
+ color: #606266;
13
+ padding-bottom: 10px;
14
+ }
15
+ .u-tag {
16
+ margin: 0 10px 10px 0;
17
+ .pointer;
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "7.0.1",
3
+ "version": "7.0.3",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,9 +31,9 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@jx3box/jx3box-comment-ui": "^1.7.8",
34
- "@jx3box/jx3box-common": "^7.7.2",
34
+ "@jx3box/jx3box-common": "^7.7.3",
35
35
  "@jx3box/jx3box-data": "^3.0.4",
36
- "@jx3box/jx3box-editor": "^1.7.3",
36
+ "@jx3box/jx3box-editor": "^1.7.4",
37
37
  "axios": "^0.26.1",
38
38
  "dayjs": "^1.11.0",
39
39
  "element-ui": "^2.13.2",
package/service/cms.js CHANGED
@@ -18,6 +18,10 @@ 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
+ }
21
25
  // 通用上传
22
26
  function upload(formData) {
23
27
  return $cms().post(`/api/cms/upload`, formData);
@@ -28,4 +32,4 @@ function checkTeamMember() {
28
32
  return $cms().get(`/api/cms/config/teammates/check`);
29
33
  }
30
34
 
31
- export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, checkTeamMember };
35
+ export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, checkTeamMember, getHonorJson };
package/src/App.vue CHANGED
@@ -66,6 +66,8 @@
66
66
  <clientBy type="" />
67
67
  <zlpBy />
68
68
 
69
+ <tagBy2 v-model="tag2" :tags="post_topics" />
70
+
69
71
  <hr />
70
72
  <uploadImage
71
73
  v-model="upload"
@@ -171,6 +173,7 @@ import orderBy from "./filters/orderBy.vue";
171
173
  import tagBy from "./filters/tagBy.vue";
172
174
  import clientBy from "./filters/clientBy.vue";
173
175
  import zlpBy from "./filters/zlpBy.vue";
176
+ import tagBy2 from "./filters/tagBy2.vue";
174
177
 
175
178
  import uploadImage from "./upload/upload_banner.vue";
176
179
  import AuthorMedal from "./medal/medal.vue";
@@ -181,6 +184,7 @@ import WikiComments from "./wiki/WikiComments.vue";
181
184
  import axios from "axios";
182
185
  import { __server } from "@jx3box/jx3box-common/data/jx3box.json";
183
186
  import { wiki } from "@jx3box/jx3box-common/js/wiki";
187
+ import post_topics from "@jx3box/jx3box-common/data/post_topics.json";
184
188
 
185
189
  export default {
186
190
  name: "App",
@@ -223,6 +227,7 @@ export default {
223
227
  tagBy,
224
228
  clientBy,
225
229
  zlpBy,
230
+ tagBy2,
226
231
 
227
232
  uploadImage,
228
233
  AuthorMedal,
@@ -249,6 +254,9 @@ export default {
249
254
 
250
255
  upload: "",
251
256
  text: `<Text>text="使用:<BUFF 3222 1 desc>,持续<BUFF 3222 1 time>。\\\n" font=105 </text><Text>text="红豆沙做馅儿,精致细腻的广式月饼。" font=100 </text><Text>text="使用:能在唐门套装供应商处换取如下装备。\\\n" font=105 </text><Text>text="[燕云·重泉靴]" name="iteminfolink" eventid=513 script="this.nVersion=0 this.dwTabType=7 this.dwIndex=35244 this.OnItemLButtonDown=function() OnItemLinkDown(this) end" font=100 r=255 g=40 b=255 </text><Text>text="," font=105 </text><Text>text="[燕云·铭松靴]" name="iteminfolink" eventid=513 script="this.nVersion=0 this.dwTabType=7 this.dwIndex=35245 this.OnItemLButtonDown=function() OnItemLinkDown(this) end" font=100 r=255 g=40 b=255 </text><Text>text="。" font=100 </text>`,
257
+
258
+ post_topics,
259
+ tag2: ''
252
260
  };
253
261
  },
254
262
  created: function () {
@@ -158,7 +158,9 @@ export default {
158
158
  cursor: default;
159
159
  &:hover {
160
160
  cursor: pointer;
161
- background: #ecf5ff;
161
+ background: #409eff;
162
+ color: #fff;
163
+ border-color: #409eff;
162
164
  }
163
165
  }
164
166
 
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div class="c-honor" :style="{ backgroundImage: `url(${imgUrl()})` }" v-if="honor">
3
+ <span :style="{ color: honor.color }">{{ honor.honor }}</span>
4
+ </div>
5
+ </template>
6
+ <script>
7
+ import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
8
+ import { getDecoration, getHonorJson } from "../../service/cms";
9
+ import { inRange } from "lodash";
10
+ const HONOR_IMG_KEY = "honor_img";
11
+ export default {
12
+ props: ["uid"],
13
+ data: function () {
14
+ return {
15
+ honor: "",
16
+ };
17
+ },
18
+ watch: {
19
+ uid: {
20
+ immediate: true,
21
+ handler: function (val) {
22
+ val && this.getHonor();
23
+ },
24
+ },
25
+ },
26
+ methods: {
27
+ imgUrl: function () {
28
+ let item = this.honor;
29
+ if (!item) return;
30
+ if (item.isImgIndex) {
31
+ return __imgPath + `decoration/honor/${item.val}/${item.val}_${item.imgIndex}.${item.ext}`;
32
+ }
33
+ return __imgPath + `decoration/honor/${item.val}/${item.val}.${item.ext}`;
34
+ },
35
+ getHonor() {
36
+ let user_id = this.uid;
37
+ if (!user_id) return;
38
+ let honor_local = sessionStorage.getItem(HONOR_IMG_KEY + user_id);
39
+ if (honor_local) {
40
+ //解析本地缓存
41
+ let honor_parse = JSON.parse(honor_local);
42
+ if (!honor_parse == "no") return;
43
+ this.honor = honor_parse;
44
+ return;
45
+ }
46
+ getDecoration({ using: 1, user_id: user_id, type: "honor" }).then((data) => {
47
+ let res = data.data.data;
48
+ if (res.length == 0) {
49
+ //空 则为无主题,不再加载接口,界面设No
50
+ sessionStorage.setItem(HONOR_IMG_KEY + user_id, "no");
51
+ return;
52
+ }
53
+ let honor = res[0];
54
+ this.getHonorStyle(honor);
55
+ });
56
+ },
57
+ //有称号后,获取样式配置
58
+ getHonorStyle(data) {
59
+ getHonorJson().then((res) => {
60
+ let honorList = res.data;
61
+ //过滤称号信息
62
+ let honorConfig = honorList[data.val];
63
+ //正则取出前缀
64
+ let prefix = honorConfig.prefix;
65
+ let regPrefix = honorConfig.prefix.match(/(?<=\{)(.+?)(?=\})/g);
66
+ let ranking = honorConfig.ranking;
67
+ let honorStr = honorConfig.year || "";
68
+ if (regPrefix) {
69
+ honorStr = honorStr + (data[regPrefix[0]] || "");
70
+ } else {
71
+ honorStr = honorStr + prefix;
72
+ }
73
+ //排名处理
74
+ if (ranking.length > 0) {
75
+ data.imgIndex = 0;
76
+ for (let i = 0; i < ranking.length; i++) {
77
+ //处在范围内取数组第三个值进行称号拼接
78
+ if (data.ranking != undefined && inRange(Number(data.ranking), ranking[i][0], ranking[i][1])) {
79
+ data.imgIndex = i;
80
+ let str = ranking[i][2];
81
+ //正则取出需替换值,如果没有则直接拼接
82
+ let regStr = str.match(/(?<=\{)(.+?)(?=\})/g);
83
+ if (regStr) {
84
+ //包含花括号替换
85
+ honorStr = honorStr + str.replace(/\{(.+?)\}/g, data[regStr[0]]);
86
+ } else {
87
+ honorStr = honorStr + str;
88
+ }
89
+ break;
90
+ }
91
+ }
92
+ }
93
+ data.honor = honorStr + honorConfig.suffix;
94
+ data.color = honorConfig.color;
95
+ data.ext = honorConfig.ext;
96
+ data.isHave = true;
97
+ data.isImgIndex = honorConfig.ranking.length > 0 ? true : false;
98
+ sessionStorage.setItem(HONOR_IMG_KEY + this.uid, JSON.stringify(data));
99
+ this.honor = data;
100
+ });
101
+ },
102
+ },
103
+ };
104
+ </script>
105
+ <style lang="less">
106
+ .c-honor {
107
+ .dbi;
108
+ text-align: center;
109
+ .mb(10px);
110
+ .size(220px,45px);
111
+ // background-color: #494038;
112
+ color: #ffffff;
113
+ .fz(10px,45px);
114
+ .r(2px);
115
+ }
116
+ </style>
@@ -35,7 +35,7 @@
35
35
  </div>
36
36
  </div>
37
37
  </div>
38
- <div class="u-honor" :style="honorStyle" v-if="honor">{{ honor }}</div>
38
+ <Honor :uid="uid"></Honor>
39
39
  <div class="u-bio">{{ data.user_bio }}</div>
40
40
  </div>
41
41
  </template>
@@ -45,25 +45,23 @@ 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, getDecorationJson } from "../../service/cms";
48
+ import { getDecoration, getHonorJson } from "../../service/cms";
49
49
  import Avatar from "./Avatar.vue";
50
- const DECORATION_JSON = "decoration_json";
51
- const DECORATION_KEY = "decoration_me";
52
- const HONOR_KEY = "honor_me";
50
+ import Honor from "./AuthorHonor.vue";
51
+ import { cloneDeep, inRange } from "lodash";
52
+ const HONOR_IMG_KEY = "honor_img";
53
53
  export default {
54
54
  name: "AuthorInfo",
55
55
  props: ["uid"],
56
56
  components: {
57
57
  Avatar,
58
+ Honor,
58
59
  },
59
60
  data: function () {
60
61
  return {
61
62
  data: {},
62
-
63
63
  isVIP: false,
64
64
  super_author_icon: __imgPath + "image/user/" + "superauthor.svg",
65
- honor: "",
66
- honorStyle: {},
67
65
  };
68
66
  },
69
67
  computed: {
@@ -92,7 +90,7 @@ export default {
92
90
  uid: {
93
91
  immediate: true,
94
92
  handler: function (val) {
95
- val && this.loadData() && this.getHonor();
93
+ val && this.loadData();
96
94
  },
97
95
  },
98
96
  },
@@ -111,80 +109,6 @@ export default {
111
109
  showLevelColor: function (level) {
112
110
  return __userLevelColor[level];
113
111
  },
114
- getHonor() {
115
- let user_id = this.uid;
116
- if (!user_id) {
117
- return;
118
- }
119
- let honor_local = sessionStorage.getItem(HONOR_KEY + user_id);
120
- if (honor_local == "no") return;
121
- //已有缓存,读取解析
122
- if (honor_local) {
123
- this.honor = honor_local;
124
- this.getHonorStyle();
125
- return;
126
- }
127
- getDecoration({ using: 1, user_id: user_id, type: "honor" }).then((data) => {
128
- let res = data.data.data;
129
- if (res.length == 0) {
130
- //空 则为无主题,不再加载接口,界面设No
131
- sessionStorage.setItem(HONOR_KEY + user_id, "no");
132
- return;
133
- }
134
- let honor = res[0];
135
- sessionStorage.setItem(HONOR_KEY + user_id, honor.val);
136
- this.honor = honor.val;
137
- this.getHonorStyle();
138
- });
139
- },
140
- //有称号后,获取样式配置
141
- getHonorStyle() {
142
- let user_id = this.uid;
143
- let decoration_local = sessionStorage.getItem(DECORATION_KEY + user_id);
144
- if (decoration_local) {
145
- //解析本地缓存
146
- let decoration_parse = JSON.parse(decoration_local);
147
- if (!decoration_parse.status) return;
148
-
149
- if (decoration_parse) {
150
- this.setHonorStyle(decoration_parse);
151
- return;
152
- }
153
- }
154
- getDecoration({ using: 1, user_id: user_id, type: "homebg" }).then((data) => {
155
- let res = data.data.data;
156
- if (res.length == 0) {
157
- //空 则为无主题,不再加载接口,界面设No
158
- sessionStorage.setItem(DECORATION_KEY + user_id, JSON.stringify({ status: false }));
159
- return;
160
- }
161
- let decoration = res[0];
162
- let decorationJson = sessionStorage.getItem(DECORATION_JSON);
163
- if (!decorationJson) {
164
- //加载远程json,用于Honor颜色配置
165
- getDecorationJson().then((json) => {
166
- let decoration_json = json.data;
167
- let theme = JSON.parse(JSON.stringify(decoration_json[decoration.val]));
168
- theme.status = true;
169
- sessionStorage.setItem(DECORATION_KEY + this.uid, JSON.stringify(theme));
170
- //缓存远程JSON文件
171
- sessionStorage.setItem(DECORATION_JSON, JSON.stringify(decoration_json));
172
- this.setHonorStyle(theme);
173
- });
174
- } else {
175
- let theme = JSON.parse(decorationJson)[decoration.val];
176
- theme.status = true;
177
- sessionStorage.setItem(DECORATION_KEY + this.uid, JSON.stringify(theme));
178
- this.setHonorStyle(theme);
179
- }
180
- });
181
- },
182
- setHonorStyle(style) {
183
- this.honorStyle = {
184
- "background-color": style.buttoncolor,
185
- color: style.buttontextcolor,
186
- };
187
- },
188
112
  },
189
113
  created: function () {},
190
114
  mounted: function () {},
@@ -295,12 +219,12 @@ export default {
295
219
  }
296
220
  .u-honor {
297
221
  .dbi;
298
- .mt(10px);
299
- background-color: #494038;
222
+ text-align: center;
223
+ .mb(10px);
224
+ .size(220px,45px);
225
+ // background-color: #494038;
300
226
  color: #ffffff;
301
- padding: 2px 50px 2px 10px;
302
- .fz(12px,14px);
303
- .mb(6px);
227
+ .fz(10px,45px);
304
228
  .r(2px);
305
229
  }
306
230
  }
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <div class="w-filter-tags" ref="tagBy">
3
+ <el-popover
4
+ v-model="visible"
5
+ trigger="manual"
6
+ ref="pop"
7
+ :width="400"
8
+ popper-class="w-filter-tag__pop"
9
+ :popper-options="{ boundariesElement: 'parent' }"
10
+ >
11
+ <div class="w-filter-tag__content">
12
+ <div v-for="(group, key) in tags" :key="key">
13
+ <div class="u-group-title">{{ key }}</div>
14
+ <div class="u-group">
15
+ <el-tag
16
+ v-for="item in group"
17
+ :key="item"
18
+ @click="onTagClick(item)"
19
+ class="u-tag"
20
+ :effect="item === value ? 'dark' : 'plain'"
21
+ >{{ item }}</el-tag
22
+ >
23
+ </div>
24
+ </div>
25
+ </div>
26
+
27
+ <template #reference>
28
+ <span @click="onToggle" class="u-toggle" :class="{ active: !!value }">{{ activeText }}</span>
29
+ </template>
30
+ </el-popover>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ export default {
36
+ name: "tagBy2",
37
+ props: {
38
+ tags: {
39
+ type: Object,
40
+ default: () => {},
41
+ },
42
+ modelValue: {
43
+ type: String,
44
+ default: "",
45
+ },
46
+ },
47
+ emits: ["update:modelValue"],
48
+ model: {
49
+ prop: "modelValue",
50
+ event: "update:modelValue",
51
+ },
52
+ data() {
53
+ return {
54
+ visible: false,
55
+ value: "",
56
+ };
57
+ },
58
+ computed: {
59
+ activeText() {
60
+ const { value } = this;
61
+ return value ? value : "主题";
62
+ },
63
+ },
64
+ watch: {
65
+ modelValue: {
66
+ immediate: true,
67
+ handler(val) {
68
+ this.value = val;
69
+ },
70
+ },
71
+ value(val) {
72
+ this.$emit("update:modelValue", val);
73
+ },
74
+ },
75
+ mounted() {
76
+ document.addEventListener("click", this.clickOutside);
77
+ },
78
+ beforeDestroy() {
79
+ document.removeEventListener("click", this.clickOutside);
80
+ },
81
+ methods: {
82
+ onToggle() {
83
+ this.visible = !this.visible;
84
+ },
85
+ onTagClick(item) {
86
+ this.value = item;
87
+
88
+ setTimeout(() => {
89
+ this.visible = false;
90
+ }, 100);
91
+ },
92
+ clickOutside(e) {
93
+ const tagBy = this.$refs.tagBy;
94
+ const pop = this.$refs.pop;
95
+
96
+ if (tagBy && !tagBy.contains(e.target) && pop && !pop.$el.contains(e.target)) {
97
+ this.visible = false;
98
+ }
99
+ },
100
+ },
101
+ };
102
+ </script>
103
+
104
+ <style lang="less">
105
+ @import "../../assets/css/tag-by2.less";
106
+ </style>