@jx3box/jx3box-ui 2.3.16 → 2.3.17
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 +1 -1
- package/service/header.js +18 -1
- package/src/footer/resource.vue +18 -27
- package/src/header/shop.vue +4 -12
- package/src/header/vip.vue +4 -12
package/package.json
CHANGED
package/service/header.js
CHANGED
|
@@ -6,6 +6,7 @@ const GLOBAL_CONFIG_STORAGE_KEY = "jx3box:global-config";
|
|
|
6
6
|
const GLOBAL_CONFIG_TTL = 6 * 60 * 60 * 1000;
|
|
7
7
|
let globalConfigCache = null;
|
|
8
8
|
let globalConfigPending = null;
|
|
9
|
+
let globalConfigRefreshPending = null;
|
|
9
10
|
|
|
10
11
|
function getGlobalConfigUrl() {
|
|
11
12
|
const root = JX3BOX.__ossRoot || "https://cdn.jx3box.com/";
|
|
@@ -74,7 +75,23 @@ function getGames() {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
// 获取全局配置
|
|
77
|
-
function getGlobalConfig() {
|
|
78
|
+
function getGlobalConfig({ force = false } = {}) {
|
|
79
|
+
if (force) {
|
|
80
|
+
if (!globalConfigRefreshPending) {
|
|
81
|
+
globalConfigRefreshPending = axios
|
|
82
|
+
.get(getGlobalConfigUrl())
|
|
83
|
+
.then((res) => {
|
|
84
|
+
globalConfigCache = res.data || {};
|
|
85
|
+
writeGlobalConfigStorage(globalConfigCache);
|
|
86
|
+
return globalConfigCache;
|
|
87
|
+
})
|
|
88
|
+
.finally(() => {
|
|
89
|
+
globalConfigRefreshPending = null;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return globalConfigRefreshPending;
|
|
93
|
+
}
|
|
94
|
+
|
|
78
95
|
if (globalConfigCache) return Promise.resolve(globalConfigCache);
|
|
79
96
|
|
|
80
97
|
const storageConfig = readGlobalConfigStorage();
|
package/src/footer/resource.vue
CHANGED
|
@@ -165,10 +165,17 @@
|
|
|
165
165
|
import { ArrowDown, ArrowUp, Download } from "@element-plus/icons-vue";
|
|
166
166
|
import { copyText } from "../../utils";
|
|
167
167
|
import i18nMixin from "../../i18n/mixin";
|
|
168
|
-
import {
|
|
168
|
+
import { getGlobalConfig } from "../../service/header";
|
|
169
169
|
|
|
170
170
|
const APP_LOGO_FALLBACK = "https://cdn.jx3box.com/design/app/logo/jx3box-icon-512.png";
|
|
171
|
-
const APP_CONFIG_KEYS = [
|
|
171
|
+
const APP_CONFIG_KEYS = [
|
|
172
|
+
"android_apk",
|
|
173
|
+
"android_versions",
|
|
174
|
+
"app_logo",
|
|
175
|
+
"app_version_desc",
|
|
176
|
+
"apple_url",
|
|
177
|
+
"harmony_url",
|
|
178
|
+
];
|
|
172
179
|
|
|
173
180
|
export default {
|
|
174
181
|
name: "FooterResource",
|
|
@@ -305,20 +312,11 @@ export default {
|
|
|
305
312
|
window.open(this.activeDownloadUrl, "_blank", "noopener,noreferrer");
|
|
306
313
|
},
|
|
307
314
|
loadAppConfig() {
|
|
308
|
-
const storeConfig = this.getStoreAppConfig();
|
|
309
|
-
if (storeConfig) {
|
|
310
|
-
this.appConfig = {
|
|
311
|
-
...this.appConfig,
|
|
312
|
-
...storeConfig,
|
|
313
|
-
};
|
|
314
|
-
this.appConfigLoaded = true;
|
|
315
|
-
return Promise.resolve();
|
|
316
|
-
}
|
|
317
315
|
if (this.appConfigLoading || this.appConfigLoaded) return Promise.resolve();
|
|
318
316
|
this.appConfigLoading = true;
|
|
319
|
-
return
|
|
320
|
-
.then((
|
|
321
|
-
this.appConfig = this.
|
|
317
|
+
return getGlobalConfig({ force: true })
|
|
318
|
+
.then((config) => {
|
|
319
|
+
this.appConfig = this.getAppConfig(config);
|
|
322
320
|
this.appConfigLoaded = true;
|
|
323
321
|
})
|
|
324
322
|
.catch(() => {
|
|
@@ -328,22 +326,13 @@ export default {
|
|
|
328
326
|
this.appConfigLoading = false;
|
|
329
327
|
});
|
|
330
328
|
},
|
|
331
|
-
|
|
332
|
-
|
|
329
|
+
getAppConfig(config) {
|
|
330
|
+
if (!config || typeof config !== "object") return {};
|
|
333
331
|
const appConfig = APP_CONFIG_KEYS.reduce((result, key) => {
|
|
334
332
|
if (config[key]) result[key] = config[key];
|
|
335
333
|
return result;
|
|
336
334
|
}, {});
|
|
337
|
-
return
|
|
338
|
-
},
|
|
339
|
-
getAppConfigFromItems(items) {
|
|
340
|
-
if (!Array.isArray(items)) return {};
|
|
341
|
-
return items.reduce((config, item) => {
|
|
342
|
-
if (!item?.key || !APP_CONFIG_KEYS.includes(item.key)) return config;
|
|
343
|
-
if (item.subtype && item.subtype !== "app") return config;
|
|
344
|
-
config[item.key] = item.val;
|
|
345
|
-
return config;
|
|
346
|
-
}, {});
|
|
335
|
+
return appConfig;
|
|
347
336
|
},
|
|
348
337
|
getDescLines(description) {
|
|
349
338
|
return String(description || "")
|
|
@@ -372,7 +361,9 @@ export default {
|
|
|
372
361
|
window.open("/qqbot", "_blank");
|
|
373
362
|
},
|
|
374
363
|
},
|
|
375
|
-
created: function () {
|
|
364
|
+
created: function () {
|
|
365
|
+
this.loadAppConfig();
|
|
366
|
+
},
|
|
376
367
|
mounted: function () {},
|
|
377
368
|
};
|
|
378
369
|
</script>
|
package/src/header/shop.vue
CHANGED
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script>
|
|
26
|
-
import { getConfig
|
|
27
|
-
import User from "@jx3box/jx3box-common/js/user";
|
|
26
|
+
import { getConfig } from "../../service/cms";
|
|
28
27
|
import i18nMixin from "../../i18n/mixin";
|
|
29
28
|
// import shopIcon from "@/assets/img/components/common/header/gift.svg";
|
|
30
29
|
export default {
|
|
@@ -72,25 +71,18 @@ export default {
|
|
|
72
71
|
/**
|
|
73
72
|
* 只在点击入口后记录本地版本;仅看到气泡不算已处理。
|
|
74
73
|
*/
|
|
75
|
-
let meta = null;
|
|
76
|
-
if (User.isLogin()) {
|
|
77
|
-
meta = await getUserMeta({ key: "mall_pop" });
|
|
78
|
-
}
|
|
79
74
|
let config = this.config || (this.configManaged ? null : await getConfig({ key: "mall" }));
|
|
80
75
|
if (!config) return;
|
|
81
76
|
this.initialized = true;
|
|
82
77
|
this.popValue = config.val;
|
|
83
78
|
|
|
84
|
-
this.pop = this.shouldShowPop(
|
|
79
|
+
this.pop = this.shouldShowPop(config.val);
|
|
85
80
|
},
|
|
86
|
-
shouldShowPop(
|
|
81
|
+
shouldShowPop(value) {
|
|
87
82
|
if (!~~value) return false;
|
|
88
83
|
|
|
89
84
|
const local = localStorage.getItem("mall_pop");
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (meta == null || meta == 1) return true;
|
|
93
|
-
return ~~value > ~~local;
|
|
85
|
+
return String(local) !== String(value);
|
|
94
86
|
},
|
|
95
87
|
markPopRead() {
|
|
96
88
|
if (!this.pop || this.popValue == null) return;
|
package/src/header/vip.vue
CHANGED
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script>
|
|
26
|
-
import { getConfig
|
|
27
|
-
import User from "@jx3box/jx3box-common/js/user";
|
|
26
|
+
import { getConfig } from "../../service/cms";
|
|
28
27
|
import i18nMixin from "../../i18n/mixin";
|
|
29
28
|
// import vipIcon from "@/assets/img/components/common/header/vip.svg";
|
|
30
29
|
export default {
|
|
@@ -72,25 +71,18 @@ export default {
|
|
|
72
71
|
/**
|
|
73
72
|
* 只在点击入口后记录本地版本;仅看到气泡不算已处理。
|
|
74
73
|
*/
|
|
75
|
-
let meta = null;
|
|
76
|
-
if (User.isLogin()) {
|
|
77
|
-
meta = await getUserMeta({ key: "vip_pop" });
|
|
78
|
-
}
|
|
79
74
|
let config = this.config || (this.configManaged ? null : await getConfig({ key: "vip" }));
|
|
80
75
|
if (!config) return;
|
|
81
76
|
this.initialized = true;
|
|
82
77
|
this.popValue = config.val;
|
|
83
78
|
|
|
84
|
-
this.pop = this.shouldShowPop(
|
|
79
|
+
this.pop = this.shouldShowPop(config.val);
|
|
85
80
|
},
|
|
86
|
-
shouldShowPop(
|
|
81
|
+
shouldShowPop(value) {
|
|
87
82
|
if (!~~value) return false;
|
|
88
83
|
|
|
89
84
|
const local = localStorage.getItem("vip_pop");
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (meta == null || meta == 1) return true;
|
|
93
|
-
return ~~value > ~~local;
|
|
85
|
+
return String(local) !== String(value);
|
|
94
86
|
},
|
|
95
87
|
markPopRead() {
|
|
96
88
|
if (!this.pop || this.popValue == null) return;
|