rexma-design 1.2.0 → 1.2.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
package/utils/ClientSign.ts
CHANGED
|
@@ -10,15 +10,20 @@ type IGetClientSignParams = {
|
|
|
10
10
|
developmentClientSign?: IXinhuaClientState['clientSign'];
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
type IAesDecryptParams = {
|
|
14
|
+
key: string;
|
|
15
|
+
offset: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
13
18
|
class ClientSign {
|
|
14
19
|
/**
|
|
15
20
|
* ASE 解密
|
|
16
21
|
* @description 使用加密秘钥,对 需要解密的参数 进行解密
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param {string} params.offset - 偏移量
|
|
22
|
+
* @param content - 需要解密的参数
|
|
23
|
+
* @param params - 加密信息
|
|
20
24
|
*/
|
|
21
|
-
static aesDecryptParams(content
|
|
25
|
+
static aesDecryptParams(content: string, params: IAesDecryptParams) {
|
|
26
|
+
const { key, offset } = params;
|
|
22
27
|
if (!key || !offset) {
|
|
23
28
|
throw new Error('缺少加密相关配置');
|
|
24
29
|
}
|
|
@@ -42,8 +47,7 @@ class ClientSign {
|
|
|
42
47
|
*/
|
|
43
48
|
static async getClientSign(options: IGetClientSignParams) {
|
|
44
49
|
const { developmentClientSign, key, offset, moduleCode } = options;
|
|
45
|
-
|
|
46
|
-
if (process?.env?.NODE_ENV === 'development' && developmentClientSign) {
|
|
50
|
+
if (import.meta.env.DEV && developmentClientSign) {
|
|
47
51
|
return developmentClientSign;
|
|
48
52
|
}
|
|
49
53
|
if (!xh.isMediaConvergenceXinhuaApp()) {
|
|
@@ -27,17 +27,24 @@ class XinhuaClient {
|
|
|
27
27
|
|
|
28
28
|
private static async stateInit() {
|
|
29
29
|
const initOptions = this.initOptions;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
if (import.meta.env.DEV && initOptions.developmentState) {
|
|
31
|
+
// 本地开发、配置的本地开发环境的数据
|
|
32
32
|
this.state = {
|
|
33
33
|
...this.state,
|
|
34
34
|
...initOptions.developmentState,
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
const isClientDebug = import.meta.env.DEV && initOptions.clientDebug;
|
|
38
|
+
if (xh.isMediaConvergenceXinhuaApp() && !isClientDebug) {
|
|
38
39
|
// 客户端环境
|
|
39
40
|
this.state.siteId = getValueFromUA('currentSiteId');
|
|
40
|
-
|
|
41
|
+
const userInfo = await new Promise<any>((resolve) => {
|
|
42
|
+
xh.getUserInfo({
|
|
43
|
+
goLogin: initOptions.goLogin ?? false,
|
|
44
|
+
success: (res) => resolve(res),
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
this.state.userId = userInfo?.info?.id;
|
|
41
48
|
const numberStatusBarHeight = Number(getValueFromUA('statusBarHeight'));
|
|
42
49
|
this.state.statusBarHeight = isNaN(numberStatusBarHeight) ? 0 : numberStatusBarHeight;
|
|
43
50
|
this.state.clientSign = await ClientSign.getClientSign({
|