@jx3box/jx3box-common-ui 5.5.16 → 5.5.19

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.
@@ -115,12 +115,12 @@
115
115
  }
116
116
  padding:2px 0;
117
117
  }
118
- .u-teamlogo {
118
+ .u-team-logo {
119
119
  .size(26px);
120
120
  .y;
121
121
  .mr(10px);
122
122
  }
123
- .u-teamname {
123
+ .u-team-name {
124
124
  .fz(12px);
125
125
  color: #555;
126
126
  }
package/index.js CHANGED
@@ -5,6 +5,7 @@ import Breadcrumb from './src/Breadcrumb.vue'
5
5
  import LeftSidebar from './src/LeftSidebar.vue'
6
6
  import LeftSideToggle from './src/LeftSideToggle.vue'
7
7
  import Author from './src/Author.vue'
8
+ import Avatar from './src/Avatar.vue'
8
9
  import RightSidebar from './src/RightSidebar.vue'
9
10
  import RightSideMsg from './src/RightSideMsg.vue'
10
11
  import Main from './src/Main.vue'
@@ -44,6 +45,7 @@ const components = {
44
45
 
45
46
  RightSideMsg,
46
47
  Author,
48
+ Avatar,
47
49
 
48
50
  Thx,
49
51
  Like,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "5.5.16",
3
+ "version": "5.5.19",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,10 +30,10 @@
30
30
  "last 2 versions"
31
31
  ],
32
32
  "dependencies": {
33
- "@jx3box/jx3box-comment-ui": "^1.6.6",
34
- "@jx3box/jx3box-common": "^7.0.5",
33
+ "@jx3box/jx3box-comment-ui": "^1.6.7",
34
+ "@jx3box/jx3box-common": "^7.0.17",
35
35
  "@jx3box/jx3box-data": "^1.8.3",
36
- "@jx3box/jx3box-editor": "^1.2.0",
36
+ "@jx3box/jx3box-editor": "^1.2.4",
37
37
  "axios": "^0.19.2",
38
38
  "element-ui": "^2.13.2",
39
39
  "jquery": "^3.5.1",
package/src/App.vue CHANGED
@@ -13,6 +13,17 @@
13
13
 
14
14
  <Main :withoutLeft="false" :withoutRight="false">
15
15
  <el-tabs v-model="tab" type="card">
16
+ <el-tab-pane label="头像" name="avatar">
17
+ <el-radio-group v-model="avatar_size">
18
+ <el-radio :label="60">xs-60</el-radio>
19
+ <el-radio :label="84">s-84</el-radio>
20
+ <el-radio :label="136">m-136</el-radio>
21
+ <el-radio :label="224">l-224</el-radio>
22
+ </el-radio-group>
23
+ <div>
24
+ <Avatar :size="avatar_size" url="" :id="8" frame="" />
25
+ </div>
26
+ </el-tab-pane>
16
27
  <el-tab-pane label="CMS作品" name="post">
17
28
  <el-radio-group v-model="post_id">
18
29
  <el-radio label="35605">Markdown</el-radio>
@@ -96,6 +107,7 @@ import Breadcrumb from "./Breadcrumb.vue";
96
107
  import LeftSidebar from "./LeftSidebar.vue";
97
108
  import LeftSideToggle from "./LeftSideToggle.vue";
98
109
  import Author from "./Author.vue";
110
+ import Avatar from "./author/Avatar.vue";
99
111
  import UserPop from "./author/UserPop.vue";
100
112
 
101
113
  import Main from "./Main.vue";
@@ -161,6 +173,7 @@ export default {
161
173
 
162
174
  RightSideMsg,
163
175
  Author,
176
+ Avatar,
164
177
  // Authorposts,
165
178
 
166
179
  Mark,
@@ -188,7 +201,7 @@ export default {
188
201
  },
189
202
  data: function() {
190
203
  return {
191
- tab: "post",
204
+ tab: "avatar",
192
205
 
193
206
  post: "",
194
207
  post_id: "35605",
@@ -197,6 +210,8 @@ export default {
197
210
  wikiPost: null,
198
211
  tag: "",
199
212
  visible: false,
213
+
214
+ avatar_size : 60,
200
215
  };
201
216
  },
202
217
  created: function() {
package/src/Author.vue CHANGED
@@ -3,12 +3,12 @@
3
3
  <div class="u-author">
4
4
  <Avatar
5
5
  class="u-avatar"
6
- :id="id"
6
+ :uid="uid"
7
7
  :url="data.user_avatar"
8
8
  :size="68"
9
9
  :frame="data.user_avatar_frame"
10
10
  />
11
- <a class="u-name" :href="authorLink(id)">
11
+ <a class="u-name" :href="authorLink(uid)">
12
12
  <span>{{ data.display_name }}</span>
13
13
  </a>
14
14
  <el-tooltip
@@ -88,8 +88,8 @@
88
88
  <span>所属团队</span>
89
89
  </div>
90
90
  <a class="u-team" v-for="(item,i) in teams" :key="i" :href="teamLink(item.team_id)" target="_blank">
91
- <img class="u-teamlogo" :src="showTeamLogo(item.team_logo)" />
92
- <span class="u-teamname">{{item.team_name}}@{{item.team_server}}</span>
91
+ <img class="u-team-logo" :src="showTeamLogo(item.team_logo)" />
92
+ <span class="u-team-name">{{item.team_name}}@{{item.team_server}}</span>
93
93
  </a>
94
94
  </div>
95
95
  <Authorposts :uid="uid" />
@@ -139,9 +139,6 @@ export default {
139
139
  };
140
140
  },
141
141
  computed: {
142
- id: function () {
143
- return this.uid;
144
- },
145
142
  tv_type: function () {
146
143
  return this.data && this.data.tv_type;
147
144
  },
@@ -180,7 +177,7 @@ export default {
180
177
  },
181
178
  methods: {
182
179
  loadData: function () {
183
- return getUserInfo(this.id)
180
+ return getUserInfo(this.uid)
184
181
  .then((data) => {
185
182
  this.data = data;
186
183
  })
@@ -200,12 +197,12 @@ export default {
200
197
  }
201
198
  },
202
199
  loadMedals: function () {
203
- getUserMedals(this.id).then((data) => {
200
+ getUserMedals(this.uid).then((data) => {
204
201
  this.medals = data;
205
202
  });
206
203
  },
207
204
  loadTeams: function () {
208
- getUserPublicTeams(this.id).then((data) => {
205
+ getUserPublicTeams(this.uid).then((data) => {
209
206
  this.teams = data && data.slice(0, 5);
210
207
  });
211
208
  },
@@ -214,12 +211,12 @@ export default {
214
211
  this.isVIP = await User.isVIP();
215
212
  },
216
213
  checkSuperAuthor: function () {
217
- getSuperAuthor(this.id).then((res) => {
214
+ getSuperAuthor(this.uid).then((res) => {
218
215
  this.isSuperAuthor = res.data.data;
219
216
  });
220
217
  },
221
218
  loadIdentity: function () {
222
- getIdentity(this.id).then((res) => {
219
+ getIdentity(this.uid).then((res) => {
223
220
  this.isPRO = res.data.data.isPRO;
224
221
  this.isVIP = res.data.data.isPRE;
225
222
  });
@@ -239,8 +236,8 @@ export default {
239
236
  githubLink: function (val) {
240
237
  return "https://github.com/" + val;
241
238
  },
242
- teamLink: function (id) {
243
- return getLink("org", id);
239
+ teamLink: function (team_id) {
240
+ return getLink("org", team_id);
244
241
  },
245
242
  showTeamLogo: function (val) {
246
243
  return getThumbnail(val, 32);
@@ -252,7 +249,7 @@ export default {
252
249
  },
253
250
  },
254
251
  mounted: function () {
255
- this.id && this.loadData();
252
+ this.uid && this.loadData();
256
253
  },
257
254
  components: {
258
255
  Avatar,
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <a class="c-avatar" :href="authorLink(uid)">
3
- <img :src="showAvatar(avatar)" class="c-avatar-pic" :class="{ isCircle }" />
3
+ <img :src="showAvatar(url)" class="c-avatar-pic" :class="{ isCircle }" />
4
4
  <i class="c-avatar-frame" v-if="frameName" :class="style">
5
5
  <img :src="frameUrl" />
6
6
  </i>
@@ -9,71 +9,87 @@
9
9
  </template>
10
10
 
11
11
  <script>
12
- import frames from "@jx3box/jx3box-common/data/user_avatar_frame.json";
12
+ import default_frames from "@jx3box/jx3box-common/data/user_avatar_frame.json";
13
13
  import { __server, __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
14
14
  import { getFrames } from "../../service/author";
15
15
  import { showAvatar, authorLink } from "@jx3box/jx3box-common/js/utils";
16
16
  export default {
17
17
  name: "",
18
- props: ["id", "url", "size", "frame"],
18
+ props: ["uid", "url", "size", "frame"],
19
19
  components: {},
20
- data: function () {
20
+ data: function() {
21
21
  return {
22
- frames,
23
- style_map: [60, 84, 136, 224],
24
- style_cls: ["xs", "s", "m", "l"],
22
+ frames: [],
23
+ styles : [
24
+ {cls:'xs',size:60},
25
+ {cls:'s',size:84},
26
+ {cls:'m',size:136},
27
+ {cls:'l',size:224},
28
+ ]
25
29
  };
26
30
  },
27
31
  computed: {
28
- uid: function () {
29
- return ~~this.id || 0;
30
- },
31
- avatar: function () {
32
- return this.url;
33
- },
34
- frameName: function () {
32
+ frameName: function() {
35
33
  return this.frame && this.frames[this.frame] ? this.frame : "";
36
34
  },
37
- frameUrl: function () {
35
+ frameUrl: function() {
38
36
  if (this.frameName) {
39
- let fileName = this.frames[this.frameName].files[this.style]
40
- .file;
37
+ let fileName = this.frames[this.frameName].files[this.style].file;
41
38
  return __imgPath + `image/avatar/${this.frameName}/${fileName}`;
42
39
  }
43
40
  return "";
44
41
  },
45
- isCircle: function () {
46
- return (
47
- this.frameName && this.frames[this.frameName].style == "circle"
48
- );
42
+ isCircle: function() {
43
+ return this.frameName && this.frames[this.frameName].style == "circle";
49
44
  },
50
- style: function () {
45
+ style: function() {
51
46
  let style = ~~this.size;
52
- this.style_map.forEach((item, i) => {
53
- if (style < item) {
54
- return this.style_cls[i];
47
+ for(let [i,v] of this.styles.entries()){
48
+ if(style < v){
49
+ return this.styles[i]['cls']
55
50
  }
56
- });
51
+ }
57
52
  return "s";
58
53
  },
54
+ data: function() {
55
+ return [this.uid, this.url, this.size, this.frame];
56
+ },
59
57
  },
60
58
  methods: {
61
- loadFrames: function () {
62
- getFrames().then((res) => {
63
- if (res.data) {
64
- this.frames = res.data;
59
+ loadFrames: function() {
60
+
61
+ // 无头像框
62
+ if(!this.frame) return
63
+
64
+ let frames = sessionStorage.getItem("avatarFrames");
65
+
66
+ // 本地缓存
67
+ if(frames){
68
+ try {
69
+ frames = JSON.parse(frames);
70
+ this.frames = frames;
71
+ } catch (e) {
72
+ this.frames = default_frames
65
73
  }
66
- });
74
+
75
+ // 线上数据
76
+ }else{
77
+ getFrames().then((res) => {
78
+ if (res.data) {
79
+ this.frames = res.data || {};
80
+ sessionStorage.setItem("avatarFrames", JSON.stringify(this.frames));
81
+ }
82
+ });
83
+ }
67
84
  },
68
- showAvatar: function (val) {
85
+ showAvatar: function(val) {
69
86
  return showAvatar(val, this.size);
70
87
  },
71
88
  authorLink,
72
89
  },
73
- created: function () {
74
- this.loadFrames();
75
- },
76
- mounted: function () {},
90
+ mounted : function (){
91
+ this.loadFrames()
92
+ }
77
93
  };
78
94
  </script>
79
95
 
@@ -125,4 +141,4 @@ export default {
125
141
  top: -22px;
126
142
  }
127
143
  }
128
- </style>
144
+ </style>
@@ -111,7 +111,7 @@ export default {
111
111
  deep: true,
112
112
  handler: function (val) {
113
113
  if (val) {
114
- this.list = [val, ...this.list];
114
+ this.list.push(val);
115
115
  // 清空父组件的cache
116
116
  this.$parent.cacheRecord = null;
117
117
  }
@@ -18,25 +18,13 @@
18
18
  <th>贡献者</th>
19
19
  <th>修订说明</th>
20
20
  </tr>
21
- <tr
22
- class="history"
23
- v-for="(ver, key) in versions"
24
- :key="key"
25
- >
21
+ <tr class="history" v-for="(ver, key) in versions" :key="key">
26
22
  <td>
27
- <a
28
- :href="link(type, `${ver.source_id}/${ver.id}`)"
29
- v-text="'v' + (versions.length - key)"
30
- ></a>
23
+ <a :href="link(type, `${ver.source_id}/${ver.id}`)" v-text="'v' + (versions.length - key)" @click="redirectRevision(ver,$event)"></a>
31
24
  </td>
32
25
  <td v-text="ts2str(ver.updated)"></td>
33
26
  <td>
34
- <a
35
- :href="
36
- ver.user_id ? author_url(ver.user_id) : null
37
- "
38
- v-text="ver.user_nickname"
39
- ></a>
27
+ <a :href="ver.user_id ? author_url(ver.user_id) : null" v-text="ver.user_nickname"></a>
40
28
  </td>
41
29
  <td v-text="ver.remark"></td>
42
30
  </tr>
@@ -50,36 +38,42 @@
50
38
  import WikiPanel from "./WikiPanel";
51
39
  import { WikiPost } from "@jx3box/jx3box-common/js/helper";
52
40
  import { getLink, authorLink, ts2str } from "@jx3box/jx3box-common/js/utils";
53
- import {__Root,__OriginRoot} from '@jx3box/jx3box-common/data/jx3box.json'
41
+ import { __Root, __OriginRoot } from "@jx3box/jx3box-common/data/jx3box.json";
54
42
 
55
43
  export default {
56
44
  name: "WikiRevisions",
57
- props: ["type", "sourceId",'isGame'],
45
+ props: ["type", "sourceId", "isGame"],
58
46
  data: function() {
59
47
  return {
60
48
  versions: null,
61
49
  };
62
50
  },
63
- computed : {
64
- baseUrl : function (){
65
- return location.href.includes('classic') ? __OriginRoot : __Root
51
+ computed: {
52
+ baseUrl: function() {
53
+ return (location.href.includes("classic") || location.href.includes("origin")) ? __OriginRoot : __Root;
66
54
  },
67
- prefix : function (){
68
- if(this.isGame){
69
- return this.baseUrl
70
- }else{
71
- return ''
55
+ prefix: function() {
56
+ if (this.isGame) {
57
+ return this.baseUrl.slice(0,-1);
58
+ } else {
59
+ return "";
72
60
  }
73
- }
61
+ },
74
62
  },
75
63
  methods: {
76
- link: function (type,id){
77
- return this.prefix + getLink(type,id)
64
+ link: function(type, id) {
65
+ return this.prefix + getLink(type, id);
78
66
  },
79
- author_url: function (uid){
80
- return this.prefix + authorLink(uid)
67
+ author_url: function(uid) {
68
+ return this.prefix + authorLink(uid);
81
69
  },
82
70
  ts2str,
71
+ redirectRevision : function (ver,e){
72
+ if(!this.isGame && this.$router){
73
+ e.preventDefault();
74
+ this.$router.replace({path:`/view/${ver.source_id}/${ver.id}`})
75
+ }
76
+ }
83
77
  },
84
78
  components: {
85
79
  WikiPanel,
@@ -92,8 +86,7 @@ export default {
92
86
  WikiPost.versions(this.type, this.sourceId).then(
93
87
  (res) => {
94
88
  res = res.data;
95
- this.versions =
96
- res.code === 200 ? res.data.versions : false;
89
+ this.versions = res.code === 200 ? res.data.versions : false;
97
90
  },
98
91
  () => {
99
92
  this.versions = false;