@conecli/cone-render 0.8.26 → 0.8.27
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/token/index.h5.ts +1 -1
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +3 -0
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/web.jdb.ts +1 -0
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/request.ts +1 -0
- package/dist/service/bMallConst.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -0
- package/dist/service/http/const.ts +1 -1
- package/dist/service/http/http.ts +1 -1
- package/dist/service/requestServer.ts +1 -0
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/jm-common.js +1 -1
- package/dist/utils/ready.ts +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { JdJumpJdApp } from './jdJumpJdApp'
|
|
2
|
routerInfo: {
|
|
1
3
|
params: {},
|
|
2
4
|
},
|
|
3
5
|
nativeEvent: null,
|
|
4
6
|
jumpConfig: {
|
|
5
7
|
venderId: null,
|
|
6
8
|
shopId: null,
|
|
7
9
|
sourceValue: '',
|
|
8
10
|
sourceType: 'App-H5',
|
|
9
11
|
activityType: 'shopx',
|
|
10
12
|
moduleId: 'none',
|
|
11
13
|
entrance: 'none',
|
|
12
14
|
},
|
|
13
15
|
logPageParamStr: '',
|
|
14
16
|
public logPageId: string
|
|
15
17
|
public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
|
|
16
18
|
constructor(opt = {}) {
|
|
17
19
|
console.log('jdb加载==========')
|
|
18
20
|
super(opt)
|
|
19
21
|
this.getConfig(opt)
|
|
20
22
|
}
|
|
21
23
|
jdbOpenAppParams(openAppUrl): Object | boolean {
|
|
22
24
|
let getParams: boolean | Object = false
|
|
23
25
|
if (this.isOpenJdbAppUrl(openAppUrl)) {
|
|
24
26
|
try {
|
|
25
27
|
getParams = openAppUrl.replace(
|
|
26
28
|
/openApp\.jdbmall:\/\/virtual\?params=/i,
|
|
27
29
|
'',
|
|
28
30
|
)
|
|
29
31
|
getParams = JSON.parse(String(getParams))
|
|
30
32
|
} catch (e) {
|
|
31
33
|
console.log(e)
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
return getParams
|
|
35
37
|
}
|
|
36
38
|
isOpenJdbAppUrl(openAppUrl) {
|
|
37
39
|
return /openApp\.jdbmall:\/\/virtual\?params=/i.test(openAppUrl)
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
async jdJumpConfigUrl(detail, logEventInfo = {}) {
|
|
41
43
|
const { configDataType, configDataValue } = detail
|
|
42
44
|
switch (configDataType) {
|
|
43
45
|
case LinkConfigType.CONFIG_TYPE_SKU_LIST:
|
|
44
46
|
this.jdJumpToProduct(
|
|
45
47
|
{
|
|
46
48
|
...configDataValue,
|
|
47
49
|
skuId: configDataValue.skuIds,
|
|
48
50
|
skuUniformBizInfo: { buId: configDataValue.buId },
|
|
49
51
|
},
|
|
50
52
|
logEventInfo,
|
|
51
53
|
)
|
|
52
54
|
break
|
|
53
55
|
case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK: {
|
|
54
56
|
const _url = configDataValue.linkUrl
|
|
55
57
|
if (this.isOpenJdbAppUrl(_url)) {
|
|
56
58
|
const getOpenAppParams = this.jdbOpenAppParams(_url)
|
|
57
59
|
console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
|
|
58
60
|
if (getOpenAppParams) {
|
|
59
61
|
this.jdNavigateToNative(
|
|
60
62
|
Object.assign({}, getOpenAppParams, {
|
|
61
63
|
logEventInfo,
|
|
62
64
|
}),
|
|
63
65
|
)
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
break
|
|
67
69
|
}
|
|
68
70
|
default:
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
jdJumpToProduct(skuParams, logEventInfo) {
|
|
73
75
|
if (typeof skuParams !== 'object') {
|
|
74
76
|
console.error('万商app跳转商品详情参数需要对象,详情请查看文档')
|
|
75
77
|
return
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
let { skuId, bMallTag = '1', skuUniformBizInfo } = skuParams
|
|
79
81
|
skuId = skuId.toString().trim()
|
|
80
82
|
this.jdNavigateToNative({
|
|
81
83
|
category: 'jump',
|
|
82
84
|
des: 'skudetail',
|
|
83
85
|
param: {
|
|
84
86
|
skuId: skuId,
|
|
85
87
|
bMallTag: bMallTag,
|
|
86
88
|
skuUniformBizInfo,
|
|
87
89
|
},
|
|
88
90
|
logEventInfo,
|
|
89
91
|
})
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
jdNavigateToNative(
|
|
93
95
|
params: {},
|
|
94
96
|
url = OpenAppHost,
|
|
95
97
|
successBack?: Function | null,
|
|
96
98
|
failBack?: Function | null,
|
|
97
99
|
) {
|
|
98
100
|
console.log('jdb web', params)
|
|
99
101
|
const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
|
|
100
102
|
Object.assign(
|
|
101
103
|
{},
|
|
102
104
|
{
|
|
103
105
|
param: {},
|
|
104
106
|
},
|
|
105
107
|
params,
|
|
106
108
|
)
|
|
107
109
|
const { logEventInfo, ...otherParams } = getResParams
|
|
108
110
|
console.log(
|
|
109
111
|
'jdb web 获取open协议参数 jdNavigateToNative params: ',
|
|
110
112
|
otherParams,
|
|
111
113
|
)
|
|
112
114
|
console.log('logEventInfo params: ', logEventInfo)
|
|
113
115
|
console.log('otherParams', otherParams)
|
|
114
116
|
const paramsStr = JSON.stringify(otherParams)
|
|
115
117
|
console.log('跳转web jdb open协议', `${url}?params=${paramsStr}`)
|
|
116
118
|
global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
|
|
117
119
|
this.clickEventLog(logEventInfo || getResParams)
|
|
118
120
|
.then(() => {
|
|
119
121
|
if (typeof successBack == 'function') {
|
|
120
122
|
successBack(getResParams)
|
|
121
123
|
} else {
|
|
122
124
|
try {
|
|
123
125
|
const paramsStr = JSON.stringify(otherParams)
|
|
124
126
|
console.log(
|
|
125
127
|
'success: 跳转web jdb open协议',
|
|
126
128
|
`${url}?params=${paramsStr}`,
|
|
127
129
|
)
|
|
128
130
|
window.location.href = `${url}?params=${paramsStr}`
|
|
129
131
|
} catch (e) {
|
|
130
132
|
console.log('跳转异常', e)
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
})
|
|
134
136
|
.catch((e) => {
|
|
135
137
|
console.log('catch', e)
|
|
136
138
|
typeof failBack == 'function' && failBack(getResParams)
|
|
137
139
|
})
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
clickEventLog(
|
|
141
143
|
opts: JumpEventReportInterFace.OptEventLogParams = {},
|
|
142
144
|
reportKey = 'click',
|
|
143
145
|
) {
|
|
144
146
|
const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
|
|
145
147
|
if (eventId && jsonParam) {
|
|
146
148
|
const { etModelInfo, logBaseInfo } = jsonParam
|
|
147
149
|
const webLogParams = {
|
|
148
150
|
eid: eventId,
|
|
149
151
|
elevel: eventLevel,
|
|
150
152
|
jsonParam: JSON.stringify(logBaseInfo || jsonParam),
|
|
151
153
|
etModel: JSON.stringify(etModelInfo || {}),
|
|
152
154
|
pageId: this.logPageId,
|
|
153
155
|
pageParam: this.logPageParamStr,
|
|
154
156
|
...otherParams,
|
|
155
157
|
}
|
|
156
158
|
return /click|exposure/.test(reportKey)
|
|
157
159
|
? reportClick(webLogParams)
|
|
158
160
|
: reportToCart(opts)
|
|
159
161
|
} else {
|
|
160
162
|
console.log('暂无埋点参数eventId和eventParam')
|
|
161
163
|
return Promise.resolve(false)
|
|
162
164
|
}
|
|
163
165
|
}
|
|
164
166
|
getConfig(opt = {}) {
|
|
165
167
|
return Object.assign(this, {}, defaultConfig, opt)
|
|
166
168
|
}
|
package/dist/open/api/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import * as device from './device'
|
|
2
1
|
device,
|
|
3
2
|
environment,
|
|
4
3
|
jump,
|
|
5
4
|
storage,
|
|
6
5
|
util,
|
|
7
6
|
moduleUtil,
|
|
8
7
|
track,
|
|
9
8
|
trackPromise,
|
|
10
9
|
global,
|
|
11
10
|
http,
|
|
12
11
|
shopMember,
|
|
13
12
|
userToken,
|
|
14
13
|
TokenPlatform,
|
|
15
14
|
isvStorage,
|
|
15
|
+
import * as device from './device'
|
|
16
16
|
device,
|
|
17
17
|
environment,
|
|
18
18
|
jump,
|
|
19
19
|
storage,
|
|
20
20
|
util,
|
|
21
21
|
moduleUtil,
|
|
22
22
|
track,
|
|
23
23
|
trackPromise,
|
|
24
24
|
global,
|
|
25
25
|
http,
|
|
26
26
|
shopMember,
|
|
27
27
|
userToken,
|
|
28
28
|
TokenPlatform,
|
|
29
29
|
requestServer,
|
|
30
30
|
isvStorage,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import requestServer from '../../service/requestServer'
|
|
2
|
return requestServer.receiveCoupon(param, clientParams)
|
|
1
3
|
return requestServer.bMallGetUserInfo()
|
|
2
4
|
return requestServer.bMallGetSkuNumApi(needRequest, bMallTag)
|
|
3
5
|
return requestServer.bMallCartHandle(goodItem, num)
|
|
4
6
|
receiveCoupon,
|
|
5
7
|
bMallGetUserInfo,
|
|
6
8
|
bMallGetSkuNumApi,
|
|
7
9
|
bMallCartHandle
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { isAndroidDevice } from '../utils'
|
|
2
|
buId: '',
|
|
1
3
|
console.log('getBMallUserInfo')
|
|
2
4
|
if (!isApp('jdb')) {
|
|
3
5
|
return null
|
|
4
6
|
}
|
|
5
7
|
const requestTimeoutPromise = new Promise((resolve) => {
|
|
6
8
|
setTimeout(() => {
|
|
7
9
|
resolve({})
|
|
8
10
|
}, 3000)
|
|
9
11
|
})
|
|
10
12
|
const userInfoPromise = new Promise((resolve) => {
|
|
11
13
|
let result: any = {}
|
|
12
14
|
try {
|
|
13
15
|
if (isAndroidDevice) {
|
|
14
16
|
result = JSON.parse(
|
|
15
17
|
window.WebViewCommon && window.WebViewCommon.getUserInfo(),
|
|
16
18
|
)
|
|
17
19
|
commonParam.buId = result?.data?.buId
|
|
18
20
|
resolve(result)
|
|
19
21
|
} else {
|
|
20
22
|
window.getUserInfoCallBack = null
|
|
21
23
|
window.getUserInfoCallBack = function (callBackJson) {
|
|
22
24
|
console.log('in???callBackJson', callBackJson)
|
|
23
25
|
if (callBackJson) {
|
|
24
26
|
result.data = JSON.parse(callBackJson)
|
|
25
27
|
commonParam.buId = result?.data?.buId
|
|
26
28
|
resolve(result)
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
console.log(
|
|
30
32
|
'window?.webkit?.messageHandlers?.WebViewCommon?.postMessage',
|
|
31
33
|
window?.webkit?.messageHandlers?.WebViewCommon?.postMessage,
|
|
32
34
|
)
|
|
33
35
|
window?.webkit?.messageHandlers?.WebViewCommon?.postMessage({
|
|
34
36
|
businessType: 'router://com.jd.jlstudio/getUserInfo',
|
|
35
37
|
params: {},
|
|
36
38
|
callBackName: 'getUserInfoCallBack',
|
|
37
39
|
method: 'callRouterModuleWithParams',
|
|
38
40
|
})
|
|
39
41
|
}
|
|
40
42
|
} catch (e) {
|
|
41
43
|
resolve(result)
|
|
42
44
|
}
|
|
43
45
|
})
|
|
44
46
|
return Promise.race([userInfoPromise, requestTimeoutPromise])
|
|
45
47
|
process.env.NODE_ENV === 'development'
|
|
46
48
|
? {
|
|
47
49
|
apolloId: '48ee955b0fb04d19b9f9fe8cb73d387f',
|
|
48
50
|
apolloSecret: '0d9c76ee66b0487da4e17d3cf1d7af7a',
|
|
49
51
|
}
|
|
50
52
|
: {
|
|
51
53
|
apolloId: '80c46fd06e4442998609d9f6a4ab96f0',
|
|
52
54
|
apolloSecret: 'f36bef08bcba4683b409732095793fb2',
|
|
53
55
|
}
|
|
54
56
|
if (typeof window.crypto === 'object') {
|
|
55
57
|
if (typeof (window.crypto as any).randomUUID === 'function') {
|
|
56
58
|
return (window.crypto as any).randomUUID()
|
|
57
59
|
}
|
|
58
60
|
if (
|
|
59
61
|
typeof (window.crypto as any).getRandomValues === 'function' &&
|
|
60
62
|
typeof Uint8Array === 'function'
|
|
61
63
|
) {
|
|
62
64
|
const callback = (c) => {
|
|
63
65
|
const num = Number(c)
|
|
64
66
|
return (
|
|
65
67
|
num ^
|
|
66
68
|
((window.crypto as any).getRandomValues(new Uint8Array(1))[0] &
|
|
67
69
|
(15 >> (num / 4)))
|
|
68
70
|
).toString(16)
|
|
69
71
|
}
|
|
70
72
|
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, callback)
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
let timestamp = new Date().getTime()
|
|
74
76
|
let perforNow =
|
|
75
77
|
(typeof window.performance !== 'undefined' &&
|
|
76
78
|
window.performance.now &&
|
|
77
79
|
window.performance.now() * 1000) ||
|
|
78
80
|
0
|
|
79
81
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
80
82
|
let random = Math.random() * 16
|
|
81
83
|
if (timestamp > 0) {
|
|
82
84
|
random = (timestamp + random) % 16 | 0
|
|
83
85
|
timestamp = Math.floor(timestamp / 16)
|
|
84
86
|
} else {
|
|
85
87
|
random = (perforNow + random) % 16 | 0
|
|
86
88
|
perforNow = Math.floor(perforNow / 16)
|
|
87
89
|
}
|
|
88
90
|
return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
|
|
89
91
|
})
|
|
90
92
|
skuId,
|
|
91
93
|
bMallTag = 1,
|
|
92
94
|
num,
|
|
93
95
|
skuUuid,
|
|
94
96
|
...otherGoodParams
|
|
95
97
|
let buId = commonParam.buId
|
|
96
98
|
if (!buId) {
|
|
97
99
|
const useInfo: any = await getBMallUserInfo()
|
|
98
100
|
buId = useInfo?.data?.buId
|
|
99
101
|
}
|
|
100
102
|
let params: any = {
|
|
101
103
|
uniformBizInfo: {
|
|
102
104
|
tenantId: 1024,
|
|
103
105
|
ua: 1,
|
|
104
106
|
buId: buId || 456,
|
|
105
107
|
bMallTag: bMallTag,
|
|
106
108
|
},
|
|
107
109
|
commonParam: {
|
|
108
110
|
pid: 100,
|
|
109
111
|
verticalCode: 'cn_retail_bmall',
|
|
110
112
|
ua: 1,
|
|
111
113
|
language: 'zh',
|
|
112
114
|
},
|
|
113
115
|
operations: [{ TheSkus: [{ Id: skuId, num: num ?? 1 }] }],
|
|
114
116
|
apolloId: APOLLO.apolloId,
|
|
115
117
|
apolloSecret: APOLLO.apolloSecret,
|
|
116
118
|
client: 'H5',
|
|
117
119
|
verticalTag: 'cn_retail_bmall',
|
|
118
120
|
carttype: bMallTag == 1 ? 21 : 22,
|
|
119
121
|
bMallTag: bMallTag,
|
|
120
122
|
traceId: getUuid(),
|
|
121
123
|
noResponse: true,
|
|
122
124
|
}
|
|
123
125
|
if (skuUuid) {
|
|
124
126
|
params.operations[0].TheSkus[0].skuUuid = skuUuid
|
|
125
127
|
}
|
|
126
128
|
if (otherGoodParams.buId) {
|
|
127
129
|
const uniformBizInfo = {
|
|
128
130
|
buId: otherGoodParams.buId,
|
|
129
131
|
}
|
|
130
132
|
params.operations[0].TheSkus[0].uniformBizInfo = uniformBizInfo
|
|
131
133
|
}
|
|
132
134
|
if (window?.siteTransResult?.gridInfoList) {
|
|
133
135
|
params = {
|
|
134
136
|
...params,
|
|
135
137
|
cartLocationList: [
|
|
136
138
|
{
|
|
137
139
|
gridInfos:
|
|
138
140
|
window?.siteTransResult?.gridInfoList &&
|
|
139
141
|
JSON.parse(window?.siteTransResult?.gridInfoList),
|
|
140
142
|
areaIdSet:
|
|
141
143
|
window?.siteTransResult?.area &&
|
|
142
144
|
window?.siteTransResult?.area?.split('-'),
|
|
143
145
|
},
|
|
144
146
|
],
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
return params
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ServiceInterFace } from '../../interface'
|
|
2
|
AppVerifyColorList,
|
|
1
3
|
SHOP_VERIFY_CODE,
|
|
2
4
|
PAGES_VERIFY_CODE,
|
|
3
5
|
B2B_VERITY_CODE,
|
|
4
6
|
PAGES_DOMAIN,
|
|
5
7
|
B2BColorFunctionIdList,
|
|
6
8
|
public fmInfo: {
|
|
7
9
|
eid?: string
|
|
8
10
|
fp?: string
|
|
9
11
|
jsToken?: string
|
|
10
12
|
sdkToken?: string
|
|
11
13
|
}
|
|
12
14
|
public api: ServiceInterFace.HttpApi
|
|
13
15
|
public paramsSignInstance: any
|
|
14
16
|
public paramsSignPagesInstance: any
|
|
15
17
|
public paramsSignBmallInstance: any
|
|
16
18
|
public isPageDomain: boolean
|
|
17
19
|
constructor() {
|
|
18
20
|
this.api = api
|
|
19
21
|
this.isPageDomain = window.location.hostname === PAGES_DOMAIN
|
|
20
22
|
this.paramsSignInstance = undefined
|
|
21
23
|
this.paramsSignPagesInstance = undefined
|
|
22
24
|
this.paramsSignBmallInstance = undefined
|
|
23
25
|
this.fmInfo = {}
|
|
24
26
|
this._initSign()
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
_getMobileJsToken(): Promise<{
|
|
28
30
|
ok: boolean
|
|
29
31
|
data?: any
|
|
30
32
|
error?: any
|
|
31
33
|
}> {
|
|
32
34
|
return new Promise((resolve, reject) => {
|
|
33
35
|
try {
|
|
34
36
|
if (window?.getJsToken) {
|
|
35
37
|
window.getJsToken(function (res) {
|
|
36
38
|
console.log('JS token 获取结果:', res)
|
|
37
39
|
resolve({
|
|
38
40
|
ok: true,
|
|
39
41
|
data: res,
|
|
40
42
|
})
|
|
41
43
|
}, 600)
|
|
42
44
|
} else {
|
|
43
45
|
reject({
|
|
44
46
|
ok: false,
|
|
45
47
|
error: '没有识别到getJsToken全局方法',
|
|
46
48
|
})
|
|
47
49
|
}
|
|
48
50
|
} catch (e) {
|
|
49
51
|
console.log('获取指纹JS token 异常', e)
|
|
50
52
|
reject({
|
|
51
53
|
ok: false,
|
|
52
54
|
error: e,
|
|
53
55
|
})
|
|
54
56
|
}
|
|
55
57
|
})
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
async getFmInfo() {
|
|
59
61
|
try {
|
|
60
62
|
const { ok, data } = await this._getMobileJsToken()
|
|
61
63
|
this.fmInfo = ok && data ? data : this.fmInfo
|
|
62
64
|
return this.fmInfo
|
|
63
65
|
} catch (e) {
|
|
64
66
|
console.log('获取指纹信息异常', e)
|
|
65
67
|
return this.fmInfo
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
_initSign() {
|
|
70
72
|
this.paramsSignInstance = window.PSign
|
|
71
73
|
? window.PSign
|
|
72
74
|
: window.ParamsSign
|
|
73
75
|
? this._initParamsSignInstance(SHOP_VERIFY_CODE)
|
|
74
76
|
: null
|
|
75
77
|
this.paramsSignPagesInstance = window.ParamsSign
|
|
76
78
|
? this._initParamsSignInstance(PAGES_VERIFY_CODE)
|
|
77
79
|
: null
|
|
78
80
|
this.paramsSignBmallInstance = window.ParamsSign
|
|
79
81
|
? this._initParamsSignInstance(B2B_VERITY_CODE)
|
|
80
82
|
: null
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
_initParamsSignInstance(appId) {
|
|
84
86
|
return new window.ParamsSign({
|
|
85
87
|
appId: appId,
|
|
86
88
|
debug: false,
|
|
87
89
|
preRequest: false,
|
|
88
90
|
onSign: ({ code }) => {
|
|
89
91
|
console.log('签名可用率监控', code)
|
|
90
92
|
},
|
|
91
93
|
onRequestTokenRemotely: ({ code, message }) => {
|
|
92
94
|
console.log('算法接口可用率监控', code, message)
|
|
93
95
|
},
|
|
94
96
|
onRequestToken: ({ code, message }) => {
|
|
95
97
|
console.log('token的可用率监控', code, message)
|
|
96
98
|
},
|
|
97
99
|
})
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
paramsSign(data) {
|
|
101
103
|
try {
|
|
102
104
|
console.log('获取加签参数', data, this.paramsSignInstance)
|
|
103
105
|
if (!data || typeof data !== 'object' || !this.paramsSignInstance) {
|
|
104
106
|
return Promise.resolve(data)
|
|
105
107
|
} else {
|
|
106
108
|
const param: any = {
|
|
107
109
|
appid: data.appid,
|
|
108
110
|
client: data.client,
|
|
109
111
|
clientVersion: data.clientVersion,
|
|
110
112
|
functionId: data.functionId,
|
|
111
113
|
t: data.t,
|
|
112
114
|
sign: data?.sign,
|
|
113
115
|
jsonp: data?.jsonp,
|
|
114
116
|
}
|
|
115
117
|
data && data.body && (param.body = sha256(data.body).toString())
|
|
116
118
|
console.log(
|
|
117
119
|
'获取加签前的参数处理',
|
|
118
120
|
param,
|
|
119
121
|
'获取下发data',
|
|
120
122
|
data,
|
|
121
123
|
'获取加签实例',
|
|
122
124
|
this.paramsSignInstance,
|
|
123
125
|
this.paramsSignPagesInstance,
|
|
124
126
|
)
|
|
125
127
|
return this.isPageDomain &&
|
|
126
128
|
this.paramsSignPagesInstance &&
|
|
127
129
|
AppVerifyColorList.includes(param.functionId)
|
|
128
130
|
? this.paramsSignPagesInstance.sign(param)
|
|
129
131
|
: this.paramsSignBmallInstance &&
|
|
130
132
|
B2BColorFunctionIdList.includes(param.functionId)
|
|
131
133
|
? this.paramsSignBmallInstance.sign(param)
|
|
132
134
|
: this.paramsSignInstance.sign(param)
|
|
133
135
|
}
|
|
134
136
|
} catch (e) {
|
|
135
137
|
console.log('获取加签参数结果异常', e)
|
|
136
138
|
return Promise.resolve(data)
|
|
137
139
|
}
|
|
138
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const HttpStatus = {
|
|
2
1
|
SUCCESS: 200,
|
|
3
2
|
CREATED: 201,
|
|
4
3
|
ACCEPTED: 202,
|
|
5
4
|
CLIENT_ERROR: 400,
|
|
6
5
|
AUTHENTICATE: 401,
|
|
7
6
|
FORBIDDEN: 403,
|
|
8
7
|
NOT_FOUND: 404,
|
|
9
8
|
SERVER_ERROR: 500,
|
|
10
9
|
BAD_GATEWAY: 502,
|
|
11
10
|
SERVICE_UNAVAILABLE: 503,
|
|
12
11
|
GATEWAY_TIMEOUT: 504
|
|
13
12
|
[HttpStatus.NOT_FOUND]: "请求资源不存在",
|
|
14
13
|
[HttpStatus.BAD_GATEWAY]: "服务端异常,请稍后重试",
|
|
15
14
|
[HttpStatus.FORBIDDEN]: "没有权限访问",
|
|
16
15
|
[HttpStatus.AUTHENTICATE]: "需要鉴权",
|
|
17
16
|
[HttpStatus.SUCCESS]: "成功"
|
|
17
|
+
export const HttpStatus = {
|
|
18
18
|
SUCCESS: 200,
|
|
19
19
|
CREATED: 201,
|
|
20
20
|
ACCEPTED: 202,
|
|
21
21
|
CLIENT_ERROR: 400,
|
|
22
22
|
AUTHENTICATE: 401,
|
|
23
23
|
FORBIDDEN: 403,
|
|
24
24
|
NOT_FOUND: 404,
|
|
25
25
|
SERVER_ERROR: 500,
|
|
26
26
|
BAD_GATEWAY: 502,
|
|
27
27
|
SERVICE_UNAVAILABLE: 503,
|
|
28
28
|
GATEWAY_TIMEOUT: 504,
|
|
29
29
|
[HttpStatus.NOT_FOUND]: '请求资源不存在',
|
|
30
30
|
[HttpStatus.BAD_GATEWAY]: '服务端异常,请稍后重试',
|
|
31
31
|
[HttpStatus.FORBIDDEN]: '没有权限访问',
|
|
32
32
|
[HttpStatus.AUTHENTICATE]: '需要鉴权',
|
|
33
33
|
[HttpStatus.SUCCESS]: '成功',
|
|
34
34
|
'whx_getShopHomeFloorInfo',
|
|
35
35
|
'whx_searchWare',
|
|
36
36
|
'shopGuessYouLike',
|
|
37
37
|
'whx_getMShopCategory',
|
|
38
38
|
'whx_newWareList',
|
|
39
39
|
'getShopHomePromotionWebPage',
|
|
40
40
|
'whx_getShopCampaignPage',
|
|
41
41
|
'whx_getPromotionWares',
|
|
42
42
|
'whx_buyerShowPage',
|
|
43
43
|
'whx_getShopGwredPage',
|
|
44
44
|
'whx_getShopSpeciSecKillPage',
|
|
45
45
|
'whx_getSignInfo',
|
|
46
46
|
'whx_getSignPrize',
|
|
47
47
|
'getShopHomeFloorInfo',
|
|
48
48
|
'shopGuessYouLike',
|
|
49
49
|
'getShopHomePromotionWebPage',
|
|
50
50
|
'getVipDetail',
|
|
51
51
|
'getShopCategory',
|
|
52
52
|
'getShopNavigationCategory',
|
|
53
53
|
'getPagePreview',
|
|
54
54
|
'bmall_cart',
|
|
55
55
|
'bmall_getOmittedProduct',
|
|
56
56
|
'bmall_cartAdd',
|
|
57
57
|
'bmall_cartChange',
|
|
58
58
|
'bmall_cartRemove',
|
|
59
59
|
'getShopHomeFloorInfo',
|
|
60
60
|
'getShopCategory',
|
|
61
61
|
'getShopNavigationCategory',
|
|
62
62
|
'receiveShopCoupon',
|
|
63
63
|
'getShopHomePromotionWebPage',
|
|
64
64
|
'shopGuessYouLike',
|
|
65
65
|
'addRemind',
|
|
66
66
|
'cancelRemind',
|
|
67
67
|
'getVipDetail',
|
|
68
68
|
'shopDetail',
|
|
69
69
|
'address_queryAddress',
|
|
70
70
|
'shopMemberSprintJoinActivity',
|
|
71
71
|
'shopMemberSprintReceivePrize',
|
|
72
72
|
'customerCenterDispatch'
|
|
73
73
|
'bmall_cart',
|
|
74
74
|
'bmall_getOmittedProduct',
|
|
75
75
|
'bmall_cartAdd',
|
|
76
76
|
'bmall_cartChange',
|
|
77
77
|
'bmall_cartRemove',
|
|
78
78
|
SHOP_COLOR_APPID: 'shop_m_jd_com',
|
|
79
79
|
JSHOPX_COLOR_APPID: 'jshopx_jd_com',
|
|
80
80
|
PAGES_COLOR_APPID: 'pages_jd_com',
|
|
81
81
|
B2B_COLOR_APPID: 'b2b',
|
|
82
82
|
SHOP_MEMBER_COLOR_APPID: 'shopmember_m_jd_com'
|