@jx3box/jx3box-common-ui 5.7.9 → 5.7.12

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": "5.7.9",
3
+ "version": "5.7.12",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@jx3box/jx3box-comment-ui": "^1.7.0",
34
- "@jx3box/jx3box-common": "^7.1.5",
34
+ "@jx3box/jx3box-common": "^7.1.6",
35
35
  "@jx3box/jx3box-data": "^1.9.4",
36
36
  "@jx3box/jx3box-editor": "^1.2.7",
37
37
  "axios": "^0.26.1",
package/src/App.vue CHANGED
@@ -65,6 +65,7 @@
65
65
 
66
66
  <hr />
67
67
  <uploadImage v-model="upload" info="非必选。首页海报尺寸1100*300(推荐2200*600支持高分屏),最大20M。"></uploadImage>
68
+ <AuthorMedal :author-id="8"></AuthorMedal>
68
69
  </el-tab-pane>
69
70
  <el-tab-pane label="百科组件" name="wiki"
70
71
  ><WikiPanel :wiki-post="wikiPost">
@@ -146,6 +147,7 @@ import clientBy from "./filters/clientBy.vue";
146
147
  import zlpBy from "./filters/zlpBy.vue";
147
148
 
148
149
  import uploadImage from './upload/upload_banner.vue'
150
+ import AuthorMedal from './medal/medal.vue'
149
151
 
150
152
  import WikiPanel from "./wiki/WikiPanel.vue";
151
153
  import WikiRevisions from "./wiki/WikiRevisions.vue";
@@ -199,6 +201,7 @@ export default {
199
201
  zlpBy,
200
202
 
201
203
  uploadImage,
204
+ AuthorMedal,
202
205
 
203
206
  WikiPanel,
204
207
  WikiRevisions,
package/src/Box.vue CHANGED
@@ -78,6 +78,22 @@ export default {
78
78
  return "_blank";
79
79
  }
80
80
  },
81
+ loadMenu() {
82
+ try {
83
+ const _box = JSON.parse(sessionStorage.getItem("box"));
84
+ if (_box) {
85
+ this.data = _box;
86
+ } else {
87
+ getMenu('box').then(res => {
88
+ this.data = res.data?.data?.val;
89
+ sessionStorage.setItem("box", JSON.stringify(this.data));
90
+ });
91
+ }
92
+ } catch(e) {
93
+ this.data = box;
94
+ console.log('loadBox error', e);
95
+ }
96
+ }
81
97
  },
82
98
  created: function () {
83
99
  if (this.overlayEnable) {
@@ -89,9 +105,7 @@ export default {
89
105
  }, 200)
90
106
  );
91
107
  }
92
- getMenu('box').then((res) => {
93
- this.data = res.data?.data?.val || box;
94
- });
108
+ this.loadMenu();
95
109
  },
96
110
  mounted: function () {
97
111
  Bus.$on("toggleBox", (status) => {
@@ -129,4 +143,4 @@ export default {
129
143
  .db;
130
144
  }
131
145
  }
132
- </style>
146
+ </style>
@@ -95,13 +95,27 @@ export default {
95
95
  isSelf: function (link) {
96
96
  return link.startsWith("/") ? "_self" : "_blank";
97
97
  },
98
+ loadNav() {
99
+ try {
100
+ const nav = JSON.parse(sessionStorage.getItem("nav"));
101
+ if (nav) {
102
+ this.nav = nav;
103
+ } else {
104
+ getMenu("nav").then((res) => {
105
+ if (res.data) {
106
+ this.nav = res?.data?.data?.val
107
+ sessionStorage.setItem("nav", JSON.stringify(this.nav));
108
+ }
109
+ });
110
+ }
111
+ } catch (e) {
112
+ this.nav = default_nav;
113
+ console.log('loadNav error', e);
114
+ }
115
+ }
98
116
  },
99
117
  created: function () {
100
- getMenu("nav").then((res) => {
101
- if (res.data) {
102
- this.nav = res?.data?.data?.val || default_nav;
103
- }
104
- });
118
+
105
119
  },
106
120
  components: {},
107
121
  };
@@ -230,9 +230,20 @@ export default {
230
230
  });
231
231
  },
232
232
  loadPanel: function () {
233
- getMenu("panel").then((res) => {
234
- this.panel = res.data?.data?.val || panel;
235
- });
233
+ try {
234
+ const panel = JSON.parse(sessionStorage.getItem("panel"));
235
+ if (panel) {
236
+ this.panel = panel;
237
+ } else {
238
+ getMenu("panel").then((res) => {
239
+ this.panel = res.data?.data?.val;
240
+ sessionStorage.setItem("panel", JSON.stringify(this.panel));
241
+ });
242
+ }
243
+ } catch (e) {
244
+ this.panel = panel;
245
+ console.log('loadPanel error', e);
246
+ }
236
247
  },
237
248
  logout: function () {
238
249
  User.destroy()
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <div class="m-medal">
3
+ <a :href="medalLink(item)" target="_blank" class="u-medal" v-for="item in medals" :key="item.id" :title="item.medal_desc">
4
+ <img class="u-medal-img" :src="showIcon(item.medal)" alt="">
5
+ </a>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import { getMedalLink } from '@jx3box/jx3box-common/js/utils'
11
+ export default {
12
+ name: 'author_medal',
13
+ props: {
14
+ medals: {
15
+ type: Array,
16
+ default: () => [], // [{ rank_id, medal_desc, medal }]
17
+ },
18
+ showIcon: {
19
+ type: Function,
20
+ default: () => true,
21
+ }
22
+ },
23
+ methods: {
24
+
25
+ medalLink({ rank_id, subtype }) {
26
+ return getMedalLink(rank_id, subtype)
27
+ }
28
+ }
29
+ }
30
+ </script>
31
+
32
+ <style lang="less">
33
+ .m-medal {
34
+ display: block;
35
+ margin: 5px 0;
36
+
37
+ .u-medal {
38
+ cursor: pointer;
39
+ .u-medal-img {
40
+ width: 20px;
41
+ height: 20px;
42
+ margin-right: 5px;
43
+ }
44
+ }
45
+ }
46
+ </style>