@conecli/cone-render 0.10.1-shop3.2 → 0.10.1-shop3.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/utils/index.h5.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
UtilsInterFace
|
|
3
2
|
nativePageShowToast,
|
|
4
3
|
ToastAndroidType,
|
|
5
4
|
ToastIosType,
|
|
6
5
|
stopNativeScrollEvent,
|
|
7
6
|
getAppChannelType,
|
|
8
7
|
isAndroidDevice,
|
|
9
8
|
isH5AndJdShopView,
|
|
10
9
|
isChartH5,
|
|
11
10
|
isH5AndJdShopViewNativeScroll,
|
|
12
11
|
isIosDevice,
|
|
13
12
|
isJdAndAndroidDevice,
|
|
14
13
|
isJdAndIosDevice,
|
|
15
14
|
isJdApp,
|
|
16
15
|
isWxApp,
|
|
17
16
|
isWxMiniH5View,
|
|
18
17
|
isJdAndHarmonyDevice,
|
|
19
18
|
isH5AndJingGouMini,
|
|
20
19
|
urlCookie,
|
|
21
20
|
sgmCustomReport,
|
|
22
21
|
draCustomReport,
|
|
23
22
|
remoteCustomReport,
|
|
24
23
|
draInterfaceCustomReport,
|
|
25
24
|
draBusinessCustomReport,
|
|
26
25
|
isMemberPage,
|
|
27
26
|
isH5AndJdShopViewH5Scroll,
|
|
28
27
|
isH5AndJdShopH5CustomScrollView,
|
|
29
28
|
isAppClassifyPage,
|
|
30
29
|
isAppHomeForMarketPage,
|
|
31
30
|
isPc,
|
|
32
31
|
ipLoc_djd,
|
|
33
32
|
jdAppVersionCompare,
|
|
34
33
|
isTjScence,
|
|
35
34
|
isH5AdnJxMini,
|
|
36
35
|
isTjM,
|
|
37
36
|
isTjJxM,
|
|
38
37
|
isTJApp,
|
|
39
38
|
isH5AdnHaoWuJie,
|
|
40
39
|
tjChannel,
|
|
41
40
|
dealNativePixelToCssPixel,
|
|
42
41
|
isAppStowShop,
|
|
43
42
|
isJdAndroidX5Core,
|
|
44
43
|
parseQueryUrlObj,
|
|
45
44
|
isIpadDevice,
|
|
46
45
|
isSupportHybridHttpRequest,
|
|
47
46
|
isLanguageForEn,
|
|
48
47
|
addHttps,
|
|
49
48
|
clearTaroStorageKey,
|
|
50
49
|
countStringify,
|
|
51
50
|
dateFormat,
|
|
52
51
|
dealAddress,
|
|
53
52
|
dealShopContentData as originDealShopContentData,
|
|
54
53
|
debounce,
|
|
55
54
|
filterUrlQueryData,
|
|
56
55
|
formatTabActiveMenuType,
|
|
57
56
|
getAvifSupport,
|
|
58
57
|
getWebpSupport,
|
|
59
58
|
getTaroStorageKeyValue,
|
|
60
59
|
getWxAppCookieStr,
|
|
61
60
|
isH5,
|
|
62
61
|
isMin,
|
|
63
62
|
isJdMin,
|
|
64
63
|
isWxMin,
|
|
65
64
|
isWxMinAndWxapp,
|
|
66
65
|
isJdMinAndHarmony,
|
|
67
66
|
lodashThrottle,
|
|
68
67
|
objectToUrlEncode,
|
|
69
68
|
parseQueryUrlString,
|
|
70
69
|
removeTaroStorageKey,
|
|
71
70
|
setLowSmallPicUrl,
|
|
72
71
|
setTaroStorage,
|
|
73
72
|
showFailToast,
|
|
74
73
|
showNormalToast,
|
|
75
74
|
showSuccessToast,
|
|
76
75
|
sliceArrToChunkList,
|
|
77
76
|
throttle,
|
|
78
77
|
getQualityImageNew,
|
|
79
78
|
getQualityImageOld,
|
|
80
79
|
isOpenJdAppUrl,
|
|
81
80
|
jdOpenAppParams,
|
|
82
81
|
createJdOpenAppUrl,
|
|
83
82
|
isEmpty,
|
|
84
83
|
getJdAppReportPageSource,
|
|
85
84
|
dealJdOpenAppData,
|
|
86
85
|
getBorderStyle,
|
|
87
86
|
SgmCustomCode,
|
|
88
87
|
} from '../common/sgmCustomCode'
|
|
89
88
|
const getNum = Number(num)
|
|
90
89
|
let _changeLayoutWidth = layoutWidth
|
|
91
90
|
if (!_changeLayoutWidth) {
|
|
92
91
|
_changeLayoutWidth =
|
|
93
92
|
_ShopSystemInfo && _ShopSystemInfo?.windowWidth
|
|
94
93
|
? _ShopSystemInfo.windowWidth
|
|
95
94
|
: Taro.getSystemInfoSync()?.windowWidth
|
|
96
95
|
}
|
|
97
96
|
return Math.round((getNum / widthSize) * _changeLayoutWidth)
|
|
98
97
|
changeSize,
|
|
99
98
|
designWidth = 750,
|
|
100
99
|
systemInfo,
|
|
101
100
|
const getRootFontSize =
|
|
102
101
|
(40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
|
|
103
102
|
const getRealRootFontSize =
|
|
104
103
|
getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
|
|
105
104
|
return Math.ceil(
|
|
106
105
|
(((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
|
|
107
106
|
getRealRootFontSize,
|
|
108
107
|
)
|
|
109
108
|
console.log(
|
|
110
109
|
'获取系统宽度systemInfo?.windowWidth',
|
|
111
110
|
systemInfo?.windowWidth,
|
|
112
111
|
'taroToTransformRoutimePXNumber(changeWidth)',
|
|
113
112
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
|
|
114
113
|
)
|
|
115
114
|
return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
|
|
116
115
|
? systemInfo?.windowWidth -
|
|
117
116
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
|
|
118
117
|
: systemInfo?.windowWidth ?? 0
|
|
119
118
|
const systemInfo = Taro.getSystemInfoSync()
|
|
120
119
|
if (params && params?.pageWidth && params?.pageHeight) {
|
|
121
120
|
systemInfo.windowWidth = params?.pageWidth
|
|
122
121
|
systemInfo.windowHeight = params?.pageHeight
|
|
123
122
|
console.warn("松果安卓app内获折叠屏信息重置系统信息宽度值",params,",systemInfo信息集合为",systemInfo)
|
|
124
123
|
}else {
|
|
125
124
|
if (isJdApp && isAndroidDevice && systemInfo) {
|
|
126
125
|
const getWinWidth = window.innerWidth;
|
|
127
126
|
const getWinHeight = window.innerHeight;
|
|
128
127
|
const getScreenWidth = window.screen.width;
|
|
129
128
|
const getScreenHeight = window.screen.height;
|
|
130
129
|
const isLandscape = getScreenWidth >= getScreenHeight;
|
|
131
130
|
const { windowWidth,windowHeight, screenWidth, screenHeight } = systemInfo
|
|
132
131
|
if (windowWidth <= 0) {
|
|
133
132
|
systemInfo.initWindowWidth = windowWidth;
|
|
134
133
|
if(isLandscape){
|
|
135
134
|
systemInfo.windowWidth = getScreenHeight
|
|
136
135
|
systemInfo.windowHeight = getScreenWidth
|
|
137
136
|
systemInfo.screenWidth = getScreenHeight
|
|
138
137
|
systemInfo.screenHeight = getScreenWidth
|
|
139
138
|
}else {
|
|
140
139
|
systemInfo.windowWidth = getScreenWidth
|
|
141
140
|
systemInfo.windowHeight = getScreenHeight
|
|
142
141
|
systemInfo.screenWidth = getScreenWidth
|
|
143
142
|
systemInfo.screenHeight = getScreenHeight
|
|
144
143
|
}
|
|
145
144
|
console.warn(`松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight}`)
|
|
146
145
|
sgmCustomReport({
|
|
147
146
|
type: 2,
|
|
148
147
|
code: 'android_jdapp_width_error_info',
|
|
149
148
|
msg: {
|
|
150
149
|
title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
|
|
151
150
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
152
151
|
taroSysInfo: systemInfo
|
|
153
152
|
}
|
|
154
153
|
})
|
|
155
154
|
}else {
|
|
156
155
|
let _getChangeWinWidthState = false
|
|
157
156
|
if( getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth){
|
|
158
157
|
if(isLandscape){
|
|
159
158
|
systemInfo.windowWidth = getScreenHeight
|
|
160
159
|
systemInfo.windowHeight = getScreenWidth
|
|
161
160
|
systemInfo.screenWidth = getScreenHeight
|
|
162
161
|
systemInfo.screenHeight = getScreenWidth
|
|
163
162
|
}else {
|
|
164
163
|
systemInfo.windowWidth = getScreenWidth
|
|
165
164
|
systemInfo.windowHeight = getScreenHeight
|
|
166
165
|
systemInfo.screenWidth = getScreenWidth
|
|
167
166
|
systemInfo.screenHeight = getScreenHeight
|
|
168
167
|
}
|
|
169
168
|
_getChangeWinWidthState = true
|
|
170
169
|
}
|
|
171
170
|
_getChangeWinWidthState && console.warn(`松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`)
|
|
172
171
|
_getChangeWinWidthState && sgmCustomReport({
|
|
173
172
|
type: 2,
|
|
174
173
|
code: 'android_jdapp_width_error_info',
|
|
175
174
|
msg: {
|
|
176
175
|
title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
|
|
177
176
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
178
177
|
taroSysInfo: systemInfo
|
|
179
178
|
}
|
|
180
179
|
})
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
}
|
|
184
183
|
systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
|
|
185
184
|
console.warn('====获取系统信息=====', systemInfo)
|
|
186
185
|
return systemInfo
|
|
187
186
|
let result: boolean | null = null
|
|
188
187
|
return function() {
|
|
189
188
|
if (result === null) {
|
|
190
189
|
const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
|
|
191
190
|
if(!isJdApp){
|
|
192
191
|
console.warn("🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~")
|
|
193
192
|
isIgnoreOptimizeFromServer = true
|
|
194
193
|
result = true
|
|
195
194
|
return true
|
|
196
195
|
}
|
|
197
196
|
const enableAvifOptimize = appVersionCheckPass
|
|
198
197
|
if(enableAvifOptimize){
|
|
199
198
|
const configData = global.getDynamicConfig('avifSwitch')
|
|
200
199
|
console.warn("🚗 ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:", buildType)
|
|
201
200
|
console.warn("🚗 ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:", configData)
|
|
202
201
|
const { globalOn = true, ignoreOptimizeFromServer = false, page = {}, grayscale = {}, whiteList = [], blackList = [] } = configData || {}
|
|
203
202
|
const {shopId = '0', venderId = '0'} = parseQueryUrlObj
|
|
204
203
|
let imageEnableResult = true
|
|
205
204
|
isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
|
|
206
205
|
console.warn("🚗 ~~ file: index.h5.ts:213 ~~ returnfunction ~~ grayscale[buildType]:", grayscale[buildType])
|
|
207
206
|
if (blackList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
|
|
208
207
|
imageEnableResult = false
|
|
209
208
|
console.warn("🚗 ~~ file: utils.ts:198 命中黑名单~")
|
|
210
209
|
}else if(whiteList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
|
|
211
210
|
isIgnoreOptimizeFromServer = true
|
|
212
211
|
imageEnableResult = true
|
|
213
212
|
console.warn("🚗 ~~ file: utils.ts:205 命中白名单~")
|
|
214
213
|
}else if(grayscale[buildType] && isInGrayscale(grayscale[buildType])){
|
|
215
214
|
isIgnoreOptimizeFromServer = true
|
|
216
215
|
imageEnableResult = true
|
|
217
216
|
console.warn("🚗 ~~ file: utils.ts:214 命中灰度~")
|
|
218
217
|
}else{
|
|
219
218
|
imageEnableResult = globalOn === true || page[buildType] === true
|
|
220
219
|
if(globalOn === true){
|
|
221
220
|
isIgnoreOptimizeFromServer = true
|
|
222
221
|
console.warn("🚗 ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~")
|
|
223
222
|
}else if(page[buildType] === true){
|
|
224
223
|
console.warn("🚗 ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~")
|
|
225
224
|
}else{
|
|
226
225
|
console.warn("🚗 ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!")
|
|
227
226
|
}
|
|
228
227
|
}
|
|
229
228
|
result = imageEnableResult
|
|
230
229
|
return imageEnableResult
|
|
231
230
|
}else{
|
|
232
231
|
result = false
|
|
233
232
|
return false
|
|
234
233
|
}
|
|
235
234
|
} else {
|
|
236
235
|
return result
|
|
237
236
|
}
|
|
238
237
|
}
|
|
239
238
|
if(typeof options === 'object' && isImageOptimizeEnable()){
|
|
240
239
|
return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
|
|
241
240
|
}else{
|
|
242
241
|
return getQualityImageOld(imgUrl, options)
|
|
243
242
|
}
|
|
244
243
|
const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
|
|
245
244
|
windowWidth: window.innerWidth,
|
|
246
245
|
containerWidth: getContainerWidth(buildType, {
|
|
247
246
|
windowWidth: window.innerWidth,
|
|
248
247
|
}),
|
|
249
248
|
screenWidth: window.innerWidth,
|
|
250
249
|
platform: '',
|
|
251
250
|
model: '',
|
|
252
251
|
system: '',
|
|
253
252
|
}
|
|
254
253
|
return getSystemInfo
|
|
255
254
|
console.log('进入commonshowToast, 传入参数options为: ', options)
|
|
256
255
|
const params = Object.assign(
|
|
257
256
|
{},
|
|
258
257
|
{
|
|
259
258
|
title: '',
|
|
260
259
|
duration: 1500,
|
|
261
260
|
},
|
|
262
261
|
options,
|
|
263
262
|
)
|
|
264
263
|
params.duration = params.duration / 1000
|
|
265
264
|
if (isJdApp) {
|
|
266
265
|
const showSuccessType = isIosDevice
|
|
267
266
|
? ToastIosType.SUCCESS
|
|
268
267
|
: ToastAndroidType.SUCCESS
|
|
269
268
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
270
269
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
271
270
|
console.log('执行原生toast success')
|
|
272
271
|
} else {
|
|
273
272
|
showSuccessToast(options)
|
|
274
273
|
}
|
|
275
274
|
const params = Object.assign(
|
|
276
275
|
{},
|
|
277
276
|
{
|
|
278
277
|
title: '',
|
|
279
278
|
duration: 1500,
|
|
280
279
|
},
|
|
281
280
|
options,
|
|
282
281
|
)
|
|
283
282
|
params.duration = params.duration / 1000
|
|
284
283
|
if (isJdApp) {
|
|
285
284
|
const showSuccessType = isIosDevice
|
|
286
285
|
? ToastIosType.FAIL
|
|
287
286
|
: ToastAndroidType.FAIL
|
|
288
287
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
289
288
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
290
289
|
console.log('执行原生toast fail')
|
|
291
290
|
} else {
|
|
292
291
|
console.log('执行H5 toast fail')
|
|
293
292
|
showFailToast(options)
|
|
294
293
|
}
|
|
295
294
|
const params = Object.assign(
|
|
296
295
|
{},
|
|
297
296
|
{
|
|
298
297
|
title: '',
|
|
299
298
|
duration: 1500,
|
|
300
299
|
},
|
|
301
300
|
options,
|
|
302
301
|
)
|
|
303
302
|
params.duration = params.duration / 1000
|
|
304
303
|
if (isJdApp) {
|
|
305
304
|
const showSuccessType = isIosDevice ?
|
|
306
305
|
ToastIosType.NORMAL :
|
|
307
306
|
ToastAndroidType.NORMAL
|
|
308
307
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
309
308
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
310
309
|
} else {
|
|
311
310
|
showNormalToast(options)
|
|
312
311
|
}
|
|
313
312
|
const createLoadingEle = document.createElement('div')
|
|
314
313
|
createLoadingEle.id = 'J_shopLoading'
|
|
315
314
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
316
315
|
createLoadingEle.innerHTML =
|
|
317
316
|
`<div class='d-loading-content'>
|
|
318
317
|
<span class='d-shop-loading-icon'></span>
|
|
319
318
|
<p class='d-shop-text'>${text}</p>
|
|
320
319
|
</div>`
|
|
321
320
|
const getEle = document.body
|
|
322
321
|
? document.body
|
|
323
322
|
: document.getElementsByTagName('body')[0]
|
|
324
323
|
getEle.appendChild(createLoadingEle)
|
|
325
324
|
const getEle = document.getElementById('J_shopLoading')
|
|
326
325
|
getEle && getEle.remove()
|
|
327
326
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(
|
|
328
327
|
params,
|
|
329
328
|
)
|
|
330
329
|
if (!systemInfo.system && window) {
|
|
331
330
|
systemInfo.system = window.navigator.userAgent
|
|
332
331
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
333
332
|
}
|
|
334
333
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
335
334
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
336
335
|
systemInfo.navBarHeight = 0
|
|
337
336
|
systemInfo.statusBarHeight = 0
|
|
338
337
|
systemInfo.capsulePosition = null
|
|
339
338
|
systemInfo.isIOS = isIOS
|
|
340
339
|
systemInfo.isAndroid = isAndroid
|
|
341
340
|
_ShopSystemInfo = systemInfo
|
|
342
341
|
return systemInfo
|
|
343
342
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev)
|
|
344
343
|
const numScale = Number(scale)
|
|
345
344
|
if(isNaN(numScale)){
|
|
346
345
|
console.warn(`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`)
|
|
347
346
|
return false
|
|
348
347
|
}
|
|
349
348
|
const { venderId } = global.info.queryInfo || {}
|
|
350
349
|
const id = venderId
|
|
351
350
|
if(!id && numScale !== 1){
|
|
352
351
|
return false
|
|
353
352
|
}
|
|
354
353
|
const useScale = Math.max(0, Math.min(1, numScale))
|
|
355
354
|
const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0
|
|
356
355
|
if(reportKey){
|
|
357
356
|
sgmCustomReport({
|
|
358
357
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
|
|
359
358
|
msg: '灰度调用',
|
|
360
359
|
})
|
|
361
360
|
console.log(`基于KEY[${reportKey}]的灰度调用1次~`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`))
|
|
362
361
|
if(isMatch){
|
|
363
362
|
sgmCustomReport({
|
|
364
363
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
|
|
365
364
|
msg: '灰度命中',
|
|
366
365
|
})
|
|
367
366
|
console.log(`基于KEY[${reportKey}]的命中1次灰度!`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`))
|
|
368
367
|
}
|
|
369
368
|
}
|
|
370
369
|
return isMatch
|
|
371
370
|
isJdApp,
|
|
372
371
|
isWxApp,
|
|
373
372
|
isIosDevice,
|
|
374
373
|
isAndroidDevice,
|
|
375
374
|
isJdAndIosDevice,
|
|
376
375
|
isJdAndAndroidDevice,
|
|
377
376
|
isJdAndHarmonyDevice,
|
|
378
377
|
isJdAndroidX5Core,
|
|
379
378
|
isMin,
|
|
380
379
|
isWxMin,
|
|
381
380
|
isWxMinAndWxapp,
|
|
382
381
|
isJdMinAndHarmony,
|
|
383
382
|
isJdMin,
|
|
384
383
|
isH5,
|
|
385
384
|
isH5AndJdShopView,
|
|
386
385
|
isChartH5,
|
|
387
386
|
isH5AndJdShopViewNativeScroll,
|
|
388
387
|
isH5AndJdShopViewH5Scroll,
|
|
389
388
|
isH5AndJdShopH5CustomScrollView,
|
|
390
389
|
isH5AndJingGouMini,
|
|
391
390
|
isWxMiniH5View,
|
|
392
391
|
urlCookie,
|
|
393
392
|
sliceArrToChunkList,
|
|
394
393
|
dealAddress,
|
|
395
394
|
objectToUrlEncode,
|
|
396
395
|
parseQueryUrlString,
|
|
397
396
|
setLowSmallPicUrl,
|
|
398
397
|
setTaroStorage,
|
|
399
398
|
getTaroStorageKeyValue,
|
|
400
399
|
removeTaroStorageKey,
|
|
401
400
|
clearTaroStorageKey,
|
|
402
401
|
getAvifSupport,
|
|
403
402
|
getWebpSupport,
|
|
404
403
|
getQualityImage,
|
|
405
404
|
countStringify,
|
|
406
405
|
getWxAppCookieStr,
|
|
407
406
|
getSystemInfos,
|
|
408
407
|
pxTransformFromData,
|
|
409
408
|
dealShopContentDataAndReport as dealShopContentData,
|
|
410
409
|
dateFormat,
|
|
411
410
|
throttle,
|
|
412
411
|
lodashThrottle,
|
|
413
412
|
debounce,
|
|
414
413
|
addHttps,
|
|
415
414
|
commonShowSuccessToast as showSuccessToast,
|
|
416
415
|
commonShowFailToast as showFailToast,
|
|
417
416
|
commonShowNormalToast as showNormalToast,
|
|
418
417
|
showShopLoading,
|
|
419
418
|
hideShopLoading,
|
|
420
419
|
stopNativeScrollEvent,
|
|
421
420
|
getAppChannelType,
|
|
422
421
|
formatTabActiveMenuType,
|
|
423
422
|
filterUrlQueryData,
|
|
424
423
|
sgmCustomReport,
|
|
425
424
|
draCustomReport,
|
|
426
425
|
remoteCustomReport,
|
|
427
426
|
draInterfaceCustomReport,
|
|
428
427
|
draBusinessCustomReport,
|
|
429
428
|
isMemberPage,
|
|
430
429
|
getFloorDataToDataDefines,
|
|
431
430
|
isOpenJdAppUrl,
|
|
432
431
|
jdOpenAppParams,
|
|
433
432
|
createJdOpenAppUrl,
|
|
434
433
|
isEmpty,
|
|
435
434
|
getJdAppReportPageSource,
|
|
436
435
|
isAppClassifyPage,
|
|
437
436
|
isAppHomeForMarketPage,
|
|
438
437
|
isImageOptimizeEnable,
|
|
439
438
|
isPc,
|
|
440
439
|
ipLoc_djd,
|
|
441
440
|
isTjScence,
|
|
442
441
|
isH5AdnJxMini,
|
|
443
442
|
isTjM,
|
|
444
443
|
isTjJxM,
|
|
445
444
|
isTJApp,
|
|
446
445
|
isH5AdnHaoWuJie,
|
|
447
446
|
tjChannel,
|
|
448
447
|
dealJdOpenAppData,
|
|
449
448
|
jdAppVersionCompare,
|
|
450
449
|
dealNativePixelToCssPixel,
|
|
451
450
|
isAppStowShop,
|
|
452
451
|
getSgmCustomCode,
|
|
453
452
|
handleSgmCodeTaroVersion,
|
|
454
453
|
isInGrayscale,
|
|
455
454
|
isIpadDevice,
|
|
456
455
|
getBorderStyle,
|
|
457
456
|
isSupportHybridHttpRequest,
|
|
458
457
|
isLanguageForEn
|
|
458
|
+
import Taro from '@tarojs/taro'
|
|
459
459
|
UtilsInterFace
|
|
460
460
|
nativePageShowToast,
|
|
461
461
|
ToastAndroidType,
|
|
462
462
|
ToastIosType,
|
|
463
463
|
stopNativeScrollEvent,
|
|
464
464
|
getAppChannelType,
|
|
465
465
|
isAndroidDevice,
|
|
466
466
|
isH5AndJdShopView,
|
|
467
467
|
isChartH5,
|
|
468
468
|
isH5AndJdShopViewNativeScroll,
|
|
469
469
|
isIosDevice,
|
|
470
470
|
isJdAndAndroidDevice,
|
|
471
471
|
isJdAndIosDevice,
|
|
472
472
|
isJdApp,
|
|
473
473
|
isWxApp,
|
|
474
474
|
isWxMiniH5View,
|
|
475
475
|
isJdAndHarmonyDevice,
|
|
476
476
|
isH5AndJingGouMini,
|
|
477
477
|
urlCookie,
|
|
478
478
|
sgmCustomReport,
|
|
479
479
|
draCustomReport,
|
|
480
480
|
remoteCustomReport,
|
|
481
481
|
draInterfaceCustomReport,
|
|
482
482
|
draBusinessCustomReport,
|
|
483
483
|
isMemberPage,
|
|
484
484
|
isH5AndJdShopViewH5Scroll,
|
|
485
485
|
isH5AndJdShopH5CustomScrollView,
|
|
486
486
|
isAppClassifyPage,
|
|
487
487
|
isAppHomeForMarketPage,
|
|
488
488
|
isPc,
|
|
489
489
|
ipLoc_djd,
|
|
490
490
|
jdAppVersionCompare,
|
|
491
491
|
isTjScence,
|
|
492
492
|
isH5AdnJxMini,
|
|
493
493
|
isTjM,
|
|
494
494
|
isTjJxM,
|
|
495
495
|
isTJApp,
|
|
496
496
|
isH5AdnHaoWuJie,
|
|
497
497
|
tjChannel,
|
|
498
498
|
dealNativePixelToCssPixel,
|
|
499
499
|
isAppStowShop,
|
|
500
500
|
isJdAndroidX5Core,
|
|
501
501
|
parseQueryUrlObj,
|
|
502
502
|
isIpadDevice,
|
|
503
503
|
isSupportHybridHttpRequest,
|
|
504
504
|
isLanguageForEn,
|
|
505
505
|
addHttps,
|
|
506
506
|
clearTaroStorageKey,
|
|
507
507
|
countStringify,
|
|
508
508
|
dateFormat,
|
|
509
509
|
dealAddress,
|
|
510
510
|
dealShopContentData as originDealShopContentData,
|
|
511
511
|
debounce,
|
|
512
512
|
filterUrlQueryData,
|
|
513
513
|
formatTabActiveMenuType,
|
|
514
514
|
getAvifSupport,
|
|
515
515
|
getWebpSupport,
|
|
516
516
|
getTaroStorageKeyValue,
|
|
517
517
|
getWxAppCookieStr,
|
|
518
518
|
isH5,
|
|
519
519
|
isMin,
|
|
520
520
|
isJdMin,
|
|
521
521
|
isWxMin,
|
|
522
522
|
isWxMinAndWxapp,
|
|
523
523
|
isJdMinAndHarmony,
|
|
524
524
|
lodashThrottle,
|
|
525
525
|
objectToUrlEncode,
|
|
526
526
|
parseQueryUrlString,
|
|
527
527
|
removeTaroStorageKey,
|
|
528
528
|
setLowSmallPicUrl,
|
|
529
529
|
setTaroStorage,
|
|
530
530
|
showFailToast,
|
|
531
531
|
showNormalToast,
|
|
532
532
|
showSuccessToast,
|
|
533
533
|
sliceArrToChunkList,
|
|
534
534
|
throttle,
|
|
535
535
|
getQualityImageNew,
|
|
536
536
|
getQualityImageOld,
|
|
537
537
|
isOpenJdAppUrl,
|
|
538
538
|
jdOpenAppParams,
|
|
539
539
|
createJdOpenAppUrl,
|
|
540
540
|
isEmpty,
|
|
541
541
|
getJdAppReportPageSource,
|
|
542
542
|
dealJdOpenAppData,
|
|
543
543
|
getBorderStyle,
|
|
544
544
|
SgmCustomCode,
|
|
545
545
|
} from '../common/sgmCustomCode'
|
|
546
546
|
const getNum = Number(num)
|
|
547
547
|
let _changeLayoutWidth = layoutWidth
|
|
548
548
|
if (!_changeLayoutWidth) {
|
|
549
549
|
_changeLayoutWidth =
|
|
550
550
|
_ShopSystemInfo && _ShopSystemInfo?.windowWidth
|
|
551
551
|
? _ShopSystemInfo.windowWidth
|
|
552
552
|
: Taro.getSystemInfoSync()?.windowWidth
|
|
553
553
|
}
|
|
554
554
|
return Math.round((getNum / widthSize) * _changeLayoutWidth)
|
|
555
555
|
changeSize,
|
|
556
556
|
designWidth = 750,
|
|
557
557
|
systemInfo,
|
|
558
558
|
const getRootFontSize =
|
|
559
559
|
(40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
|
|
560
560
|
const getRealRootFontSize =
|
|
561
561
|
getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
|
|
562
562
|
return Math.ceil(
|
|
563
563
|
(((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
|
|
564
564
|
getRealRootFontSize,
|
|
565
565
|
)
|
|
566
566
|
console.log(
|
|
567
567
|
'获取系统宽度systemInfo?.windowWidth',
|
|
568
568
|
systemInfo?.windowWidth,
|
|
569
569
|
'taroToTransformRoutimePXNumber(changeWidth)',
|
|
570
570
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
|
|
571
571
|
)
|
|
572
572
|
return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
|
|
573
573
|
? systemInfo?.windowWidth -
|
|
574
574
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
|
|
575
575
|
: systemInfo?.windowWidth ?? 0
|
|
576
576
|
const systemInfo = Taro.getSystemInfoSync()
|
|
577
577
|
if (params && params?.pageWidth && params?.pageHeight) {
|
|
578
578
|
systemInfo.windowWidth = params?.pageWidth
|
|
579
579
|
systemInfo.windowHeight = params?.pageHeight
|
|
580
580
|
console.warn("松果安卓app内获折叠屏信息重置系统信息宽度值",params,",systemInfo信息集合为",systemInfo)
|
|
581
581
|
}else {
|
|
582
582
|
if (isJdApp && isAndroidDevice && systemInfo) {
|
|
583
583
|
const getWinWidth = window.innerWidth;
|
|
584
584
|
const getWinHeight = window.innerHeight;
|
|
585
585
|
const getScreenWidth = window.screen.width;
|
|
586
586
|
const getScreenHeight = window.screen.height;
|
|
587
587
|
const isLandscape = getScreenWidth >= getScreenHeight;
|
|
588
588
|
const { windowWidth,windowHeight, screenWidth, screenHeight } = systemInfo
|
|
589
589
|
if (windowWidth <= 0) {
|
|
590
590
|
systemInfo.initWindowWidth = windowWidth;
|
|
591
591
|
if(isLandscape){
|
|
592
592
|
systemInfo.windowWidth = getScreenHeight
|
|
593
593
|
systemInfo.windowHeight = getScreenWidth
|
|
594
594
|
systemInfo.screenWidth = getScreenHeight
|
|
595
595
|
systemInfo.screenHeight = getScreenWidth
|
|
596
596
|
}else {
|
|
597
597
|
systemInfo.windowWidth = getScreenWidth
|
|
598
598
|
systemInfo.windowHeight = getScreenHeight
|
|
599
599
|
systemInfo.screenWidth = getScreenWidth
|
|
600
600
|
systemInfo.screenHeight = getScreenHeight
|
|
601
601
|
}
|
|
602
602
|
console.warn(`松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight}`)
|
|
603
603
|
sgmCustomReport({
|
|
604
604
|
type: 2,
|
|
605
605
|
code: 'android_jdapp_width_error_info',
|
|
606
606
|
msg: {
|
|
607
607
|
title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
|
|
608
608
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
609
609
|
taroSysInfo: systemInfo
|
|
610
610
|
}
|
|
611
611
|
})
|
|
612
612
|
}else {
|
|
613
613
|
let _getChangeWinWidthState = false
|
|
614
614
|
if( getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth){
|
|
615
615
|
if(isLandscape){
|
|
616
616
|
systemInfo.windowWidth = getScreenHeight
|
|
617
617
|
systemInfo.windowHeight = getScreenWidth
|
|
618
618
|
systemInfo.screenWidth = getScreenHeight
|
|
619
619
|
systemInfo.screenHeight = getScreenWidth
|
|
620
620
|
}else {
|
|
621
621
|
systemInfo.windowWidth = getScreenWidth
|
|
622
622
|
systemInfo.windowHeight = getScreenHeight
|
|
623
623
|
systemInfo.screenWidth = getScreenWidth
|
|
624
624
|
systemInfo.screenHeight = getScreenHeight
|
|
625
625
|
}
|
|
626
626
|
_getChangeWinWidthState = true
|
|
627
627
|
}
|
|
628
628
|
_getChangeWinWidthState && console.warn(`松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`)
|
|
629
629
|
_getChangeWinWidthState && sgmCustomReport({
|
|
630
630
|
type: 2,
|
|
631
631
|
code: 'android_jdapp_width_error_info',
|
|
632
632
|
msg: {
|
|
633
633
|
title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
|
|
634
634
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
635
635
|
taroSysInfo: systemInfo
|
|
636
636
|
}
|
|
637
637
|
})
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
|
|
642
642
|
console.warn('====获取系统信息=====', systemInfo)
|
|
643
643
|
return systemInfo
|
|
644
644
|
let result: boolean | null = null
|
|
645
645
|
return function() {
|
|
646
646
|
if (result === null) {
|
|
647
647
|
const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
|
|
648
648
|
if(!isJdApp){
|
|
649
649
|
console.warn("🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~")
|
|
650
650
|
isIgnoreOptimizeFromServer = true
|
|
651
651
|
result = true
|
|
652
652
|
return true
|
|
653
653
|
}
|
|
654
654
|
const enableAvifOptimize = appVersionCheckPass
|
|
655
655
|
if(enableAvifOptimize){
|
|
656
656
|
const configData = global.getDynamicConfig('avifSwitch')
|
|
657
657
|
console.warn("🚗 ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:", buildType)
|
|
658
658
|
console.warn("🚗 ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:", configData)
|
|
659
659
|
const { globalOn = true, ignoreOptimizeFromServer = false, page = {}, grayscale = {}, whiteList = [], blackList = [] } = configData || {}
|
|
660
660
|
const {shopId = '0', venderId = '0'} = parseQueryUrlObj
|
|
661
661
|
let imageEnableResult = true
|
|
662
662
|
isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
|
|
663
663
|
console.warn("🚗 ~~ file: index.h5.ts:213 ~~ returnfunction ~~ grayscale[buildType]:", grayscale[buildType])
|
|
664
664
|
if (blackList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
|
|
665
665
|
imageEnableResult = false
|
|
666
666
|
console.warn("🚗 ~~ file: utils.ts:198 命中黑名单~")
|
|
667
667
|
}else if(whiteList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
|
|
668
668
|
isIgnoreOptimizeFromServer = true
|
|
669
669
|
imageEnableResult = true
|
|
670
670
|
console.warn("🚗 ~~ file: utils.ts:205 命中白名单~")
|
|
671
671
|
}else if(grayscale[buildType] && isInGrayscale(grayscale[buildType])){
|
|
672
672
|
isIgnoreOptimizeFromServer = true
|
|
673
673
|
imageEnableResult = true
|
|
674
674
|
console.warn("🚗 ~~ file: utils.ts:214 命中灰度~")
|
|
675
675
|
}else{
|
|
676
676
|
imageEnableResult = globalOn === true || page[buildType] === true
|
|
677
677
|
if(globalOn === true){
|
|
678
678
|
isIgnoreOptimizeFromServer = true
|
|
679
679
|
console.warn("🚗 ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~")
|
|
680
680
|
}else if(page[buildType] === true){
|
|
681
681
|
console.warn("🚗 ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~")
|
|
682
682
|
}else{
|
|
683
683
|
console.warn("🚗 ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!")
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
686
|
result = imageEnableResult
|
|
687
687
|
return imageEnableResult
|
|
688
688
|
}else{
|
|
689
689
|
result = false
|
|
690
690
|
return false
|
|
691
691
|
}
|
|
692
692
|
} else {
|
|
693
693
|
return result
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
if(typeof options === 'object' && isImageOptimizeEnable()){
|
|
697
697
|
return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
|
|
698
698
|
}else{
|
|
699
699
|
return getQualityImageOld(imgUrl, options)
|
|
700
700
|
}
|
|
701
701
|
const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
|
|
702
702
|
windowWidth: window.innerWidth,
|
|
703
703
|
containerWidth: getContainerWidth(buildType, {
|
|
704
704
|
windowWidth: window.innerWidth,
|
|
705
705
|
}),
|
|
706
706
|
screenWidth: window.innerWidth,
|
|
707
707
|
platform: '',
|
|
708
708
|
model: '',
|
|
709
709
|
system: '',
|
|
710
710
|
}
|
|
711
711
|
return getSystemInfo
|
|
712
712
|
console.log('进入commonshowToast, 传入参数options为: ', options)
|
|
713
713
|
const params = Object.assign(
|
|
714
714
|
{},
|
|
715
715
|
{
|
|
716
716
|
title: '',
|
|
717
717
|
duration: 1500,
|
|
718
718
|
},
|
|
719
719
|
options,
|
|
720
720
|
)
|
|
721
721
|
params.duration = params.duration / 1000
|
|
722
722
|
if (isJdApp && !isJdAndHarmonyDevice) {
|
|
723
723
|
const showSuccessType = isIosDevice
|
|
724
724
|
? ToastIosType.SUCCESS
|
|
725
725
|
: ToastAndroidType.SUCCESS
|
|
726
726
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
727
727
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
728
728
|
console.log('执行原生toast success')
|
|
729
729
|
} else {
|
|
730
730
|
showSuccessToast(options)
|
|
731
731
|
}
|
|
732
732
|
const params = Object.assign(
|
|
733
733
|
{},
|
|
734
734
|
{
|
|
735
735
|
title: '',
|
|
736
736
|
duration: 1500,
|
|
737
737
|
},
|
|
738
738
|
options,
|
|
739
739
|
)
|
|
740
740
|
params.duration = params.duration / 1000
|
|
741
741
|
if (isJdApp) {
|
|
742
742
|
const showSuccessType = isIosDevice
|
|
743
743
|
? ToastIosType.FAIL
|
|
744
744
|
: ToastAndroidType.FAIL
|
|
745
745
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
746
746
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
747
747
|
console.log('执行原生toast fail')
|
|
748
748
|
} else {
|
|
749
749
|
console.log('执行H5 toast fail')
|
|
750
750
|
showFailToast(options)
|
|
751
751
|
}
|
|
752
752
|
const params = Object.assign(
|
|
753
753
|
{},
|
|
754
754
|
{
|
|
755
755
|
title: '',
|
|
756
756
|
duration: 1500,
|
|
757
757
|
},
|
|
758
758
|
options,
|
|
759
759
|
)
|
|
760
760
|
params.duration = params.duration / 1000
|
|
761
761
|
if (isJdApp) {
|
|
762
762
|
const showSuccessType = isIosDevice ?
|
|
763
763
|
ToastIosType.NORMAL :
|
|
764
764
|
ToastAndroidType.NORMAL
|
|
765
765
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
766
766
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
767
767
|
} else {
|
|
768
768
|
showNormalToast(options)
|
|
769
769
|
}
|
|
770
770
|
const createLoadingEle = document.createElement('div')
|
|
771
771
|
createLoadingEle.id = 'J_shopLoading'
|
|
772
772
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
773
773
|
createLoadingEle.innerHTML =
|
|
774
774
|
`<div class='d-loading-content'>
|
|
775
775
|
<span class='d-shop-loading-icon'></span>
|
|
776
776
|
<p class='d-shop-text'>${text}</p>
|
|
777
777
|
</div>`
|
|
778
778
|
const getEle = document.body
|
|
779
779
|
? document.body
|
|
780
780
|
: document.getElementsByTagName('body')[0]
|
|
781
781
|
getEle.appendChild(createLoadingEle)
|
|
782
782
|
const getEle = document.getElementById('J_shopLoading')
|
|
783
783
|
getEle && getEle.remove()
|
|
784
784
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(
|
|
785
785
|
params,
|
|
786
786
|
)
|
|
787
787
|
if (!systemInfo.system && window) {
|
|
788
788
|
systemInfo.system = window.navigator.userAgent
|
|
789
789
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
790
790
|
}
|
|
791
791
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
792
792
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
793
793
|
systemInfo.navBarHeight = 0
|
|
794
794
|
systemInfo.statusBarHeight = 0
|
|
795
795
|
systemInfo.capsulePosition = null
|
|
796
796
|
systemInfo.isIOS = isIOS
|
|
797
797
|
systemInfo.isAndroid = isAndroid
|
|
798
798
|
_ShopSystemInfo = systemInfo
|
|
799
799
|
return systemInfo
|
|
800
800
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev)
|
|
801
801
|
const numScale = Number(scale)
|
|
802
802
|
if(isNaN(numScale)){
|
|
803
803
|
console.warn(`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`)
|
|
804
804
|
return false
|
|
805
805
|
}
|
|
806
806
|
const { venderId } = global.info.queryInfo || {}
|
|
807
807
|
const id = venderId
|
|
808
808
|
if(!id && numScale !== 1){
|
|
809
809
|
return false
|
|
810
810
|
}
|
|
811
811
|
const useScale = Math.max(0, Math.min(1, numScale))
|
|
812
812
|
const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0
|
|
813
813
|
if(reportKey){
|
|
814
814
|
sgmCustomReport({
|
|
815
815
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
|
|
816
816
|
msg: '灰度调用',
|
|
817
817
|
})
|
|
818
818
|
console.log(`基于KEY[${reportKey}]的灰度调用1次~`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`))
|
|
819
819
|
if(isMatch){
|
|
820
820
|
sgmCustomReport({
|
|
821
821
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
|
|
822
822
|
msg: '灰度命中',
|
|
823
823
|
})
|
|
824
824
|
console.log(`基于KEY[${reportKey}]的命中1次灰度!`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`))
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
return isMatch
|
|
828
828
|
isJdApp,
|
|
829
829
|
isWxApp,
|
|
830
830
|
isIosDevice,
|
|
831
831
|
isAndroidDevice,
|
|
832
832
|
isJdAndIosDevice,
|
|
833
833
|
isJdAndAndroidDevice,
|
|
834
834
|
isJdAndHarmonyDevice,
|
|
835
835
|
isJdAndroidX5Core,
|
|
836
836
|
isMin,
|
|
837
837
|
isWxMin,
|
|
838
838
|
isWxMinAndWxapp,
|
|
839
839
|
isJdMinAndHarmony,
|
|
840
840
|
isJdMin,
|
|
841
841
|
isH5,
|
|
842
842
|
isH5AndJdShopView,
|
|
843
843
|
isChartH5,
|
|
844
844
|
isH5AndJdShopViewNativeScroll,
|
|
845
845
|
isH5AndJdShopViewH5Scroll,
|
|
846
846
|
isH5AndJdShopH5CustomScrollView,
|
|
847
847
|
isH5AndJingGouMini,
|
|
848
848
|
isWxMiniH5View,
|
|
849
849
|
urlCookie,
|
|
850
850
|
sliceArrToChunkList,
|
|
851
851
|
dealAddress,
|
|
852
852
|
objectToUrlEncode,
|
|
853
853
|
parseQueryUrlString,
|
|
854
854
|
setLowSmallPicUrl,
|
|
855
855
|
setTaroStorage,
|
|
856
856
|
getTaroStorageKeyValue,
|
|
857
857
|
removeTaroStorageKey,
|
|
858
858
|
clearTaroStorageKey,
|
|
859
859
|
getAvifSupport,
|
|
860
860
|
getWebpSupport,
|
|
861
861
|
getQualityImage,
|
|
862
862
|
countStringify,
|
|
863
863
|
getWxAppCookieStr,
|
|
864
864
|
getSystemInfos,
|
|
865
865
|
pxTransformFromData,
|
|
866
866
|
dealShopContentDataAndReport as dealShopContentData,
|
|
867
867
|
dateFormat,
|
|
868
868
|
throttle,
|
|
869
869
|
lodashThrottle,
|
|
870
870
|
debounce,
|
|
871
871
|
addHttps,
|
|
872
872
|
commonShowSuccessToast as showSuccessToast,
|
|
873
873
|
commonShowFailToast as showFailToast,
|
|
874
874
|
commonShowNormalToast as showNormalToast,
|
|
875
875
|
showShopLoading,
|
|
876
876
|
hideShopLoading,
|
|
877
877
|
stopNativeScrollEvent,
|
|
878
878
|
getAppChannelType,
|
|
879
879
|
formatTabActiveMenuType,
|
|
880
880
|
filterUrlQueryData,
|
|
881
881
|
sgmCustomReport,
|
|
882
882
|
draCustomReport,
|
|
883
883
|
remoteCustomReport,
|
|
884
884
|
draInterfaceCustomReport,
|
|
885
885
|
draBusinessCustomReport,
|
|
886
886
|
isMemberPage,
|
|
887
887
|
getFloorDataToDataDefines,
|
|
888
888
|
isOpenJdAppUrl,
|
|
889
889
|
jdOpenAppParams,
|
|
890
890
|
createJdOpenAppUrl,
|
|
891
891
|
isEmpty,
|
|
892
892
|
getJdAppReportPageSource,
|
|
893
893
|
isAppClassifyPage,
|
|
894
894
|
isAppHomeForMarketPage,
|
|
895
895
|
isImageOptimizeEnable,
|
|
896
896
|
isPc,
|
|
897
897
|
ipLoc_djd,
|
|
898
898
|
isTjScence,
|
|
899
899
|
isH5AdnJxMini,
|
|
900
900
|
isTjM,
|
|
901
901
|
isTjJxM,
|
|
902
902
|
isTJApp,
|
|
903
903
|
isH5AdnHaoWuJie,
|
|
904
904
|
tjChannel,
|
|
905
905
|
dealJdOpenAppData,
|
|
906
906
|
jdAppVersionCompare,
|
|
907
907
|
dealNativePixelToCssPixel,
|
|
908
908
|
isAppStowShop,
|
|
909
909
|
getSgmCustomCode,
|
|
910
910
|
handleSgmCodeTaroVersion,
|
|
911
911
|
isInGrayscale,
|
|
912
912
|
isIpadDevice,
|
|
913
913
|
getBorderStyle,
|
|
914
914
|
isSupportHybridHttpRequest,
|
|
915
915
|
isLanguageForEn
|