@conecli/cone-render 0.10.1-shop3.3 → 0.10.1-shop3.5
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/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
- package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
- package/dist/components/base/ItemViewExposureSmart/index.tsx +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/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/modules/ContainerFloorList/index.h5.module.scss +3 -0
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/open/api/util.ts +1 -1
- package/dist/service/http/colorSign.ts +1 -1
- package/dist/service/http/const.ts +1 -1
- package/dist/service/requestServer.h5.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/sColor.js +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +1 -1
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 && !isJdAndHarmonyDevice) {
|
|
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
|
stopNativeScrollEvent,
|
|
460
460
|
getAppChannelType,
|
|
461
461
|
isAndroidDevice,
|
|
462
462
|
isH5AndJdShopView,
|
|
463
463
|
isChartH5,
|
|
464
464
|
isH5AndJdShopViewNativeScroll,
|
|
465
465
|
isIosDevice,
|
|
466
466
|
isJdAndAndroidDevice,
|
|
467
467
|
isJdAndIosDevice,
|
|
468
468
|
isJdApp,
|
|
469
469
|
isWxApp,
|
|
470
470
|
isWxMiniH5View,
|
|
471
471
|
isJdAndHarmonyDevice,
|
|
472
472
|
isH5AndJingGouMini,
|
|
473
473
|
urlCookie,
|
|
474
474
|
sgmCustomReport,
|
|
475
475
|
draCustomReport,
|
|
476
476
|
remoteCustomReport,
|
|
477
477
|
draInterfaceCustomReport,
|
|
478
478
|
draBusinessCustomReport,
|
|
479
479
|
isMemberPage,
|
|
480
480
|
isH5AndJdShopViewH5Scroll,
|
|
481
481
|
isH5AndJdShopH5CustomScrollView,
|
|
482
482
|
isAppClassifyPage,
|
|
483
483
|
isAppHomeForMarketPage,
|
|
484
484
|
isPc,
|
|
485
485
|
ipLoc_djd,
|
|
486
486
|
jdAppVersionCompare,
|
|
487
487
|
isTjScence,
|
|
488
488
|
isH5AdnJxMini,
|
|
489
489
|
isTjM,
|
|
490
490
|
isTjJxM,
|
|
491
491
|
isTJApp,
|
|
492
492
|
isH5AdnHaoWuJie,
|
|
493
493
|
tjChannel,
|
|
494
494
|
dealNativePixelToCssPixel,
|
|
495
495
|
isAppStowShop,
|
|
496
496
|
isJdAndroidX5Core,
|
|
497
497
|
parseQueryUrlObj,
|
|
498
498
|
isIpadDevice,
|
|
499
499
|
isSupportHybridHttpRequest,
|
|
500
500
|
isLanguageForEn,
|
|
501
501
|
sColor,
|
|
502
502
|
draInterfaceDSMCustomReport,
|
|
503
503
|
addHttps,
|
|
504
504
|
clearTaroStorageKey,
|
|
505
505
|
countStringify,
|
|
506
506
|
dateFormat,
|
|
507
507
|
dealAddress,
|
|
508
508
|
dealShopContentData as originDealShopContentData,
|
|
509
509
|
debounce,
|
|
510
510
|
filterUrlQueryData,
|
|
511
511
|
formatTabActiveMenuType,
|
|
512
512
|
getAvifSupport,
|
|
513
513
|
getWebpSupport,
|
|
514
514
|
getTaroStorageKeyValue,
|
|
515
515
|
getWxAppCookieStr,
|
|
516
516
|
isH5,
|
|
517
517
|
isMin,
|
|
518
518
|
isJdMin,
|
|
519
519
|
isWxMin,
|
|
520
520
|
isWxMinAndWxapp,
|
|
521
521
|
isJdMinAndHarmony,
|
|
522
522
|
lodashThrottle,
|
|
523
523
|
objectToUrlEncode,
|
|
524
524
|
parseQueryUrlString,
|
|
525
525
|
removeTaroStorageKey,
|
|
526
526
|
setLowSmallPicUrl,
|
|
527
527
|
setTaroStorage,
|
|
528
528
|
showFailToast,
|
|
529
529
|
showNormalToast,
|
|
530
530
|
showSuccessToast,
|
|
531
531
|
sliceArrToChunkList,
|
|
532
532
|
throttle,
|
|
533
533
|
getQualityImageNew,
|
|
534
534
|
getQualityImageOld,
|
|
535
535
|
isOpenJdAppUrl,
|
|
536
536
|
jdOpenAppParams,
|
|
537
537
|
createJdOpenAppUrl,
|
|
538
538
|
isEmpty,
|
|
539
539
|
getJdAppReportPageSource,
|
|
540
540
|
dealJdOpenAppData,
|
|
541
541
|
getBorderStyle,
|
|
542
542
|
const getNum = Number(num);
|
|
543
543
|
let _changeLayoutWidth = layoutWidth;
|
|
544
544
|
if (!_changeLayoutWidth) {
|
|
545
545
|
_changeLayoutWidth =
|
|
546
546
|
_ShopSystemInfo && _ShopSystemInfo?.windowWidth
|
|
547
547
|
? _ShopSystemInfo.windowWidth
|
|
548
548
|
: Taro.getSystemInfoSync()?.windowWidth;
|
|
549
549
|
}
|
|
550
550
|
return Math.round((getNum / widthSize) * _changeLayoutWidth);
|
|
551
551
|
const getRootFontSize = (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
|
|
552
552
|
const getRealRootFontSize =
|
|
553
553
|
getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
|
|
554
554
|
return Math.ceil(
|
|
555
555
|
(((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) * getRealRootFontSize,
|
|
556
556
|
);
|
|
557
557
|
console.log(
|
|
558
558
|
'获取系统宽度systemInfo?.windowWidth',
|
|
559
559
|
systemInfo?.windowWidth,
|
|
560
560
|
'taroToTransformRoutimePXNumber(changeWidth)',
|
|
561
561
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
|
|
562
562
|
);
|
|
563
563
|
return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
|
|
564
564
|
? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
|
|
565
565
|
: (systemInfo?.windowWidth ?? 0);
|
|
566
566
|
const systemInfo = Taro.getSystemInfoSync();
|
|
567
567
|
if (params && params?.pageWidth && params?.pageHeight) {
|
|
568
568
|
systemInfo.windowWidth = params?.pageWidth;
|
|
569
569
|
systemInfo.windowHeight = params?.pageHeight;
|
|
570
570
|
console.warn(
|
|
571
571
|
'松果安卓app内获折叠屏信息重置系统信息宽度值',
|
|
572
572
|
params,
|
|
573
573
|
',systemInfo信息集合为',
|
|
574
574
|
systemInfo,
|
|
575
575
|
);
|
|
576
576
|
} else {
|
|
577
577
|
if (isJdApp && isAndroidDevice && systemInfo) {
|
|
578
578
|
const getWinWidth = window.innerWidth;
|
|
579
579
|
const getWinHeight = window.innerHeight;
|
|
580
580
|
const getScreenWidth = window.screen.width;
|
|
581
581
|
const getScreenHeight = window.screen.height;
|
|
582
582
|
const isLandscape = getScreenWidth >= getScreenHeight;
|
|
583
583
|
const { windowWidth, windowHeight, screenWidth, screenHeight } = systemInfo;
|
|
584
584
|
if (windowWidth <= 0) {
|
|
585
585
|
systemInfo.initWindowWidth = windowWidth;
|
|
586
586
|
if (isLandscape) {
|
|
587
587
|
systemInfo.windowWidth = getScreenHeight;
|
|
588
588
|
systemInfo.windowHeight = getScreenWidth;
|
|
589
589
|
systemInfo.screenWidth = getScreenHeight;
|
|
590
590
|
systemInfo.screenHeight = getScreenWidth;
|
|
591
591
|
} else {
|
|
592
592
|
systemInfo.windowWidth = getScreenWidth;
|
|
593
593
|
systemInfo.windowHeight = getScreenHeight;
|
|
594
594
|
systemInfo.screenWidth = getScreenWidth;
|
|
595
595
|
systemInfo.screenHeight = getScreenHeight;
|
|
596
596
|
}
|
|
597
597
|
console.warn(
|
|
598
598
|
`松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight}`,
|
|
599
599
|
);
|
|
600
600
|
sgmCustomReport({
|
|
601
601
|
type: 2,
|
|
602
602
|
code: 'android_jdapp_width_error_info',
|
|
603
603
|
msg: {
|
|
604
604
|
title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
|
|
605
605
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
606
606
|
taroSysInfo: systemInfo,
|
|
607
607
|
},
|
|
608
608
|
});
|
|
609
609
|
} else {
|
|
610
610
|
let _getChangeWinWidthState = false;
|
|
611
611
|
if (getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth) {
|
|
612
612
|
if (isLandscape) {
|
|
613
613
|
systemInfo.windowWidth = getScreenHeight;
|
|
614
614
|
systemInfo.windowHeight = getScreenWidth;
|
|
615
615
|
systemInfo.screenWidth = getScreenHeight;
|
|
616
616
|
systemInfo.screenHeight = getScreenWidth;
|
|
617
617
|
} else {
|
|
618
618
|
systemInfo.windowWidth = getScreenWidth;
|
|
619
619
|
systemInfo.windowHeight = getScreenHeight;
|
|
620
620
|
systemInfo.screenWidth = getScreenWidth;
|
|
621
621
|
systemInfo.screenHeight = getScreenHeight;
|
|
622
622
|
}
|
|
623
623
|
_getChangeWinWidthState = true;
|
|
624
624
|
}
|
|
625
625
|
_getChangeWinWidthState &&
|
|
626
626
|
console.warn(
|
|
627
627
|
`松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`,
|
|
628
628
|
);
|
|
629
629
|
_getChangeWinWidthState &&
|
|
630
630
|
sgmCustomReport({
|
|
631
631
|
type: 2,
|
|
632
632
|
code: 'android_jdapp_width_error_info',
|
|
633
633
|
msg: {
|
|
634
634
|
title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
|
|
635
635
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
636
636
|
taroSysInfo: systemInfo,
|
|
637
637
|
},
|
|
638
638
|
});
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo);
|
|
643
643
|
console.warn('====获取系统信息=====', systemInfo);
|
|
644
644
|
return systemInfo;
|
|
645
645
|
let result: boolean | null = null;
|
|
646
646
|
return function () {
|
|
647
647
|
if (result === null) {
|
|
648
648
|
const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
|
|
649
649
|
if (!isJdApp) {
|
|
650
650
|
console.warn('🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~');
|
|
651
651
|
isIgnoreOptimizeFromServer = true;
|
|
652
652
|
result = true;
|
|
653
653
|
return true;
|
|
654
654
|
}
|
|
655
655
|
const enableAvifOptimize = appVersionCheckPass;
|
|
656
656
|
if (enableAvifOptimize) {
|
|
657
657
|
const configData = global.getDynamicConfig('avifSwitch');
|
|
658
658
|
console.warn(
|
|
659
659
|
'🚗 ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:',
|
|
660
660
|
buildType,
|
|
661
661
|
);
|
|
662
662
|
console.warn(
|
|
663
663
|
'🚗 ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:',
|
|
664
664
|
configData,
|
|
665
665
|
);
|
|
666
666
|
const {
|
|
667
667
|
globalOn = true,
|
|
668
668
|
ignoreOptimizeFromServer = false,
|
|
669
669
|
page = {},
|
|
670
670
|
grayscale = {},
|
|
671
671
|
whiteList = [],
|
|
672
672
|
blackList = [],
|
|
673
673
|
} = configData || {};
|
|
674
674
|
const { shopId = '0', venderId = '0' } = parseQueryUrlObj;
|
|
675
675
|
let imageEnableResult = true;
|
|
676
676
|
isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
|
|
677
677
|
console.warn(
|
|
678
678
|
'🚗 ~~ file: index.h5.ts:213 ~~ returnfunction ~~ grayscale[buildType]:',
|
|
679
679
|
grayscale[buildType],
|
|
680
680
|
);
|
|
681
681
|
if (
|
|
682
682
|
blackList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
|
|
683
683
|
) {
|
|
684
684
|
imageEnableResult = false;
|
|
685
685
|
console.warn('🚗 ~~ file: utils.ts:198 命中黑名单~');
|
|
686
686
|
} else if (
|
|
687
687
|
whiteList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
|
|
688
688
|
) {
|
|
689
689
|
isIgnoreOptimizeFromServer = true;
|
|
690
690
|
imageEnableResult = true;
|
|
691
691
|
console.warn('🚗 ~~ file: utils.ts:205 命中白名单~');
|
|
692
692
|
} else if (grayscale[buildType] && isInGrayscale(grayscale[buildType])) {
|
|
693
693
|
isIgnoreOptimizeFromServer = true;
|
|
694
694
|
imageEnableResult = true;
|
|
695
695
|
console.warn('🚗 ~~ file: utils.ts:214 命中灰度~');
|
|
696
696
|
} else {
|
|
697
697
|
imageEnableResult = globalOn === true || page[buildType] === true;
|
|
698
698
|
if (globalOn === true) {
|
|
699
699
|
isIgnoreOptimizeFromServer = true;
|
|
700
700
|
console.warn('🚗 ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~');
|
|
701
701
|
} else if (page[buildType] === true) {
|
|
702
702
|
console.warn('🚗 ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~');
|
|
703
703
|
} else {
|
|
704
704
|
console.warn('🚗 ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!');
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
707
|
result = imageEnableResult;
|
|
708
708
|
return imageEnableResult;
|
|
709
709
|
} else {
|
|
710
710
|
result = false;
|
|
711
711
|
return false;
|
|
712
712
|
}
|
|
713
713
|
} else {
|
|
714
714
|
return result;
|
|
715
715
|
}
|
|
716
716
|
};
|
|
717
717
|
if (typeof options === 'object' && isImageOptimizeEnable()) {
|
|
718
718
|
return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
|
|
719
719
|
} else {
|
|
720
720
|
return getQualityImageOld(imgUrl, options);
|
|
721
721
|
}
|
|
722
722
|
const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
|
|
723
723
|
windowWidth: window.innerWidth,
|
|
724
724
|
containerWidth: getContainerWidth(buildType, {
|
|
725
725
|
windowWidth: window.innerWidth,
|
|
726
726
|
}),
|
|
727
727
|
screenWidth: window.innerWidth,
|
|
728
728
|
platform: '',
|
|
729
729
|
model: '',
|
|
730
730
|
system: '',
|
|
731
731
|
};
|
|
732
732
|
return getSystemInfo;
|
|
733
733
|
const params = Object.assign(
|
|
734
734
|
{},
|
|
735
735
|
{
|
|
736
736
|
title: '',
|
|
737
737
|
duration: 1500,
|
|
738
738
|
},
|
|
739
739
|
options,
|
|
740
740
|
);
|
|
741
741
|
params.duration = params.duration / 1000;
|
|
742
742
|
if (isJdApp && !isJdAndHarmonyDevice) {
|
|
743
743
|
const showSuccessType = isIosDevice ? ToastIosType.SUCCESS : ToastAndroidType.SUCCESS;
|
|
744
744
|
const duration = isAndroidDevice ? 0 : params.duration;
|
|
745
745
|
nativePageShowToast(options.title, showSuccessType, duration);
|
|
746
746
|
console.log('执行原生toast success');
|
|
747
747
|
} else {
|
|
748
748
|
showSuccessToast(options);
|
|
749
749
|
}
|
|
750
750
|
const params = Object.assign(
|
|
751
751
|
{},
|
|
752
752
|
{
|
|
753
753
|
title: '',
|
|
754
754
|
duration: 1500,
|
|
755
755
|
},
|
|
756
756
|
options,
|
|
757
757
|
);
|
|
758
758
|
params.duration = params.duration / 1000;
|
|
759
759
|
if (isJdApp) {
|
|
760
760
|
const showSuccessType = isIosDevice ? ToastIosType.FAIL : ToastAndroidType.FAIL;
|
|
761
761
|
const duration = isAndroidDevice ? 0 : params.duration;
|
|
762
762
|
nativePageShowToast(options.title, showSuccessType, duration);
|
|
763
763
|
console.log('执行原生toast fail');
|
|
764
764
|
} else {
|
|
765
765
|
console.log('执行H5 toast fail');
|
|
766
766
|
showFailToast(options);
|
|
767
767
|
}
|
|
768
768
|
const params = Object.assign(
|
|
769
769
|
{},
|
|
770
770
|
{
|
|
771
771
|
title: '',
|
|
772
772
|
duration: 1500,
|
|
773
773
|
},
|
|
774
774
|
options,
|
|
775
775
|
);
|
|
776
776
|
params.duration = params.duration / 1000;
|
|
777
777
|
if (isJdApp) {
|
|
778
778
|
const showSuccessType = isIosDevice ? ToastIosType.NORMAL : ToastAndroidType.NORMAL;
|
|
779
779
|
const duration = isAndroidDevice ? 0 : params.duration;
|
|
780
780
|
nativePageShowToast(options.title, showSuccessType, duration);
|
|
781
781
|
} else {
|
|
782
782
|
showNormalToast(options);
|
|
783
783
|
}
|
|
784
784
|
const createLoadingEle = document.createElement('div');
|
|
785
785
|
createLoadingEle.id = 'J_shopLoading';
|
|
786
786
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
|
|
787
787
|
createLoadingEle.innerHTML = `<div class='d-loading-content'>
|
|
788
788
|
<span class='d-shop-loading-icon'></span>
|
|
789
789
|
<p class='d-shop-text'>${text}</p>
|
|
790
790
|
</div>`;
|
|
791
791
|
const getEle = document.body ? document.body : document.getElementsByTagName('body')[0];
|
|
792
792
|
getEle.appendChild(createLoadingEle);
|
|
793
793
|
const getEle = document.getElementById('J_shopLoading');
|
|
794
794
|
getEle && getEle.remove();
|
|
795
795
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(params);
|
|
796
796
|
if (!systemInfo.system && window) {
|
|
797
797
|
systemInfo.system = window.navigator.userAgent;
|
|
798
798
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
|
|
799
799
|
}
|
|
800
800
|
const isIOS = !!systemInfo?.system.match(/ios/i);
|
|
801
801
|
const isAndroid = !!systemInfo?.system.match(/android/i);
|
|
802
802
|
systemInfo.navBarHeight = 0;
|
|
803
803
|
systemInfo.statusBarHeight = 0;
|
|
804
804
|
systemInfo.capsulePosition = null;
|
|
805
805
|
systemInfo.isIOS = isIOS;
|
|
806
806
|
systemInfo.isAndroid = isAndroid;
|
|
807
807
|
_ShopSystemInfo = systemInfo;
|
|
808
808
|
return systemInfo;
|
|
809
809
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev);
|
|
810
810
|
const numScale = Number(scale);
|
|
811
811
|
if (isNaN(numScale)) {
|
|
812
812
|
console.warn(
|
|
813
813
|
`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`,
|
|
814
814
|
);
|
|
815
815
|
return false;
|
|
816
816
|
}
|
|
817
817
|
const { venderId } = global.info.queryInfo || {};
|
|
818
818
|
const id = venderId;
|
|
819
819
|
if (!id && numScale !== 1) {
|
|
820
820
|
return false;
|
|
821
821
|
}
|
|
822
822
|
const useScale = Math.max(0, Math.min(1, numScale));
|
|
823
823
|
const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
|
|
824
824
|
if (reportKey) {
|
|
825
825
|
sgmCustomReport({
|
|
826
826
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
|
|
827
827
|
msg: '灰度调用',
|
|
828
828
|
});
|
|
829
829
|
console.log(
|
|
830
830
|
`基于KEY[${reportKey}]的灰度调用1次~`,
|
|
831
831
|
getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
|
|
832
832
|
);
|
|
833
833
|
if (isMatch) {
|
|
834
834
|
sgmCustomReport({
|
|
835
835
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
|
|
836
836
|
msg: '灰度命中',
|
|
837
837
|
});
|
|
838
838
|
console.log(
|
|
839
839
|
`基于KEY[${reportKey}]的命中1次灰度!`,
|
|
840
840
|
getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
|
|
841
841
|
);
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
844
|
return isMatch;
|
|
845
845
|
isJdApp,
|
|
846
846
|
isWxApp,
|
|
847
847
|
isIosDevice,
|
|
848
848
|
isAndroidDevice,
|
|
849
849
|
isJdAndIosDevice,
|
|
850
850
|
isJdAndAndroidDevice,
|
|
851
851
|
isJdAndHarmonyDevice,
|
|
852
852
|
isJdAndroidX5Core,
|
|
853
853
|
isMin,
|
|
854
854
|
isWxMin,
|
|
855
855
|
isWxMinAndWxapp,
|
|
856
856
|
isJdMinAndHarmony,
|
|
857
857
|
isJdMin,
|
|
858
858
|
isH5,
|
|
859
859
|
isH5AndJdShopView,
|
|
860
860
|
isChartH5,
|
|
861
861
|
isH5AndJdShopViewNativeScroll,
|
|
862
862
|
isH5AndJdShopViewH5Scroll,
|
|
863
863
|
isH5AndJdShopH5CustomScrollView,
|
|
864
864
|
isH5AndJingGouMini,
|
|
865
865
|
isWxMiniH5View,
|
|
866
866
|
urlCookie,
|
|
867
867
|
sliceArrToChunkList,
|
|
868
868
|
dealAddress,
|
|
869
869
|
objectToUrlEncode,
|
|
870
870
|
parseQueryUrlString,
|
|
871
871
|
setLowSmallPicUrl,
|
|
872
872
|
setTaroStorage,
|
|
873
873
|
getTaroStorageKeyValue,
|
|
874
874
|
removeTaroStorageKey,
|
|
875
875
|
clearTaroStorageKey,
|
|
876
876
|
getAvifSupport,
|
|
877
877
|
getWebpSupport,
|
|
878
878
|
getQualityImage,
|
|
879
879
|
countStringify,
|
|
880
880
|
getWxAppCookieStr,
|
|
881
881
|
getSystemInfos,
|
|
882
882
|
pxTransformFromData,
|
|
883
883
|
dealShopContentDataAndReport as dealShopContentData,
|
|
884
884
|
dateFormat,
|
|
885
885
|
throttle,
|
|
886
886
|
lodashThrottle,
|
|
887
887
|
debounce,
|
|
888
888
|
addHttps,
|
|
889
889
|
commonShowSuccessToast as showSuccessToast,
|
|
890
890
|
commonShowFailToast as showFailToast,
|
|
891
891
|
commonShowNormalToast as showNormalToast,
|
|
892
892
|
showShopLoading,
|
|
893
893
|
hideShopLoading,
|
|
894
894
|
stopNativeScrollEvent,
|
|
895
895
|
getAppChannelType,
|
|
896
896
|
formatTabActiveMenuType,
|
|
897
897
|
filterUrlQueryData,
|
|
898
898
|
sgmCustomReport,
|
|
899
899
|
draCustomReport,
|
|
900
900
|
remoteCustomReport,
|
|
901
901
|
draInterfaceCustomReport,
|
|
902
902
|
draBusinessCustomReport,
|
|
903
903
|
isMemberPage,
|
|
904
904
|
getFloorDataToDataDefines,
|
|
905
905
|
isOpenJdAppUrl,
|
|
906
906
|
jdOpenAppParams,
|
|
907
907
|
createJdOpenAppUrl,
|
|
908
908
|
isEmpty,
|
|
909
909
|
getJdAppReportPageSource,
|
|
910
910
|
isAppClassifyPage,
|
|
911
911
|
isAppHomeForMarketPage,
|
|
912
912
|
isImageOptimizeEnable,
|
|
913
913
|
isPc,
|
|
914
914
|
ipLoc_djd,
|
|
915
915
|
isTjScence,
|
|
916
916
|
isH5AdnJxMini,
|
|
917
917
|
isTjM,
|
|
918
918
|
isTjJxM,
|
|
919
919
|
isTJApp,
|
|
920
920
|
isH5AdnHaoWuJie,
|
|
921
921
|
tjChannel,
|
|
922
922
|
dealJdOpenAppData,
|
|
923
923
|
jdAppVersionCompare,
|
|
924
924
|
dealNativePixelToCssPixel,
|
|
925
925
|
isAppStowShop,
|
|
926
926
|
getSgmCustomCode,
|
|
927
927
|
handleSgmCodeTaroVersion,
|
|
928
928
|
isInGrayscale,
|
|
929
929
|
isIpadDevice,
|
|
930
930
|
getBorderStyle,
|
|
931
931
|
isSupportHybridHttpRequest,
|
|
932
932
|
isLanguageForEn,
|
|
933
933
|
sColor,
|
|
934
934
|
draInterfaceDSMCustomReport,
|