@jx3box/jx3box-ui 2.3.11 → 2.3.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
package/src/CommonHeader.vue
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
:header-config-loaded="headerConfigLoaded"
|
|
28
28
|
:header-config-managed="true"
|
|
29
29
|
:account-ready-issues="accountReadyIssues"
|
|
30
|
+
:account-ready-incomplete="accountReadyIncomplete"
|
|
30
31
|
@open-account-ready="openAccountReadyDialog"
|
|
31
32
|
/>
|
|
32
33
|
</div>
|
|
@@ -45,8 +46,8 @@
|
|
|
45
46
|
<p class="u-desc">为了保障 App 登录、账号找回和卡密等功能正常使用,请先补全以下账号安全信息。</p>
|
|
46
47
|
<div class="u-list">
|
|
47
48
|
<div class="u-item" v-if="accountReadyIssues.includes('contact')">
|
|
48
|
-
<div class="u-title"
|
|
49
|
-
<div class="u-text"
|
|
49
|
+
<div class="u-title">绑定邮箱和手机号</div>
|
|
50
|
+
<div class="u-text">当前账号的邮箱或手机号尚未完善。请完成手机号绑定,并绑定且验证邮箱,否则后续可能无法找回账号。</div>
|
|
50
51
|
<el-button type="primary" @click="goAccountReady('/dashboard/notice')">去绑定</el-button>
|
|
51
52
|
</div>
|
|
52
53
|
<div class="u-item" v-if="accountReadyIssues.includes('password')">
|
|
@@ -89,6 +90,7 @@ import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
|
|
|
89
90
|
|
|
90
91
|
const HEADER_CONFIG_KEYS = ["important_notice", "important_notice_url", "vip", "mall", "user_profile_ready"];
|
|
91
92
|
const ACCOUNT_READY_STORAGE_PREFIX = "jx3box:account-ready-dismissed-until";
|
|
93
|
+
const ACCOUNT_READY_COMPLETE_STORAGE_PREFIX = "jx3box:account-ready-complete";
|
|
92
94
|
const ACCOUNT_READY_DISMISS_INTERVAL = 7 * 24 * 60 * 60 * 1000;
|
|
93
95
|
|
|
94
96
|
export default {
|
|
@@ -114,6 +116,7 @@ export default {
|
|
|
114
116
|
headerConfigLoaded: false,
|
|
115
117
|
accountReadyDialogVisible: false,
|
|
116
118
|
accountReadyIssues: [],
|
|
119
|
+
accountReadyIncomplete: false,
|
|
117
120
|
accountReadyChecking: false,
|
|
118
121
|
};
|
|
119
122
|
},
|
|
@@ -192,6 +195,7 @@ export default {
|
|
|
192
195
|
if (User.isLogin()) {
|
|
193
196
|
this.loadAsset();
|
|
194
197
|
this.refreshAuthToken();
|
|
198
|
+
this.initAccountReadyState();
|
|
195
199
|
}
|
|
196
200
|
|
|
197
201
|
// 获取全局配置
|
|
@@ -267,13 +271,13 @@ export default {
|
|
|
267
271
|
})
|
|
268
272
|
.then((data) => {
|
|
269
273
|
this.headerConfig = this.normalizeHeaderConfig(data);
|
|
270
|
-
this.checkAccountReadiness();
|
|
271
274
|
})
|
|
272
275
|
.catch(() => {
|
|
273
276
|
this.headerConfig = {};
|
|
274
277
|
})
|
|
275
278
|
.finally(() => {
|
|
276
279
|
this.headerConfigLoaded = true;
|
|
280
|
+
this.checkAccountReadiness();
|
|
277
281
|
});
|
|
278
282
|
},
|
|
279
283
|
normalizeHeaderConfig: function (data) {
|
|
@@ -294,9 +298,31 @@ export default {
|
|
|
294
298
|
isAccountReadyEnabled: function () {
|
|
295
299
|
return String(this.getConfigValue("user_profile_ready") || "").trim() === "1";
|
|
296
300
|
},
|
|
297
|
-
|
|
301
|
+
getAccountReadyUserId: function () {
|
|
298
302
|
const uid = User.getInfo()?.uid || localStorage.getItem("uid") || "0";
|
|
299
|
-
return
|
|
303
|
+
return uid || "0";
|
|
304
|
+
},
|
|
305
|
+
getAccountReadyStorageKey: function () {
|
|
306
|
+
return `${ACCOUNT_READY_STORAGE_PREFIX}:${this.getAccountReadyUserId()}`;
|
|
307
|
+
},
|
|
308
|
+
getAccountReadyCompleteStorageKey: function () {
|
|
309
|
+
return `${ACCOUNT_READY_COMPLETE_STORAGE_PREFIX}:${this.getAccountReadyUserId()}`;
|
|
310
|
+
},
|
|
311
|
+
isAccountReadyCompleted: function () {
|
|
312
|
+
try {
|
|
313
|
+
return !!localStorage.getItem(this.getAccountReadyCompleteStorageKey());
|
|
314
|
+
} catch (e) {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
markAccountReadyCompleted: function () {
|
|
319
|
+
try {
|
|
320
|
+
localStorage.setItem(this.getAccountReadyCompleteStorageKey(), String(Date.now()));
|
|
321
|
+
} catch (e) {}
|
|
322
|
+
this.clearAccountReadyDismissed();
|
|
323
|
+
},
|
|
324
|
+
initAccountReadyState: function () {
|
|
325
|
+
this.accountReadyIncomplete = !this.isAccountReadyCompleted();
|
|
300
326
|
},
|
|
301
327
|
isAccountReadyDismissed: function () {
|
|
302
328
|
try {
|
|
@@ -316,7 +342,7 @@ export default {
|
|
|
316
342
|
},
|
|
317
343
|
buildAccountReadyIssues: function (status = {}) {
|
|
318
344
|
const issues = [];
|
|
319
|
-
if (!status.has_phone
|
|
345
|
+
if (!status.has_phone || !status.has_verified_email) {
|
|
320
346
|
issues.push("contact");
|
|
321
347
|
}
|
|
322
348
|
if (!status.has_password) {
|
|
@@ -329,8 +355,12 @@ export default {
|
|
|
329
355
|
},
|
|
330
356
|
checkAccountReadiness: function () {
|
|
331
357
|
if (this.accountReadyChecking || !User.isLogin()) return;
|
|
332
|
-
if (this.
|
|
333
|
-
|
|
358
|
+
if (this.isAccountReadyCompleted()) {
|
|
359
|
+
this.accountReadyIssues = [];
|
|
360
|
+
this.accountReadyIncomplete = false;
|
|
361
|
+
this.accountReadyDialogVisible = false;
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
334
364
|
|
|
335
365
|
this.accountReadyChecking = true;
|
|
336
366
|
getMyAccountStatus()
|
|
@@ -338,12 +368,14 @@ export default {
|
|
|
338
368
|
const issues = this.buildAccountReadyIssues(status);
|
|
339
369
|
if (!issues.length) {
|
|
340
370
|
this.accountReadyIssues = [];
|
|
371
|
+
this.accountReadyIncomplete = false;
|
|
341
372
|
this.accountReadyDialogVisible = false;
|
|
342
|
-
this.
|
|
373
|
+
this.markAccountReadyCompleted();
|
|
343
374
|
return;
|
|
344
375
|
}
|
|
345
376
|
this.accountReadyIssues = issues;
|
|
346
|
-
|
|
377
|
+
this.accountReadyIncomplete = true;
|
|
378
|
+
if (this.isAccountReadyEnabled() && !this.isAccountReadyTargetPage() && !this.isAccountReadyDismissed()) {
|
|
347
379
|
this.accountReadyDialogVisible = true;
|
|
348
380
|
}
|
|
349
381
|
})
|
|
@@ -357,9 +389,35 @@ export default {
|
|
|
357
389
|
localStorage.removeItem(this.getAccountReadyStorageKey());
|
|
358
390
|
} catch (e) {}
|
|
359
391
|
},
|
|
360
|
-
openAccountReadyDialog: function () {
|
|
361
|
-
if (
|
|
362
|
-
|
|
392
|
+
openAccountReadyDialog: function (issues) {
|
|
393
|
+
if (Array.isArray(issues) && issues.length) {
|
|
394
|
+
this.accountReadyIssues = issues;
|
|
395
|
+
}
|
|
396
|
+
if (this.accountReadyIssues.length) {
|
|
397
|
+
this.accountReadyDialogVisible = true;
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if (!User.isLogin() || this.isAccountReadyCompleted()) return;
|
|
401
|
+
|
|
402
|
+
this.accountReadyChecking = true;
|
|
403
|
+
getMyAccountStatus()
|
|
404
|
+
.then((status) => {
|
|
405
|
+
const freshIssues = this.buildAccountReadyIssues(status);
|
|
406
|
+
if (!freshIssues.length) {
|
|
407
|
+
this.accountReadyIssues = [];
|
|
408
|
+
this.accountReadyIncomplete = false;
|
|
409
|
+
this.accountReadyDialogVisible = false;
|
|
410
|
+
this.markAccountReadyCompleted();
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
this.accountReadyIssues = freshIssues;
|
|
414
|
+
this.accountReadyIncomplete = true;
|
|
415
|
+
this.accountReadyDialogVisible = true;
|
|
416
|
+
})
|
|
417
|
+
.catch(() => {})
|
|
418
|
+
.finally(() => {
|
|
419
|
+
this.accountReadyChecking = false;
|
|
420
|
+
});
|
|
363
421
|
},
|
|
364
422
|
goAccountReady: function (url) {
|
|
365
423
|
this.markAccountReadyDismissed();
|
package/src/header/manage.vue
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<span v-if="item.remark == 'auth' && !isAuth" class="u-new">New!</span>
|
|
23
23
|
</a>
|
|
24
24
|
<a
|
|
25
|
-
v-if="item
|
|
25
|
+
v-if="isFeaturePanelItem(item) && hasAccountReadyIssue"
|
|
26
26
|
href="javascript:;"
|
|
27
27
|
class="u-menu-item u-menu-item--account-ready"
|
|
28
28
|
@click.prevent="openAccountReady"
|
|
@@ -100,6 +100,10 @@ export default {
|
|
|
100
100
|
type: Array,
|
|
101
101
|
default: () => [],
|
|
102
102
|
},
|
|
103
|
+
accountReadyIncomplete: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: false,
|
|
106
|
+
},
|
|
103
107
|
},
|
|
104
108
|
emits: ["open-account-ready"],
|
|
105
109
|
computed: {
|
|
@@ -117,10 +121,10 @@ export default {
|
|
|
117
121
|
return User.isPhoneMember();
|
|
118
122
|
},
|
|
119
123
|
hasAccountReadyIssue() {
|
|
120
|
-
return this.
|
|
124
|
+
return this.accountReadyIncomplete;
|
|
121
125
|
},
|
|
122
126
|
showPanelPop() {
|
|
123
|
-
return this.showPop || this.hasAccountReadyIssue
|
|
127
|
+
return this.showPop || this.hasAccountReadyIssue;
|
|
124
128
|
},
|
|
125
129
|
},
|
|
126
130
|
mounted() {
|
|
@@ -140,6 +144,9 @@ export default {
|
|
|
140
144
|
if (item?.key) return this.$jx3boxT(`jx3boxUi.commonHeader.panel.${item.key}`, item.label || item.key);
|
|
141
145
|
return item?.label || "";
|
|
142
146
|
},
|
|
147
|
+
isFeaturePanelItem(item = {}) {
|
|
148
|
+
return item.remark === "feature" || !!item.meta || item.key === "featureUpdate" || item.label === "功能更新";
|
|
149
|
+
},
|
|
143
150
|
loadPanel: async function () {
|
|
144
151
|
try {
|
|
145
152
|
const panel = JSON.parse(sessionStorage.getItem("panel"));
|
|
@@ -194,7 +201,7 @@ export default {
|
|
|
194
201
|
}
|
|
195
202
|
},
|
|
196
203
|
openAccountReady() {
|
|
197
|
-
this.$emit("open-account-ready");
|
|
204
|
+
this.$emit("open-account-ready", this.accountReadyIssues);
|
|
198
205
|
},
|
|
199
206
|
},
|
|
200
207
|
};
|
package/src/header/user.vue
CHANGED
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
:header-config-loaded="headerConfigLoaded"
|
|
25
25
|
:header-config-managed="headerConfigManaged"
|
|
26
26
|
:account-ready-issues="accountReadyIssues"
|
|
27
|
-
|
|
27
|
+
:account-ready-incomplete="accountReadyIncomplete"
|
|
28
|
+
@open-account-ready="$emit('open-account-ready', $event)"
|
|
28
29
|
/>
|
|
29
30
|
|
|
30
31
|
<!-- 语言切换 -->
|
|
@@ -101,6 +102,10 @@ export default {
|
|
|
101
102
|
type: Array,
|
|
102
103
|
default: () => [],
|
|
103
104
|
},
|
|
105
|
+
accountReadyIncomplete: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false,
|
|
108
|
+
},
|
|
104
109
|
},
|
|
105
110
|
emits: ["open-account-ready"],
|
|
106
111
|
components: {
|
|
@@ -56,6 +56,7 @@ export const AccountReadyMock = {
|
|
|
56
56
|
localStorage.setItem('token_version', 'storybook');
|
|
57
57
|
localStorage.setItem('avatar', 'https://cdn.jx3box.com/upload/avatar/2022/3/2/8_9860765.png');
|
|
58
58
|
localStorage.removeItem('jx3box:account-ready-dismissed-until:8');
|
|
59
|
+
localStorage.removeItem('jx3box:account-ready-complete:8');
|
|
59
60
|
sessionStorage.removeItem('panel');
|
|
60
61
|
|
|
61
62
|
return { args };
|