@jx3box/jx3box-common-ui 9.0.32 → 9.0.34
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 +10 -3
- package/src/Header.vue +36 -10
- package/src/bread/CommunityAdmin.vue +0 -1
- package/src/header/user.vue +0 -1
package/package.json
CHANGED
package/service/header.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import { $
|
|
3
|
-
import { __dataPath } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
2
|
+
import { $cms, $next } from "@jx3box/jx3box-common/js/https.js";
|
|
3
|
+
import { __dataPath, __ossRoot } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
4
4
|
|
|
5
5
|
function getLetter() {
|
|
6
6
|
return $next({ mute: true }).get("/api/letter/unread/count");
|
|
@@ -32,4 +32,11 @@ function getGames() {
|
|
|
32
32
|
return axios.get(__dataPath + 'data/product/games.json')
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
// 获取全局配置
|
|
36
|
+
function getGlobalConfig() {
|
|
37
|
+
return axios.get(`${__ossRoot}config/global.json`).then((res) => {
|
|
38
|
+
return res.data;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { getLetter, getNav, getPanel, getBox, getMenu, getGames, getMsg, getGlobalConfig };
|
package/src/Header.vue
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<header
|
|
3
|
-
class="c-header"
|
|
4
|
-
id="c-header"
|
|
5
|
-
:class="{ isOverlay: overlayEnable && isOverlay }"
|
|
6
|
-
v-if="!isApp"
|
|
7
|
-
>
|
|
2
|
+
<header class="c-header" id="c-header" :class="{ isOverlay: overlayEnable && isOverlay }" v-if="!isApp">
|
|
8
3
|
<div class="c-header-inner">
|
|
9
4
|
<!-- logo -->
|
|
10
5
|
<header-logo />
|
|
@@ -24,7 +19,7 @@
|
|
|
24
19
|
<slot></slot>
|
|
25
20
|
|
|
26
21
|
<!-- user -->
|
|
27
|
-
<header-user :client="client" />
|
|
22
|
+
<header-user ref="user" :client="client" />
|
|
28
23
|
</div>
|
|
29
24
|
<Box class="c-header-jx3box" :overlayEnable="overlayEnable" :client="client" />
|
|
30
25
|
</header>
|
|
@@ -32,7 +27,6 @@
|
|
|
32
27
|
|
|
33
28
|
<script>
|
|
34
29
|
import _ from "lodash";
|
|
35
|
-
// import JX3BOX from "@jx3box/jx3box-common/data/jx3box.json";
|
|
36
30
|
import { isApp, KW } from "../assets/js/app.js";
|
|
37
31
|
|
|
38
32
|
import logo from "./header/logo.vue";
|
|
@@ -43,7 +37,9 @@ import user from "./header/user.vue";
|
|
|
43
37
|
import Box from "../src/Box.vue";
|
|
44
38
|
import { isMiniProgram, miniprogramHack } from "@jx3box/jx3box-common/js/utils";
|
|
45
39
|
import miniprogram from "@jx3box/jx3box-common/data/miniprogram.json";
|
|
46
|
-
|
|
40
|
+
import { getGlobalConfig } from "../service/header.js";
|
|
41
|
+
import User from "@jx3box/jx3box-common/js/user.js";
|
|
42
|
+
import { __Root, __OriginRoot } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
47
43
|
|
|
48
44
|
export default {
|
|
49
45
|
name: "Header",
|
|
@@ -58,6 +54,9 @@ export default {
|
|
|
58
54
|
client: function () {
|
|
59
55
|
return location.hostname.includes("origin") ? "origin" : "std";
|
|
60
56
|
},
|
|
57
|
+
siteRoot: function () {
|
|
58
|
+
return location.host.includes("origin") ? __OriginRoot : __Root;
|
|
59
|
+
},
|
|
61
60
|
},
|
|
62
61
|
methods: {
|
|
63
62
|
// webView检测
|
|
@@ -67,7 +66,6 @@ export default {
|
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
if (isMiniProgram()) {
|
|
70
|
-
|
|
71
69
|
const urlParams = new URLSearchParams(window.location.search);
|
|
72
70
|
const appid = urlParams.get("appid");
|
|
73
71
|
const item = miniprogram?.find((item) => item.appid === appid);
|
|
@@ -96,6 +94,34 @@ export default {
|
|
|
96
94
|
const token = this.getUrlParam("__token");
|
|
97
95
|
|
|
98
96
|
token && localStorage.setItem("__token", token);
|
|
97
|
+
|
|
98
|
+
// 获取全局配置
|
|
99
|
+
getGlobalConfig().then(async (res) => {
|
|
100
|
+
const global_token_version = res.token_version;
|
|
101
|
+
const token_version = localStorage.getItem("token_version");
|
|
102
|
+
|
|
103
|
+
if (User.isLogin()) {
|
|
104
|
+
if (token_version != global_token_version) {
|
|
105
|
+
User.destroy().then((res) => {
|
|
106
|
+
this.$refs.user?.logout();
|
|
107
|
+
// 清除马甲所有马甲信息
|
|
108
|
+
let keys = Object.keys(localStorage);
|
|
109
|
+
let alternate = keys.filter((key) => key.startsWith("jx3box-alternate-"));
|
|
110
|
+
|
|
111
|
+
alternate.forEach((key) => {
|
|
112
|
+
localStorage.removeItem(key);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (
|
|
116
|
+
location.pathname.startsWith("/dashboard") ||
|
|
117
|
+
location.pathname.startsWith("/publish")
|
|
118
|
+
) {
|
|
119
|
+
location.href = this.siteRoot;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
99
125
|
},
|
|
100
126
|
|
|
101
127
|
getUrlParam(name) {
|