@jx3box/jx3box-common-ui 6.4.0 → 6.4.2

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": "6.4.0",
3
+ "version": "6.4.2",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -6,15 +6,8 @@
6
6
  <el-tooltip effect="dark" content="我的消息" placement="bottom">
7
7
  <a class="u-msg" :href="url.msg">
8
8
  <i class="u-icon u-icon-msg">
9
- <i
10
- class="u-pop"
11
- style="display: none"
12
- v-show="pop"
13
- ></i>
14
- <img
15
- svg-inline
16
- src="../../assets/img/header/msg.svg"
17
- />
9
+ <i class="u-pop" style="display: none" v-show="pop"></i>
10
+ <img svg-inline src="../../assets/img/header/msg.svg" />
18
11
  </i>
19
12
  </a>
20
13
  </el-tooltip>
@@ -24,22 +17,14 @@
24
17
  <div class="c-header-panel" id="c-header-panel">
25
18
  <el-tooltip effect="dark" content="发布中心" placement="bottom">
26
19
  <a class="u-post" :href="url.publish">
27
- <img
28
- class="u-add"
29
- svg-inline
30
- src="../../assets/img/header/add.svg"
31
- />
20
+ <img class="u-add" svg-inline src="../../assets/img/header/add.svg" />
32
21
  </a>
33
22
  </el-tooltip>
34
23
  </div>
35
24
 
36
25
  <!-- user info -->
37
26
  <div class="c-header-info">
38
- <div
39
- class="c-header-profile"
40
- id="c-header-profile"
41
- @click="showmenu"
42
- >
27
+ <div class="c-header-profile" id="c-header-profile" @click="showmenu">
43
28
  <img class="u-avatar" :src="user.avatar" />
44
29
  <span class="u-dropdown"></span>
45
30
  <ul class="u-menu" v-show="!fold">
@@ -57,22 +42,12 @@
57
42
  </a>
58
43
  </li>
59
44
  <li>
60
- <a
61
- class="u-vip"
62
- href="/vip/premium?from=header_usermenu"
63
- target="_blank"
64
- >
65
- <i
66
- class="i-icon-vip"
67
- :class="{ on: isVIP || isPRO }"
68
- >{{ vipType }}</i
69
- >
45
+ <a class="u-vip" href="/vip/premium?from=header_usermenu" target="_blank">
46
+ <i class="i-icon-vip" :class="{ on: isVIP || isPRO }">{{ vipType }}</i>
70
47
  <span class="u-vip-type">
71
48
  <template v-if="isVIP || isPRO">
72
49
  {{ vipTypeTxt }}
73
- <span class="u-vip-left"
74
- >({{ vipLeftDays }}天)</span
75
- >
50
+ <span class="u-vip-left">({{ vipLeftDays }}天)</span>
76
51
  </template>
77
52
  <template v-else>升级账号类型</template>
78
53
  </span>
@@ -81,10 +56,7 @@
81
56
  </li>
82
57
  <hr />
83
58
  <template v-for="(item, i) in panel">
84
- <li
85
- :key="'panel-' + i"
86
- v-if="isAdmin || !item.onlyAdmin"
87
- >
59
+ <li :key="'panel-' + i" v-if="isAdmin || !item.onlyAdmin">
88
60
  <a :href="item.link">{{ item.label }}</a>
89
61
  </li>
90
62
  </template>
@@ -112,17 +84,12 @@
112
84
  <script>
113
85
  import User from "@jx3box/jx3box-common/js/user";
114
86
  import { showDate } from "@jx3box/jx3box-common/js/moment";
115
- import {
116
- __Links,
117
- __Root,
118
- __imgPath,
119
- __OriginRoot,
120
- } from "@jx3box/jx3box-common/data/jx3box.json";
87
+ import { __Links, __Root, __imgPath, __OriginRoot } from "@jx3box/jx3box-common/data/jx3box.json";
121
88
  import panel from "../../assets/data/panel.json";
122
89
  import { getMsg, getMenu } from "../../service/header";
123
90
  import { getMyInfo, userSignIn } from "../../service/author";
124
- import dayjs from 'dayjs';
125
- import isToday from 'dayjs/plugin/isToday';
91
+ import dayjs from "dayjs";
92
+ import isToday from "dayjs/plugin/isToday";
126
93
  dayjs.extend(isToday);
127
94
  export default {
128
95
  props: [],
@@ -161,8 +128,7 @@ export default {
161
128
 
162
129
  // 链接
163
130
  login_url: __Links.account.login + "?redirect=" + location.href,
164
- register_url:
165
- __Links.account.register + "?redirect=" + location.href,
131
+ register_url: __Links.account.register + "?redirect=" + location.href,
166
132
  isSuperAuthor: false,
167
133
  };
168
134
  },
@@ -190,14 +156,9 @@ export default {
190
156
  },
191
157
  vipLeftDays: function () {
192
158
  if (this.isPRO) {
193
- return parseInt(
194
- (new Date(this.asset.pro_expire_date) - new Date()) /
195
- 86400000
196
- );
159
+ return parseInt((new Date(this.asset.pro_expire_date) - new Date()) / 86400000);
197
160
  } else if (this.isVIP) {
198
- return parseInt(
199
- (new Date(this.asset.expire_date) - new Date()) / 86400000
200
- );
161
+ return parseInt((new Date(this.asset.expire_date) - new Date()) / 86400000);
201
162
  } else {
202
163
  return "";
203
164
  }
@@ -205,15 +166,15 @@ export default {
205
166
  super_author_icon: function () {
206
167
  return __imgPath + "image/user/" + "superauthor.svg";
207
168
  },
208
- siteRoot : function (){
209
- return location.host.includes('origin') ? __OriginRoot : __Root
210
- }
169
+ siteRoot: function () {
170
+ return location.host.includes("origin") ? __OriginRoot : __Root;
171
+ },
211
172
  },
212
173
  watch: {
213
174
  fold(val) {
214
175
  if (!val) {
215
176
  }
216
- }
177
+ },
217
178
  },
218
179
  methods: {
219
180
  // 消息
@@ -247,14 +208,14 @@ export default {
247
208
  }
248
209
  } catch (e) {
249
210
  this.panel = panel;
250
- console.log('loadPanel error', e);
211
+ console.log("loadPanel error", e);
251
212
  }
252
213
  },
253
214
  logout: function () {
254
215
  User.destroy()
255
216
  .then((res) => {
256
217
  this.isLogin = false;
257
- if (location.pathname.startsWith('/dashboard') || location.pathname.startsWith('/publish')) {
218
+ if (location.pathname.startsWith("/dashboard") || location.pathname.startsWith("/publish")) {
258
219
  location.href = this.siteRoot;
259
220
  }
260
221
  })
@@ -268,28 +229,35 @@ export default {
268
229
  });
269
230
  },
270
231
  // 签到
271
- signIn: function (){
232
+ signIn: function () {
272
233
  try {
273
- let user_last_login = localStorage.getItem('user_last_login');
274
- user_last_login = user_last_login && JSON.parse(user_last_login) || ''
234
+ let user_last_login = localStorage.getItem("user_last_login");
235
+ user_last_login = (user_last_login && JSON.parse(user_last_login)) || "";
275
236
 
276
237
  if (user_last_login && dayjs(user_last_login).isToday()) {
277
- console.log('已签到')
238
+ console.log("已签到");
278
239
  } else {
279
- userSignIn().then(res => {
280
- this.$message({
281
- type: 'success',
282
- message: '签到成功',
283
- customClass: 'c-header-signin'
240
+ userSignIn()
241
+ .then((res) => {
242
+ let msg = this.$message({
243
+ type: "success",
244
+ message: "签到成功",
245
+ customClass: "c-header-signin",
246
+ duration: 0,
247
+ });
248
+ // 模拟手动关闭
249
+ setTimeout(() => {
250
+ msg.close();
251
+ }, 3000);
252
+ localStorage.setItem("user_last_login", JSON.stringify(dayjs()));
253
+ })
254
+ .catch((err) => {
255
+ localStorage.setItem("user_last_login", JSON.stringify(dayjs()));
256
+ console.log(dayjs.tz.guess());
284
257
  })
285
- localStorage.setItem('user_last_login', JSON.stringify(dayjs()))
286
- }).catch(err => {
287
- localStorage.setItem('user_last_login', JSON.stringify(dayjs()))
288
- console.log(dayjs.tz.guess())
289
- }).finally(() => {})
290
258
  }
291
- } catch(e) {
292
- console.log(e)
259
+ } catch (e) {
260
+ console.log(e);
293
261
  }
294
262
  },
295
263
 
@@ -300,9 +268,9 @@ export default {
300
268
  });
301
269
  },
302
270
  loadMyInfo: function () {
303
- getMyInfo().then(res => {
304
- this.isSuperAuthor = !!res.sign
305
- })
271
+ getMyInfo().then((res) => {
272
+ this.isSuperAuthor = !!res.sign;
273
+ });
306
274
  },
307
275
 
308
276
  // 初始化
@@ -313,8 +281,8 @@ export default {
313
281
  this.checkMSG();
314
282
  this.loadPanel();
315
283
  this.loadAsset();
316
- this.loadMyInfo()
317
- this.signIn()
284
+ this.loadMyInfo();
285
+ this.signIn();
318
286
  }
319
287
  },
320
288
 
@@ -38,7 +38,7 @@
38
38
  :maxlength="30"
39
39
  show-word-limit
40
40
  ></el-input>
41
- <el-button @click="insertCurrentRelease">插入当前版本</el-button>
41
+ <el-button :disabled="fetchingCurrentRelease" @click="insertCurrentRelease">插入当前版本</el-button>
42
42
  </div>
43
43
  </div>
44
44
  </div>
@@ -71,6 +71,7 @@ export default {
71
71
  chosen: '', // 被选中的人
72
72
 
73
73
  submitting: false,
74
+ fetchingCurrentRelease: false,
74
75
  };
75
76
  },
76
77
  computed: {
@@ -134,13 +135,16 @@ export default {
134
135
  });
135
136
  },
136
137
  insertCurrentRelease: function() {
137
- getBreadcrumb("current-release").then(res => {
138
+ this.fetchingCurrentRelease = true;
139
+ getBreadcrumb(`current-release-${this.hostClient}`).then(res => {
138
140
  this.remark += res;
139
141
  }).catch(err => {
140
142
  this.$message({
141
143
  message: "获取失败",
142
144
  type: "error",
143
145
  });
146
+ }).finally(() => {
147
+ this.fetchingCurrentRelease = false;
144
148
  });
145
149
  },
146
150
  init: function () {},