@conecli/cone-render 0.10.1-shop3.4 → 0.10.1-shop3.6
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/common/const.ts +1 -1
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +11 -0
- package/dist/components/base/InViewRender/index.tsx +1 -1
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/interface/common.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -56
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/sass/app.h5.scss +252 -224
- package/dist/service/fetchGateway.ts +1 -1
- package/dist/service/fetchGateway.weapp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -1
- package/dist/service/http/const.ts +1 -1
- package/dist/service/http/h5Http.ts +1 -1
- package/dist/service/requestServer.h5.ts +1 -1
- package/dist/service/requestServer.ts +1 -1
- package/dist/utils/h5Utils.ts +1 -1
- package/dist/utils/index.h5.ts +1 -1
- package/dist/utils/index.ts +1 -1
- package/dist/utils/index.weapp.ts +1 -1
- package/dist/utils/jumpExtMapUtil.js +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro';
|
|
2
1
|
clientVersion:
|
|
3
2
|
isJdApp && jdAppVersionStr !== '' ? jdAppVersionStr : '11.0.0',
|
|
4
3
|
client: isJdApp ? (isIosDevice ? 'apple' : 'android') : isPc ? 'pc' : 'wh5',
|
|
5
4
|
screen: `${Math.ceil(window.screen?.width * devicePixelRatio)}*${Math.ceil(
|
|
6
5
|
window.screen?.height * devicePixelRatio,
|
|
7
6
|
)}`,
|
|
8
7
|
area: '1_72_2799_0',
|
|
9
8
|
uuid: UUID,
|
|
10
9
|
if(area && area !== ""){
|
|
11
10
|
clientParams.area = area
|
|
12
11
|
}
|
|
13
12
|
console.warn("cone-render中对外暴露fetchGateway收到原生端获取传来的四级地址信息",area,"更新后的接口底层信息", clientParams)
|
|
14
13
|
functionId: string,
|
|
15
14
|
body = {},
|
|
16
15
|
options = {},
|
|
17
16
|
requestOptions = {},
|
|
18
17
|
const params = Object.assign(
|
|
19
18
|
{},
|
|
20
19
|
{
|
|
21
20
|
t: Date.now(),
|
|
22
21
|
functionId,
|
|
23
22
|
appid: 'shop_m_jd_com',
|
|
24
23
|
body: JSON.stringify(body),
|
|
25
24
|
},
|
|
26
25
|
clientParams,
|
|
27
26
|
options,
|
|
28
27
|
{
|
|
29
28
|
area: clientParams.area,
|
|
30
29
|
client: !isJdApp && options?.client ? options?.client : clientParams.client ,
|
|
31
30
|
clientVersion: !isJdApp && options?.clientVersion ? options?.clientVersion : clientParams.clientVersion,
|
|
32
31
|
}
|
|
33
32
|
)
|
|
34
33
|
console.warn(
|
|
35
34
|
'fetchGateway url:' + api.apiFunc + ',functionId:' + params.functionId,
|
|
36
35
|
"底层默认的clientParams",
|
|
37
36
|
clientParams,
|
|
38
37
|
"下发的options",
|
|
39
38
|
options,
|
|
40
39
|
"最后params",
|
|
41
40
|
params
|
|
42
41
|
)
|
|
43
42
|
return http.post(api.apiFunc, params, requestOptions)
|
|
43
|
+
import Taro from '@tarojs/taro';
|
|
44
44
|
clientVersion: isJdApp && jdAppVersionStr !== '' ? jdAppVersionStr : '11.0.0',
|
|
45
45
|
client: isJdApp ? (isIosDevice ? 'apple' : 'android') : isPc ? 'pc' : 'wh5',
|
|
46
46
|
screen: `${Math.ceil(window.screen?.width * devicePixelRatio)}*${Math.ceil(
|
|
47
47
|
window.screen?.height * devicePixelRatio,
|
|
48
48
|
)}`,
|
|
49
49
|
area: '1_72_2799_0',
|
|
50
50
|
uuid: UUID,
|
|
51
51
|
if (area && area !== '') {
|
|
52
52
|
clientParams.area = area;
|
|
53
53
|
}
|
|
54
54
|
console.warn(
|
|
55
55
|
'cone-render中对外暴露fetchGateway收到原生端获取传来的四级地址信息',
|
|
56
56
|
area,
|
|
57
57
|
'更新后的接口底层信息',
|
|
58
58
|
clientParams,
|
|
59
59
|
);
|
|
60
60
|
if (isH5 && (isJdAndIosDevice || isJdAndAndroidDevice)) {
|
|
61
61
|
const smartCouponInfo = await getSmartCouponInfo();
|
|
62
62
|
if (smartCouponInfo) {
|
|
63
63
|
requestParams.smartCouponInfo = smartCouponInfo;
|
|
64
64
|
}
|
|
65
65
|
} else {
|
|
66
66
|
console.warn('🚗 ~~ handleSmartCouponInfo ~~ 不支持的环境!');
|
|
67
67
|
}
|
|
68
68
|
functionId: string,
|
|
69
69
|
body = {},
|
|
70
70
|
options = {},
|
|
71
71
|
requestOptions = {},
|
|
72
72
|
const useBodyParams = { ...body };
|
|
73
73
|
if (passSmartCouponInfoFunctionIdList.includes(functionId)) {
|
|
74
74
|
await handleSmartCouponInfo(useBodyParams);
|
|
75
75
|
}
|
|
76
76
|
const params = Object.assign(
|
|
77
77
|
{},
|
|
78
78
|
{
|
|
79
79
|
t: Date.now(),
|
|
80
80
|
functionId,
|
|
81
81
|
appid: 'shop_m_jd_com',
|
|
82
82
|
body: JSON.stringify(useBodyParams),
|
|
83
83
|
},
|
|
84
84
|
clientParams,
|
|
85
85
|
options,
|
|
86
86
|
{
|
|
87
87
|
area: clientParams.area,
|
|
88
88
|
client: !isJdApp && options?.client ? options?.client : clientParams.client,
|
|
89
89
|
clientVersion:
|
|
90
90
|
!isJdApp && options?.clientVersion ? options?.clientVersion : clientParams.clientVersion,
|
|
91
91
|
},
|
|
92
92
|
);
|
|
93
93
|
console.warn(
|
|
94
94
|
'fetchGateway url:' + api.apiFunc + ',functionId:' + params.functionId,
|
|
95
95
|
'底层默认的clientParams',
|
|
96
96
|
clientParams,
|
|
97
97
|
'下发的options',
|
|
98
98
|
options,
|
|
99
99
|
'最后params',
|
|
100
100
|
params,
|
|
101
101
|
);
|
|
102
102
|
return http.post(api.apiFunc, params, requestOptions);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Taro from '@tarojs/taro';
|
|
2
|
clientVersion: '11.0.0',
|
|
1
3
|
client: 'wh5',
|
|
2
4
|
screen: `${Math.ceil(getSystemInfo?.screenWidth * devicePixelRatio)}*${Math.ceil(
|
|
3
5
|
getSystemInfo?.screenHeight * devicePixelRatio,
|
|
4
6
|
)}`,
|
|
5
7
|
area: '1_72_2799_0',
|
|
6
8
|
uuid: UUID,
|
|
7
9
|
if (area && area !== '') {
|
|
8
10
|
clientParams.area = area;
|
|
9
11
|
}
|
|
10
12
|
console.warn(
|
|
11
13
|
'cone-render中对外暴露fetchGateway收到原生端获取传来的四级地址信息',
|
|
12
14
|
area,
|
|
13
15
|
'更新后的接口底层信息',
|
|
14
16
|
clientParams,
|
|
15
17
|
);
|
|
16
18
|
functionId: string,
|
|
17
19
|
body = {},
|
|
18
20
|
options = {},
|
|
19
21
|
requestOptions = {},
|
|
20
22
|
const params = Object.assign(
|
|
21
23
|
{},
|
|
22
24
|
{
|
|
23
25
|
t: Date.now(),
|
|
24
26
|
functionId,
|
|
25
27
|
appid: 'shop_m_jd_com',
|
|
26
28
|
body: JSON.stringify(body),
|
|
27
29
|
},
|
|
28
30
|
clientParams,
|
|
29
31
|
options,
|
|
30
32
|
{
|
|
31
33
|
area: clientParams.area,
|
|
32
34
|
client: options?.client || clientParams.client,
|
|
33
35
|
clientVersion: options?.clientVersion || clientParams.clientVersion,
|
|
34
36
|
},
|
|
35
37
|
);
|
|
36
38
|
console.warn(
|
|
37
39
|
'fetchGateway url:' + api.apiFunc + ',functionId:' + params.functionId,
|
|
38
40
|
'底层默认的clientParams',
|
|
39
41
|
clientParams,
|
|
40
42
|
'下发的options',
|
|
41
43
|
options,
|
|
42
44
|
'最后params',
|
|
43
45
|
params,
|
|
44
46
|
);
|
|
45
47
|
return http.post(api.apiFunc, params, requestOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import { ServiceInterFace } from '../../interface';
|
|
2
1
|
SHOP_VERIFY_CODE,
|
|
3
2
|
PAGES_VERIFY_CODE,
|
|
4
3
|
B2B_VERITY_CODE,
|
|
5
4
|
PAGES_DOMAIN,
|
|
6
5
|
B2BColorFunctionIdList,
|
|
7
6
|
APPID,
|
|
8
7
|
public fmInfo: {
|
|
9
8
|
eid?: string;
|
|
10
9
|
fp?: string;
|
|
11
10
|
jsToken?: string;
|
|
12
11
|
sdkToken?: string;
|
|
13
12
|
};
|
|
14
13
|
public api: ServiceInterFace.HttpApi;
|
|
15
14
|
public paramsSignInstance: any;
|
|
16
15
|
public paramsSignPagesInstance: any;
|
|
17
16
|
public paramsSignBmallInstance: any;
|
|
18
17
|
public isPageDomain: boolean;
|
|
19
18
|
public initParamsSignInstance: any;
|
|
20
19
|
public initJsTokenInstance: any;
|
|
21
20
|
constructor() {
|
|
22
21
|
this.api = api;
|
|
23
22
|
this.isPageDomain = location?.hostname === PAGES_DOMAIN;
|
|
24
23
|
this.paramsSignInstance = undefined;
|
|
25
24
|
this.paramsSignPagesInstance = undefined;
|
|
26
25
|
this.paramsSignBmallInstance = undefined;
|
|
27
26
|
this.initParamsSignInstance = undefined;
|
|
28
27
|
this.initJsTokenInstance = undefined;
|
|
29
28
|
this.fmInfo = {};
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
_loadSingleJs(jsFileName, successCallback?, failCallback?) {
|
|
33
32
|
const jsInfo = global.loadJsSdkList.find((item) => item?.fileName === jsFileName);
|
|
34
33
|
if (jsInfo) {
|
|
35
34
|
global
|
|
36
35
|
.loadItemSdkPromise(jsInfo)
|
|
37
36
|
.then(() => {
|
|
38
37
|
typeof successCallback === 'function' && successCallback();
|
|
39
38
|
})
|
|
40
39
|
.catch(() => {
|
|
41
40
|
console.info('业务发起接口请求前置加载js异常' + jsInfo?.src);
|
|
42
41
|
typeof failCallback === 'function' && failCallback();
|
|
43
42
|
});
|
|
44
43
|
} else {
|
|
45
44
|
typeof failCallback === 'function' && failCallback();
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
_getMobileJsToken(): Promise<{
|
|
50
49
|
ok: boolean;
|
|
51
50
|
data?: any;
|
|
52
51
|
error?: any;
|
|
53
52
|
}> {
|
|
54
53
|
return this._handleInitJsToken().then(() => {
|
|
55
54
|
try {
|
|
56
55
|
if (window?.getJsToken) {
|
|
57
56
|
return new Promise((resolve) => {
|
|
58
57
|
window.getJsToken(function (res) {
|
|
59
58
|
console.log('JS token 获取结果', res);
|
|
60
59
|
resolve({
|
|
61
60
|
ok: true,
|
|
62
61
|
data: res,
|
|
63
62
|
});
|
|
64
63
|
}, 600);
|
|
65
64
|
});
|
|
66
65
|
} else {
|
|
67
66
|
console.log('没有识别到getJsToken全局方法');
|
|
68
67
|
return Promise.resolve({
|
|
69
68
|
ok: false,
|
|
70
69
|
error: '没有识别到getJsToken全局方法',
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
72
|
} catch (e) {
|
|
74
73
|
console.log('获取指纹JS token 异常', e);
|
|
75
74
|
return Promise.resolve({
|
|
76
75
|
ok: false,
|
|
77
76
|
error: e,
|
|
78
77
|
});
|
|
79
78
|
}
|
|
80
79
|
});
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
async getFmInfo() {
|
|
84
83
|
try {
|
|
85
84
|
const { ok, data } = await this._getMobileJsToken();
|
|
86
85
|
this.fmInfo = ok && data ? data : this.fmInfo;
|
|
87
86
|
return this.fmInfo;
|
|
88
87
|
} catch (e) {
|
|
89
88
|
console.log('获取指纹信息异常', e);
|
|
90
89
|
return this.fmInfo;
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
_initSign() {
|
|
95
94
|
this.paramsSignInstance = window.PSign
|
|
96
95
|
? window.PSign
|
|
97
96
|
: window.ParamsSign
|
|
98
97
|
? this._initParamsSignInstance(SHOP_VERIFY_CODE)
|
|
99
98
|
: null;
|
|
100
99
|
this.paramsSignPagesInstance = window.ParamsSign
|
|
101
100
|
? this._initParamsSignInstance(PAGES_VERIFY_CODE)
|
|
102
101
|
: null;
|
|
103
102
|
this.paramsSignBmallInstance = window.ParamsSign
|
|
104
103
|
? this._initParamsSignInstance(B2B_VERITY_CODE)
|
|
105
104
|
: null;
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
_initParamsSignInstance(appId) {
|
|
109
108
|
return new window.ParamsSign({
|
|
110
109
|
appId: appId,
|
|
111
110
|
debug: false,
|
|
112
111
|
preRequest: false,
|
|
113
112
|
onSign: ({ code }) => {
|
|
114
113
|
console.log('签名可用率监控', code);
|
|
115
114
|
},
|
|
116
115
|
onRequestTokenRemotely: ({ code, message }) => {
|
|
117
116
|
console.log('算法接口可用率监控', code, message);
|
|
118
117
|
},
|
|
119
118
|
onRequestToken: ({ code, message }) => {
|
|
120
119
|
console.log('token的可用率监控', code, message);
|
|
121
120
|
},
|
|
122
121
|
});
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
paramsSign(data) {
|
|
126
125
|
try {
|
|
127
126
|
return this._handleInitSign().then(() => {
|
|
128
127
|
console.log('获取加签参数', data, this.paramsSignInstance);
|
|
129
128
|
if (!data || typeof data !== 'object' || !this.paramsSignInstance) {
|
|
130
129
|
return Promise.resolve(data);
|
|
131
130
|
} else {
|
|
132
131
|
const param: any = {
|
|
133
132
|
appid: data.appid,
|
|
134
133
|
client: data.client,
|
|
135
134
|
clientVersion: data.clientVersion,
|
|
136
135
|
functionId: data.functionId,
|
|
137
136
|
t: data.t,
|
|
138
137
|
sign: data?.sign,
|
|
139
138
|
jsonp: data?.jsonp,
|
|
140
139
|
};
|
|
141
140
|
data && data.body && (param.body = sha256(data.body).toString());
|
|
142
141
|
console.log(
|
|
143
142
|
'获取加签前的参数处理',
|
|
144
143
|
param,
|
|
145
144
|
'获取下发data',
|
|
146
145
|
data,
|
|
147
146
|
'获取加签实例',
|
|
148
147
|
this.paramsSignInstance,
|
|
149
148
|
this.paramsSignPagesInstance,
|
|
150
149
|
);
|
|
151
150
|
return this._checkFunctionIdNeedSignForPages(data)
|
|
152
151
|
? this.paramsSignPagesInstance.sign(param)
|
|
153
152
|
: this.paramsSignBmallInstance && B2BColorFunctionIdList.includes(param.functionId)
|
|
154
153
|
? this.paramsSignBmallInstance.sign(param)
|
|
155
154
|
: this.paramsSignInstance.sign(param);
|
|
156
155
|
}
|
|
157
156
|
});
|
|
158
157
|
} catch (e) {
|
|
159
158
|
console.log('获取加签参数结果异常', e);
|
|
160
159
|
return Promise.resolve(data);
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
162
|
|
|
164
163
|
_checkFunctionIdNeedSignForPages(data) {
|
|
165
164
|
const { appid, functionId } = data;
|
|
166
165
|
return (
|
|
167
166
|
this.isPageDomain &&
|
|
168
167
|
this.paramsSignPagesInstance &&
|
|
169
168
|
appid === APPID.PAGES_COLOR_APPID &&
|
|
170
169
|
functionId
|
|
171
170
|
);
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
_handleInitSign() {
|
|
175
174
|
if (!this.initParamsSignInstance) {
|
|
176
175
|
this.initParamsSignInstance = new Promise((resolve) => {
|
|
177
176
|
if (window?.ParamsSign) {
|
|
178
177
|
this._initSign();
|
|
179
178
|
resolve({
|
|
180
179
|
ok: true,
|
|
181
180
|
msg: '加固js已加载',
|
|
182
181
|
});
|
|
183
182
|
} else if (window?.PAGE_DATA?.asyncLoadSecurityJs) {
|
|
184
183
|
this._loadSingleJs(
|
|
185
184
|
'securityJs',
|
|
186
185
|
() => {
|
|
187
186
|
this._initSign();
|
|
188
187
|
resolve({
|
|
189
188
|
ok: true,
|
|
190
189
|
msg: '异步请求加固js成功加载',
|
|
191
190
|
});
|
|
192
191
|
},
|
|
193
192
|
() => {
|
|
194
193
|
resolve({
|
|
195
194
|
ok: true,
|
|
196
195
|
msg: '加固js加载异常',
|
|
197
196
|
});
|
|
198
197
|
},
|
|
199
198
|
);
|
|
200
199
|
} else {
|
|
201
200
|
resolve({
|
|
202
201
|
ok: true,
|
|
203
202
|
msg: '加固js开关配置为false不加载',
|
|
204
203
|
});
|
|
205
204
|
}
|
|
206
205
|
});
|
|
207
206
|
}
|
|
208
207
|
return this.initParamsSignInstance;
|
|
209
208
|
}
|
|
210
209
|
|
|
211
210
|
_handleInitJsToken() {
|
|
212
211
|
if (!this.initJsTokenInstance) {
|
|
213
212
|
this.initJsTokenInstance = new Promise((resolve) => {
|
|
214
213
|
if (window?.getJsToken) {
|
|
215
214
|
resolve({
|
|
216
215
|
ok: true,
|
|
217
216
|
msg: '指纹js已加载',
|
|
218
217
|
});
|
|
219
218
|
} else if (window?.PAGE_DATA?.asyncLoadMtkJs) {
|
|
220
219
|
this._loadSingleJs(
|
|
221
220
|
'mtkJs',
|
|
222
221
|
() => {
|
|
223
222
|
resolve({
|
|
224
223
|
ok: true,
|
|
225
224
|
msg: '异步请求指纹js成功加载',
|
|
226
225
|
});
|
|
227
226
|
},
|
|
228
227
|
() => {
|
|
229
228
|
resolve({
|
|
230
229
|
ok: true,
|
|
231
230
|
msg: '指纹js加载异常',
|
|
232
231
|
});
|
|
233
232
|
},
|
|
234
233
|
);
|
|
235
234
|
} else {
|
|
236
235
|
resolve({
|
|
237
236
|
ok: true,
|
|
238
237
|
msg: '指纹js开关配置为false不加载',
|
|
239
238
|
});
|
|
240
239
|
}
|
|
241
240
|
});
|
|
242
241
|
}
|
|
243
242
|
return this.initJsTokenInstance;
|
|
244
243
|
}
|
|
244
|
+
import { ServiceInterFace } from '../../interface';
|
|
245
245
|
SHOP_VERIFY_CODE,
|
|
246
246
|
PAGES_VERIFY_CODE,
|
|
247
247
|
B2B_VERITY_CODE,
|
|
248
248
|
PAGES_DOMAIN,
|
|
249
249
|
B2BColorFunctionIdList,
|
|
250
250
|
APPID,
|
|
251
251
|
public fmInfo: {
|
|
252
252
|
eid?: string;
|
|
253
253
|
fp?: string;
|
|
254
254
|
jsToken?: string;
|
|
255
255
|
sdkToken?: string;
|
|
256
256
|
};
|
|
257
257
|
public api: ServiceInterFace.HttpApi;
|
|
258
258
|
public paramsSignInstance: any;
|
|
259
259
|
public paramsSignPagesInstance: any;
|
|
260
260
|
public paramsSignBmallInstance: any;
|
|
261
261
|
public isPageDomain: boolean;
|
|
262
262
|
public initParamsSignInstance: any;
|
|
263
263
|
public initJsTokenInstance: any;
|
|
264
264
|
constructor() {
|
|
265
265
|
this.api = api;
|
|
266
266
|
this.isPageDomain = location?.hostname === PAGES_DOMAIN;
|
|
267
267
|
this.paramsSignInstance = undefined;
|
|
268
268
|
this.paramsSignPagesInstance = undefined;
|
|
269
269
|
this.paramsSignBmallInstance = undefined;
|
|
270
270
|
this.initParamsSignInstance = undefined;
|
|
271
271
|
this.initJsTokenInstance = undefined;
|
|
272
272
|
this.fmInfo = {};
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
_loadSingleJs(jsFileName, successCallback?, failCallback?) {
|
|
276
276
|
const jsInfo = global.loadJsSdkList.find((item) => item?.fileName === jsFileName);
|
|
277
277
|
if (jsInfo) {
|
|
278
278
|
global
|
|
279
279
|
.loadItemSdkPromise(jsInfo)
|
|
280
280
|
.then(() => {
|
|
281
281
|
typeof successCallback === 'function' && successCallback();
|
|
282
282
|
})
|
|
283
283
|
.catch(() => {
|
|
284
284
|
console.info('业务发起接口请求前置加载js异常' + jsInfo?.src);
|
|
285
285
|
typeof failCallback === 'function' && failCallback();
|
|
286
286
|
});
|
|
287
287
|
} else {
|
|
288
288
|
typeof failCallback === 'function' && failCallback();
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
_getMobileJsToken(): Promise<{
|
|
293
293
|
ok: boolean;
|
|
294
294
|
data?: any;
|
|
295
295
|
error?: any;
|
|
296
296
|
}> {
|
|
297
297
|
return this._handleInitJsToken().then(() => {
|
|
298
298
|
try {
|
|
299
299
|
if (window?.getJsToken) {
|
|
300
300
|
return new Promise((resolve) => {
|
|
301
301
|
window.getJsToken(function (res) {
|
|
302
302
|
console.log('JS token 获取结果', res);
|
|
303
303
|
resolve({
|
|
304
304
|
ok: true,
|
|
305
305
|
data: res,
|
|
306
306
|
});
|
|
307
307
|
}, 600);
|
|
308
308
|
});
|
|
309
309
|
} else {
|
|
310
310
|
console.log('没有识别到getJsToken全局方法');
|
|
311
311
|
return Promise.resolve({
|
|
312
312
|
ok: false,
|
|
313
313
|
error: '没有识别到getJsToken全局方法',
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
} catch (e) {
|
|
317
317
|
console.log('获取指纹JS token 异常', e);
|
|
318
318
|
return Promise.resolve({
|
|
319
319
|
ok: false,
|
|
320
320
|
error: e,
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
async getFmInfo() {
|
|
327
327
|
try {
|
|
328
328
|
const { ok, data } = await this._getMobileJsToken();
|
|
329
329
|
this.fmInfo = ok && data ? data : this.fmInfo;
|
|
330
330
|
return this.fmInfo;
|
|
331
331
|
} catch (e) {
|
|
332
332
|
console.log('获取指纹信息异常', e);
|
|
333
333
|
return this.fmInfo;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
_initSign() {
|
|
338
338
|
this.paramsSignInstance = window.PSign
|
|
339
339
|
? window.PSign
|
|
340
340
|
: window.ParamsSign
|
|
341
341
|
? this._initParamsSignInstance(SHOP_VERIFY_CODE)
|
|
342
342
|
: null;
|
|
343
343
|
this.paramsSignPagesInstance = window.ParamsSign
|
|
344
344
|
? this._initParamsSignInstance(PAGES_VERIFY_CODE)
|
|
345
345
|
: null;
|
|
346
346
|
this.paramsSignBmallInstance = window.ParamsSign
|
|
347
347
|
? this._initParamsSignInstance(B2B_VERITY_CODE)
|
|
348
348
|
: null;
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
_initParamsSignInstance(appId) {
|
|
352
352
|
return new window.ParamsSign({
|
|
353
353
|
appId: appId,
|
|
354
354
|
debug: false,
|
|
355
355
|
preRequest: false,
|
|
356
356
|
onSign: ({ code }) => {
|
|
357
357
|
console.log('签名可用率监控', code);
|
|
358
358
|
},
|
|
359
359
|
onRequestTokenRemotely: ({ code, message }) => {
|
|
360
360
|
console.log('算法接口可用率监控', code, message);
|
|
361
361
|
},
|
|
362
362
|
onRequestToken: ({ code, message }) => {
|
|
363
363
|
console.log('token的可用率监控', code, message);
|
|
364
364
|
},
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
paramsSign(data) {
|
|
369
369
|
try {
|
|
370
370
|
return this._handleInitSign().then(() => {
|
|
371
371
|
console.log('获取加签参数', data, this.paramsSignInstance);
|
|
372
372
|
if (!data || typeof data !== 'object' || !this.paramsSignInstance) {
|
|
373
373
|
return Promise.resolve(data);
|
|
374
374
|
} else {
|
|
375
375
|
const param: any = {
|
|
376
376
|
appid: data.appid,
|
|
377
377
|
client: data.client,
|
|
378
378
|
clientVersion: data.clientVersion,
|
|
379
379
|
functionId: data.functionId,
|
|
380
380
|
t: data.t,
|
|
381
381
|
sign: data?.sign,
|
|
382
382
|
jsonp: data?.jsonp,
|
|
383
383
|
};
|
|
384
384
|
data && data.body && (param.body = sha256(data.body).toString());
|
|
385
385
|
console.log(
|
|
386
386
|
'获取加签前的参数处理',
|
|
387
387
|
param,
|
|
388
388
|
'获取下发data',
|
|
389
389
|
data,
|
|
390
390
|
'获取加签实例',
|
|
391
391
|
this.paramsSignInstance,
|
|
392
392
|
this.paramsSignPagesInstance,
|
|
393
393
|
);
|
|
394
394
|
return this._checkFunctionIdNeedSignForPages(data)
|
|
395
395
|
? this.paramsSignPagesInstance.sign(param)
|
|
396
396
|
: this.paramsSignBmallInstance && B2BColorFunctionIdList.includes(param.functionId)
|
|
397
397
|
? this.paramsSignBmallInstance.sign(param)
|
|
398
398
|
: this.paramsSignInstance.sign(param);
|
|
399
399
|
}
|
|
400
400
|
});
|
|
401
401
|
} catch (e) {
|
|
402
402
|
console.log('获取加签参数结果异常', e);
|
|
403
403
|
return Promise.resolve(data);
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
|
|
407
407
|
_checkFunctionIdNeedSignForPages(data) {
|
|
408
408
|
const { appid, functionId } = data;
|
|
409
409
|
return (
|
|
410
410
|
this.isPageDomain &&
|
|
411
411
|
this.paramsSignPagesInstance &&
|
|
412
412
|
appid === APPID.PAGES_COLOR_APPID &&
|
|
413
413
|
functionId
|
|
414
414
|
);
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
_handleInitSign() {
|
|
418
418
|
if (!this.initParamsSignInstance) {
|
|
419
419
|
this.initParamsSignInstance = new Promise((resolve) => {
|
|
420
420
|
if (window?.ParamsSign) {
|
|
421
421
|
this._initSign();
|
|
422
422
|
resolve({
|
|
423
423
|
ok: true,
|
|
424
424
|
msg: '加固js已加载',
|
|
425
425
|
});
|
|
426
426
|
} else if (window?.PAGE_DATA?.asyncLoadSecurityJs) {
|
|
427
427
|
this._loadSingleJs(
|
|
428
428
|
'securityJs',
|
|
429
429
|
() => {
|
|
430
430
|
this._initSign();
|
|
431
431
|
resolve({
|
|
432
432
|
ok: true,
|
|
433
433
|
msg: '异步请求加固js成功加载',
|
|
434
434
|
});
|
|
435
435
|
},
|
|
436
436
|
() => {
|
|
437
437
|
resolve({
|
|
438
438
|
ok: true,
|
|
439
439
|
msg: '加固js加载异常',
|
|
440
440
|
});
|
|
441
441
|
},
|
|
442
442
|
);
|
|
443
443
|
} else {
|
|
444
444
|
resolve({
|
|
445
445
|
ok: true,
|
|
446
446
|
msg: '加固js开关配置为false不加载',
|
|
447
447
|
});
|
|
448
448
|
}
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
451
|
return this.initParamsSignInstance;
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
_handleInitJsToken() {
|
|
455
455
|
if (!this.initJsTokenInstance) {
|
|
456
456
|
this.initJsTokenInstance = new Promise((resolve) => {
|
|
457
457
|
if (window?.getJsToken) {
|
|
458
458
|
resolve({
|
|
459
459
|
ok: true,
|
|
460
460
|
msg: '指纹js已加载',
|
|
461
461
|
});
|
|
462
462
|
} else if (window?.PAGE_DATA?.asyncLoadMtkJs) {
|
|
463
463
|
this._loadSingleJs(
|
|
464
464
|
'mtkJs',
|
|
465
465
|
() => {
|
|
466
466
|
resolve({
|
|
467
467
|
ok: true,
|
|
468
468
|
msg: '异步请求指纹js成功加载',
|
|
469
469
|
});
|
|
470
470
|
},
|
|
471
471
|
() => {
|
|
472
472
|
resolve({
|
|
473
473
|
ok: true,
|
|
474
474
|
msg: '指纹js加载异常',
|
|
475
475
|
});
|
|
476
476
|
},
|
|
477
477
|
);
|
|
478
478
|
} else {
|
|
479
479
|
resolve({
|
|
480
480
|
ok: true,
|
|
481
481
|
msg: '指纹js开关配置为false不加载',
|
|
482
482
|
});
|
|
483
483
|
}
|
|
484
484
|
});
|
|
485
485
|
}
|
|
486
486
|
return this.initJsTokenInstance;
|
|
487
487
|
}
|