@conecli/cone-render 0.8.20 → 0.8.21-shop-beta.3
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/api/index.ts +1 -1
- 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/common/isvStorage/index.h5.ts +1 -0
- package/dist/common/isvStorage/index.ts +1 -0
- package/dist/common/token/const.ts +1 -0
- package/dist/common/token/index.h5.ts +1 -0
- package/dist/common/token/index.ts +1 -0
- package/dist/common/token/token.jd.ts +1 -0
- package/dist/common/token/token.ts +1 -0
- package/dist/common/token/token.wxapp.ts +1 -0
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +1 -1
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/CustomVideo/const.ts +1 -0
- package/dist/components/base/CustomVideo/index.module.scss +40 -64
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +6 -2
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/const.ts +1 -0
- package/dist/components/base/ExposureSmart/index.h5.module.scss +18 -4
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.module.scss +20 -9
- package/dist/components/base/ExposureSmart/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
- package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
- package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
- package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +7 -1
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
- package/dist/components/base/Price/Base/index.module.scss +136 -0
- package/dist/components/base/Price/Base/index.tsx +1 -0
- package/dist/components/base/Price/Double/index.module.scss +158 -0
- package/dist/components/base/Price/Double/index.tsx +1 -0
- package/dist/components/base/Price/index.tsx +1 -1
- package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
- package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
- package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
- package/dist/components/floorItem.jd.tsx +1 -0
- package/dist/components/floorItem.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -0
- package/dist/interface/common.ts +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/interface/jumpEventReport.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/index.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web/report.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/jumpEventReport/web.jdb.ts +1 -0
- package/dist/jumpEventReport/web.jdjch.ts +1 -0
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +10 -1
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/device.ts +1 -1
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/jump/business.ts +1 -0
- package/dist/open/api/jump/index.ts +1 -0
- package/dist/open/api/jump/minPath.ts +1 -0
- package/dist/open/api/jump/side.ts +1 -0
- package/dist/open/api/jump/webUrl.ts +1 -0
- package/dist/open/api/jump copy.ts +1 -0
- package/dist/open/api/moduleUtil.ts +1 -1
- package/dist/open/api/request.ts +1 -0
- package/dist/open/api/shopMember.ts +1 -0
- package/dist/open/api/track.ts +1 -1
- package/dist/open/api/userToken.ts +1 -0
- package/dist/open/api/util.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- package/dist/service/bMallConst.ts +1 -0
- package/dist/service/bMallConst.weapp.ts +1 -0
- package/dist/service/fetchGateway.ts +1 -0
- package/dist/service/fetchJsonp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -0
- package/dist/service/http/colorSign.weapp.ts +1 -0
- package/dist/service/http/const.ts +1 -0
- package/dist/service/http/http.ts +1 -0
- package/dist/service/http/httpInterceptors.jd.ts +1 -0
- package/dist/service/http/httpInterceptors.ts +1 -0
- package/dist/service/http/index.ts +1 -0
- package/dist/service/requestServer.ts +1 -0
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/connectNativeJsBridge.weapp.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/intersectionObserver.ts +1 -1
- package/dist/utils/jm-common.js +1 -1
- package/dist/utils/memberFormatUtils.js +1 -0
- package/dist/utils/priceUtils.js +1 -0
- package/dist/utils/ready.ts +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +9 -5
- package/dist/components/base/Price/index.module.scss +0 -136
- package/dist/open/api/jump.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
2
|
TaroEventType,
|
|
1
3
|
JUMP_MEMBER_CHANNEL,
|
|
2
4
|
CENTERDISPATCH_JUMPPAGE_VALUE,
|
|
3
5
|
|
|
4
6
|
CARD_BANNER = 'shopMemberCardVenderCardBanner',
|
|
5
7
|
|
|
6
8
|
CARD_NAME = 'shopMemberCardVenderCardName',
|
|
7
9
|
|
|
8
10
|
MEMBERSHIP_LEVEL = 'shopMemberCardMembershipLevel',
|
|
9
11
|
|
|
10
12
|
MEMBERSHIP_RULE_ENTRANCE = 'shopMemberCardMembershipRuleEntrance',
|
|
11
13
|
|
|
12
14
|
MEMBERSHIP_POINT = 'shopMemberCardMembershipPoint',
|
|
13
15
|
return new Promise((resolve) => {
|
|
14
16
|
requestServer
|
|
15
17
|
.getCustomerCenterDispatch(params)
|
|
16
18
|
.then(async (response) => {
|
|
17
19
|
if (response.result && response.code === '0') {
|
|
18
20
|
resolve(response.result)
|
|
19
21
|
} else {
|
|
20
22
|
resolve({
|
|
21
23
|
jumpPage:
|
|
22
24
|
response.code === '1'
|
|
23
25
|
? CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
|
|
24
26
|
: CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR,
|
|
25
27
|
})
|
|
26
28
|
}
|
|
27
29
|
})
|
|
28
30
|
.catch((err) => {
|
|
29
31
|
resolve({ jumpPage: CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR })
|
|
30
32
|
console.log('oneKeyJoinMember getcustomerCenterDispatch err', err)
|
|
31
33
|
})
|
|
32
34
|
})
|
|
33
35
|
const currentVenderId = global.info.queryInfo.venderId
|
|
34
36
|
const currentShopId = global.info.queryInfo.shopId
|
|
35
37
|
const channel = JUMP_MEMBER_CHANNEL.POP_WEBVIEW
|
|
36
38
|
const toastOpt = {
|
|
37
39
|
duration: 3000,
|
|
38
40
|
image:
|
|
39
41
|
'https://img13.360buyimg.com/img/jfs/t1/196933/39/19850/1479/61b059aaEe969b8db/acb37a47b9034333.png',
|
|
40
42
|
}
|
|
41
43
|
const params = {
|
|
42
44
|
venderId: currentVenderId,
|
|
43
45
|
channel,
|
|
44
46
|
queryVersion:
|
|
45
47
|
isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '9.2.0',
|
|
46
48
|
}
|
|
47
49
|
const centerDispatchResult = await getCenterDispatchResult(params)
|
|
48
50
|
console.log(
|
|
49
51
|
'oneKeyJoinMember getcustomerCenterDispatch 接口返回值',
|
|
50
52
|
centerDispatchResult,
|
|
51
53
|
)
|
|
52
54
|
const { jumpPage } = centerDispatchResult
|
|
53
55
|
if (typeof jumpPage !== 'number') {
|
|
54
56
|
console.log(
|
|
55
57
|
'oneKeyJoinMember getcustomerCenterDispatch 接口返回 jumpPage 值类型异常,非数字',
|
|
56
58
|
)
|
|
57
59
|
showFailToast({
|
|
58
60
|
title: '网络繁忙,稍后再试吧~',
|
|
59
61
|
...toastOpt,
|
|
60
62
|
})
|
|
61
63
|
return
|
|
62
64
|
}
|
|
63
65
|
const centerDispatchJumpPageValue = Number(jumpPage)
|
|
64
66
|
if (
|
|
65
67
|
centerDispatchJumpPageValue ===
|
|
66
68
|
CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR ||
|
|
67
69
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR
|
|
68
70
|
) {
|
|
69
71
|
console.log(
|
|
70
72
|
'oneKeyJoinMember getcustomerCenterDispatch 接口网络异常或接口异常',
|
|
71
73
|
jumpPage,
|
|
72
74
|
)
|
|
73
75
|
showFailToast({
|
|
74
76
|
title: '网络繁忙,稍后再试吧~',
|
|
75
77
|
...toastOpt,
|
|
76
78
|
})
|
|
77
79
|
return
|
|
78
80
|
}
|
|
79
81
|
if (
|
|
80
82
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
|
|
81
83
|
) {
|
|
82
84
|
console.log(
|
|
83
85
|
'oneKeyJoinMember getcustomerCenterDispatch 接口返回未登录,跳登录页',
|
|
84
86
|
)
|
|
85
87
|
global
|
|
86
88
|
.doLogin()
|
|
87
89
|
.then((res) => {
|
|
88
90
|
console.log('登录成功', res)
|
|
89
91
|
})
|
|
90
92
|
.catch((err) => {
|
|
91
93
|
console.log('登录失败', err)
|
|
92
94
|
})
|
|
93
95
|
return
|
|
94
96
|
}
|
|
95
97
|
const memberRoleJumpPageValueArr = [
|
|
96
98
|
CENTERDISPATCH_JUMPPAGE_VALUE.MEMBER_CENTER,
|
|
97
99
|
CENTERDISPATCH_JUMPPAGE_VALUE.ISV_MEMBER,
|
|
98
100
|
CENTERDISPATCH_JUMPPAGE_VALUE.JSHOP_ISV_PAGE,
|
|
99
101
|
]
|
|
100
102
|
const isMemberRole = memberRoleJumpPageValueArr.includes(
|
|
101
103
|
centerDispatchJumpPageValue,
|
|
102
104
|
)
|
|
103
105
|
if (isMemberRole) {
|
|
104
106
|
showFailToast({
|
|
105
107
|
title: '您已是本店会员,无需再次入会',
|
|
106
108
|
...toastOpt,
|
|
107
109
|
})
|
|
108
110
|
return
|
|
109
111
|
}
|
|
110
112
|
if (!isH5AndJdShopView) {
|
|
111
113
|
JumpEventReport.jdJumpToNewH5MemberCard()
|
|
112
114
|
return
|
|
113
115
|
}
|
|
114
116
|
const { isDegrade = true, isLowVersion = true } = centerDispatchResult
|
|
115
117
|
console.log('一键入会,是否已降级', isDegrade)
|
|
116
118
|
console.log('一键入会,是否低版本', isLowVersion)
|
|
117
119
|
if (isDegrade) {
|
|
118
120
|
console.log('一键入会,已降级')
|
|
119
121
|
showFailToast({
|
|
120
122
|
title: '网络繁忙,稍后再试吧~',
|
|
121
123
|
...toastOpt,
|
|
122
124
|
})
|
|
123
125
|
return
|
|
124
126
|
}
|
|
125
127
|
if (isLowVersion) {
|
|
126
128
|
console.log('一键入会,低版本')
|
|
127
129
|
JumpEventReport.jdJumpToMemberTab()
|
|
128
130
|
return
|
|
129
131
|
}
|
|
130
132
|
return new Promise((resolve) => {
|
|
131
133
|
const memberCardurl = `${JumpWebUrl.shopH5MemberCardAPP}?venderId=${currentVenderId}&shopId=${currentShopId}&channel=${JUMP_MEMBER_CHANNEL.POP_WEBVIEW}`
|
|
132
134
|
const sourceUrl = encodeURIComponent(window.location.href || '')
|
|
133
135
|
const url =
|
|
134
136
|
sourceUrl && sourceUrl !== ''
|
|
135
137
|
? `${memberCardurl}&sourceUrl=${sourceUrl}`
|
|
136
138
|
: memberCardurl
|
|
137
139
|
console.log('openPopWebview url', url)
|
|
138
140
|
nativeOpenPopWebView({
|
|
139
141
|
url,
|
|
140
142
|
})
|
|
141
143
|
Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS)
|
|
142
144
|
Taro.eventCenter.on(TaroEventType.JOIN_MEMBER_SUCCESS, (res) => {
|
|
143
145
|
console.log('TaroEventType.JOIN_MEMBER_SUCCESS res', res)
|
|
144
146
|
const { shopId, venderId } = res
|
|
145
147
|
if (shopId === currentShopId && venderId === currentVenderId) {
|
|
146
148
|
resolve(true)
|
|
147
149
|
} else {
|
|
148
150
|
console.log(
|
|
149
151
|
'TaroEventType.JOIN_MEMBER_SUCCESS shopId venderId 不匹配,currentShopId, currentVenderId',
|
|
150
152
|
currentShopId,
|
|
151
153
|
currentVenderId,
|
|
152
154
|
)
|
|
153
155
|
resolve(false)
|
|
154
156
|
}
|
|
155
157
|
})
|
|
156
158
|
})
|
package/dist/open/api/track.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import { JumpEventReport, JumpEventReportPromise } from '../../jumpEventReport'
|
|
2
1
|
initReportBaseData: ReportContainerData.initReportBaseData.bind(ReportContainerData),
|
|
3
2
|
updateSectionTabDataInfo: ReportContainerData.updateSectionTabDataInfo.bind(ReportContainerData),
|
|
3
|
+
import { JumpEventReport, JumpEventReportPromise } from '../../jumpEventReport'
|
|
4
4
|
initOpenTriggerExposure: (type: string) => void
|
|
5
5
|
logPageIdInfo: Object
|
|
6
6
|
logPnameInfo: Object
|
|
7
7
|
getFloorPointIndexClassName: (obj: object, index?: number, tip?: string) => string
|
|
8
8
|
initOpenTriggerExposure: () => {},
|
|
9
9
|
initOpenTriggerExposure,
|
|
10
10
|
logPageIdInfo,
|
|
11
11
|
logPnameInfo
|
|
12
12
|
initReportBaseData: ReportContainerData.initReportBaseData.bind(ReportContainerData),
|
|
13
13
|
updateSectionTabDataInfo: ReportContainerData.updateSectionTabDataInfo.bind(ReportContainerData),
|
|
14
14
|
initOpenTriggerExposure: initOpenTriggerExposure.bind(JumpEventReport),
|
|
15
15
|
logPnameInfo: logPnameInfo,
|
|
16
16
|
logPageIdInfo: logPageIdInfo,
|
|
17
17
|
getFloorPointIndexClassName: ReportContainerData.getFloorPointIndexClassName.bind(ReportContainerData)
|
package/dist/open/api/util.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
2
|
dateFormat,
|
|
3
3
|
showSuccessToast,
|
|
4
4
|
showFailToast,
|
|
5
5
|
showNormalToast,
|
|
6
6
|
isJdApp,
|
|
7
7
|
isH5AndJdShopView,
|
|
8
8
|
isH5,
|
|
9
9
|
isH5AndJdShopViewH5Scroll
|
|
10
10
|
openTaroEventDialog,
|
|
11
11
|
closeTaroEventDialog,
|
|
12
12
|
dateFormat,
|
|
13
13
|
showSuccessToast,
|
|
14
14
|
showFailToast,
|
|
15
15
|
showNormalToast,
|
|
16
16
|
openDialog: openTaroEventDialog,
|
|
17
17
|
closeDialog: closeTaroEventDialog,
|
|
18
18
|
isJdApp,
|
|
19
19
|
isH5AndJdShopView,
|
|
20
20
|
isH5,
|
|
21
21
|
isH5AndJdShopViewH5Scroll
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { isAndroidDevice } from '../utils'
|
|
2
|
buId: '',
|
|
1
3
|
console.log('getBMallUserInfo')
|
|
2
4
|
if (!(isApp('jdb') || isApp('jdjch'))) {
|
|
3
5
|
return null
|
|
4
6
|
}
|
|
5
7
|
if (bMallUserInfo) {
|
|
6
8
|
return new Promise((resolve) => resolve(bMallUserInfo))
|
|
7
9
|
}
|
|
8
10
|
const requestTimeoutPromise = new Promise((resolve) => {
|
|
9
11
|
setTimeout(() => {
|
|
10
12
|
resolve({})
|
|
11
13
|
}, 3000)
|
|
12
14
|
})
|
|
13
15
|
const userInfoPromise = new Promise((resolve) => {
|
|
14
16
|
let result: any = {}
|
|
15
17
|
try {
|
|
16
18
|
if(isApp('jdjch')) {
|
|
17
19
|
const { user } = window['@jd/jdb-jssdk-b2b'] || {}
|
|
18
20
|
user && user.getUserInfo().then((res) => {
|
|
19
21
|
resolve(res?.data || {})
|
|
20
22
|
})
|
|
21
23
|
}else {
|
|
22
24
|
if (isAndroidDevice) {
|
|
23
25
|
result = JSON.parse(
|
|
24
26
|
window.WebViewCommon && window.WebViewCommon.getUserInfo(),
|
|
25
27
|
)
|
|
26
28
|
bMallUserInfo = result
|
|
27
29
|
commonParam.buId = result?.data?.buId
|
|
28
30
|
resolve(result)
|
|
29
31
|
} else {
|
|
30
32
|
window.getUserInfoCallBack = null
|
|
31
33
|
window.getUserInfoCallBack = function (callBackJson) {
|
|
32
34
|
if (callBackJson) {
|
|
33
35
|
result.data = JSON.parse(callBackJson)
|
|
34
36
|
bMallUserInfo = result
|
|
35
37
|
commonParam.buId = result?.data?.buId
|
|
36
38
|
resolve(result)
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
window?.webkit?.messageHandlers?.WebViewCommon?.postMessage({
|
|
40
42
|
businessType: 'router://com.jd.jlstudio/getUserInfo',
|
|
41
43
|
params: {},
|
|
42
44
|
callBackName: 'getUserInfoCallBack',
|
|
43
45
|
method: 'callRouterModuleWithParams',
|
|
44
46
|
})
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
} catch (e) {
|
|
48
50
|
resolve(result)
|
|
49
51
|
}
|
|
50
52
|
})
|
|
51
53
|
return Promise.race([userInfoPromise, requestTimeoutPromise])
|
|
52
54
|
process.env.NODE_ENV === 'development'
|
|
53
55
|
? {
|
|
54
56
|
apolloId: '48ee955b0fb04d19b9f9fe8cb73d387f',
|
|
55
57
|
apolloSecret: '0d9c76ee66b0487da4e17d3cf1d7af7a',
|
|
56
58
|
}
|
|
57
59
|
: {
|
|
58
60
|
apolloId: '80c46fd06e4442998609d9f6a4ab96f0',
|
|
59
61
|
apolloSecret: 'f36bef08bcba4683b409732095793fb2',
|
|
60
62
|
}
|
|
61
63
|
if (typeof window.crypto === 'object') {
|
|
62
64
|
if (typeof (window.crypto as any).randomUUID === 'function') {
|
|
63
65
|
return (window.crypto as any).randomUUID()
|
|
64
66
|
}
|
|
65
67
|
if (
|
|
66
68
|
typeof (window.crypto as any).getRandomValues === 'function' &&
|
|
67
69
|
typeof Uint8Array === 'function'
|
|
68
70
|
) {
|
|
69
71
|
const callback = (c) => {
|
|
70
72
|
const num = Number(c)
|
|
71
73
|
return (
|
|
72
74
|
num ^
|
|
73
75
|
((window.crypto as any).getRandomValues(new Uint8Array(1))[0] &
|
|
74
76
|
(15 >> (num / 4)))
|
|
75
77
|
).toString(16)
|
|
76
78
|
}
|
|
77
79
|
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, callback)
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
let timestamp = new Date().getTime()
|
|
81
83
|
let perforNow =
|
|
82
84
|
(typeof window.performance !== 'undefined' &&
|
|
83
85
|
window.performance.now &&
|
|
84
86
|
window.performance.now() * 1000) ||
|
|
85
87
|
0
|
|
86
88
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
87
89
|
let random = Math.random() * 16
|
|
88
90
|
if (timestamp > 0) {
|
|
89
91
|
random = (timestamp + random) % 16 | 0
|
|
90
92
|
timestamp = Math.floor(timestamp / 16)
|
|
91
93
|
} else {
|
|
92
94
|
random = (perforNow + random) % 16 | 0
|
|
93
95
|
perforNow = Math.floor(perforNow / 16)
|
|
94
96
|
}
|
|
95
97
|
return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
|
|
96
98
|
})
|
|
97
99
|
skuId,
|
|
98
100
|
bMallTag = 1,
|
|
99
101
|
num,
|
|
100
102
|
skuUuid,
|
|
101
103
|
...otherGoodParams
|
|
102
104
|
let buId = commonParam.buId
|
|
103
105
|
if (!buId) {
|
|
104
106
|
const useInfo: any = await getBMallUserInfo()
|
|
105
107
|
buId = useInfo?.data?.buId
|
|
106
108
|
}
|
|
107
109
|
let params: any = {
|
|
108
110
|
uniformBizInfo: {
|
|
109
111
|
tenantId: 1024,
|
|
110
112
|
ua: 1,
|
|
111
113
|
buId: buId || 456,
|
|
112
114
|
bMallTag: bMallTag,
|
|
113
115
|
},
|
|
114
116
|
commonParam: {
|
|
115
117
|
pid: 100,
|
|
116
118
|
verticalCode: 'cn_retail_bmall',
|
|
117
119
|
ua: 1,
|
|
118
120
|
language: 'zh',
|
|
119
121
|
},
|
|
120
122
|
operations: [{ TheSkus: [{ Id: skuId, num: num ?? 1 }] }],
|
|
121
123
|
apolloId: APOLLO.apolloId,
|
|
122
124
|
apolloSecret: APOLLO.apolloSecret,
|
|
123
125
|
client: 'H5',
|
|
124
126
|
verticalTag: 'cn_retail_bmall',
|
|
125
127
|
carttype: bMallTag == 1 ? 21 : 22,
|
|
126
128
|
bMallTag: bMallTag,
|
|
127
129
|
traceId: getUuid(),
|
|
128
130
|
noResponse: true,
|
|
129
131
|
}
|
|
130
132
|
if (skuUuid) {
|
|
131
133
|
params.operations[0].TheSkus[0].skuUuid = skuUuid
|
|
132
134
|
}
|
|
133
135
|
if (otherGoodParams.buId) {
|
|
134
136
|
const uniformBizInfo = {
|
|
135
137
|
buId: otherGoodParams.buId,
|
|
136
138
|
}
|
|
137
139
|
params.operations[0].TheSkus[0].uniformBizInfo = uniformBizInfo
|
|
138
140
|
}
|
|
139
141
|
if (window?.siteTransResult?.gridInfoList) {
|
|
140
142
|
params = {
|
|
141
143
|
...params,
|
|
142
144
|
cartLocationList: [
|
|
143
145
|
{
|
|
144
146
|
gridInfos:
|
|
145
147
|
window?.siteTransResult?.gridInfoList &&
|
|
146
148
|
JSON.parse(window?.siteTransResult?.gridInfoList),
|
|
147
149
|
areaIdSet:
|
|
148
150
|
window?.siteTransResult?.area &&
|
|
149
151
|
window?.siteTransResult?.area?.split('-'),
|
|
150
152
|
},
|
|
151
153
|
],
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
156
|
return params
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { api } from '../api'
|
|
2
|
clientVersion: '11.0.0',
|
|
1
3
|
client: 'wh5',
|
|
2
4
|
area: '1_72_2799_0',
|
|
3
5
|
loginType: '2',
|
|
4
6
|
uuid: UUID,
|
|
5
7
|
functionId: string,
|
|
6
8
|
body = {},
|
|
7
9
|
options = {},
|
|
8
10
|
requestOptions = {},
|
|
9
11
|
const params = Object.assign(
|
|
10
12
|
{},
|
|
11
13
|
{
|
|
12
14
|
t: Date.now(),
|
|
13
15
|
functionId,
|
|
14
16
|
appid: 'shop_m_jd_com',
|
|
15
17
|
body: JSON.stringify(body),
|
|
16
18
|
},
|
|
17
19
|
clientParams,
|
|
18
20
|
options,
|
|
19
21
|
)
|
|
20
22
|
console.warn(
|
|
21
23
|
'fetchGateway url:' + api.apiFunc + ',functionId:' + params.functionId,
|
|
22
24
|
)
|
|
23
25
|
return http.post(api.apiFunc, params, requestOptions)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const defaultOptions = {
|
|
2
|
timeout: 5000,
|
|
1
3
|
jsonpCallback: 'callback',
|
|
2
4
|
return `jsonp_${Date.now()}_${Math.ceil(Math.random() * 100000)}`
|
|
3
5
|
try {
|
|
4
6
|
delete window[functionName]
|
|
5
7
|
} catch (e) {
|
|
6
8
|
window[functionName] = undefined
|
|
7
9
|
}
|
|
8
10
|
const script = document.getElementById(scriptId)
|
|
9
11
|
document.getElementsByTagName('head')[0].removeChild(script)
|
|
10
12
|
const timeout =
|
|
11
13
|
|
|
12
14
|
options.timeout != null ? options.timeout : defaultOptions.timeout
|
|
13
15
|
const jsonpCallback =
|
|
14
16
|
|
|
15
17
|
options.jsonpCallback != null
|
|
16
18
|
? options.jsonpCallback
|
|
17
19
|
: defaultOptions.jsonpCallback
|
|
18
20
|
let timeoutId: string | number | NodeJS.Timeout | undefined
|
|
19
21
|
return new Promise((resolve, reject) => {
|
|
20
22
|
const callbackFunction = generateCallbackFunction()
|
|
21
23
|
window[callbackFunction] = function (response: any) {
|
|
22
24
|
resolve({
|
|
23
25
|
ok: true,
|
|
24
26
|
json: function () {
|
|
25
27
|
return Promise.resolve(response)
|
|
26
28
|
},
|
|
27
29
|
})
|
|
28
30
|
if (timeoutId) clearTimeout(timeoutId)
|
|
29
31
|
removeScript(jsonpCallback + '_' + callbackFunction)
|
|
30
32
|
clearFunction(callbackFunction)
|
|
31
33
|
}
|
|
32
34
|
url += url.indexOf('?') === -1 ? '?' : '&'
|
|
33
35
|
const jsonpScript = document.createElement('script')
|
|
34
36
|
jsonpScript.setAttribute(
|
|
35
37
|
'src',
|
|
36
38
|
url + jsonpCallback + '=' + callbackFunction,
|
|
37
39
|
)
|
|
38
40
|
jsonpScript.id = jsonpCallback + '_' + callbackFunction
|
|
39
41
|
document.getElementsByTagName('head')[0].appendChild(jsonpScript)
|
|
40
42
|
timeoutId = setTimeout(() => {
|
|
41
43
|
reject(new Error(`JSONP request to ${url} timed out`))
|
|
42
44
|
clearFunction(callbackFunction)
|
|
43
45
|
removeScript(jsonpCallback + '_' + callbackFunction)
|
|
44
46
|
}, timeout)
|
|
45
47
|
})
|
|
@@ -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 = 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
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import global from '../../common'
|
|
2
|
WXAPP_VERIFY_CODE,
|
|
1
3
|
WxappVerifyColorList
|
|
2
4
|
public fmInfo: {
|
|
3
5
|
eid?: string
|
|
4
6
|
fp?: string
|
|
5
7
|
jsToken?: string
|
|
6
8
|
sdkToken?: string
|
|
7
9
|
}
|
|
8
10
|
constructor() {
|
|
9
11
|
this.fmInfo = {}
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
async getFmInfo() {
|
|
13
15
|
if (!this.fmInfo["eid"]) {
|
|
14
16
|
try {
|
|
15
17
|
const getFmRes = await global.wxAppFingerReportInstance.getFm();
|
|
16
18
|
console.log("获取指纹信息", getFmRes);
|
|
17
19
|
this.fmInfo = getFmRes;
|
|
18
20
|
return this.fmInfo;
|
|
19
21
|
} catch (e) {
|
|
20
22
|
console.log("获取指纹信息异常", e);
|
|
21
23
|
return this.fmInfo;
|
|
22
24
|
}
|
|
23
25
|
} else {
|
|
24
26
|
return this.fmInfo;
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
paramsSign(data) {
|
|
29
31
|
return global?.wxAppParamsSignInstance
|
|
30
32
|
? global.wxAppParamsSignInstance?.paramsSign({
|
|
31
33
|
color: WxappVerifyColorList.includes(data?.functionId),
|
|
32
34
|
verifyCode: WXAPP_VERIFY_CODE,
|
|
33
35
|
data,
|
|
34
36
|
})
|
|
35
37
|
: Promise.resolve(data)
|
|
36
38
|
}
|