@gct-paas/core 0.1.6-dev.27 → 0.1.6-dev.29
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/dist/index.esm.min.js +2 -2
- package/dist/{redirect-index-2mXSgnns.js → redirect-index-BI-ZN18W.js} +1 -1
- package/es/global/gct/gct.d.ts +10 -4
- package/es/global/gct/gct.mjs +6 -0
- package/es/index.d.ts +1 -0
- package/es/index.mjs +5 -2
- package/es/interface/i-pinia-action/i-global-actions.d.ts +6 -0
- package/es/interface/i-pinia-getter/i-global-getters.d.ts +22 -1
- package/es/interface/i-pinia-state/i-global-state.d.ts +9 -2
- package/es/interface/open-util/i-confirm-util/i-confirm-util.d.ts +65 -0
- package/es/interface/open-util/index.d.ts +1 -0
- package/es/locale/sys.d.ts +3 -0
- package/es/locale/sys.mjs +4 -1
- package/es/modules/mqtt/interfaces/i-mqtt.d.ts +6 -2
- package/es/modules/mqtt/mqtt-client.d.ts +7 -7
- package/es/modules/mqtt/mqtt-client.mjs +20 -19
- package/es/modules/platform-config/constants/theme.const.d.ts +9 -1
- package/es/modules/platform-config/constants/theme.const.mjs +13 -2
- package/es/modules/platform-config/store.d.ts +3 -3
- package/es/modules/platform-config/useThemeSetting.d.ts +1 -1
- package/es/modules/platform-config/useThemeSetting.mjs +11 -1
- package/es/modules/system-mqtt/index.d.ts +3 -0
- package/es/modules/system-mqtt/index.mjs +2 -0
- package/es/modules/system-mqtt/system-mqtt.const.d.ts +1 -0
- package/es/modules/system-mqtt/system-mqtt.const.mjs +13 -0
- package/es/modules/system-mqtt/system-mqtt.interface.d.ts +71 -0
- package/es/modules/system-mqtt/system-mqtt.service.d.ts +104 -0
- package/es/modules/system-mqtt/system-mqtt.service.mjs +198 -0
- package/es/modules/user-stores/store/permission.store.d.ts +1 -0
- package/es/modules/user-stores/store/permission.store.mjs +10 -0
- package/es/router/guard/index.d.ts +4 -0
- package/es/router/guard/index.mjs +41 -0
- package/es/router/index.mjs +2 -10
- package/es/state/global-pinia-state/global-pinia-state.d.ts +6 -0
- package/es/state/global-pinia-state/global-pinia-state.mjs +6 -0
- package/es/store/global-store.mjs +6 -0
- package/es/utils/auth-util/auth-util.d.ts +6 -0
- package/es/utils/auth-util/auth-util.mjs +13 -1
- package/es/utils/axios/check-status.mjs +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { MqttCancelSub, IMqttClient } from '../mqtt';
|
|
2
|
+
import { IInternalMessagePayload, IKickOutPayload, IToDoMessagePayload, MqttSubCallback } from './system-mqtt.interface';
|
|
3
|
+
/**
|
|
4
|
+
* 系统级 MQTT 业务
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class SystemMqttService
|
|
8
|
+
*/
|
|
9
|
+
export declare class SystemMqttService {
|
|
10
|
+
private static isInitialized;
|
|
11
|
+
protected static client: IMqttClient | undefined;
|
|
12
|
+
protected static fingerprint: string | undefined;
|
|
13
|
+
protected static readonly LOGOUT_CLIENT_TAG = "USER_LOGOUT";
|
|
14
|
+
/**
|
|
15
|
+
* 用户登出消息 topic
|
|
16
|
+
*
|
|
17
|
+
* @static
|
|
18
|
+
*/
|
|
19
|
+
static readonly USER_LOGOUT_TOPIC = "users/logout/msg";
|
|
20
|
+
/**
|
|
21
|
+
* 踢出用户消息 topic
|
|
22
|
+
*
|
|
23
|
+
* @readonly
|
|
24
|
+
* @static
|
|
25
|
+
* @type {string}
|
|
26
|
+
*/
|
|
27
|
+
static get KICK_OUT_TOPIC(): string;
|
|
28
|
+
/**
|
|
29
|
+
* 未读消息变化 topic
|
|
30
|
+
*
|
|
31
|
+
* @readonly
|
|
32
|
+
* @static
|
|
33
|
+
* @type {string}
|
|
34
|
+
*/
|
|
35
|
+
static get INTERNAL_MESSAGE_TOPIC(): string;
|
|
36
|
+
/**
|
|
37
|
+
* 待办消息数量 topic
|
|
38
|
+
*
|
|
39
|
+
* @readonly
|
|
40
|
+
* @static
|
|
41
|
+
* @type {string}
|
|
42
|
+
*/
|
|
43
|
+
static get TASK_TODO_COUNT_TOPIC(): string;
|
|
44
|
+
/**
|
|
45
|
+
* 强制刷新并清空缓存 topic
|
|
46
|
+
*
|
|
47
|
+
* @static
|
|
48
|
+
*/
|
|
49
|
+
static readonly CLEAN_CACHE_TOPIC = "CLEAN_CACHE";
|
|
50
|
+
/**
|
|
51
|
+
* 初始化系统级 MQTT 客户端,需要在用户信息以及应用信息加载完成后调用
|
|
52
|
+
*
|
|
53
|
+
* @static
|
|
54
|
+
* @return {*} {Promise<void>}
|
|
55
|
+
*/
|
|
56
|
+
static init(): Promise<void>;
|
|
57
|
+
protected static createMqtt(): Promise<void>;
|
|
58
|
+
protected static subs(): void;
|
|
59
|
+
/**
|
|
60
|
+
* 订阅系统级 MQTT 消息
|
|
61
|
+
*
|
|
62
|
+
* @static
|
|
63
|
+
* @param {string} topic
|
|
64
|
+
*/
|
|
65
|
+
protected static subscribe<T = IObject>(topic: string, callback: MqttSubCallback<T>): MqttCancelSub;
|
|
66
|
+
/**
|
|
67
|
+
* 订阅用户被踢出消息
|
|
68
|
+
*
|
|
69
|
+
* @static
|
|
70
|
+
* @param {MqttSubCallback<IKickOutPayload>} callback
|
|
71
|
+
* @return {*} {MqttCancelSub}
|
|
72
|
+
*/
|
|
73
|
+
protected static subKickOut(callback?: MqttSubCallback<IKickOutPayload>): MqttCancelSub;
|
|
74
|
+
/**
|
|
75
|
+
* 订阅未读消息变化
|
|
76
|
+
*
|
|
77
|
+
* @static
|
|
78
|
+
* @param {MqttSubCallback<IInternalMessagePayload>} callback
|
|
79
|
+
* @return {*} {MqttCancelSub}
|
|
80
|
+
*/
|
|
81
|
+
static subInternalMessage(callback: MqttSubCallback<IInternalMessagePayload>): MqttCancelSub;
|
|
82
|
+
/**
|
|
83
|
+
* 订阅待办消息数量变化
|
|
84
|
+
*
|
|
85
|
+
* @static
|
|
86
|
+
* @param {MqttSubCallback<IToDoMessagePayload>} callback
|
|
87
|
+
* @return {*} {MqttCancelSub}
|
|
88
|
+
*/
|
|
89
|
+
static subTaskTodoCount(callback: MqttSubCallback<IToDoMessagePayload>): MqttCancelSub;
|
|
90
|
+
/**
|
|
91
|
+
* 强制用户界面刷新
|
|
92
|
+
*
|
|
93
|
+
* @static
|
|
94
|
+
* @param {MqttSubCallback<void>} callback
|
|
95
|
+
* @return {*} {MqttCancelSub}
|
|
96
|
+
*/
|
|
97
|
+
static subCleanCache(): MqttCancelSub;
|
|
98
|
+
/**
|
|
99
|
+
* 发送用户登出消息
|
|
100
|
+
*
|
|
101
|
+
* @static
|
|
102
|
+
*/
|
|
103
|
+
static pubLogout(): void;
|
|
104
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { getTenant, getToken } from "../../utils/tools/tools.mjs";
|
|
2
|
+
import { AuthUtil } from "../../utils/auth-util/auth-util.mjs";
|
|
3
|
+
import { t } from "../../utils/i18n/index.mjs";
|
|
4
|
+
import { getBrowserFingerprint, getPageIdentification } from "../../utils/deviceFingerprint.mjs";
|
|
5
|
+
import "../../utils/index.mjs";
|
|
6
|
+
import "../mqtt/index.mjs";
|
|
7
|
+
import { ProjectNameType } from "./system-mqtt.const.mjs";
|
|
8
|
+
//#region src/modules/system-mqtt/system-mqtt.service.ts
|
|
9
|
+
/**
|
|
10
|
+
* 系统级 MQTT 业务
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @class SystemMqttService
|
|
14
|
+
*/
|
|
15
|
+
var SystemMqttService = class {
|
|
16
|
+
static isInitialized = false;
|
|
17
|
+
static client;
|
|
18
|
+
static fingerprint;
|
|
19
|
+
static LOGOUT_CLIENT_TAG = "USER_LOGOUT";
|
|
20
|
+
/**
|
|
21
|
+
* 用户登出消息 topic
|
|
22
|
+
*
|
|
23
|
+
* @static
|
|
24
|
+
*/
|
|
25
|
+
static USER_LOGOUT_TOPIC = `users/logout/msg`;
|
|
26
|
+
/**
|
|
27
|
+
* 踢出用户消息 topic
|
|
28
|
+
*
|
|
29
|
+
* @readonly
|
|
30
|
+
* @static
|
|
31
|
+
* @type {string}
|
|
32
|
+
*/
|
|
33
|
+
static get KICK_OUT_TOPIC() {
|
|
34
|
+
return `USER/${_gct.store.userInfo.userId}/KICK_OUT`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 未读消息变化 topic
|
|
38
|
+
*
|
|
39
|
+
* @readonly
|
|
40
|
+
* @static
|
|
41
|
+
* @type {string}
|
|
42
|
+
*/
|
|
43
|
+
static get INTERNAL_MESSAGE_TOPIC() {
|
|
44
|
+
return `${_gct.env.getEnv().toUpperCase()}/USER/${getTenant()}/${_gct.store.userInfo.userId}/INTERNAL_MESSAGE`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 待办消息数量 topic
|
|
48
|
+
*
|
|
49
|
+
* @readonly
|
|
50
|
+
* @static
|
|
51
|
+
* @type {string}
|
|
52
|
+
*/
|
|
53
|
+
static get TASK_TODO_COUNT_TOPIC() {
|
|
54
|
+
return `${_gct.env.getEnv().toUpperCase()}/USER/${getTenant()}/${_gct.store.userInfo.userId}/TASK_TODO_COUNT`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 强制刷新并清空缓存 topic
|
|
58
|
+
*
|
|
59
|
+
* @static
|
|
60
|
+
*/
|
|
61
|
+
static CLEAN_CACHE_TOPIC = "CLEAN_CACHE";
|
|
62
|
+
/**
|
|
63
|
+
* 初始化系统级 MQTT 客户端,需要在用户信息以及应用信息加载完成后调用
|
|
64
|
+
*
|
|
65
|
+
* @static
|
|
66
|
+
* @return {*} {Promise<void>}
|
|
67
|
+
*/
|
|
68
|
+
static async init() {
|
|
69
|
+
if (this.isInitialized) {
|
|
70
|
+
console.warn("SystemMqttService 已经初始化,请勿重复调用 init 方法");
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.isInitialized = true;
|
|
74
|
+
this.fingerprint = await getBrowserFingerprint();
|
|
75
|
+
await this.createMqtt();
|
|
76
|
+
this.subs();
|
|
77
|
+
}
|
|
78
|
+
static async createMqtt() {
|
|
79
|
+
const willDelayInterval = 20;
|
|
80
|
+
const userInfo = _gct.store.userInfo;
|
|
81
|
+
const mqttProperties = userInfo.mqttProperties || {};
|
|
82
|
+
this.client = _gct.mqtt.create(this.LOGOUT_CLIENT_TAG, {
|
|
83
|
+
...mqttProperties,
|
|
84
|
+
clientId: "logout" + this.fingerprint + getPageIdentification(),
|
|
85
|
+
protocolVersion: 5,
|
|
86
|
+
clean: false,
|
|
87
|
+
will: {
|
|
88
|
+
topic: this.USER_LOGOUT_TOPIC,
|
|
89
|
+
payload: JSON.stringify({
|
|
90
|
+
appId: _gct.store.appInfo.id,
|
|
91
|
+
ipAddress: userInfo.ip,
|
|
92
|
+
signLog: `${userInfo.userId}.${_gct.env.getEnv()}.${this.fingerprint}.${ProjectNameType[_gct.store.projectName]}.web.${getPageIdentification()}`,
|
|
93
|
+
tenantId: getTenant()
|
|
94
|
+
}),
|
|
95
|
+
qos: 1,
|
|
96
|
+
retain: true,
|
|
97
|
+
properties: {
|
|
98
|
+
willDelayInterval,
|
|
99
|
+
messageExpiryInterval: willDelayInterval * 10
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
properties: { sessionExpiryInterval: willDelayInterval * 2 }
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
static subs() {
|
|
106
|
+
this.subCleanCache();
|
|
107
|
+
this.subKickOut();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 订阅系统级 MQTT 消息
|
|
111
|
+
*
|
|
112
|
+
* @static
|
|
113
|
+
* @param {string} topic
|
|
114
|
+
*/
|
|
115
|
+
static subscribe(topic, callback) {
|
|
116
|
+
if (!this.client) throw new Error("MQTT client is not initialized");
|
|
117
|
+
return this.client.subscribe(topic, (_topic, payload) => {
|
|
118
|
+
try {
|
|
119
|
+
const payloadStr = payload.toString();
|
|
120
|
+
callback(JSON.parse(payloadStr));
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error("解析 MQTT 消息 payload 失败:", error);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* 订阅用户被踢出消息
|
|
128
|
+
*
|
|
129
|
+
* @static
|
|
130
|
+
* @param {MqttSubCallback<IKickOutPayload>} callback
|
|
131
|
+
* @return {*} {MqttCancelSub}
|
|
132
|
+
*/
|
|
133
|
+
static subKickOut(callback) {
|
|
134
|
+
return this.subscribe(this.KICK_OUT_TOPIC, (data) => {
|
|
135
|
+
const token = getToken();
|
|
136
|
+
if (token && token === data?.token) {
|
|
137
|
+
_gct.confirm.warning({
|
|
138
|
+
title: t("sys.loginWarning"),
|
|
139
|
+
content: t("sys.loginWarningContent"),
|
|
140
|
+
okText: t("sys.understood")
|
|
141
|
+
}).then(() => {
|
|
142
|
+
AuthUtil.getInstance().clearAuthAndGoLogin();
|
|
143
|
+
});
|
|
144
|
+
callback?.(data);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 订阅未读消息变化
|
|
150
|
+
*
|
|
151
|
+
* @static
|
|
152
|
+
* @param {MqttSubCallback<IInternalMessagePayload>} callback
|
|
153
|
+
* @return {*} {MqttCancelSub}
|
|
154
|
+
*/
|
|
155
|
+
static subInternalMessage(callback) {
|
|
156
|
+
return this.subscribe(this.INTERNAL_MESSAGE_TOPIC, callback);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* 订阅待办消息数量变化
|
|
160
|
+
*
|
|
161
|
+
* @static
|
|
162
|
+
* @param {MqttSubCallback<IToDoMessagePayload>} callback
|
|
163
|
+
* @return {*} {MqttCancelSub}
|
|
164
|
+
*/
|
|
165
|
+
static subTaskTodoCount(callback) {
|
|
166
|
+
return this.subscribe(this.TASK_TODO_COUNT_TOPIC, callback);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* 强制用户界面刷新
|
|
170
|
+
*
|
|
171
|
+
* @static
|
|
172
|
+
* @param {MqttSubCallback<void>} callback
|
|
173
|
+
* @return {*} {MqttCancelSub}
|
|
174
|
+
*/
|
|
175
|
+
static subCleanCache() {
|
|
176
|
+
return this.subscribe(this.CLEAN_CACHE_TOPIC, () => {
|
|
177
|
+
const url = new URL(window.location.href);
|
|
178
|
+
url.searchParams.set("reloadTime", Date.now().toString());
|
|
179
|
+
window.location.replace(url.toString());
|
|
180
|
+
location.reload();
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* 发送用户登出消息
|
|
185
|
+
*
|
|
186
|
+
* @static
|
|
187
|
+
*/
|
|
188
|
+
static pubLogout() {
|
|
189
|
+
this.client?.publish(this.USER_LOGOUT_TOPIC, JSON.stringify({
|
|
190
|
+
appId: _gct.store.appInfo.id,
|
|
191
|
+
ipAddress: _gct.store.userInfo.ip,
|
|
192
|
+
signLog: `${_gct.store.userInfo.userId}.${_gct.env.getEnv()}.${this.fingerprint}.${ProjectNameType[_gct.store.projectName]}.web.${getPageIdentification()}`,
|
|
193
|
+
tenantId: getTenant()
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
//#endregion
|
|
198
|
+
export { SystemMqttService };
|
|
@@ -9,6 +9,16 @@ var usePermissionStore = defineStore("permission", {
|
|
|
9
9
|
return !!state.userPermissions.appSuperAdmin || !!state.userPermissions.permissions["POINT.*"];
|
|
10
10
|
} },
|
|
11
11
|
actions: {
|
|
12
|
+
async initPremission() {
|
|
13
|
+
const res = await _api.apaas.designerCommon.getUserInfo();
|
|
14
|
+
Object.assign(this.userPermissions, {
|
|
15
|
+
...res,
|
|
16
|
+
permissions: res?.permissions ? res?.permissions.reduce((map, item) => {
|
|
17
|
+
map[item] = true;
|
|
18
|
+
return map;
|
|
19
|
+
}, {}) : {}
|
|
20
|
+
});
|
|
21
|
+
},
|
|
12
22
|
getPermissionByKey(pageId, key) {
|
|
13
23
|
if (this.hasAllPermissions) return true;
|
|
14
24
|
if (!key) return this.userPermissions.permissions[pageId];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getToken } from "../../utils/tools/tools.mjs";
|
|
2
|
+
import "../../utils/index.mjs";
|
|
3
|
+
import { usePlatformConfigStore } from "../../modules/platform-config/store.mjs";
|
|
4
|
+
import "../../modules/platform-config/index.mjs";
|
|
5
|
+
import nProgress from "nprogress";
|
|
6
|
+
//#region src/router/guard/index.ts
|
|
7
|
+
function createPageLoadingGuard(router) {
|
|
8
|
+
const platformStore = usePlatformConfigStore();
|
|
9
|
+
router.beforeEach(async (to) => {
|
|
10
|
+
if (!getToken() || to.meta.loaded) return true;
|
|
11
|
+
if (platformStore.themeSetting.pageLoading == true) {
|
|
12
|
+
_gct.store.setPageLoading(true);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
});
|
|
17
|
+
router.afterEach(async () => {
|
|
18
|
+
setTimeout(() => {
|
|
19
|
+
_gct.store.setPageLoading(false);
|
|
20
|
+
}, 220);
|
|
21
|
+
return true;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function createProgressGuard(router) {
|
|
25
|
+
const platformStore = usePlatformConfigStore();
|
|
26
|
+
router.beforeEach(async (to) => {
|
|
27
|
+
if (to.meta.loaded) return true;
|
|
28
|
+
if (platformStore.themeSetting.pageProgress == true) nProgress.start();
|
|
29
|
+
return true;
|
|
30
|
+
});
|
|
31
|
+
router.afterEach(async () => {
|
|
32
|
+
nProgress.done();
|
|
33
|
+
return true;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function createGuard(router) {
|
|
37
|
+
createPageLoadingGuard(router);
|
|
38
|
+
createProgressGuard(router);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { createGuard };
|
package/es/router/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createGuard } from "./guard/index.mjs";
|
|
2
2
|
import "vue";
|
|
3
3
|
import { createRouter, createWebHashHistory } from "vue-router";
|
|
4
|
-
import nProgress from "nprogress";
|
|
5
4
|
//#region src/router/index.ts
|
|
6
5
|
var REDIRECT_NAME = "Redirect";
|
|
7
6
|
var RouterUtil = class {
|
|
@@ -11,14 +10,7 @@ var RouterUtil = class {
|
|
|
11
10
|
history: createWebHashHistory(),
|
|
12
11
|
routes
|
|
13
12
|
});
|
|
14
|
-
this.router
|
|
15
|
-
if (to.meta.loaded) return true;
|
|
16
|
-
if (usePlatformConfigStore().themeSetting.pageProgress == true) nProgress.start();
|
|
17
|
-
return true;
|
|
18
|
-
});
|
|
19
|
-
this.router.afterEach(() => {
|
|
20
|
-
nProgress.done();
|
|
21
|
-
});
|
|
13
|
+
createGuard(this.router);
|
|
22
14
|
}
|
|
23
15
|
/**
|
|
24
16
|
* 添加路由
|
|
@@ -20,6 +20,9 @@ var useGlobalStore = defineStore("global-store", {
|
|
|
20
20
|
},
|
|
21
21
|
getEmptyDisplay() {
|
|
22
22
|
return nullDisplayEnum[this.globalSetting.emptyDisplay];
|
|
23
|
+
},
|
|
24
|
+
getPageLoading() {
|
|
25
|
+
return this.pageLoading;
|
|
23
26
|
}
|
|
24
27
|
},
|
|
25
28
|
actions: {
|
|
@@ -50,6 +53,9 @@ var useGlobalStore = defineStore("global-store", {
|
|
|
50
53
|
setProjectName(name) {
|
|
51
54
|
this.projectName = name;
|
|
52
55
|
},
|
|
56
|
+
setPageLoading(loading) {
|
|
57
|
+
this.pageLoading = loading;
|
|
58
|
+
},
|
|
53
59
|
updateUserInfo(data) {
|
|
54
60
|
this.userInfo = {
|
|
55
61
|
...this.userInfo,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useUserStore } from "../../modules/user-stores/store/user.store.mjs";
|
|
2
2
|
import "../../modules/user-stores/index.mjs";
|
|
3
|
-
import { getToken } from "../tools/tools.mjs";
|
|
3
|
+
import { getToken, setTenant, setToken } from "../tools/tools.mjs";
|
|
4
4
|
//#region src/utils/auth-util/auth-util.ts
|
|
5
5
|
/**
|
|
6
6
|
* 认证工具类
|
|
@@ -39,6 +39,18 @@ var AuthUtil = class AuthUtil {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
+
* 清除认证信息并跳转到登录页
|
|
43
|
+
*
|
|
44
|
+
* @return {*} {Promise<void>}
|
|
45
|
+
*/
|
|
46
|
+
async clearAuthAndGoLogin() {
|
|
47
|
+
setToken();
|
|
48
|
+
setTenant();
|
|
49
|
+
const url = new URL(`${location.origin}/paas-front/portal`);
|
|
50
|
+
url.hash = `/login`;
|
|
51
|
+
window.location.href = url.toString();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
42
54
|
* 跳转到首页
|
|
43
55
|
*
|
|
44
56
|
* @return {*} {Promise<void>}
|
|
@@ -9,7 +9,7 @@ function checkStatus(status, msg, errorMessageMode = "message") {
|
|
|
9
9
|
break;
|
|
10
10
|
case 401:
|
|
11
11
|
errMessage = msg || t("sys.errMsg401");
|
|
12
|
-
AuthUtil.getInstance().
|
|
12
|
+
AuthUtil.getInstance().clearAuthAndGoLogin();
|
|
13
13
|
break;
|
|
14
14
|
case 402:
|
|
15
15
|
setTimeout(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/core",
|
|
3
|
-
"version": "0.1.6-dev.
|
|
3
|
+
"version": "0.1.6-dev.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"loader": "dist/index.esm.min.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@fingerprintjs/fingerprintjs": "^5.1.0",
|
|
35
35
|
"@floating-ui/dom": "^1.7.6",
|
|
36
|
-
"@gct-paas/api": "^0.1.6-dev.
|
|
36
|
+
"@gct-paas/api": "^0.1.6-dev.15",
|
|
37
37
|
"@module-federation/runtime": "^2.2.3",
|
|
38
38
|
"@vueuse/core": "^14.1.0",
|
|
39
39
|
"async-validator": "^4.2.5",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"playwright": "^1.58.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@gct-paas/api": "^0.1.6-dev.
|
|
63
|
+
"@gct-paas/api": "^0.1.6-dev.15",
|
|
64
64
|
"vue": ">=3",
|
|
65
65
|
"vue-i18n": ">=11",
|
|
66
66
|
"vue-router": ">=4"
|