@conecli/cone-render 0.8.28 → 0.8.30
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/token/index.h5.ts +1 -1
- package/dist/common/token/token.ts +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/CustomVideo/index.module.scss +3 -2
- 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/InOrOutViewObserver/index.tsx +1 -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/floorItem.weapp.tsx +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/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/open/api/shopMember.ts +1 -1
- package/dist/service/bMallConst.ts +1 -1
- package/dist/service/bMallConst.wxapp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -1
- package/dist/service/http/colorSign.wxapp.ts +1 -0
- package/dist/service/http/const.ts +1 -1
- package/dist/service/requestServer.ts +1 -1
- package/dist/utils/connectNativeJsBridge.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/jm-common.js +1 -1
- package/dist/utils/memberFormatUtils.js +1 -0
- package/dist/utils/priceUtils.js +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +3 -3
- package/dist/components/base/Price/index.module.scss +0 -136
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
APPID,
|
|
3
2
|
JshopxColorFunctionIdList,
|
|
4
3
|
PagesColorFunctionIdList,
|
|
5
4
|
PAGES_DOMAIN,
|
|
6
5
|
B2BColorFunctionIdList,
|
|
7
6
|
MobileVerifyColorList,
|
|
8
7
|
AppVerifyColorList,
|
|
9
8
|
JshopxVerifyColorList,
|
|
10
9
|
BMallVerifyColorList,
|
|
11
10
|
shopMemberColorFunctionIdList
|
|
12
11
|
cookiesStr: '',
|
|
13
12
|
requestHeaderContentType: {
|
|
14
13
|
jsonHeader: {
|
|
15
14
|
'content-type': 'application/json;charset=utf-8',
|
|
16
15
|
},
|
|
17
16
|
formDataHeader: {
|
|
18
17
|
'content-type': 'application/x-www-form-urlencoded',
|
|
19
18
|
},
|
|
20
19
|
},
|
|
21
20
|
requestBaseParam: {
|
|
22
21
|
data: null,
|
|
23
22
|
header: {
|
|
24
23
|
'content-type': 'application/json;charset=utf-8',
|
|
25
24
|
},
|
|
26
25
|
},
|
|
27
26
|
timeOut: 7000,
|
|
28
27
|
apiClientParams: {
|
|
29
28
|
appid: APPID.SHOP_COLOR_APPID,
|
|
30
29
|
clientVersion:
|
|
31
30
|
isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '11.0.0',
|
|
32
31
|
client: isH5AndJdShopView ? (isIosDevice ? 'apple' : 'android') : 'wh5',
|
|
33
32
|
area: '1_72_2799_0',
|
|
34
33
|
uuid: UUID,
|
|
35
34
|
},
|
|
36
35
|
public addressFetchInfo: {
|
|
37
36
|
reqState: boolean
|
|
38
37
|
promiseInstance: null | Promise<any>
|
|
39
38
|
}
|
|
40
39
|
public getPromotionConfig: {
|
|
41
40
|
projectId: null | string | number
|
|
42
41
|
pageId: null | string | number
|
|
43
42
|
}
|
|
44
43
|
public resInfo: ServiceInterFace.HttpRequestInfo
|
|
45
44
|
public api: ServiceInterFace.HttpApi
|
|
46
45
|
public isPageDomain: boolean
|
|
47
46
|
public verifyColorList: string[]
|
|
48
47
|
constructor(opt) {
|
|
49
48
|
this._init()
|
|
50
49
|
this.addressFetchInfo = {
|
|
51
50
|
reqState: false,
|
|
52
51
|
promiseInstance: null,
|
|
53
52
|
}
|
|
54
53
|
this.getPromotionConfig = {
|
|
55
54
|
projectId: null,
|
|
56
55
|
pageId: null,
|
|
57
56
|
}
|
|
58
57
|
this._userAreaUpdateListen()
|
|
59
58
|
this.resInfo = this._getResConfig(opt)
|
|
60
59
|
this.api = api
|
|
61
60
|
this.isPageDomain = window.location.hostname === PAGES_DOMAIN
|
|
62
61
|
this.verifyColorList = [
|
|
63
62
|
...MobileVerifyColorList,
|
|
64
63
|
...AppVerifyColorList,
|
|
65
64
|
...JshopxVerifyColorList,
|
|
66
65
|
...BMallVerifyColorList,
|
|
67
66
|
]
|
|
68
67
|
}
|
|
69
68
|
_init(): void {
|
|
70
69
|
httpInterceptors.forEach((item) => {
|
|
71
70
|
Taro.addInterceptor((chain) => item(chain))
|
|
72
71
|
})
|
|
73
72
|
}
|
|
74
73
|
_getResConfig(opt = {}): ServiceInterFace.HttpRequestInfo {
|
|
75
74
|
return Object.assign({}, DefaultConfig, opt)
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
_userAreaUpdateListen() {
|
|
79
78
|
Taro.eventCenter.on(TaroEventType.USER_AREA_UPDATE, (area) => {
|
|
80
79
|
this.updateApiClientParamsResInfo({
|
|
81
80
|
area,
|
|
82
81
|
})
|
|
83
82
|
})
|
|
84
83
|
}
|
|
85
84
|
updateApiClientParamsResInfo(opt = {}) {
|
|
86
85
|
this.resInfo.apiClientParams = {
|
|
87
86
|
...this.resInfo.apiClientParams,
|
|
88
87
|
...opt,
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
checkFunctionIdToReturnAppId(functionId) {
|
|
93
92
|
if (JshopxColorFunctionIdList.includes(functionId)) {
|
|
94
93
|
return APPID.JSHOPX_COLOR_APPID
|
|
95
94
|
} else if (
|
|
96
95
|
this.isPageDomain &&
|
|
97
96
|
PagesColorFunctionIdList.includes(functionId)
|
|
98
97
|
) {
|
|
99
98
|
return APPID.PAGES_COLOR_APPID
|
|
100
99
|
} else if (shopMemberColorFunctionIdList.includes(functionId)) {
|
|
101
100
|
return APPID.SHOP_MEMBER_COLOR_APPID
|
|
102
101
|
}else if (B2BColorFunctionIdList.includes(functionId)) {
|
|
103
102
|
return APPID.B2B_COLOR_APPID
|
|
104
103
|
} else {
|
|
105
104
|
return APPID.SHOP_COLOR_APPID
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
gatewayReq(
|
|
110
109
|
functionId: string,
|
|
111
110
|
bodyParams = {},
|
|
112
111
|
clientParams = {},
|
|
113
112
|
): Promise<any> {
|
|
114
113
|
if (
|
|
115
114
|
functionId === 'receiveShopCoupon' &&
|
|
116
115
|
((isH5 && window.isJingGouMiniViewState) || isWxMinAndWxapp)
|
|
117
116
|
) {
|
|
118
117
|
clientParams = Object.assign(
|
|
119
118
|
{},
|
|
120
119
|
{
|
|
121
120
|
loginType: '1',
|
|
122
121
|
loginWQBiz: WXAPP_BIZ_KEY,
|
|
123
122
|
},
|
|
124
123
|
clientParams,
|
|
125
124
|
)
|
|
126
125
|
}
|
|
127
126
|
const apiClientParams = Object.assign(
|
|
128
127
|
{},
|
|
129
128
|
this.resInfo.apiClientParams,
|
|
130
129
|
clientParams,
|
|
131
130
|
)
|
|
132
131
|
typeof apiClientParams.appid === 'undefined' && (apiClientParams.appid = this.checkFunctionIdToReturnAppId(functionId))
|
|
133
132
|
const isColorVerify = this.verifyColorList.includes(functionId)
|
|
134
133
|
const getReqData = {
|
|
135
134
|
functionId: functionId,
|
|
136
135
|
body: JSON.stringify(bodyParams),
|
|
137
136
|
t: Date.now(),
|
|
138
137
|
...apiClientParams,
|
|
139
138
|
}
|
|
140
139
|
return http
|
|
141
140
|
.request({
|
|
142
141
|
url: this.api.apiFunc,
|
|
143
142
|
data: getReqData,
|
|
144
143
|
isColorVerify,
|
|
145
144
|
})
|
|
146
145
|
.then((res: ServiceInterFace.RequestPromiseRes) => {
|
|
147
146
|
const { statusCode, data } = res
|
|
148
147
|
let changeRes: ServiceInterFace.RequestResponseFormatRes = {
|
|
149
148
|
ok: true,
|
|
150
149
|
}
|
|
151
150
|
if (statusCode === 200 && data) {
|
|
152
151
|
const resCode = Object.prototype.hasOwnProperty.call(res.data, 'code')
|
|
153
152
|
? Number(res.data.code)
|
|
154
153
|
: -1
|
|
155
154
|
const subCode = Object.prototype.hasOwnProperty.call(
|
|
156
155
|
res.data,
|
|
157
156
|
'subCode',
|
|
158
157
|
)
|
|
159
158
|
? Number(res.data.subCode)
|
|
160
159
|
: -1
|
|
161
160
|
if (
|
|
162
161
|
data.success === true ||
|
|
163
162
|
data.isSuccess ||
|
|
164
163
|
resCode === 0 ||
|
|
165
164
|
resCode === 200 ||
|
|
166
165
|
subCode === 0
|
|
167
166
|
) {
|
|
168
167
|
changeRes = {
|
|
169
168
|
result: Object.prototype.hasOwnProperty.call(data, 'result')
|
|
170
169
|
? data.result
|
|
171
170
|
: Object.prototype.hasOwnProperty.call(data, 'data')
|
|
172
171
|
? data.data
|
|
173
172
|
: data,
|
|
174
173
|
code: data.code || 200,
|
|
175
174
|
ok: true,
|
|
176
175
|
source: data,
|
|
177
176
|
}
|
|
178
177
|
return changeRes
|
|
179
178
|
} else {
|
|
180
179
|
changeRes = {
|
|
181
180
|
...data,
|
|
182
181
|
ok: false,
|
|
183
182
|
statusCode: res.statusCode,
|
|
184
183
|
}
|
|
185
184
|
return changeRes
|
|
186
185
|
}
|
|
187
186
|
} else {
|
|
188
187
|
changeRes = {
|
|
189
188
|
...data,
|
|
190
189
|
ok: false,
|
|
191
190
|
statusCode: res.statusCode,
|
|
192
191
|
}
|
|
193
192
|
return changeRes
|
|
194
193
|
}
|
|
195
194
|
})
|
|
196
195
|
.catch((res) => {
|
|
197
196
|
return {
|
|
198
197
|
...res,
|
|
199
198
|
ok: false,
|
|
200
199
|
} as ServiceInterFace.RequestResponseFormatRes
|
|
201
200
|
})
|
|
202
201
|
}
|
|
203
202
|
|
|
204
203
|
async receiveCoupon(param = {}, clientParams) {
|
|
205
204
|
return await this.gatewayReq(
|
|
206
205
|
'receiveShopCoupon',
|
|
207
206
|
{
|
|
208
207
|
operation: '3',
|
|
209
208
|
...param,
|
|
210
209
|
},
|
|
211
210
|
clientParams,
|
|
212
211
|
)
|
|
213
212
|
}
|
|
214
213
|
|
|
215
214
|
getCustomerCenterDispatch(params = {}) {
|
|
216
215
|
return this.gatewayReq('customerCenterDispatch', params, {
|
|
217
216
|
clientVersion: '9.2.0',
|
|
218
217
|
client: 'H5',
|
|
219
218
|
uuid: 88888,
|
|
220
219
|
appid: 'shopmember_m_jd_com',
|
|
221
220
|
})
|
|
222
221
|
}
|
|
223
222
|
bMallGetUserInfo = () => {
|
|
224
223
|
return bMallUserInfo
|
|
225
224
|
}
|
|
226
225
|
async bMallAddCart(params = {}) {
|
|
227
226
|
return await this.gatewayReq('bmall_cartAdd', params, {
|
|
228
227
|
client: 'H5',
|
|
229
228
|
clientVersion: '5.5.0'
|
|
230
229
|
})
|
|
231
230
|
}
|
|
232
231
|
async bMallChangeCart(params = {}) {
|
|
233
232
|
return await this.gatewayReq('bmall_cartChange', params, {
|
|
234
233
|
client: 'H5',
|
|
235
234
|
clientVersion: '5.5.0'
|
|
236
235
|
})
|
|
237
236
|
}
|
|
238
237
|
async bMallRemoveCart(params = {}) {
|
|
239
238
|
return await this.gatewayReq(
|
|
240
239
|
'bmall_cartRemove',
|
|
241
240
|
params,
|
|
242
241
|
{
|
|
243
242
|
client: 'H5',
|
|
244
243
|
clientVersion: '5.5.0'
|
|
245
244
|
},
|
|
246
245
|
)
|
|
247
246
|
}
|
|
248
247
|
async bMallGetOmittedProduct(params = {}) {
|
|
249
248
|
return await this.gatewayReq('bmall_getOmittedProduct', params, {
|
|
250
249
|
client: 'H5',
|
|
251
250
|
clientVersion: '5.5.0'
|
|
252
251
|
})
|
|
253
252
|
}
|
|
254
253
|
async bMallAddCartService({ skuId, bMallTag, num, data = {} }) {
|
|
255
254
|
const params = await getParams({ ...data, skuId, bMallTag, num })
|
|
256
255
|
return await this.bMallAddCart(params)
|
|
257
256
|
}
|
|
258
257
|
async bMallGetSkuNumService(bMallTag = 1) {
|
|
259
258
|
const params = await getParams({ bMallTag })
|
|
260
259
|
delete params.operations
|
|
261
260
|
return await this.bMallGetOmittedProduct(params)
|
|
262
261
|
}
|
|
263
262
|
async bMallRemoveCartService({ skuId, bMallTag, num, skuUuid, data = {} }) {
|
|
264
263
|
let params = await getParams({ ...data, skuId, bMallTag, num, skuUuid })
|
|
265
264
|
return await this.bMallRemoveCart(params)
|
|
266
265
|
}
|
|
267
266
|
async bMallChangeCartService({ skuId, bMallTag, num, skuUuid, data = {} }) {
|
|
268
267
|
let params = await getParams({ ...data, skuId, bMallTag, num, skuUuid })
|
|
269
268
|
return await this.bMallChangeCart(params)
|
|
270
269
|
}
|
|
271
270
|
|
|
272
271
|
async bMallGetSkuNumApi(needRequest = false, bMallTag = 1) {
|
|
273
272
|
if (!needRequest && window.bMallCartData) {
|
|
274
273
|
return window.bMallCartData
|
|
275
274
|
}
|
|
276
275
|
const cartData = await this.bMallGetSkuNumService(bMallTag)
|
|
277
276
|
let items
|
|
278
277
|
if (cartData.ok && cartData.result) {
|
|
279
278
|
items = cartData?.result?.items || {}
|
|
280
279
|
}
|
|
281
280
|
window.bMallCartData = items
|
|
282
281
|
return items
|
|
283
282
|
}
|
|
284
283
|
|
|
285
284
|
async bMallCartHandle(goodItem, num) {
|
|
286
285
|
try {
|
|
287
286
|
const {
|
|
288
287
|
skuUuid,
|
|
289
288
|
limitUpper,
|
|
290
289
|
limitLower,
|
|
291
290
|
} = goodItem
|
|
292
291
|
let cartNum = Number(num)
|
|
293
292
|
if (limitLower && cartNum && cartNum < limitLower) {
|
|
294
293
|
cartNum = limitLower
|
|
295
294
|
} else if (limitUpper && cartNum && cartNum > limitUpper) {
|
|
296
295
|
cartNum = limitUpper
|
|
297
296
|
}
|
|
298
297
|
if (skuUuid && cartNum > 0) {
|
|
299
298
|
return this.bMallChangeCartService({
|
|
300
299
|
...goodItem,
|
|
301
300
|
skuUuid,
|
|
302
301
|
num: cartNum,
|
|
303
302
|
})
|
|
304
303
|
} else if (!skuUuid && cartNum > 0) {
|
|
305
304
|
return this.bMallAddCartService({ ...goodItem, num: cartNum })
|
|
306
305
|
} else if (skuUuid && !cartNum) {
|
|
307
306
|
return this.bMallRemoveCartService({
|
|
308
307
|
...goodItem,
|
|
309
308
|
skuUuid,
|
|
310
309
|
num: cartNum,
|
|
311
310
|
})
|
|
312
311
|
} else {
|
|
313
312
|
console.error('参数不全')
|
|
314
313
|
return false
|
|
315
314
|
}
|
|
316
315
|
} catch (e) {
|
|
317
316
|
console.error(e)
|
|
318
317
|
}
|
|
319
318
|
}
|
|
319
|
+
import Taro from '@tarojs/taro'
|
|
320
320
|
APPID,
|
|
321
321
|
JshopxColorFunctionIdList,
|
|
322
322
|
PagesColorFunctionIdList,
|
|
323
323
|
PAGES_DOMAIN,
|
|
324
324
|
B2BColorFunctionIdList,
|
|
325
325
|
MobileVerifyColorList,
|
|
326
326
|
AppVerifyColorList,
|
|
327
327
|
JshopxVerifyColorList,
|
|
328
328
|
BMallVerifyColorList,
|
|
329
329
|
shopMemberColorFunctionIdList
|
|
330
330
|
cookiesStr: '',
|
|
331
331
|
requestHeaderContentType: {
|
|
332
332
|
jsonHeader: {
|
|
333
333
|
'content-type': 'application/json;charset=utf-8',
|
|
334
334
|
},
|
|
335
335
|
formDataHeader: {
|
|
336
336
|
'content-type': 'application/x-www-form-urlencoded',
|
|
337
337
|
},
|
|
338
338
|
},
|
|
339
339
|
requestBaseParam: {
|
|
340
340
|
data: null,
|
|
341
341
|
header: {
|
|
342
342
|
'content-type': 'application/json;charset=utf-8',
|
|
343
343
|
},
|
|
344
344
|
},
|
|
345
345
|
timeOut: 7000,
|
|
346
346
|
apiClientParams: {
|
|
347
347
|
appid: APPID.SHOP_COLOR_APPID,
|
|
348
348
|
clientVersion:
|
|
349
349
|
isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '11.0.0',
|
|
350
350
|
client: isH5AndJdShopView ? (isIosDevice ? 'apple' : 'android') : 'wh5',
|
|
351
351
|
area: '1_72_2799_0',
|
|
352
352
|
uuid: UUID,
|
|
353
353
|
},
|
|
354
354
|
public addressFetchInfo: {
|
|
355
355
|
reqState: boolean
|
|
356
356
|
promiseInstance: null | Promise<any>
|
|
357
357
|
}
|
|
358
358
|
public getPromotionConfig: {
|
|
359
359
|
projectId: null | string | number
|
|
360
360
|
pageId: null | string | number
|
|
361
361
|
}
|
|
362
362
|
public resInfo: ServiceInterFace.HttpRequestInfo
|
|
363
363
|
public api: ServiceInterFace.HttpApi
|
|
364
364
|
public isPageDomain: boolean
|
|
365
365
|
public verifyColorList: string[]
|
|
366
366
|
constructor(opt) {
|
|
367
367
|
this._init()
|
|
368
368
|
this.addressFetchInfo = {
|
|
369
369
|
reqState: false,
|
|
370
370
|
promiseInstance: null,
|
|
371
371
|
}
|
|
372
372
|
this.getPromotionConfig = {
|
|
373
373
|
projectId: null,
|
|
374
374
|
pageId: null,
|
|
375
375
|
}
|
|
376
376
|
this._userAreaUpdateListen()
|
|
377
377
|
this.resInfo = this._getResConfig(opt)
|
|
378
378
|
this.api = api
|
|
379
379
|
this.isPageDomain = isH5 ? window?.location?.hostname === PAGES_DOMAIN : false
|
|
380
380
|
this.verifyColorList = [
|
|
381
381
|
...MobileVerifyColorList,
|
|
382
382
|
...AppVerifyColorList,
|
|
383
383
|
...JshopxVerifyColorList,
|
|
384
384
|
...BMallVerifyColorList,
|
|
385
385
|
]
|
|
386
386
|
}
|
|
387
387
|
_init(): void {
|
|
388
388
|
httpInterceptors.forEach((item) => {
|
|
389
389
|
Taro.addInterceptor((chain) => item(chain))
|
|
390
390
|
})
|
|
391
391
|
}
|
|
392
392
|
_getResConfig(opt = {}): ServiceInterFace.HttpRequestInfo {
|
|
393
393
|
return Object.assign({}, DefaultConfig, opt)
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
_userAreaUpdateListen() {
|
|
397
397
|
Taro.eventCenter.on(TaroEventType.USER_AREA_UPDATE, (area) => {
|
|
398
398
|
this.updateApiClientParamsResInfo({
|
|
399
399
|
area,
|
|
400
400
|
})
|
|
401
401
|
})
|
|
402
402
|
}
|
|
403
403
|
updateApiClientParamsResInfo(opt = {}) {
|
|
404
404
|
this.resInfo.apiClientParams = {
|
|
405
405
|
...this.resInfo.apiClientParams,
|
|
406
406
|
...opt,
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
checkFunctionIdToReturnAppId(functionId) {
|
|
411
411
|
if (JshopxColorFunctionIdList.includes(functionId)) {
|
|
412
412
|
return APPID.JSHOPX_COLOR_APPID
|
|
413
413
|
} else if (
|
|
414
414
|
this.isPageDomain &&
|
|
415
415
|
PagesColorFunctionIdList.includes(functionId)
|
|
416
416
|
) {
|
|
417
417
|
return APPID.PAGES_COLOR_APPID
|
|
418
418
|
} else if (shopMemberColorFunctionIdList.includes(functionId)) {
|
|
419
419
|
return APPID.SHOP_MEMBER_COLOR_APPID
|
|
420
420
|
}else if (B2BColorFunctionIdList.includes(functionId)) {
|
|
421
421
|
return APPID.B2B_COLOR_APPID
|
|
422
422
|
} else {
|
|
423
423
|
return APPID.SHOP_COLOR_APPID
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
|
|
427
427
|
gatewayReq(
|
|
428
428
|
functionId: string,
|
|
429
429
|
bodyParams = {},
|
|
430
430
|
clientParams = {},
|
|
431
431
|
): Promise<any> {
|
|
432
432
|
if (
|
|
433
433
|
functionId === 'receiveShopCoupon' &&
|
|
434
434
|
((isH5 && window?.isJingGouMiniViewState) || isWxMinAndWxapp)
|
|
435
435
|
) {
|
|
436
436
|
clientParams = Object.assign(
|
|
437
437
|
{},
|
|
438
438
|
{
|
|
439
439
|
loginType: '1',
|
|
440
440
|
loginWQBiz: WXAPP_BIZ_KEY,
|
|
441
441
|
},
|
|
442
442
|
clientParams,
|
|
443
443
|
)
|
|
444
444
|
}
|
|
445
445
|
const apiClientParams = Object.assign(
|
|
446
446
|
{},
|
|
447
447
|
this.resInfo.apiClientParams,
|
|
448
448
|
clientParams,
|
|
449
449
|
)
|
|
450
450
|
typeof apiClientParams.appid === 'undefined' && (apiClientParams.appid = this.checkFunctionIdToReturnAppId(functionId))
|
|
451
451
|
const isColorVerify = this.verifyColorList.includes(functionId)
|
|
452
452
|
const getReqData = {
|
|
453
453
|
functionId: functionId,
|
|
454
454
|
body: JSON.stringify(bodyParams),
|
|
455
455
|
t: Date.now(),
|
|
456
456
|
...apiClientParams,
|
|
457
457
|
}
|
|
458
458
|
return http
|
|
459
459
|
.request({
|
|
460
460
|
url: this.api.apiFunc,
|
|
461
461
|
data: getReqData,
|
|
462
462
|
isColorVerify,
|
|
463
463
|
})
|
|
464
464
|
.then((res: ServiceInterFace.RequestPromiseRes) => {
|
|
465
465
|
const { statusCode, data } = res
|
|
466
466
|
let changeRes: ServiceInterFace.RequestResponseFormatRes = {
|
|
467
467
|
ok: true,
|
|
468
468
|
}
|
|
469
469
|
if (statusCode === 200 && data) {
|
|
470
470
|
const resCode = Object.prototype.hasOwnProperty.call(res.data, 'code')
|
|
471
471
|
? Number(res.data.code)
|
|
472
472
|
: -1
|
|
473
473
|
const subCode = Object.prototype.hasOwnProperty.call(
|
|
474
474
|
res.data,
|
|
475
475
|
'subCode',
|
|
476
476
|
)
|
|
477
477
|
? Number(res.data.subCode)
|
|
478
478
|
: -1
|
|
479
479
|
if (
|
|
480
480
|
data.success === true ||
|
|
481
481
|
data.isSuccess ||
|
|
482
482
|
resCode === 0 ||
|
|
483
483
|
resCode === 200 ||
|
|
484
484
|
subCode === 0
|
|
485
485
|
) {
|
|
486
486
|
changeRes = {
|
|
487
487
|
result: Object.prototype.hasOwnProperty.call(data, 'result')
|
|
488
488
|
? data.result
|
|
489
489
|
: Object.prototype.hasOwnProperty.call(data, 'data')
|
|
490
490
|
? data.data
|
|
491
491
|
: data,
|
|
492
492
|
code: data.code || 200,
|
|
493
493
|
ok: true,
|
|
494
494
|
source: data,
|
|
495
495
|
}
|
|
496
496
|
return changeRes
|
|
497
497
|
} else {
|
|
498
498
|
changeRes = {
|
|
499
499
|
...data,
|
|
500
500
|
ok: false,
|
|
501
501
|
statusCode: res.statusCode,
|
|
502
502
|
}
|
|
503
503
|
return changeRes
|
|
504
504
|
}
|
|
505
505
|
} else {
|
|
506
506
|
changeRes = {
|
|
507
507
|
...data,
|
|
508
508
|
ok: false,
|
|
509
509
|
statusCode: res.statusCode,
|
|
510
510
|
}
|
|
511
511
|
return changeRes
|
|
512
512
|
}
|
|
513
513
|
})
|
|
514
514
|
.catch((res) => {
|
|
515
515
|
return {
|
|
516
516
|
...res,
|
|
517
517
|
ok: false,
|
|
518
518
|
} as ServiceInterFace.RequestResponseFormatRes
|
|
519
519
|
})
|
|
520
520
|
}
|
|
521
521
|
|
|
522
522
|
async receiveCoupon(param = {}, clientParams) {
|
|
523
523
|
return await this.gatewayReq(
|
|
524
524
|
'receiveShopCoupon',
|
|
525
525
|
{
|
|
526
526
|
operation: '3',
|
|
527
527
|
...param,
|
|
528
528
|
},
|
|
529
529
|
clientParams,
|
|
530
530
|
)
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
getCustomerCenterDispatch(params = {}) {
|
|
534
534
|
return this.gatewayReq('customerCenterDispatch', params, {
|
|
535
535
|
clientVersion: '9.2.0',
|
|
536
536
|
client: 'H5',
|
|
537
537
|
uuid: 88888,
|
|
538
538
|
appid: 'shopmember_m_jd_com',
|
|
539
539
|
})
|
|
540
540
|
}
|
|
541
541
|
bMallGetUserInfo = () => {
|
|
542
542
|
return getBMallUserInfo()
|
|
543
543
|
}
|
|
544
544
|
async bMallAddCart(params = {}) {
|
|
545
545
|
return await this.gatewayReq('bmall_cartAdd', params, {
|
|
546
546
|
client: 'H5',
|
|
547
547
|
clientVersion: '5.5.0'
|
|
548
548
|
})
|
|
549
549
|
}
|
|
550
550
|
async bMallChangeCart(params = {}) {
|
|
551
551
|
return await this.gatewayReq('bmall_cartChange', params, {
|
|
552
552
|
client: 'H5',
|
|
553
553
|
clientVersion: '5.5.0'
|
|
554
554
|
})
|
|
555
555
|
}
|
|
556
556
|
async bMallRemoveCart(params = {}) {
|
|
557
557
|
return await this.gatewayReq(
|
|
558
558
|
'bmall_cartRemove',
|
|
559
559
|
params,
|
|
560
560
|
{
|
|
561
561
|
client: 'H5',
|
|
562
562
|
clientVersion: '5.5.0'
|
|
563
563
|
},
|
|
564
564
|
)
|
|
565
565
|
}
|
|
566
566
|
async bMallGetOmittedProduct(params = {}) {
|
|
567
567
|
return await this.gatewayReq('bmall_getOmittedProduct', params, {
|
|
568
568
|
client: 'H5',
|
|
569
569
|
clientVersion: '5.5.0'
|
|
570
570
|
})
|
|
571
571
|
}
|
|
572
572
|
async bMallAddCartService({ skuId, bMallTag, num, data = {} }) {
|
|
573
573
|
const params = await getParams({ ...data, skuId, bMallTag, num })
|
|
574
574
|
return await this.bMallAddCart(params)
|
|
575
575
|
}
|
|
576
576
|
async bMallGetSkuNumService(bMallTag = 1) {
|
|
577
577
|
const params = await getParams({ bMallTag })
|
|
578
578
|
delete params.operations
|
|
579
579
|
return await this.bMallGetOmittedProduct(params)
|
|
580
580
|
}
|
|
581
581
|
async bMallRemoveCartService({ skuId, bMallTag, num, skuUuid, data = {} }) {
|
|
582
582
|
let params = await getParams({ ...data, skuId, bMallTag, num, skuUuid })
|
|
583
583
|
return await this.bMallRemoveCart(params)
|
|
584
584
|
}
|
|
585
585
|
async bMallChangeCartService({ skuId, bMallTag, num, skuUuid, data = {} }) {
|
|
586
586
|
let params = await getParams({ ...data, skuId, bMallTag, num, skuUuid })
|
|
587
587
|
return await this.bMallChangeCart(params)
|
|
588
588
|
}
|
|
589
589
|
|
|
590
590
|
async bMallGetSkuNumApi(needRequest = false, bMallTag = 1) {
|
|
591
591
|
if (!needRequest && isH5 && window?.bMallCartData) {
|
|
592
592
|
return window?.bMallCartData
|
|
593
593
|
}
|
|
594
594
|
const cartData = await this.bMallGetSkuNumService(bMallTag)
|
|
595
595
|
let items
|
|
596
596
|
if (cartData.ok && cartData.result) {
|
|
597
597
|
items = cartData?.result?.items || {}
|
|
598
598
|
}
|
|
599
599
|
if (isH5) {
|
|
600
600
|
window.bMallCartData = items
|
|
601
601
|
}
|
|
602
602
|
return items
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
async bMallCartHandle(goodItem, num) {
|
|
606
606
|
try {
|
|
607
607
|
const {
|
|
608
608
|
skuUuid,
|
|
609
609
|
limitUpper,
|
|
610
610
|
limitLower,
|
|
611
611
|
} = goodItem
|
|
612
612
|
let cartNum = Number(num)
|
|
613
613
|
if (limitLower && cartNum && cartNum < limitLower) {
|
|
614
614
|
cartNum = limitLower
|
|
615
615
|
} else if (limitUpper && cartNum && cartNum > limitUpper) {
|
|
616
616
|
cartNum = limitUpper
|
|
617
617
|
}
|
|
618
618
|
if (skuUuid && cartNum > 0) {
|
|
619
619
|
return this.bMallChangeCartService({
|
|
620
620
|
...goodItem,
|
|
621
621
|
skuUuid,
|
|
622
622
|
num: cartNum,
|
|
623
623
|
})
|
|
624
624
|
} else if (!skuUuid && cartNum > 0) {
|
|
625
625
|
return this.bMallAddCartService({ ...goodItem, num: cartNum })
|
|
626
626
|
} else if (skuUuid && !cartNum) {
|
|
627
627
|
return this.bMallRemoveCartService({
|
|
628
628
|
...goodItem,
|
|
629
629
|
skuUuid,
|
|
630
630
|
num: cartNum,
|
|
631
631
|
})
|
|
632
632
|
} else {
|
|
633
633
|
console.error('参数不全')
|
|
634
634
|
return false
|
|
635
635
|
}
|
|
636
636
|
} catch (e) {
|
|
637
637
|
console.error(e)
|
|
638
638
|
}
|
|
639
639
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = {
|
|
3
2
|
displayHeight: 1920,
|
|
4
3
|
offSetY: 0
|
|
5
4
|
}
|
|
6
5
|
console.log('>>>>>>>>>>>>>>>>>>> render taroEventSendPageScrollInfo origin time:', Date.now(), 'res:', options)
|
|
7
6
|
if(options){
|
|
8
7
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = options
|
|
9
8
|
}
|
|
10
9
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
11
10
|
PAGE_PV_PARAM: 'pagePvParam'
|
|
12
11
|
const { displayHeight, offSetY } = res
|
|
13
12
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
14
13
|
|
|
15
14
|
if (isIosDevice) return res
|
|
16
15
|
|
|
17
16
|
if (isAndroidDevice) {
|
|
18
17
|
const deviceRatio = window.devicePixelRatio
|
|
19
18
|
const cssDisplayHeight = Math.ceil(displayHeight / deviceRatio)
|
|
20
19
|
const cssOffsetY = Math.ceil(offSetY / deviceRatio)
|
|
21
20
|
return {
|
|
22
21
|
displayHeight: cssDisplayHeight,
|
|
23
22
|
offSetY: cssOffsetY
|
|
24
23
|
}
|
|
25
24
|
}
|
|
25
|
+
import Taro from '@tarojs/taro'
|
|
26
26
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = {
|
|
27
27
|
displayHeight: 1920,
|
|
28
28
|
offSetY: 0
|
|
29
29
|
}
|
|
30
30
|
console.log('>>>>>>>>>>>>>>>>>>> render taroEventSendPageScrollInfo origin time:', Date.now(), 'res:', options)
|
|
31
31
|
if(options){
|
|
32
32
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = options
|
|
33
33
|
}
|
|
34
34
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
35
35
|
PAGE_PV_PARAM: 'pagePvParam',
|
|
36
36
|
NATIVE_SCORLL_VIEW: 'nativeScrollControl',
|
|
37
37
|
OPEN: 'open',
|
|
38
38
|
const { displayHeight, offSetY } = res
|
|
39
39
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
40
40
|
if (isIosDevice) return res
|
|
41
41
|
if (isAndroidDevice) {
|
|
42
42
|
const deviceRatio = window.devicePixelRatio
|
|
43
43
|
const cssDisplayHeight = Math.ceil(displayHeight / deviceRatio)
|
|
44
44
|
const cssOffsetY = Math.ceil(offSetY / deviceRatio)
|
|
45
45
|
return {
|
|
46
46
|
displayHeight: cssDisplayHeight,
|
|
47
47
|
offSetY: cssOffsetY
|
|
48
48
|
}
|
|
49
49
|
}
|