@conecli/cone-render 0.10.1-shop3.1 → 0.10.1-shop3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.ts +1 -1
- package/dist/common/const.ts +1 -1
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CountDown/index.module.scss +49 -44
- package/dist/components/base/CountDown/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +11 -0
- 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/InViewRender/index.tsx +1 -1
- package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
- package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.module.scss +8 -0
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/interface/common.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/index.jd.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web/report.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/jumpEventReport/web.jdb.ts +1 -1
- package/dist/jumpEventReport/web.jdjch.ts +1 -1
- package/dist/jumpEventReport/web.jxwxapp.ts +1 -1
- package/dist/jumpEventReport/web.pc.ts +1 -1
- package/dist/jumpEventReport/web.tjapp.ts +1 -1
- package/dist/jumpEventReport/web.tjm.ts +1 -1
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -53
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/open/api/util.ts +1 -1
- package/dist/sass/app.h5.scss +261 -224
- package/dist/sass/base.scss +142 -141
- package/dist/service/fetchGateway.ts +1 -1
- package/dist/service/fetchGateway.weapp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -1
- package/dist/service/http/const.ts +1 -1
- package/dist/service/http/h5Http.ts +1 -1
- package/dist/service/requestServer.h5.ts +1 -1
- package/dist/service/requestServer.ts +1 -1
- package/dist/service/requestServer.weapp.ts +1 -0
- 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/jumpExtMapUtil.js +1 -0
- package/dist/utils/sColor.js +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +1 -1
- package/dist/utils/memberFormatUtils.js +0 -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
|
addHttps,
|
|
48
47
|
clearTaroStorageKey,
|
|
49
48
|
countStringify,
|
|
50
49
|
dateFormat,
|
|
51
50
|
dealAddress,
|
|
52
51
|
dealShopContentData as originDealShopContentData,
|
|
53
52
|
debounce,
|
|
54
53
|
filterUrlQueryData,
|
|
55
54
|
formatTabActiveMenuType,
|
|
56
55
|
getAvifSupport,
|
|
57
56
|
getWebpSupport,
|
|
58
57
|
getTaroStorageKeyValue,
|
|
59
58
|
getWxAppCookieStr,
|
|
60
59
|
isH5,
|
|
61
60
|
isMin,
|
|
62
61
|
isJdMin,
|
|
63
62
|
isWxMin,
|
|
64
63
|
isWxMinAndWxapp,
|
|
65
64
|
isJdMinAndHarmony,
|
|
66
65
|
lodashThrottle,
|
|
67
66
|
objectToUrlEncode,
|
|
68
67
|
parseQueryUrlString,
|
|
69
68
|
removeTaroStorageKey,
|
|
70
69
|
setLowSmallPicUrl,
|
|
71
70
|
setTaroStorage,
|
|
72
71
|
showFailToast,
|
|
73
72
|
showNormalToast,
|
|
74
73
|
showSuccessToast,
|
|
75
74
|
sliceArrToChunkList,
|
|
76
75
|
throttle,
|
|
77
76
|
getQualityImageNew,
|
|
78
77
|
getQualityImageOld,
|
|
79
78
|
isOpenJdAppUrl,
|
|
80
79
|
jdOpenAppParams,
|
|
81
80
|
createJdOpenAppUrl,
|
|
82
81
|
isEmpty,
|
|
83
82
|
getJdAppReportPageSource,
|
|
84
83
|
dealJdOpenAppData,
|
|
85
84
|
getBorderStyle,
|
|
86
85
|
SgmCustomCode,
|
|
87
86
|
} from '../common/sgmCustomCode'
|
|
88
87
|
const getNum = Number(num)
|
|
89
88
|
let _changeLayoutWidth = layoutWidth
|
|
90
89
|
if (!_changeLayoutWidth) {
|
|
91
90
|
_changeLayoutWidth =
|
|
92
91
|
_ShopSystemInfo && _ShopSystemInfo?.windowWidth
|
|
93
92
|
? _ShopSystemInfo.windowWidth
|
|
94
93
|
: Taro.getSystemInfoSync()?.windowWidth
|
|
95
94
|
}
|
|
96
95
|
return Math.round((getNum / widthSize) * _changeLayoutWidth)
|
|
97
96
|
changeSize,
|
|
98
97
|
designWidth = 750,
|
|
99
98
|
systemInfo,
|
|
100
99
|
const getRootFontSize =
|
|
101
100
|
(40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
|
|
102
101
|
const getRealRootFontSize =
|
|
103
102
|
getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
|
|
104
103
|
return Math.ceil(
|
|
105
104
|
(((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
|
|
106
105
|
getRealRootFontSize,
|
|
107
106
|
)
|
|
108
107
|
console.log(
|
|
109
108
|
'获取系统宽度systemInfo?.windowWidth',
|
|
110
109
|
systemInfo?.windowWidth,
|
|
111
110
|
'taroToTransformRoutimePXNumber(changeWidth)',
|
|
112
111
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
|
|
113
112
|
)
|
|
114
113
|
return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
|
|
115
114
|
? systemInfo?.windowWidth -
|
|
116
115
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
|
|
117
116
|
: systemInfo?.windowWidth ?? 0
|
|
118
117
|
const systemInfo = Taro.getSystemInfoSync()
|
|
119
118
|
if (params && params?.pageWidth && params?.pageHeight) {
|
|
120
119
|
systemInfo.windowWidth = params?.pageWidth
|
|
121
120
|
systemInfo.windowHeight = params?.pageHeight
|
|
122
121
|
console.warn("松果安卓app内获折叠屏信息重置系统信息宽度值",params,",systemInfo信息集合为",systemInfo)
|
|
123
122
|
}else {
|
|
124
123
|
if (isJdApp && isAndroidDevice && systemInfo) {
|
|
125
124
|
const getWinWidth = window.innerWidth;
|
|
126
125
|
const getWinHeight = window.innerHeight;
|
|
127
126
|
const getScreenWidth = window.screen.width;
|
|
128
127
|
const getScreenHeight = window.screen.height;
|
|
129
128
|
const isLandscape = getScreenWidth >= getScreenHeight;
|
|
130
129
|
const { windowWidth,windowHeight, screenWidth, screenHeight } = systemInfo
|
|
131
130
|
if (windowWidth <= 0) {
|
|
132
131
|
systemInfo.initWindowWidth = windowWidth;
|
|
133
132
|
if(isLandscape){
|
|
134
133
|
systemInfo.windowWidth = getScreenHeight
|
|
135
134
|
systemInfo.windowHeight = getScreenWidth
|
|
136
135
|
systemInfo.screenWidth = getScreenHeight
|
|
137
136
|
systemInfo.screenHeight = getScreenWidth
|
|
138
137
|
}else {
|
|
139
138
|
systemInfo.windowWidth = getScreenWidth
|
|
140
139
|
systemInfo.windowHeight = getScreenHeight
|
|
141
140
|
systemInfo.screenWidth = getScreenWidth
|
|
142
141
|
systemInfo.screenHeight = getScreenHeight
|
|
143
142
|
}
|
|
144
143
|
console.warn(`松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight}`)
|
|
145
144
|
sgmCustomReport({
|
|
146
145
|
type: 2,
|
|
147
146
|
code: 'android_jdapp_width_error_info',
|
|
148
147
|
msg: {
|
|
149
148
|
title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
|
|
150
149
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
151
150
|
taroSysInfo: systemInfo
|
|
152
151
|
}
|
|
153
152
|
})
|
|
154
153
|
}else {
|
|
155
154
|
let _getChangeWinWidthState = false
|
|
156
155
|
if( getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth){
|
|
157
156
|
if(isLandscape){
|
|
158
157
|
systemInfo.windowWidth = getScreenHeight
|
|
159
158
|
systemInfo.windowHeight = getScreenWidth
|
|
160
159
|
systemInfo.screenWidth = getScreenHeight
|
|
161
160
|
systemInfo.screenHeight = getScreenWidth
|
|
162
161
|
}else {
|
|
163
162
|
systemInfo.windowWidth = getScreenWidth
|
|
164
163
|
systemInfo.windowHeight = getScreenHeight
|
|
165
164
|
systemInfo.screenWidth = getScreenWidth
|
|
166
165
|
systemInfo.screenHeight = getScreenHeight
|
|
167
166
|
}
|
|
168
167
|
_getChangeWinWidthState = true
|
|
169
168
|
}
|
|
170
169
|
_getChangeWinWidthState && console.warn(`松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`)
|
|
171
170
|
_getChangeWinWidthState && sgmCustomReport({
|
|
172
171
|
type: 2,
|
|
173
172
|
code: 'android_jdapp_width_error_info',
|
|
174
173
|
msg: {
|
|
175
174
|
title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
|
|
176
175
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
177
176
|
taroSysInfo: systemInfo
|
|
178
177
|
}
|
|
179
178
|
})
|
|
180
179
|
}
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
|
|
184
183
|
console.warn('====获取系统信息=====', systemInfo)
|
|
185
184
|
return systemInfo
|
|
186
185
|
let result: boolean | null = null
|
|
187
186
|
return function() {
|
|
188
187
|
if (result === null) {
|
|
189
188
|
const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
|
|
190
189
|
if(!isJdApp){
|
|
191
190
|
console.warn("🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~")
|
|
192
191
|
isIgnoreOptimizeFromServer = true
|
|
193
192
|
result = true
|
|
194
193
|
return true
|
|
195
194
|
}
|
|
196
195
|
const enableAvifOptimize = appVersionCheckPass
|
|
197
196
|
if(enableAvifOptimize){
|
|
198
197
|
const configData = global.getDynamicConfig('avifSwitch')
|
|
199
198
|
console.warn("🚗 ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:", buildType)
|
|
200
199
|
console.warn("🚗 ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:", configData)
|
|
201
200
|
const { globalOn = true, ignoreOptimizeFromServer = false, page = {}, grayscale = {}, whiteList = [], blackList = [] } = configData || {}
|
|
202
201
|
const {shopId = '0', venderId = '0'} = parseQueryUrlObj
|
|
203
202
|
let imageEnableResult = true
|
|
204
203
|
isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
|
|
205
204
|
console.warn("🚗 ~~ file: index.h5.ts:213 ~~ returnfunction ~~ grayscale[buildType]:", grayscale[buildType])
|
|
206
205
|
if (blackList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
|
|
207
206
|
imageEnableResult = false
|
|
208
207
|
console.warn("🚗 ~~ file: utils.ts:198 命中黑名单~")
|
|
209
208
|
}else if(whiteList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
|
|
210
209
|
isIgnoreOptimizeFromServer = true
|
|
211
210
|
imageEnableResult = true
|
|
212
211
|
console.warn("🚗 ~~ file: utils.ts:205 命中白名单~")
|
|
213
212
|
}else if(grayscale[buildType] && isInGrayscale(grayscale[buildType])){
|
|
214
213
|
isIgnoreOptimizeFromServer = true
|
|
215
214
|
imageEnableResult = true
|
|
216
215
|
console.warn("🚗 ~~ file: utils.ts:214 命中灰度~")
|
|
217
216
|
}else{
|
|
218
217
|
imageEnableResult = globalOn === true || page[buildType] === true
|
|
219
218
|
if(globalOn === true){
|
|
220
219
|
isIgnoreOptimizeFromServer = true
|
|
221
220
|
console.warn("🚗 ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~")
|
|
222
221
|
}else if(page[buildType] === true){
|
|
223
222
|
console.warn("🚗 ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~")
|
|
224
223
|
}else{
|
|
225
224
|
console.warn("🚗 ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!")
|
|
226
225
|
}
|
|
227
226
|
}
|
|
228
227
|
result = imageEnableResult
|
|
229
228
|
return imageEnableResult
|
|
230
229
|
}else{
|
|
231
230
|
result = false
|
|
232
231
|
return false
|
|
233
232
|
}
|
|
234
233
|
} else {
|
|
235
234
|
return result
|
|
236
235
|
}
|
|
237
236
|
}
|
|
238
237
|
if(typeof options === 'object' && isImageOptimizeEnable()){
|
|
239
238
|
return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
|
|
240
239
|
}else{
|
|
241
240
|
return getQualityImageOld(imgUrl, options)
|
|
242
241
|
}
|
|
243
242
|
const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
|
|
244
243
|
windowWidth: window.innerWidth,
|
|
245
244
|
containerWidth: getContainerWidth(buildType, {
|
|
246
245
|
windowWidth: window.innerWidth,
|
|
247
246
|
}),
|
|
248
247
|
screenWidth: window.innerWidth,
|
|
249
248
|
platform: '',
|
|
250
249
|
model: '',
|
|
251
250
|
system: '',
|
|
252
251
|
}
|
|
253
252
|
return getSystemInfo
|
|
254
253
|
console.log('进入commonshowToast, 传入参数options为: ', options)
|
|
255
254
|
const params = Object.assign(
|
|
256
255
|
{},
|
|
257
256
|
{
|
|
258
257
|
title: '',
|
|
259
258
|
duration: 1500,
|
|
260
259
|
},
|
|
261
260
|
options,
|
|
262
261
|
)
|
|
263
262
|
params.duration = params.duration / 1000
|
|
264
263
|
if (isJdApp) {
|
|
265
264
|
const showSuccessType = isIosDevice
|
|
266
265
|
? ToastIosType.SUCCESS
|
|
267
266
|
: ToastAndroidType.SUCCESS
|
|
268
267
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
269
268
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
270
269
|
console.log('执行原生toast success')
|
|
271
270
|
} else {
|
|
272
271
|
showSuccessToast(options)
|
|
273
272
|
}
|
|
274
273
|
const params = Object.assign(
|
|
275
274
|
{},
|
|
276
275
|
{
|
|
277
276
|
title: '',
|
|
278
277
|
duration: 1500,
|
|
279
278
|
},
|
|
280
279
|
options,
|
|
281
280
|
)
|
|
282
281
|
params.duration = params.duration / 1000
|
|
283
282
|
if (isJdApp) {
|
|
284
283
|
const showSuccessType = isIosDevice
|
|
285
284
|
? ToastIosType.FAIL
|
|
286
285
|
: ToastAndroidType.FAIL
|
|
287
286
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
288
287
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
289
288
|
console.log('执行原生toast fail')
|
|
290
289
|
} else {
|
|
291
290
|
console.log('执行H5 toast fail')
|
|
292
291
|
showFailToast(options)
|
|
293
292
|
}
|
|
294
293
|
const params = Object.assign(
|
|
295
294
|
{},
|
|
296
295
|
{
|
|
297
296
|
title: '',
|
|
298
297
|
duration: 1500,
|
|
299
298
|
},
|
|
300
299
|
options,
|
|
301
300
|
)
|
|
302
301
|
params.duration = params.duration / 1000
|
|
303
302
|
if (isJdApp) {
|
|
304
303
|
const showSuccessType = isIosDevice ?
|
|
305
304
|
ToastIosType.NORMAL :
|
|
306
305
|
ToastAndroidType.NORMAL
|
|
307
306
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
308
307
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
309
308
|
} else {
|
|
310
309
|
showNormalToast(options)
|
|
311
310
|
}
|
|
312
311
|
const createLoadingEle = document.createElement('div')
|
|
313
312
|
createLoadingEle.id = 'J_shopLoading'
|
|
314
313
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
315
314
|
createLoadingEle.innerHTML =
|
|
316
315
|
`<div class='d-loading-content'>
|
|
317
316
|
<span class='d-shop-loading-icon'></span>
|
|
318
317
|
<p class='d-shop-text'>${text}</p>
|
|
319
318
|
</div>`
|
|
320
319
|
const getEle = document.body
|
|
321
320
|
? document.body
|
|
322
321
|
: document.getElementsByTagName('body')[0]
|
|
323
322
|
getEle.appendChild(createLoadingEle)
|
|
324
323
|
const getEle = document.getElementById('J_shopLoading')
|
|
325
324
|
getEle && getEle.remove()
|
|
326
325
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(
|
|
327
326
|
params,
|
|
328
327
|
)
|
|
329
328
|
if (!systemInfo.system && window) {
|
|
330
329
|
systemInfo.system = window.navigator.userAgent
|
|
331
330
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
332
331
|
}
|
|
333
332
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
334
333
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
335
334
|
systemInfo.navBarHeight = 0
|
|
336
335
|
systemInfo.statusBarHeight = 0
|
|
337
336
|
systemInfo.capsulePosition = null
|
|
338
337
|
systemInfo.isIOS = isIOS
|
|
339
338
|
systemInfo.isAndroid = isAndroid
|
|
340
339
|
_ShopSystemInfo = systemInfo
|
|
341
340
|
return systemInfo
|
|
342
341
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev)
|
|
343
342
|
const numScale = Number(scale)
|
|
344
343
|
if(isNaN(numScale)){
|
|
345
344
|
console.warn(`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`)
|
|
346
345
|
return false
|
|
347
346
|
}
|
|
348
347
|
const { venderId } = global.info.queryInfo || {}
|
|
349
348
|
const id = venderId
|
|
350
349
|
if(!id && numScale !== 1){
|
|
351
350
|
return false
|
|
352
351
|
}
|
|
353
352
|
const useScale = Math.max(0, Math.min(1, numScale))
|
|
354
353
|
const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0
|
|
355
354
|
if(reportKey){
|
|
356
355
|
sgmCustomReport({
|
|
357
356
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
|
|
358
357
|
msg: '灰度调用',
|
|
359
358
|
})
|
|
360
359
|
console.log(`基于KEY[${reportKey}]的灰度调用1次~`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`))
|
|
361
360
|
if(isMatch){
|
|
362
361
|
sgmCustomReport({
|
|
363
362
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
|
|
364
363
|
msg: '灰度命中',
|
|
365
364
|
})
|
|
366
365
|
console.log(`基于KEY[${reportKey}]的命中1次灰度!`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`))
|
|
367
366
|
}
|
|
368
367
|
}
|
|
369
368
|
return isMatch
|
|
370
369
|
isJdApp,
|
|
371
370
|
isWxApp,
|
|
372
371
|
isIosDevice,
|
|
373
372
|
isAndroidDevice,
|
|
374
373
|
isJdAndIosDevice,
|
|
375
374
|
isJdAndAndroidDevice,
|
|
376
375
|
isJdAndHarmonyDevice,
|
|
377
376
|
isJdAndroidX5Core,
|
|
378
377
|
isMin,
|
|
379
378
|
isWxMin,
|
|
380
379
|
isWxMinAndWxapp,
|
|
381
380
|
isJdMinAndHarmony,
|
|
382
381
|
isJdMin,
|
|
383
382
|
isH5,
|
|
384
383
|
isH5AndJdShopView,
|
|
385
384
|
isChartH5,
|
|
386
385
|
isH5AndJdShopViewNativeScroll,
|
|
387
386
|
isH5AndJdShopViewH5Scroll,
|
|
388
387
|
isH5AndJdShopH5CustomScrollView,
|
|
389
388
|
isH5AndJingGouMini,
|
|
390
389
|
isWxMiniH5View,
|
|
391
390
|
urlCookie,
|
|
392
391
|
sliceArrToChunkList,
|
|
393
392
|
dealAddress,
|
|
394
393
|
objectToUrlEncode,
|
|
395
394
|
parseQueryUrlString,
|
|
396
395
|
setLowSmallPicUrl,
|
|
397
396
|
setTaroStorage,
|
|
398
397
|
getTaroStorageKeyValue,
|
|
399
398
|
removeTaroStorageKey,
|
|
400
399
|
clearTaroStorageKey,
|
|
401
400
|
getAvifSupport,
|
|
402
401
|
getWebpSupport,
|
|
403
402
|
getQualityImage,
|
|
404
403
|
countStringify,
|
|
405
404
|
getWxAppCookieStr,
|
|
406
405
|
getSystemInfos,
|
|
407
406
|
pxTransformFromData,
|
|
408
407
|
dealShopContentDataAndReport as dealShopContentData,
|
|
409
408
|
dateFormat,
|
|
410
409
|
throttle,
|
|
411
410
|
lodashThrottle,
|
|
412
411
|
debounce,
|
|
413
412
|
addHttps,
|
|
414
413
|
commonShowSuccessToast as showSuccessToast,
|
|
415
414
|
commonShowFailToast as showFailToast,
|
|
416
415
|
commonShowNormalToast as showNormalToast,
|
|
417
416
|
showShopLoading,
|
|
418
417
|
hideShopLoading,
|
|
419
418
|
stopNativeScrollEvent,
|
|
420
419
|
getAppChannelType,
|
|
421
420
|
formatTabActiveMenuType,
|
|
422
421
|
filterUrlQueryData,
|
|
423
422
|
sgmCustomReport,
|
|
424
423
|
draCustomReport,
|
|
425
424
|
remoteCustomReport,
|
|
426
425
|
draInterfaceCustomReport,
|
|
427
426
|
draBusinessCustomReport,
|
|
428
427
|
isMemberPage,
|
|
429
428
|
getFloorDataToDataDefines,
|
|
430
429
|
isOpenJdAppUrl,
|
|
431
430
|
jdOpenAppParams,
|
|
432
431
|
createJdOpenAppUrl,
|
|
433
432
|
isEmpty,
|
|
434
433
|
getJdAppReportPageSource,
|
|
435
434
|
isAppClassifyPage,
|
|
436
435
|
isAppHomeForMarketPage,
|
|
437
436
|
isImageOptimizeEnable,
|
|
438
437
|
isPc,
|
|
439
438
|
ipLoc_djd,
|
|
440
439
|
isTjScence,
|
|
441
440
|
isH5AdnJxMini,
|
|
442
441
|
isTjM,
|
|
443
442
|
isTjJxM,
|
|
444
443
|
isTJApp,
|
|
445
444
|
isH5AdnHaoWuJie,
|
|
446
445
|
tjChannel,
|
|
447
446
|
dealJdOpenAppData,
|
|
448
447
|
jdAppVersionCompare,
|
|
449
448
|
dealNativePixelToCssPixel,
|
|
450
449
|
isAppStowShop,
|
|
451
450
|
getSgmCustomCode,
|
|
452
451
|
handleSgmCodeTaroVersion,
|
|
453
452
|
isInGrayscale,
|
|
454
453
|
isIpadDevice,
|
|
455
454
|
getBorderStyle,
|
|
456
455
|
isSupportHybridHttpRequest,
|
|
456
|
+
import Taro from '@tarojs/taro';
|
|
457
457
|
stopNativeScrollEvent,
|
|
458
458
|
getAppChannelType,
|
|
459
459
|
isAndroidDevice,
|
|
460
460
|
isH5AndJdShopView,
|
|
461
461
|
isChartH5,
|
|
462
462
|
isH5AndJdShopViewNativeScroll,
|
|
463
463
|
isIosDevice,
|
|
464
464
|
isJdAndAndroidDevice,
|
|
465
465
|
isJdAndIosDevice,
|
|
466
466
|
isJdApp,
|
|
467
467
|
isWxApp,
|
|
468
468
|
isWxMiniH5View,
|
|
469
469
|
isJdAndHarmonyDevice,
|
|
470
470
|
isH5AndJingGouMini,
|
|
471
471
|
urlCookie,
|
|
472
472
|
sgmCustomReport,
|
|
473
473
|
draCustomReport,
|
|
474
474
|
remoteCustomReport,
|
|
475
475
|
draInterfaceCustomReport,
|
|
476
476
|
draBusinessCustomReport,
|
|
477
477
|
isMemberPage,
|
|
478
478
|
isH5AndJdShopViewH5Scroll,
|
|
479
479
|
isH5AndJdShopH5CustomScrollView,
|
|
480
480
|
isAppClassifyPage,
|
|
481
481
|
isAppHomeForMarketPage,
|
|
482
482
|
isPc,
|
|
483
483
|
ipLoc_djd,
|
|
484
484
|
jdAppVersionCompare,
|
|
485
485
|
isTjScence,
|
|
486
486
|
isH5AdnJxMini,
|
|
487
487
|
isTjM,
|
|
488
488
|
isTjJxM,
|
|
489
489
|
isTJApp,
|
|
490
490
|
isH5AdnHaoWuJie,
|
|
491
491
|
tjChannel,
|
|
492
492
|
dealNativePixelToCssPixel,
|
|
493
493
|
isAppStowShop,
|
|
494
494
|
isJdAndroidX5Core,
|
|
495
495
|
parseQueryUrlObj,
|
|
496
496
|
isIpadDevice,
|
|
497
497
|
isTabletDevice,
|
|
498
498
|
checkPadScreenOrientationIsLandscape,
|
|
499
499
|
isSupportHybridHttpRequest,
|
|
500
500
|
isLanguageForEn,
|
|
501
501
|
sColor,
|
|
502
502
|
draInterfaceDSMCustomReport,
|
|
503
503
|
addHttps,
|
|
504
504
|
clearTaroStorageKey,
|
|
505
505
|
countStringify as h5CountStringify,
|
|
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 _ShopSystemInfo?.isJdTabletDevice && !layoutWidth
|
|
551
551
|
? Math.floor(getNum * 1.2 * (_changeLayoutWidth / 720))
|
|
552
552
|
: Math.round((getNum / widthSize) * _changeLayoutWidth);
|
|
553
553
|
const getRootFontSize = (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
|
|
554
554
|
let getRealRootFontSize = getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
|
|
555
555
|
if (_ShopSystemInfo?.isJdTabletDevice) {
|
|
556
556
|
getRealRootFontSize = Math.floor(
|
|
557
557
|
24 * ((systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth) / 720),
|
|
558
558
|
);
|
|
559
559
|
}
|
|
560
560
|
return Math.ceil(
|
|
561
561
|
(((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) * getRealRootFontSize,
|
|
562
562
|
);
|
|
563
563
|
console.log(
|
|
564
564
|
'获取系统宽度systemInfo?.windowWidth',
|
|
565
565
|
systemInfo?.windowWidth,
|
|
566
566
|
'taroToTransformRoutimePXNumber(changeWidth)',
|
|
567
567
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
|
|
568
568
|
);
|
|
569
569
|
return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
|
|
570
570
|
? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
|
|
571
571
|
: (systemInfo?.windowWidth ?? 0);
|
|
572
572
|
return (
|
|
573
573
|
isJdApp &&
|
|
574
574
|
(parseQueryUrlObj['device'] === 'tablet' || Math.min(rootEleWidth, window.screen.height) >= 720)
|
|
575
575
|
);
|
|
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 (isPc) {
|
|
583
583
|
systemInfo.windowWidth = 375;
|
|
584
584
|
} else {
|
|
585
585
|
const getWinWidth = window.innerWidth;
|
|
586
586
|
const getWinHeight = window.innerHeight;
|
|
587
587
|
const getScreenWidth = window.screen.width;
|
|
588
588
|
const getScreenHeight = window.screen.height;
|
|
589
589
|
const getRootEleInitWidth = params?.rootEleInitWidth || 0;
|
|
590
590
|
const isReplaceSystemWidth = params?.replaceSystemWidth || false;
|
|
591
591
|
systemInfo.isJdTabletDevice = checkIsJdTabletDevice(getRootEleInitWidth);
|
|
592
592
|
systemInfo.isJdTabletLandscape =
|
|
593
593
|
systemInfo.isJdTabletDevice && checkPadScreenOrientationIsLandscape();
|
|
594
594
|
if (!systemInfo.isJdTabletDevice && isReplaceSystemWidth) {
|
|
595
595
|
if (systemInfo?.windowWidth <= 0) {
|
|
596
596
|
systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
|
|
597
597
|
systemInfo.windowHeight = getScreenHeight;
|
|
598
598
|
console.warn(
|
|
599
599
|
'====初始化获取当前设备不是pad,但是触发屏幕宽高最小值600,系统获取宽度为0,进行重置系统宽度为根元素宽度与屏幕宽度最小值====',
|
|
600
600
|
systemInfo.windowWidth,
|
|
601
601
|
'getRootEleInitWidth',
|
|
602
602
|
getRootEleInitWidth,
|
|
603
603
|
'getScreenWidth',
|
|
604
604
|
getScreenWidth,
|
|
605
605
|
'getScreenHeight',
|
|
606
606
|
getScreenHeight,
|
|
607
607
|
);
|
|
608
608
|
draBusinessCustomReport({
|
|
609
609
|
type: 'jdapp_pad_width_error_info',
|
|
610
610
|
errMsg: `松果app内获取当前设备不是pad,触发屏幕宽高最小值600,系统信息宽度为0,进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
|
|
611
611
|
originReqDataStr: JSON.stringify({
|
|
612
612
|
isJdApp,
|
|
613
613
|
isAndroidDevice,
|
|
614
614
|
getScreenWidth,
|
|
615
615
|
getScreenHeight,
|
|
616
616
|
getWinWidth,
|
|
617
617
|
getWinHeight,
|
|
618
618
|
getRootEleInitWidth,
|
|
619
619
|
}),
|
|
620
620
|
});
|
|
621
621
|
}
|
|
622
622
|
} else {
|
|
623
623
|
if (isJdApp && isAndroidDevice && !systemInfo.isJdTabletDevice && systemInfo) {
|
|
624
624
|
const isLandscape = getScreenWidth >= getScreenHeight;
|
|
625
625
|
const { windowWidth, windowHeight, screenWidth, screenHeight } = systemInfo;
|
|
626
626
|
if (windowWidth <= 0) {
|
|
627
627
|
systemInfo.initWindowWidth = windowWidth;
|
|
628
628
|
if (isLandscape) {
|
|
629
629
|
systemInfo.windowWidth = getScreenHeight;
|
|
630
630
|
systemInfo.windowHeight = getScreenWidth;
|
|
631
631
|
systemInfo.screenWidth = getScreenHeight;
|
|
632
632
|
systemInfo.screenHeight = getScreenWidth;
|
|
633
633
|
} else {
|
|
634
634
|
systemInfo.windowWidth = getScreenWidth;
|
|
635
635
|
systemInfo.windowHeight = getScreenHeight;
|
|
636
636
|
systemInfo.screenWidth = getScreenWidth;
|
|
637
637
|
systemInfo.screenHeight = getScreenHeight;
|
|
638
638
|
}
|
|
639
639
|
console.warn(
|
|
640
640
|
`松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight},根元素宽度值${getRootEleInitWidth}`,
|
|
641
641
|
);
|
|
642
642
|
draBusinessCustomReport({
|
|
643
643
|
type: 'android_jdapp_width_error_info',
|
|
644
644
|
errMsg: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
|
|
645
645
|
originReqDataStr: JSON.stringify({
|
|
646
646
|
isJdApp,
|
|
647
647
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
648
648
|
getScreenWidth,
|
|
649
649
|
getScreenHeight,
|
|
650
650
|
getWinWidth,
|
|
651
651
|
getWinHeight,
|
|
652
652
|
getRootEleInitWidth,
|
|
653
653
|
}),
|
|
654
654
|
});
|
|
655
655
|
sgmCustomReport({
|
|
656
656
|
type: 2,
|
|
657
657
|
code: 'android_jdapp_width_error_info',
|
|
658
658
|
msg: {
|
|
659
659
|
title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
|
|
660
660
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
661
661
|
taroSysInfo: systemInfo,
|
|
662
662
|
},
|
|
663
663
|
});
|
|
664
664
|
} else {
|
|
665
665
|
let _getChangeWinWidthState = false;
|
|
666
666
|
if (getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth) {
|
|
667
667
|
if (isLandscape) {
|
|
668
668
|
systemInfo.windowWidth = getScreenHeight;
|
|
669
669
|
systemInfo.windowHeight = getScreenWidth;
|
|
670
670
|
systemInfo.screenWidth = getScreenHeight;
|
|
671
671
|
systemInfo.screenHeight = getScreenWidth;
|
|
672
672
|
} else {
|
|
673
673
|
systemInfo.windowWidth = getScreenWidth;
|
|
674
674
|
systemInfo.windowHeight = getScreenHeight;
|
|
675
675
|
systemInfo.screenWidth = getScreenWidth;
|
|
676
676
|
systemInfo.screenHeight = getScreenHeight;
|
|
677
677
|
}
|
|
678
678
|
_getChangeWinWidthState = true;
|
|
679
679
|
}
|
|
680
680
|
_getChangeWinWidthState &&
|
|
681
681
|
console.warn(
|
|
682
682
|
`松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`,
|
|
683
683
|
);
|
|
684
684
|
if (_getChangeWinWidthState) {
|
|
685
685
|
draBusinessCustomReport({
|
|
686
686
|
type: 'android_jdapp_width_error_info_2',
|
|
687
687
|
title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
|
|
688
688
|
originReqDataStr: JSON.stringify({
|
|
689
689
|
isJdApp,
|
|
690
690
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
691
691
|
getScreenWidth,
|
|
692
692
|
getScreenHeight,
|
|
693
693
|
getWinWidth,
|
|
694
694
|
getWinHeight,
|
|
695
695
|
getRootEleInitWidth,
|
|
696
696
|
}),
|
|
697
697
|
});
|
|
698
698
|
sgmCustomReport({
|
|
699
699
|
type: 2,
|
|
700
700
|
code: 'android_jdapp_width_error_info_2',
|
|
701
701
|
msg: {
|
|
702
702
|
title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
|
|
703
703
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
704
704
|
taroSysInfo: systemInfo,
|
|
705
705
|
},
|
|
706
706
|
});
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
|
|
712
712
|
if (systemInfo.isJdTabletDevice) {
|
|
713
713
|
systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
|
|
714
714
|
systemInfo.windowHeight = getScreenHeight;
|
|
715
715
|
if (systemInfo.isJdTabletLandscape) {
|
|
716
716
|
if (window?.PAGE_DATA?.isFitJdPadRenderCenter) {
|
|
717
717
|
systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
|
|
718
718
|
systemInfo.windowHeight = Math.max(
|
|
719
719
|
getRootEleInitWidth,
|
|
720
720
|
getScreenWidth,
|
|
721
721
|
getScreenHeight,
|
|
722
722
|
);
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
console.warn(
|
|
726
726
|
'====初始化获取当前设备是否是平板设备,是否横屏====',
|
|
727
727
|
systemInfo.isJdTabletDevice,
|
|
728
728
|
systemInfo.isJdTabletLandscape,
|
|
729
729
|
'屏幕信息',
|
|
730
730
|
window.screen,
|
|
731
731
|
'当前是否要求居中展示,居中展示那么宽高值要对调',
|
|
732
732
|
window?.PAGE_DATA?.isFitJdPadRenderCenter,
|
|
733
733
|
'当前pad最终展示的窗口宽度',
|
|
734
734
|
systemInfo.windowWidth,
|
|
735
735
|
);
|
|
736
736
|
}
|
|
737
737
|
}
|
|
738
738
|
}
|
|
739
739
|
systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo);
|
|
740
740
|
console.warn('====获取系统信息=====', systemInfo);
|
|
741
741
|
return systemInfo;
|
|
742
742
|
let result: boolean | null = null;
|
|
743
743
|
return function () {
|
|
744
744
|
if (result === null) {
|
|
745
745
|
const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
|
|
746
746
|
if (!isJdApp) {
|
|
747
747
|
console.warn('🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~');
|
|
748
748
|
isIgnoreOptimizeFromServer = true;
|
|
749
749
|
result = true;
|
|
750
750
|
return true;
|
|
751
751
|
}
|
|
752
752
|
const enableAvifOptimize = appVersionCheckPass;
|
|
753
753
|
if (enableAvifOptimize) {
|
|
754
754
|
const configData = global?.getDynamicConfig('avifSwitch');
|
|
755
755
|
const {
|
|
756
756
|
globalOn = true,
|
|
757
757
|
ignoreOptimizeFromServer = false,
|
|
758
758
|
page = {},
|
|
759
759
|
grayscale = {},
|
|
760
760
|
whiteList = [],
|
|
761
761
|
blackList = [],
|
|
762
762
|
} = configData || {};
|
|
763
763
|
const { shopId = '0', venderId = '0' } = parseQueryUrlObj;
|
|
764
764
|
let imageEnableResult = true;
|
|
765
765
|
isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
|
|
766
766
|
if (
|
|
767
767
|
blackList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
|
|
768
768
|
) {
|
|
769
769
|
imageEnableResult = false;
|
|
770
770
|
} else if (
|
|
771
771
|
whiteList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
|
|
772
772
|
) {
|
|
773
773
|
isIgnoreOptimizeFromServer = true;
|
|
774
774
|
imageEnableResult = true;
|
|
775
775
|
} else if (grayscale[buildType] && isInGrayscale(grayscale[buildType])) {
|
|
776
776
|
isIgnoreOptimizeFromServer = true;
|
|
777
777
|
imageEnableResult = true;
|
|
778
778
|
} else {
|
|
779
779
|
imageEnableResult = globalOn === true || page[buildType] === true;
|
|
780
780
|
if (globalOn === true) {
|
|
781
781
|
isIgnoreOptimizeFromServer = true;
|
|
782
782
|
} else if (page[buildType] === true) {
|
|
783
783
|
} else {
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
786
|
result = imageEnableResult;
|
|
787
787
|
return imageEnableResult;
|
|
788
788
|
} else {
|
|
789
789
|
result = false;
|
|
790
790
|
return false;
|
|
791
791
|
}
|
|
792
792
|
} else {
|
|
793
793
|
return result;
|
|
794
794
|
}
|
|
795
795
|
};
|
|
796
796
|
if (typeof options === 'object' && isImageOptimizeEnable()) {
|
|
797
797
|
return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
|
|
798
798
|
} else {
|
|
799
799
|
return getQualityImageOld(imgUrl, options);
|
|
800
800
|
}
|
|
801
801
|
const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
|
|
802
802
|
windowWidth: window.innerWidth,
|
|
803
803
|
containerWidth: getContainerWidth(buildType, {
|
|
804
804
|
windowWidth: window.innerWidth,
|
|
805
805
|
}),
|
|
806
806
|
screenWidth: window.innerWidth,
|
|
807
807
|
platform: '',
|
|
808
808
|
model: '',
|
|
809
809
|
system: '',
|
|
810
810
|
};
|
|
811
811
|
return getSystemInfo;
|
|
812
812
|
const params = Object.assign(
|
|
813
813
|
{},
|
|
814
814
|
{
|
|
815
815
|
title: '',
|
|
816
816
|
duration: 1500,
|
|
817
817
|
},
|
|
818
818
|
options,
|
|
819
819
|
);
|
|
820
820
|
params.duration = params.duration / 1000;
|
|
821
821
|
if (isJdApp && !isJdAndHarmonyDevice) {
|
|
822
822
|
const showSuccessType = isIosDevice ? ToastIosType.SUCCESS : ToastAndroidType.SUCCESS;
|
|
823
823
|
const duration = isAndroidDevice ? 0 : params.duration;
|
|
824
824
|
nativePageShowToast(options.title, showSuccessType, duration);
|
|
825
825
|
console.log('执行原生toast success');
|
|
826
826
|
} else {
|
|
827
827
|
showSuccessToast(options);
|
|
828
828
|
}
|
|
829
829
|
const params = Object.assign(
|
|
830
830
|
{},
|
|
831
831
|
{
|
|
832
832
|
title: '',
|
|
833
833
|
duration: 1500,
|
|
834
834
|
},
|
|
835
835
|
options,
|
|
836
836
|
);
|
|
837
837
|
params.duration = params.duration / 1000;
|
|
838
838
|
if (isJdApp) {
|
|
839
839
|
const showSuccessType = isIosDevice ? ToastIosType.FAIL : ToastAndroidType.FAIL;
|
|
840
840
|
const duration = isAndroidDevice ? 0 : params.duration;
|
|
841
841
|
nativePageShowToast(options.title, showSuccessType, duration);
|
|
842
842
|
console.log('执行原生toast fail');
|
|
843
843
|
} else {
|
|
844
844
|
console.log('执行H5 toast fail');
|
|
845
845
|
showFailToast(options);
|
|
846
846
|
}
|
|
847
847
|
const params = Object.assign(
|
|
848
848
|
{},
|
|
849
849
|
{
|
|
850
850
|
title: '',
|
|
851
851
|
duration: 1500,
|
|
852
852
|
},
|
|
853
853
|
options,
|
|
854
854
|
);
|
|
855
855
|
params.duration = params.duration / 1000;
|
|
856
856
|
if (isJdApp) {
|
|
857
857
|
const showSuccessType = isIosDevice ? ToastIosType.NORMAL : ToastAndroidType.NORMAL;
|
|
858
858
|
const duration = isAndroidDevice ? 0 : params.duration;
|
|
859
859
|
nativePageShowToast(options.title, showSuccessType, duration);
|
|
860
860
|
} else {
|
|
861
861
|
showNormalToast(options);
|
|
862
862
|
}
|
|
863
863
|
if (isLanguageForEn) {
|
|
864
864
|
count = Number(count);
|
|
865
865
|
if (count >= 1000000000) {
|
|
866
866
|
return (count / 1000000000).toFixed(fixedNum) + 'B';
|
|
867
867
|
} else if (count >= 1000000) {
|
|
868
868
|
return (count / 1000000).toFixed(fixedNum) + 'M';
|
|
869
869
|
} else if (count >= 1000) {
|
|
870
870
|
return (count / 1000).toFixed(fixedNum) + 'K';
|
|
871
871
|
} else {
|
|
872
872
|
return count;
|
|
873
873
|
}
|
|
874
874
|
} else {
|
|
875
875
|
return h5CountStringify(count, fixedNum, unit, maxNum);
|
|
876
876
|
}
|
|
877
877
|
const createLoadingEle = document.createElement('div');
|
|
878
878
|
createLoadingEle.id = 'J_shopLoading';
|
|
879
879
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
|
|
880
880
|
createLoadingEle.innerHTML = `<div class='d-loading-content'>
|
|
881
881
|
<span class='d-shop-loading-icon'></span>
|
|
882
882
|
<p class='d-shop-text'>${text}</p>
|
|
883
883
|
</div>`;
|
|
884
884
|
const getEle = document.body ? document.body : document.getElementsByTagName('body')[0];
|
|
885
885
|
getEle.appendChild(createLoadingEle);
|
|
886
886
|
const getEle = document.getElementById('J_shopLoading');
|
|
887
887
|
getEle && getEle.remove();
|
|
888
888
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(params);
|
|
889
889
|
if (!systemInfo.system && window) {
|
|
890
890
|
systemInfo.system = window.navigator.userAgent;
|
|
891
891
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
|
|
892
892
|
}
|
|
893
893
|
const isIOS = !!systemInfo?.system.match(/ios/i);
|
|
894
894
|
const isAndroid = !!systemInfo?.system.match(/android/i);
|
|
895
895
|
systemInfo.navBarHeight = 0;
|
|
896
896
|
systemInfo.statusBarHeight = 0;
|
|
897
897
|
systemInfo.capsulePosition = null;
|
|
898
898
|
systemInfo.isIOS = isIOS;
|
|
899
899
|
systemInfo.isAndroid = isAndroid;
|
|
900
900
|
_ShopSystemInfo = systemInfo;
|
|
901
901
|
return systemInfo;
|
|
902
902
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev);
|
|
903
903
|
const numScale = Number(scale);
|
|
904
904
|
if (isNaN(numScale)) {
|
|
905
905
|
console.warn(
|
|
906
906
|
`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`,
|
|
907
907
|
);
|
|
908
908
|
return false;
|
|
909
909
|
}
|
|
910
910
|
const { venderId } = global.info.queryInfo || {};
|
|
911
911
|
const id = venderId;
|
|
912
912
|
if (!id && numScale !== 1) {
|
|
913
913
|
return false;
|
|
914
914
|
}
|
|
915
915
|
const useScale = Math.max(0, Math.min(1, numScale));
|
|
916
916
|
const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
|
|
917
917
|
if (reportKey) {
|
|
918
918
|
sgmCustomReport({
|
|
919
919
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
|
|
920
920
|
msg: '灰度调用',
|
|
921
921
|
});
|
|
922
922
|
console.log(
|
|
923
923
|
`基于KEY[${reportKey}]的灰度调用1次~`,
|
|
924
924
|
getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
|
|
925
925
|
);
|
|
926
926
|
if (isMatch) {
|
|
927
927
|
sgmCustomReport({
|
|
928
928
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
|
|
929
929
|
msg: '灰度命中',
|
|
930
930
|
});
|
|
931
931
|
console.log(
|
|
932
932
|
`基于KEY[${reportKey}]的命中1次灰度!`,
|
|
933
933
|
getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
|
|
934
934
|
);
|
|
935
935
|
}
|
|
936
936
|
}
|
|
937
937
|
return isMatch;
|
|
938
938
|
isJdApp,
|
|
939
939
|
isWxApp,
|
|
940
940
|
isIosDevice,
|
|
941
941
|
isAndroidDevice,
|
|
942
942
|
isJdAndIosDevice,
|
|
943
943
|
isJdAndAndroidDevice,
|
|
944
944
|
isJdAndHarmonyDevice,
|
|
945
945
|
isJdAndroidX5Core,
|
|
946
946
|
isMin,
|
|
947
947
|
isWxMin,
|
|
948
948
|
isWxMinAndWxapp,
|
|
949
949
|
isJdMinAndHarmony,
|
|
950
950
|
isJdMin,
|
|
951
951
|
isH5,
|
|
952
952
|
isH5AndJdShopView,
|
|
953
953
|
isChartH5,
|
|
954
954
|
isH5AndJdShopViewNativeScroll,
|
|
955
955
|
isH5AndJdShopViewH5Scroll,
|
|
956
956
|
isH5AndJdShopH5CustomScrollView,
|
|
957
957
|
isH5AndJingGouMini,
|
|
958
958
|
isWxMiniH5View,
|
|
959
959
|
urlCookie,
|
|
960
960
|
sliceArrToChunkList,
|
|
961
961
|
dealAddress,
|
|
962
962
|
objectToUrlEncode,
|
|
963
963
|
parseQueryUrlString,
|
|
964
964
|
setLowSmallPicUrl,
|
|
965
965
|
setTaroStorage,
|
|
966
966
|
getTaroStorageKeyValue,
|
|
967
967
|
removeTaroStorageKey,
|
|
968
968
|
clearTaroStorageKey,
|
|
969
969
|
getAvifSupport,
|
|
970
970
|
getWebpSupport,
|
|
971
971
|
getQualityImage,
|
|
972
972
|
formatCountForUnit as countStringify,
|
|
973
973
|
getWxAppCookieStr,
|
|
974
974
|
getSystemInfos,
|
|
975
975
|
pxTransformFromData,
|
|
976
976
|
dealShopContentDataAndReport as dealShopContentData,
|
|
977
977
|
dateFormat,
|
|
978
978
|
throttle,
|
|
979
979
|
lodashThrottle,
|
|
980
980
|
debounce,
|
|
981
981
|
addHttps,
|
|
982
982
|
commonShowSuccessToast as showSuccessToast,
|
|
983
983
|
commonShowFailToast as showFailToast,
|
|
984
984
|
commonShowNormalToast as showNormalToast,
|
|
985
985
|
showShopLoading,
|
|
986
986
|
hideShopLoading,
|
|
987
987
|
stopNativeScrollEvent,
|
|
988
988
|
getAppChannelType,
|
|
989
989
|
formatTabActiveMenuType,
|
|
990
990
|
filterUrlQueryData,
|
|
991
991
|
sgmCustomReport,
|
|
992
992
|
draCustomReport,
|
|
993
993
|
remoteCustomReport,
|
|
994
994
|
draInterfaceCustomReport,
|
|
995
995
|
draBusinessCustomReport,
|
|
996
996
|
isMemberPage,
|
|
997
997
|
getFloorDataToDataDefines,
|
|
998
998
|
isOpenJdAppUrl,
|
|
999
999
|
jdOpenAppParams,
|
|
1000
1000
|
createJdOpenAppUrl,
|
|
1001
1001
|
isEmpty,
|
|
1002
1002
|
getJdAppReportPageSource,
|
|
1003
1003
|
isAppClassifyPage,
|
|
1004
1004
|
isAppHomeForMarketPage,
|
|
1005
1005
|
isImageOptimizeEnable,
|
|
1006
1006
|
isPc,
|
|
1007
1007
|
ipLoc_djd,
|
|
1008
1008
|
isTjScence,
|
|
1009
1009
|
isH5AdnJxMini,
|
|
1010
1010
|
isTjM,
|
|
1011
1011
|
isTjJxM,
|
|
1012
1012
|
isTJApp,
|
|
1013
1013
|
isH5AdnHaoWuJie,
|
|
1014
1014
|
tjChannel,
|
|
1015
1015
|
dealJdOpenAppData,
|
|
1016
1016
|
jdAppVersionCompare,
|
|
1017
1017
|
dealNativePixelToCssPixel,
|
|
1018
1018
|
isAppStowShop,
|
|
1019
1019
|
getSgmCustomCode,
|
|
1020
1020
|
handleSgmCodeTaroVersion,
|
|
1021
1021
|
isInGrayscale,
|
|
1022
1022
|
isIpadDevice,
|
|
1023
1023
|
getBorderStyle,
|
|
1024
1024
|
isSupportHybridHttpRequest,
|
|
1025
1025
|
isLanguageForEn,
|
|
1026
1026
|
sColor,
|
|
1027
1027
|
draInterfaceDSMCustomReport,
|
|
1028
1028
|
isTabletDevice,
|