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