@conecli/cone-render 0.10.1-isv2.2 → 0.10.1-isv2.4
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/jssdk.ts +1 -1
- package/dist/common/token/index.h5.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/common/wxappApi.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/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/debug/DebugLayout/index.module.scss +2 -2
- 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.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.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/environment.ts +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/open/api/util.ts +1 -1
- package/dist/sass/app.h5.scss +273 -224
- 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.h5.ts +1 -0
- package/dist/utils/jumpExtMapUtil.ts +1 -0
- package/dist/utils/log.ts +1 -0
- package/dist/utils/sColor.js +1 -0
- package/dist/utils/utils.ts +1 -1
- package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
- package/dist/wxapp/common/user_info.js +1 -1
- package/package.json +158 -141
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
|
stopNativeScrollEvent,
|
|
460
460
|
getAppChannelType,
|
|
461
461
|
isAndroidDevice,
|
|
462
462
|
isHarmonyDevice,
|
|
463
463
|
isH5AndJdShopView,
|
|
464
464
|
isChartH5,
|
|
465
465
|
isH5AndJdShopViewNativeScroll,
|
|
466
466
|
isIosDevice,
|
|
467
467
|
isJdAndAndroidDevice,
|
|
468
468
|
isJdAndIosDevice,
|
|
469
469
|
isJdApp,
|
|
470
470
|
isWxApp,
|
|
471
471
|
isWxMiniH5View,
|
|
472
472
|
isJdAndHarmonyDevice,
|
|
473
473
|
isH5AndJingGouMini,
|
|
474
474
|
urlCookie,
|
|
475
475
|
sgmCustomReport,
|
|
476
476
|
draCustomReport,
|
|
477
477
|
remoteCustomReport,
|
|
478
478
|
draInterfaceCustomReport,
|
|
479
479
|
draBusinessCustomReport,
|
|
480
480
|
isMemberPage,
|
|
481
481
|
isH5AndJdShopViewH5Scroll,
|
|
482
482
|
isH5AndJdShopH5CustomScrollView,
|
|
483
483
|
isAppClassifyPage,
|
|
484
484
|
isAppHomeForMarketPage,
|
|
485
485
|
isPc,
|
|
486
486
|
ipLoc_djd,
|
|
487
487
|
jdAppVersionCompare,
|
|
488
488
|
isTjScence,
|
|
489
489
|
isH5AdnJxMini,
|
|
490
490
|
isTjM,
|
|
491
491
|
isTjJxM,
|
|
492
492
|
isTJApp,
|
|
493
493
|
isH5AdnHaoWuJie,
|
|
494
494
|
tjChannel,
|
|
495
495
|
dealNativePixelToCssPixel,
|
|
496
496
|
isAppStowShop,
|
|
497
497
|
isJdAndroidX5Core,
|
|
498
498
|
parseQueryUrlObj,
|
|
499
499
|
isIpadDevice,
|
|
500
500
|
isTabletDevice,
|
|
501
501
|
checkPadScreenOrientationIsLandscape,
|
|
502
502
|
isSupportHybridHttpRequest,
|
|
503
503
|
isLanguageForEn,
|
|
504
504
|
sColor,
|
|
505
505
|
draInterfaceDSMCustomReport,
|
|
506
506
|
addHttps,
|
|
507
507
|
clearTaroStorageKey,
|
|
508
508
|
countStringify as h5CountStringify,
|
|
509
509
|
dateFormat,
|
|
510
510
|
dealAddress,
|
|
511
511
|
dealShopContentData as originDealShopContentData,
|
|
512
512
|
debounce,
|
|
513
513
|
filterUrlQueryData,
|
|
514
514
|
formatTabActiveMenuType,
|
|
515
515
|
getAvifSupport,
|
|
516
516
|
getWebpSupport,
|
|
517
517
|
getTaroStorageKeyValue,
|
|
518
518
|
getWxAppCookieStr,
|
|
519
519
|
isH5,
|
|
520
520
|
isMin,
|
|
521
521
|
isJdMin,
|
|
522
522
|
isWxMin,
|
|
523
523
|
isWxMinAndWxapp,
|
|
524
524
|
isJdMinAndHarmony,
|
|
525
525
|
lodashThrottle,
|
|
526
526
|
objectToUrlEncode,
|
|
527
527
|
parseQueryUrlString,
|
|
528
528
|
removeTaroStorageKey,
|
|
529
529
|
setLowSmallPicUrl,
|
|
530
530
|
setTaroStorage,
|
|
531
531
|
showFailToast,
|
|
532
532
|
showNormalToast,
|
|
533
533
|
showSuccessToast,
|
|
534
534
|
sliceArrToChunkList,
|
|
535
535
|
throttle,
|
|
536
536
|
getQualityImageNew,
|
|
537
537
|
getQualityImageOld,
|
|
538
538
|
isOpenJdAppUrl,
|
|
539
539
|
jdOpenAppParams,
|
|
540
540
|
createJdOpenAppUrl,
|
|
541
541
|
isEmpty,
|
|
542
542
|
getJdAppReportPageSource,
|
|
543
543
|
dealJdOpenAppData,
|
|
544
544
|
getBorderStyle,
|
|
545
545
|
const getNum = Number(num);
|
|
546
546
|
let _changeLayoutWidth = layoutWidth;
|
|
547
547
|
if (!_changeLayoutWidth) {
|
|
548
548
|
_changeLayoutWidth =
|
|
549
549
|
_ShopSystemInfo && _ShopSystemInfo?.windowWidth
|
|
550
550
|
? _ShopSystemInfo.windowWidth
|
|
551
551
|
: Taro.getSystemInfoSync()?.windowWidth;
|
|
552
552
|
}
|
|
553
553
|
return _ShopSystemInfo?.isJdTabletDevice && !layoutWidth
|
|
554
554
|
? Math.floor(getNum * 1.2 * (_changeLayoutWidth / 720))
|
|
555
555
|
: Math.round((getNum / widthSize) * _changeLayoutWidth);
|
|
556
556
|
const getRootFontSize = (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
|
|
557
557
|
let getRealRootFontSize = getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
|
|
558
558
|
if (_ShopSystemInfo?.isJdTabletDevice) {
|
|
559
559
|
getRealRootFontSize = Math.floor(
|
|
560
560
|
24 * ((systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth) / 720),
|
|
561
561
|
);
|
|
562
562
|
}
|
|
563
563
|
return Math.ceil(
|
|
564
564
|
(((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) * 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 - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
|
|
574
574
|
: (systemInfo?.windowWidth ?? 0);
|
|
575
575
|
const systemInfo = _ShopSystemInfo || Taro.getSystemInfoSync()
|
|
576
576
|
console.log(
|
|
577
577
|
'获取系统宽度systemInfo?.windowWidth',
|
|
578
578
|
systemInfo?.windowWidth,
|
|
579
579
|
'taroToTransformRoutimePXNumber(changeWidth)',
|
|
580
580
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
|
|
581
581
|
);
|
|
582
582
|
const containerWidth = isClassify && systemInfo?.windowWidth
|
|
583
583
|
? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
|
|
584
584
|
: (systemInfo?.windowWidth ?? 0);
|
|
585
585
|
if(global?.info?.sysInfo){
|
|
586
586
|
global.info.sysInfo['containerWidth'] = containerWidth;
|
|
587
587
|
}
|
|
588
588
|
return (
|
|
589
589
|
isJdApp &&
|
|
590
590
|
(parseQueryUrlObj['device'] === 'tablet' || Math.min(rootEleWidth, window.screen.height) >= 720)
|
|
591
591
|
);
|
|
592
592
|
const systemInfo = Taro.getSystemInfoSync();
|
|
593
593
|
if (params && params?.pageWidth && params?.pageHeight) {
|
|
594
594
|
systemInfo.windowWidth = params?.pageWidth;
|
|
595
595
|
systemInfo.windowHeight = params?.pageHeight;
|
|
596
596
|
console.warn('松果app内获取重置系统信息宽度值', params, ',systemInfo信息集合为', systemInfo);
|
|
597
597
|
} else {
|
|
598
598
|
if (isPc) {
|
|
599
599
|
systemInfo.windowWidth = 375;
|
|
600
600
|
} else {
|
|
601
601
|
const getWinWidth = window.innerWidth;
|
|
602
602
|
const getWinHeight = window.innerHeight;
|
|
603
603
|
const getScreenWidth = window.screen.width;
|
|
604
604
|
const getScreenHeight = window.screen.height;
|
|
605
605
|
const getRootEleInitWidth = params?.rootEleInitWidth || 0;
|
|
606
606
|
const isReplaceSystemWidth = params?.replaceSystemWidth || false;
|
|
607
607
|
systemInfo.isJdTabletDevice = checkIsJdTabletDevice(getRootEleInitWidth);
|
|
608
608
|
systemInfo.isJdTabletLandscape =
|
|
609
609
|
systemInfo.isJdTabletDevice && checkPadScreenOrientationIsLandscape();
|
|
610
610
|
if (!systemInfo.isJdTabletDevice && isReplaceSystemWidth) {
|
|
611
611
|
if (systemInfo?.windowWidth <= 0) {
|
|
612
612
|
systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
|
|
613
613
|
systemInfo.windowHeight = getScreenHeight;
|
|
614
614
|
console.warn(
|
|
615
615
|
'====初始化获取当前设备不是pad,但是触发屏幕宽高最小值600,系统获取宽度为0,进行重置系统宽度为根元素宽度与屏幕宽度最小值====',
|
|
616
616
|
systemInfo.windowWidth,
|
|
617
617
|
'getRootEleInitWidth',
|
|
618
618
|
getRootEleInitWidth,
|
|
619
619
|
'getScreenWidth',
|
|
620
620
|
getScreenWidth,
|
|
621
621
|
'getScreenHeight',
|
|
622
622
|
getScreenHeight,
|
|
623
623
|
);
|
|
624
624
|
draBusinessCustomReport({
|
|
625
625
|
type: 'jdapp_pad_width_error_info',
|
|
626
626
|
errMsg: `松果app内获取当前设备不是pad,触发屏幕宽高最小值600,系统信息宽度为0,进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
|
|
627
627
|
originReqDataStr: JSON.stringify({
|
|
628
628
|
isJdApp,
|
|
629
629
|
isAndroidDevice,
|
|
630
630
|
getScreenWidth,
|
|
631
631
|
getScreenHeight,
|
|
632
632
|
getWinWidth,
|
|
633
633
|
getWinHeight,
|
|
634
634
|
getRootEleInitWidth,
|
|
635
635
|
}),
|
|
636
636
|
});
|
|
637
637
|
}
|
|
638
638
|
} else {
|
|
639
639
|
if (isJdApp && isAndroidDevice && !systemInfo.isJdTabletDevice && systemInfo) {
|
|
640
640
|
const isLandscape = getScreenWidth >= getScreenHeight;
|
|
641
641
|
const { windowWidth, windowHeight, screenWidth, screenHeight } = systemInfo;
|
|
642
642
|
if (windowWidth <= 0) {
|
|
643
643
|
systemInfo.initWindowWidth = windowWidth;
|
|
644
644
|
if (isLandscape) {
|
|
645
645
|
systemInfo.windowWidth = getScreenHeight;
|
|
646
646
|
systemInfo.windowHeight = getScreenWidth;
|
|
647
647
|
systemInfo.screenWidth = getScreenHeight;
|
|
648
648
|
systemInfo.screenHeight = getScreenWidth;
|
|
649
649
|
} else {
|
|
650
650
|
systemInfo.windowWidth = getScreenWidth;
|
|
651
651
|
systemInfo.windowHeight = getScreenHeight;
|
|
652
652
|
systemInfo.screenWidth = getScreenWidth;
|
|
653
653
|
systemInfo.screenHeight = getScreenHeight;
|
|
654
654
|
}
|
|
655
655
|
console.warn(
|
|
656
656
|
`松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight},根元素宽度值${getRootEleInitWidth}`,
|
|
657
657
|
);
|
|
658
658
|
draBusinessCustomReport({
|
|
659
659
|
type: 'android_jdapp_width_error_info',
|
|
660
660
|
errMsg: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
|
|
661
661
|
originReqDataStr: JSON.stringify({
|
|
662
662
|
isJdApp,
|
|
663
663
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
664
664
|
getScreenWidth,
|
|
665
665
|
getScreenHeight,
|
|
666
666
|
getWinWidth,
|
|
667
667
|
getWinHeight,
|
|
668
668
|
getRootEleInitWidth,
|
|
669
669
|
}),
|
|
670
670
|
});
|
|
671
671
|
sgmCustomReport({
|
|
672
672
|
type: 2,
|
|
673
673
|
code: 'android_jdapp_width_error_info',
|
|
674
674
|
msg: {
|
|
675
675
|
title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
|
|
676
676
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
677
677
|
taroSysInfo: systemInfo,
|
|
678
678
|
},
|
|
679
679
|
});
|
|
680
680
|
} else {
|
|
681
681
|
let _getChangeWinWidthState = false;
|
|
682
682
|
if (getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth) {
|
|
683
683
|
if (isLandscape) {
|
|
684
684
|
systemInfo.windowWidth = getScreenHeight;
|
|
685
685
|
systemInfo.windowHeight = getScreenWidth;
|
|
686
686
|
systemInfo.screenWidth = getScreenHeight;
|
|
687
687
|
systemInfo.screenHeight = getScreenWidth;
|
|
688
688
|
} else {
|
|
689
689
|
systemInfo.windowWidth = getScreenWidth;
|
|
690
690
|
systemInfo.windowHeight = getScreenHeight;
|
|
691
691
|
systemInfo.screenWidth = getScreenWidth;
|
|
692
692
|
systemInfo.screenHeight = getScreenHeight;
|
|
693
693
|
}
|
|
694
694
|
_getChangeWinWidthState = true;
|
|
695
695
|
}
|
|
696
696
|
_getChangeWinWidthState &&
|
|
697
697
|
console.warn(
|
|
698
698
|
`松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`,
|
|
699
699
|
);
|
|
700
700
|
if (_getChangeWinWidthState) {
|
|
701
701
|
draBusinessCustomReport({
|
|
702
702
|
type: 'android_jdapp_width_error_info_2',
|
|
703
703
|
title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
|
|
704
704
|
originReqDataStr: JSON.stringify({
|
|
705
705
|
isJdApp,
|
|
706
706
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
707
707
|
getScreenWidth,
|
|
708
708
|
getScreenHeight,
|
|
709
709
|
getWinWidth,
|
|
710
710
|
getWinHeight,
|
|
711
711
|
getRootEleInitWidth,
|
|
712
712
|
}),
|
|
713
713
|
});
|
|
714
714
|
sgmCustomReport({
|
|
715
715
|
type: 2,
|
|
716
716
|
code: 'android_jdapp_width_error_info_2',
|
|
717
717
|
msg: {
|
|
718
718
|
title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
|
|
719
719
|
initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
|
|
720
720
|
taroSysInfo: systemInfo,
|
|
721
721
|
},
|
|
722
722
|
});
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
727
|
|
|
728
728
|
if (systemInfo.isJdTabletDevice) {
|
|
729
729
|
systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
|
|
730
730
|
systemInfo.windowHeight = getScreenHeight;
|
|
731
731
|
if (systemInfo.isJdTabletLandscape) {
|
|
732
732
|
if (window?.PAGE_DATA?.isFitJdPadRenderCenter) {
|
|
733
733
|
systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
|
|
734
734
|
systemInfo.windowHeight = Math.max(
|
|
735
735
|
getRootEleInitWidth,
|
|
736
736
|
getScreenWidth,
|
|
737
737
|
getScreenHeight,
|
|
738
738
|
);
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
console.warn(
|
|
742
742
|
'====初始化获取当前设备是否是平板设备,是否横屏====',
|
|
743
743
|
systemInfo.isJdTabletDevice,
|
|
744
744
|
systemInfo.isJdTabletLandscape,
|
|
745
745
|
'屏幕信息',
|
|
746
746
|
window.screen,
|
|
747
747
|
'当前是否要求居中展示,居中展示那么宽高值要对调',
|
|
748
748
|
window?.PAGE_DATA?.isFitJdPadRenderCenter,
|
|
749
749
|
'当前pad最终展示的窗口宽度',
|
|
750
750
|
systemInfo.windowWidth,
|
|
751
751
|
);
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
755
|
systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo);
|
|
756
756
|
console.warn('====获取系统信息=====', systemInfo);
|
|
757
757
|
return systemInfo;
|
|
758
758
|
let result: boolean | null = null;
|
|
759
759
|
return function () {
|
|
760
760
|
if (result === null) {
|
|
761
761
|
const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
|
|
762
762
|
if (!isJdApp) {
|
|
763
763
|
console.warn('🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~');
|
|
764
764
|
isIgnoreOptimizeFromServer = true;
|
|
765
765
|
result = true;
|
|
766
766
|
return true;
|
|
767
767
|
}
|
|
768
768
|
const enableAvifOptimize = appVersionCheckPass;
|
|
769
769
|
if (enableAvifOptimize) {
|
|
770
770
|
const configData = global?.getDynamicConfig('avifSwitch');
|
|
771
771
|
const {
|
|
772
772
|
globalOn = true,
|
|
773
773
|
ignoreOptimizeFromServer = false,
|
|
774
774
|
page = {},
|
|
775
775
|
grayscale = {},
|
|
776
776
|
whiteList = [],
|
|
777
777
|
blackList = [],
|
|
778
778
|
} = configData || {};
|
|
779
779
|
const { shopId = '0', venderId = '0' } = parseQueryUrlObj;
|
|
780
780
|
let imageEnableResult = true;
|
|
781
781
|
isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
|
|
782
782
|
if (
|
|
783
783
|
blackList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
|
|
784
784
|
) {
|
|
785
785
|
imageEnableResult = false;
|
|
786
786
|
} else if (
|
|
787
787
|
whiteList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
|
|
788
788
|
) {
|
|
789
789
|
isIgnoreOptimizeFromServer = true;
|
|
790
790
|
imageEnableResult = true;
|
|
791
791
|
} else if (grayscale[buildType] && isInGrayscale(grayscale[buildType])) {
|
|
792
792
|
isIgnoreOptimizeFromServer = true;
|
|
793
793
|
imageEnableResult = true;
|
|
794
794
|
} else {
|
|
795
795
|
imageEnableResult = globalOn === true || page[buildType] === true;
|
|
796
796
|
if (globalOn === true) {
|
|
797
797
|
isIgnoreOptimizeFromServer = true;
|
|
798
798
|
} else if (page[buildType] === true) {
|
|
799
799
|
} else {
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
result = imageEnableResult;
|
|
803
803
|
return imageEnableResult;
|
|
804
804
|
} else {
|
|
805
805
|
result = false;
|
|
806
806
|
return false;
|
|
807
807
|
}
|
|
808
808
|
} else {
|
|
809
809
|
return result;
|
|
810
810
|
}
|
|
811
811
|
};
|
|
812
812
|
if (typeof options === 'object' && isImageOptimizeEnable()) {
|
|
813
813
|
return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
|
|
814
814
|
} else {
|
|
815
815
|
return getQualityImageOld(imgUrl, options);
|
|
816
816
|
}
|
|
817
817
|
const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
|
|
818
818
|
windowWidth: window.innerWidth,
|
|
819
819
|
containerWidth: getContainerWidth(buildType, {
|
|
820
820
|
windowWidth: window.innerWidth,
|
|
821
821
|
}),
|
|
822
822
|
screenWidth: window.innerWidth,
|
|
823
823
|
platform: '',
|
|
824
824
|
model: '',
|
|
825
825
|
system: '',
|
|
826
826
|
};
|
|
827
827
|
return getSystemInfo;
|
|
828
828
|
const params = Object.assign(
|
|
829
829
|
{},
|
|
830
830
|
{
|
|
831
831
|
title: '',
|
|
832
832
|
duration: 1500,
|
|
833
833
|
},
|
|
834
834
|
options,
|
|
835
835
|
);
|
|
836
836
|
params.duration = params.duration / 1000;
|
|
837
837
|
if (isJdApp && !isJdAndHarmonyDevice && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
|
|
838
838
|
const showSuccessType = isIosDevice ? ToastIosType.SUCCESS : ToastAndroidType.SUCCESS;
|
|
839
839
|
const duration = isAndroidDevice ? 0 : params.duration;
|
|
840
840
|
nativePageShowToast(options.title, showSuccessType, duration);
|
|
841
841
|
console.log('执行原生toast success');
|
|
842
842
|
} else {
|
|
843
843
|
showSuccessToast(options);
|
|
844
844
|
}
|
|
845
845
|
const params = Object.assign(
|
|
846
846
|
{},
|
|
847
847
|
{
|
|
848
848
|
title: '',
|
|
849
849
|
duration: 1500,
|
|
850
850
|
},
|
|
851
851
|
options,
|
|
852
852
|
);
|
|
853
853
|
params.duration = params.duration / 1000;
|
|
854
854
|
if (isJdApp && !isJdAndHarmonyDevice && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
|
|
855
855
|
const showSuccessType = isIosDevice ? ToastIosType.FAIL : ToastAndroidType.FAIL;
|
|
856
856
|
const duration = isAndroidDevice ? 0 : params.duration;
|
|
857
857
|
nativePageShowToast(options.title, showSuccessType, duration);
|
|
858
858
|
console.log('执行原生toast fail');
|
|
859
859
|
} else {
|
|
860
860
|
console.log('执行H5 toast fail');
|
|
861
861
|
showFailToast(options);
|
|
862
862
|
}
|
|
863
863
|
const params = Object.assign(
|
|
864
864
|
{},
|
|
865
865
|
{
|
|
866
866
|
title: '',
|
|
867
867
|
duration: 1500,
|
|
868
868
|
},
|
|
869
869
|
options,
|
|
870
870
|
);
|
|
871
871
|
params.duration = params.duration / 1000;
|
|
872
872
|
if (isJdApp && !isJdAndHarmonyDevice && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
|
|
873
873
|
const showSuccessType = isIosDevice ? ToastIosType.NORMAL : ToastAndroidType.NORMAL;
|
|
874
874
|
const duration = isAndroidDevice ? 0 : params.duration;
|
|
875
875
|
nativePageShowToast(options.title, showSuccessType, duration);
|
|
876
876
|
} else {
|
|
877
877
|
showNormalToast(options);
|
|
878
878
|
}
|
|
879
879
|
if (isLanguageForEn) {
|
|
880
880
|
count = Number(count);
|
|
881
881
|
if (count >= 1000000000) {
|
|
882
882
|
return (count / 1000000000).toFixed(fixedNum) + 'B';
|
|
883
883
|
} else if (count >= 1000000) {
|
|
884
884
|
return (count / 1000000).toFixed(fixedNum) + 'M';
|
|
885
885
|
} else if (count >= 1000) {
|
|
886
886
|
return (count / 1000).toFixed(fixedNum) + 'K';
|
|
887
887
|
} else {
|
|
888
888
|
return count;
|
|
889
889
|
}
|
|
890
890
|
} else {
|
|
891
891
|
return h5CountStringify(count, fixedNum, unit, maxNum);
|
|
892
892
|
}
|
|
893
893
|
const createLoadingEle = document.createElement('div');
|
|
894
894
|
createLoadingEle.id = 'J_shopLoading';
|
|
895
895
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
|
|
896
896
|
createLoadingEle.innerHTML = `<div class='d-loading-content'>
|
|
897
897
|
<span class='d-shop-loading-icon'></span>
|
|
898
898
|
<p class='d-shop-text'>${text}</p>
|
|
899
899
|
</div>`;
|
|
900
900
|
const getEle = document.body ? document.body : document.getElementsByTagName('body')[0];
|
|
901
901
|
getEle.appendChild(createLoadingEle);
|
|
902
902
|
const getEle = document.getElementById('J_shopLoading');
|
|
903
903
|
getEle && getEle.remove();
|
|
904
904
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(params);
|
|
905
905
|
if (!systemInfo.system && window) {
|
|
906
906
|
systemInfo.system = window.navigator.userAgent;
|
|
907
907
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
|
|
908
908
|
}
|
|
909
909
|
const isIOS = !!systemInfo?.system.match(/ios/i);
|
|
910
910
|
const isAndroid = !!systemInfo?.system.match(/android/i);
|
|
911
911
|
systemInfo.navBarHeight = 0;
|
|
912
912
|
systemInfo.statusBarHeight = 0;
|
|
913
913
|
systemInfo.capsulePosition = null;
|
|
914
914
|
systemInfo.isIOS = isIOS;
|
|
915
915
|
systemInfo.isAndroid = isAndroid;
|
|
916
916
|
_ShopSystemInfo = systemInfo;
|
|
917
917
|
return systemInfo;
|
|
918
918
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev);
|
|
919
919
|
const numScale = Number(scale);
|
|
920
920
|
if (isNaN(numScale)) {
|
|
921
921
|
console.warn(
|
|
922
922
|
`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`,
|
|
923
923
|
);
|
|
924
924
|
return false;
|
|
925
925
|
}
|
|
926
926
|
const { venderId } = global.info.queryInfo || {};
|
|
927
927
|
const id = venderId;
|
|
928
928
|
if (!id && numScale !== 1) {
|
|
929
929
|
return false;
|
|
930
930
|
}
|
|
931
931
|
const useScale = Math.max(0, Math.min(1, numScale));
|
|
932
932
|
const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
|
|
933
933
|
if (reportKey) {
|
|
934
934
|
sgmCustomReport({
|
|
935
935
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
|
|
936
936
|
msg: '灰度调用',
|
|
937
937
|
});
|
|
938
938
|
console.log(
|
|
939
939
|
`基于KEY[${reportKey}]的灰度调用1次~`,
|
|
940
940
|
getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
|
|
941
941
|
);
|
|
942
942
|
if (isMatch) {
|
|
943
943
|
sgmCustomReport({
|
|
944
944
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
|
|
945
945
|
msg: '灰度命中',
|
|
946
946
|
});
|
|
947
947
|
console.log(
|
|
948
948
|
`基于KEY[${reportKey}]的命中1次灰度!`,
|
|
949
949
|
getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
|
|
950
950
|
);
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
953
|
return isMatch;
|
|
954
954
|
isJdApp,
|
|
955
955
|
isWxApp,
|
|
956
956
|
isIosDevice,
|
|
957
957
|
isAndroidDevice,
|
|
958
958
|
isHarmonyDevice,
|
|
959
959
|
isJdAndIosDevice,
|
|
960
960
|
isJdAndAndroidDevice,
|
|
961
961
|
isJdAndHarmonyDevice,
|
|
962
962
|
isJdAndroidX5Core,
|
|
963
963
|
isMin,
|
|
964
964
|
isWxMin,
|
|
965
965
|
isWxMinAndWxapp,
|
|
966
966
|
isJdMinAndHarmony,
|
|
967
967
|
isJdMin,
|
|
968
968
|
isH5,
|
|
969
969
|
isH5AndJdShopView,
|
|
970
970
|
isChartH5,
|
|
971
971
|
isH5AndJdShopViewNativeScroll,
|
|
972
972
|
isH5AndJdShopViewH5Scroll,
|
|
973
973
|
isH5AndJdShopH5CustomScrollView,
|
|
974
974
|
isH5AndJingGouMini,
|
|
975
975
|
isWxMiniH5View,
|
|
976
976
|
urlCookie,
|
|
977
977
|
sliceArrToChunkList,
|
|
978
978
|
dealAddress,
|
|
979
979
|
objectToUrlEncode,
|
|
980
980
|
parseQueryUrlString,
|
|
981
981
|
setLowSmallPicUrl,
|
|
982
982
|
setTaroStorage,
|
|
983
983
|
getTaroStorageKeyValue,
|
|
984
984
|
removeTaroStorageKey,
|
|
985
985
|
clearTaroStorageKey,
|
|
986
986
|
getAvifSupport,
|
|
987
987
|
getWebpSupport,
|
|
988
988
|
getQualityImage,
|
|
989
989
|
formatCountForUnit as countStringify,
|
|
990
990
|
getWxAppCookieStr,
|
|
991
991
|
getSystemInfos,
|
|
992
992
|
pxTransformFromData,
|
|
993
993
|
dealShopContentDataAndReport as dealShopContentData,
|
|
994
994
|
dateFormat,
|
|
995
995
|
throttle,
|
|
996
996
|
lodashThrottle,
|
|
997
997
|
debounce,
|
|
998
998
|
addHttps,
|
|
999
999
|
commonShowSuccessToast as showSuccessToast,
|
|
1000
1000
|
commonShowFailToast as showFailToast,
|
|
1001
1001
|
commonShowNormalToast as showNormalToast,
|
|
1002
1002
|
showShopLoading,
|
|
1003
1003
|
hideShopLoading,
|
|
1004
1004
|
stopNativeScrollEvent,
|
|
1005
1005
|
getAppChannelType,
|
|
1006
1006
|
formatTabActiveMenuType,
|
|
1007
1007
|
filterUrlQueryData,
|
|
1008
1008
|
sgmCustomReport,
|
|
1009
1009
|
draCustomReport,
|
|
1010
1010
|
remoteCustomReport,
|
|
1011
1011
|
draInterfaceCustomReport,
|
|
1012
1012
|
draBusinessCustomReport,
|
|
1013
1013
|
isMemberPage,
|
|
1014
1014
|
getFloorDataToDataDefines,
|
|
1015
1015
|
isOpenJdAppUrl,
|
|
1016
1016
|
jdOpenAppParams,
|
|
1017
1017
|
createJdOpenAppUrl,
|
|
1018
1018
|
isEmpty,
|
|
1019
1019
|
getJdAppReportPageSource,
|
|
1020
1020
|
isAppClassifyPage,
|
|
1021
1021
|
isAppHomeForMarketPage,
|
|
1022
1022
|
isImageOptimizeEnable,
|
|
1023
1023
|
isPc,
|
|
1024
1024
|
ipLoc_djd,
|
|
1025
1025
|
isTjScence,
|
|
1026
1026
|
isH5AdnJxMini,
|
|
1027
1027
|
isTjM,
|
|
1028
1028
|
isTjJxM,
|
|
1029
1029
|
isTJApp,
|
|
1030
1030
|
isH5AdnHaoWuJie,
|
|
1031
1031
|
tjChannel,
|
|
1032
1032
|
dealJdOpenAppData,
|
|
1033
1033
|
jdAppVersionCompare,
|
|
1034
1034
|
dealNativePixelToCssPixel,
|
|
1035
1035
|
isAppStowShop,
|
|
1036
1036
|
getSgmCustomCode,
|
|
1037
1037
|
handleSgmCodeTaroVersion,
|
|
1038
1038
|
isInGrayscale,
|
|
1039
1039
|
isIpadDevice,
|
|
1040
1040
|
getBorderStyle,
|
|
1041
1041
|
isSupportHybridHttpRequest,
|
|
1042
1042
|
isLanguageForEn,
|
|
1043
1043
|
sColor,
|
|
1044
1044
|
draInterfaceDSMCustomReport,
|
|
1045
1045
|
isTabletDevice,
|
|
1046
1046
|
taroToTransformRoutimePXNumber,
|
|
1047
1047
|
updateContainerWidth,
|