@conecli/cone-render 0.9.1-shop2.2 → 0.9.1-shop2.20
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 -0
- 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/jdplayerSdk.ts +1 -0
- package/dist/common/jssdk.ts +1 -0
- package/dist/common/pageType.ts +1 -0
- package/dist/common/sgmCustomCode.ts +1 -0
- package/dist/common/token/index.h5.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/common/token/token.ts +1 -1
- package/dist/common/wxappApi.jd.ts +1 -0
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CountDown/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.module.scss +7 -0
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +5 -0
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/Exposure/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.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/ItemViewExposureSmart/index.tsx +1 -1
- package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
- package/dist/components/base/LazyLoadImage/const.ts +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.module.scss +23 -20
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
- package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +7 -0
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/components/base/Price/index.tsx +1 -1
- package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
- 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/interface/utils.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.h5.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 -0
- package/dist/jumpEventReport/web.tjapp.ts +1 -0
- package/dist/jumpEventReport/web.tjm.ts +1 -0
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/modules/ContainerFloorList/index.h5.module.scss +18 -1
- 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/environment.ts +1 -1
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/jump copy.ts +1 -1
- package/dist/open/api/request.ts +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/open/api/track.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 +49 -3
- package/dist/sass/base.scss +57 -0
- package/dist/service/fetchGateway.ts +1 -1
- package/dist/service/http/const.ts +1 -1
- package/dist/service/requestServer.ts +1 -1
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
- package/dist/utils/draExceptionAndProfile.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/jm-common.js +1 -1
- package/dist/utils/sgmCodeUtils.ts +1 -0
- package/dist/utils/taroRenderUtil.ts +1 -1
- package/dist/utils/utils.ts +1 -1
- package/package.json +1 -1
- package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
package/dist/utils/index.h5.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
nativePageShowToast, ToastAndroidType,
|
|
3
2
|
ToastIosType,
|
|
4
3
|
getAppChannelType, isAndroidDevice, isH5AndJdShopView, isChartH5,
|
|
5
4
|
isH5AndJdShopViewNativeScroll, isIosDevice, isJdAndAndroidDevice, isJdAndIosDevice, isJdApp,
|
|
6
5
|
isWxApp, isWxMiniH5View, isH5AndJingGouMini, urlCookie,
|
|
7
6
|
sgmCustomReport, isMemberPage, isH5AndJdShopViewH5Scroll, isAppClassifyPage, isPc, ipLoc_djd
|
|
8
7
|
addHttps,
|
|
9
8
|
clearTaroStorageKey,
|
|
10
9
|
countStringify,
|
|
11
10
|
dateFormat,
|
|
12
11
|
dealAddress,
|
|
13
12
|
dealShopContentData as originDealShopContentData,
|
|
14
13
|
debounce,
|
|
15
14
|
filterUrlQueryData,
|
|
16
15
|
formatTabActiveMenuType,
|
|
17
16
|
getQualityImage,
|
|
18
17
|
getTaroStorageKeyValue,
|
|
19
18
|
getWxAppCookieStr,
|
|
20
19
|
isH5,
|
|
21
20
|
isJdMin,
|
|
22
21
|
isWxMin,
|
|
23
22
|
isWxMinAndWxapp,
|
|
24
23
|
lodashThrottle,
|
|
25
24
|
objectToUrlEncode,
|
|
26
25
|
parseQueryUrlString,
|
|
27
26
|
removeTaroStorageKey,
|
|
28
27
|
setLowSmallPicUrl,
|
|
29
28
|
setTaroStorage,
|
|
30
29
|
showFailToast,
|
|
31
30
|
showNormalToast,
|
|
32
31
|
showSuccessToast,
|
|
33
32
|
sliceArrToChunkList,
|
|
34
33
|
throttle,
|
|
35
34
|
windowWidth: window.innerWidth,
|
|
36
35
|
containerWidth: buildType === BUILD_TYPE.CLASSIFY ? window.innerWidth - 100 : window.innerWidth,
|
|
37
36
|
screenWidth: window.innerWidth,
|
|
38
37
|
platform: '',
|
|
39
38
|
model: '',
|
|
40
39
|
system: '',
|
|
41
40
|
getSystemInfo.windowWidth = getSystemInfo.screenWidth
|
|
42
41
|
getSystemInfo['containerWidth'] = buildType === BUILD_TYPE.CLASSIFY ? getSystemInfo.screenWidth - 100 : getSystemInfo.screenWidth
|
|
43
42
|
const params = Object.assign(
|
|
44
43
|
{},
|
|
45
44
|
{
|
|
46
45
|
title: '',
|
|
47
46
|
duration: 1500,
|
|
48
47
|
},
|
|
49
48
|
options,
|
|
50
49
|
)
|
|
51
50
|
params.duration = params.duration / 1000
|
|
52
51
|
if (isJdApp && isH5AndJdShopView) {
|
|
53
52
|
const showSuccessType = isIosDevice
|
|
54
53
|
? ToastIosType.SUCCESS
|
|
55
54
|
: ToastAndroidType.SUCCESS
|
|
56
55
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
57
56
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
58
57
|
console.log('执行原生toast success')
|
|
59
58
|
} else {
|
|
60
59
|
showSuccessToast(options)
|
|
61
60
|
}
|
|
62
61
|
const params = Object.assign(
|
|
63
62
|
{},
|
|
64
63
|
{
|
|
65
64
|
title: '',
|
|
66
65
|
duration: 1500,
|
|
67
66
|
},
|
|
68
67
|
options,
|
|
69
68
|
)
|
|
70
69
|
params.duration = params.duration / 1000
|
|
71
70
|
console.log(`isJdApp${isJdApp}`)
|
|
72
71
|
if (isJdApp && isH5AndJdShopView) {
|
|
73
72
|
const showSuccessType = isIosDevice
|
|
74
73
|
? ToastIosType.FAIL
|
|
75
74
|
: ToastAndroidType.FAIL
|
|
76
75
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
77
76
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
78
77
|
console.log('执行原生toast fail')
|
|
79
78
|
} else {
|
|
80
79
|
console.log('执行H5 toast fail')
|
|
81
80
|
showFailToast(options)
|
|
82
81
|
}
|
|
83
82
|
const params = Object.assign(
|
|
84
83
|
{},
|
|
85
84
|
{
|
|
86
85
|
title: '',
|
|
87
86
|
duration: 1500,
|
|
88
87
|
},
|
|
89
88
|
options,
|
|
90
89
|
)
|
|
91
90
|
params.duration = params.duration / 1000
|
|
92
91
|
if (isJdApp) {
|
|
93
92
|
const showSuccessType = isIosDevice
|
|
94
93
|
? ToastIosType.NORMAL
|
|
95
94
|
: ToastAndroidType.NORMAL
|
|
96
95
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
97
96
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
98
97
|
} else {
|
|
99
98
|
showNormalToast(options)
|
|
100
99
|
}
|
|
101
100
|
const createLoadingEle = document.createElement('div')
|
|
102
101
|
createLoadingEle.id = 'J_shopLoading'
|
|
103
102
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
104
103
|
createLoadingEle.innerHTML = `<div class='d-loading-content'>
|
|
105
104
|
<span class='d-shop-loading-icon'></span>
|
|
106
105
|
<p class='d-shop-text'>${text}</p>
|
|
107
106
|
</div>`
|
|
108
107
|
const getEle = document.body ? document.body : document.getElementsByTagName('body')[0]
|
|
109
108
|
console.log('获取getEle及append及appendChild方法', getEle, getEle?.append, getEle?.appendChild)
|
|
110
109
|
getEle.appendChild(createLoadingEle)
|
|
111
110
|
const getEle = document.getElementById('J_shopLoading')
|
|
112
111
|
getEle && getEle.remove()
|
|
113
112
|
num,
|
|
114
113
|
widthSize = 375,
|
|
115
114
|
layoutWidth = getSystemInfo.windowWidth,
|
|
116
115
|
const getNum = Number(num)
|
|
117
116
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
118
117
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo
|
|
119
118
|
if (!systemInfo.system && window) {
|
|
120
119
|
systemInfo.system = window.navigator.userAgent
|
|
121
120
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
122
121
|
}
|
|
123
122
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
124
123
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
125
124
|
systemInfo.navBarHeight = 0
|
|
126
125
|
systemInfo.statusBarHeight = 0
|
|
127
126
|
systemInfo.capsulePosition = null
|
|
128
127
|
systemInfo.isIOS = isIOS
|
|
129
128
|
systemInfo.isAndroid = isAndroid
|
|
130
129
|
return systemInfo
|
|
131
130
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev)
|
|
132
131
|
isJdApp,
|
|
133
132
|
isWxApp,
|
|
134
133
|
isIosDevice,
|
|
135
134
|
isAndroidDevice,
|
|
136
135
|
isJdAndIosDevice,
|
|
137
136
|
isJdAndAndroidDevice,
|
|
138
137
|
isWxMin,
|
|
139
138
|
isWxMinAndWxapp,
|
|
140
139
|
isJdMin,
|
|
141
140
|
isH5,
|
|
142
141
|
isH5AndJdShopView,
|
|
143
142
|
isChartH5,
|
|
144
143
|
isH5AndJdShopViewNativeScroll,
|
|
145
144
|
isH5AndJdShopViewH5Scroll,
|
|
146
145
|
isH5AndJingGouMini,
|
|
147
146
|
isWxMiniH5View,
|
|
148
147
|
urlCookie,
|
|
149
148
|
sliceArrToChunkList,
|
|
150
149
|
dealAddress,
|
|
151
150
|
objectToUrlEncode,
|
|
152
151
|
parseQueryUrlString,
|
|
153
152
|
setLowSmallPicUrl,
|
|
154
153
|
setTaroStorage,
|
|
155
154
|
getTaroStorageKeyValue,
|
|
156
155
|
removeTaroStorageKey,
|
|
157
156
|
clearTaroStorageKey,
|
|
158
157
|
getQualityImage,
|
|
159
158
|
countStringify,
|
|
160
159
|
getWxAppCookieStr,
|
|
161
160
|
getSystemInfos,
|
|
162
161
|
pxTransformFromData,
|
|
163
162
|
dealShopContentDataAndReport as dealShopContentData,
|
|
164
163
|
dateFormat,
|
|
165
164
|
throttle,
|
|
166
165
|
lodashThrottle,
|
|
167
166
|
debounce,
|
|
168
167
|
addHttps,
|
|
169
168
|
commonShowSuccessToast as showSuccessToast,
|
|
170
169
|
commonShowFailToast as showFailToast,
|
|
171
170
|
commonShowNormalToast as showNormalToast,
|
|
172
171
|
showShopLoading,
|
|
173
172
|
hideShopLoading,
|
|
174
173
|
getAppChannelType,
|
|
175
174
|
formatTabActiveMenuType,
|
|
176
175
|
filterUrlQueryData,
|
|
177
176
|
sgmCustomReport,
|
|
178
177
|
isMemberPage,
|
|
179
178
|
memberFormatUtils,
|
|
180
179
|
getFloorDataToDataDefines,
|
|
181
180
|
isAppClassifyPage,
|
|
182
181
|
isPc,
|
|
183
182
|
ipLoc_djd,
|
|
183
|
+
import Taro from '@tarojs/taro'
|
|
184
184
|
UtilsInterFace
|
|
185
185
|
nativePageShowToast,
|
|
186
186
|
ToastAndroidType,
|
|
187
187
|
ToastIosType,
|
|
188
188
|
stopNativeScrollEvent,
|
|
189
189
|
getAppChannelType,
|
|
190
190
|
isAndroidDevice,
|
|
191
191
|
isH5AndJdShopView,
|
|
192
192
|
isChartH5,
|
|
193
193
|
isH5AndJdShopViewNativeScroll,
|
|
194
194
|
isIosDevice,
|
|
195
195
|
isJdAndAndroidDevice,
|
|
196
196
|
isJdAndIosDevice,
|
|
197
197
|
isJdApp,
|
|
198
198
|
isWxApp,
|
|
199
199
|
isWxMiniH5View,
|
|
200
200
|
isJdAndHarmonyDevice,
|
|
201
201
|
isH5AndJingGouMini,
|
|
202
202
|
urlCookie,
|
|
203
203
|
sgmCustomReport,
|
|
204
204
|
isMemberPage,
|
|
205
205
|
isH5AndJdShopViewH5Scroll,
|
|
206
206
|
isH5AndJdShopH5CustomScrollView,
|
|
207
207
|
isAppClassifyPage,
|
|
208
208
|
isAppHomeForMarketPage,
|
|
209
209
|
isPc,
|
|
210
210
|
ipLoc_djd,
|
|
211
211
|
jdAppVersionCompare,
|
|
212
212
|
isTjScence,
|
|
213
213
|
isH5AdnJxMini,
|
|
214
214
|
isTjM,
|
|
215
215
|
isTjJxM,
|
|
216
216
|
isTJApp,
|
|
217
217
|
isH5AdnHaoWuJie,
|
|
218
218
|
tjChannel,
|
|
219
219
|
dealNativePixelToCssPixel,
|
|
220
220
|
isAppStowShop,
|
|
221
221
|
isJdAndroidX5Core,
|
|
222
222
|
parseQueryUrlObj,
|
|
223
223
|
isIpadDevice,
|
|
224
224
|
addHttps,
|
|
225
225
|
clearTaroStorageKey,
|
|
226
226
|
countStringify,
|
|
227
227
|
dateFormat,
|
|
228
228
|
dealAddress,
|
|
229
229
|
dealShopContentData as originDealShopContentData,
|
|
230
230
|
debounce,
|
|
231
231
|
filterUrlQueryData,
|
|
232
232
|
formatTabActiveMenuType,
|
|
233
233
|
getAvifSupport,
|
|
234
234
|
getWebpSupport,
|
|
235
235
|
getTaroStorageKeyValue,
|
|
236
236
|
getWxAppCookieStr,
|
|
237
237
|
isH5,
|
|
238
238
|
isMin,
|
|
239
239
|
isJdMin,
|
|
240
240
|
isWxMin,
|
|
241
241
|
isWxMinAndWxapp,
|
|
242
242
|
isJdMinAndHarmony,
|
|
243
243
|
lodashThrottle,
|
|
244
244
|
objectToUrlEncode,
|
|
245
245
|
parseQueryUrlString,
|
|
246
246
|
removeTaroStorageKey,
|
|
247
247
|
setLowSmallPicUrl,
|
|
248
248
|
setTaroStorage,
|
|
249
249
|
showFailToast,
|
|
250
250
|
showNormalToast,
|
|
251
251
|
showSuccessToast,
|
|
252
252
|
sliceArrToChunkList,
|
|
253
253
|
throttle,
|
|
254
254
|
getQualityImageNew,
|
|
255
255
|
getQualityImageOld,
|
|
256
256
|
isOpenJdAppUrl,
|
|
257
257
|
jdOpenAppParams,
|
|
258
258
|
createJdOpenAppUrl,
|
|
259
259
|
isEmpty,
|
|
260
260
|
getJdAppReportPageSource,
|
|
261
261
|
dealJdOpenAppData,
|
|
262
262
|
SgmCustomCode,
|
|
263
263
|
} from '../common/sgmCustomCode'
|
|
264
264
|
const getNum = Number(num)
|
|
265
265
|
let _changeLayoutWidth = layoutWidth
|
|
266
266
|
if (!_changeLayoutWidth) {
|
|
267
267
|
_changeLayoutWidth =
|
|
268
268
|
_ShopSystemInfo && _ShopSystemInfo?.windowWidth
|
|
269
269
|
? _ShopSystemInfo.windowWidth
|
|
270
270
|
: Taro.getSystemInfoSync()?.windowWidth
|
|
271
271
|
}
|
|
272
272
|
return Math.round((getNum / widthSize) * _changeLayoutWidth)
|
|
273
273
|
changeSize,
|
|
274
274
|
designWidth = 750,
|
|
275
275
|
systemInfo,
|
|
276
276
|
const getRootFontSize =
|
|
277
277
|
(40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
|
|
278
278
|
const getRealRootFontSize =
|
|
279
279
|
getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
|
|
280
280
|
return Math.ceil(
|
|
281
281
|
(((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
|
|
282
282
|
getRealRootFontSize,
|
|
283
283
|
)
|
|
284
284
|
console.log(
|
|
285
285
|
'获取系统宽度systemInfo?.windowWidth',
|
|
286
286
|
systemInfo?.windowWidth,
|
|
287
287
|
'taroToTransformRoutimePXNumber(changeWidth)',
|
|
288
288
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
|
|
289
289
|
)
|
|
290
290
|
return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
|
|
291
291
|
? systemInfo?.windowWidth -
|
|
292
292
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
|
|
293
293
|
: systemInfo?.windowWidth ?? 0
|
|
294
294
|
const systemInfo = Taro.getSystemInfoSync()
|
|
295
295
|
if (params && params?.pageWidth && params?.pageHeight) {
|
|
296
296
|
systemInfo.windowWidth = params?.pageWidth
|
|
297
297
|
systemInfo.windowHeight = params?.pageHeight
|
|
298
298
|
}
|
|
299
299
|
systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
|
|
300
300
|
console.warn('====获取系统信息=====', systemInfo)
|
|
301
301
|
return systemInfo
|
|
302
302
|
let result: boolean | null = null
|
|
303
303
|
return function() {
|
|
304
304
|
if (result === null) {
|
|
305
305
|
const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
|
|
306
306
|
if(!isJdApp){
|
|
307
307
|
console.warn("🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~")
|
|
308
308
|
isIgnoreOptimizeFromServer = true
|
|
309
309
|
result = true
|
|
310
310
|
return true
|
|
311
311
|
}
|
|
312
312
|
const enableAvifOptimize = appVersionCheckPass
|
|
313
313
|
if(enableAvifOptimize){
|
|
314
314
|
const configData = global.getDynamicConfig('avifSwitch')
|
|
315
315
|
console.warn("🚗 ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:", buildType)
|
|
316
316
|
console.warn("🚗 ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:", configData)
|
|
317
317
|
const { globalOn = true, ignoreOptimizeFromServer = false, page = {}, grayscale = {}, whiteList = [], blackList = [] } = configData || {}
|
|
318
318
|
const {shopId = '0', venderId = '0'} = parseQueryUrlObj
|
|
319
319
|
let imageEnableResult = true
|
|
320
320
|
isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
|
|
321
321
|
console.warn("🚗 ~~ file: index.h5.ts:213 ~~ returnfunction ~~ grayscale[buildType]:", grayscale[buildType])
|
|
322
322
|
console.warn("🚗 ~~ file: index.h5.ts:213 ~~ returnfunction ~~ isInGrayscale(grayscale[buildType]:", isInGrayscale(grayscale[buildType]))
|
|
323
323
|
if (blackList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
|
|
324
324
|
imageEnableResult = false
|
|
325
325
|
console.warn("🚗 ~~ file: utils.ts:198 命中黑名单~")
|
|
326
326
|
}else if(whiteList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
|
|
327
327
|
isIgnoreOptimizeFromServer = true
|
|
328
328
|
imageEnableResult = true
|
|
329
329
|
console.warn("🚗 ~~ file: utils.ts:205 命中白名单~")
|
|
330
330
|
}else if(grayscale[buildType] && isInGrayscale(grayscale[buildType], 'imageOptimizeSwitch')){
|
|
331
331
|
isIgnoreOptimizeFromServer = true
|
|
332
332
|
imageEnableResult = true
|
|
333
333
|
console.warn("🚗 ~~ file: utils.ts:214 命中灰度~")
|
|
334
334
|
}else{
|
|
335
335
|
imageEnableResult = globalOn === true || page[buildType] === true
|
|
336
336
|
if(globalOn === true){
|
|
337
337
|
isIgnoreOptimizeFromServer = true
|
|
338
338
|
console.warn("🚗 ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~")
|
|
339
339
|
}else if(page[buildType] === true){
|
|
340
340
|
console.warn("🚗 ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~")
|
|
341
341
|
}else{
|
|
342
342
|
console.warn("🚗 ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!")
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
result = imageEnableResult
|
|
346
346
|
return imageEnableResult
|
|
347
347
|
}else{
|
|
348
348
|
result = false
|
|
349
349
|
return false
|
|
350
350
|
}
|
|
351
351
|
} else {
|
|
352
352
|
return result
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
if(typeof options === 'object' && isImageOptimizeEnable()){
|
|
356
356
|
return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
|
|
357
357
|
}else{
|
|
358
358
|
return getQualityImageOld(imgUrl, options)
|
|
359
359
|
}
|
|
360
360
|
const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
|
|
361
361
|
windowWidth: window.innerWidth,
|
|
362
362
|
containerWidth: getContainerWidth(buildType, {
|
|
363
363
|
windowWidth: window.innerWidth,
|
|
364
364
|
}),
|
|
365
365
|
screenWidth: window.innerWidth,
|
|
366
366
|
platform: '',
|
|
367
367
|
model: '',
|
|
368
368
|
system: '',
|
|
369
369
|
}
|
|
370
370
|
if (isJdApp && isAndroidDevice && getSystemInfo.windowWidth <= 0) {
|
|
371
371
|
getSystemInfo.windowWidth = getSystemInfo.screenWidth
|
|
372
372
|
getSystemInfo['containerWidth'] = getContainerWidth(
|
|
373
373
|
buildType,
|
|
374
374
|
getSystemInfo,
|
|
375
375
|
)
|
|
376
376
|
}
|
|
377
377
|
return getSystemInfo
|
|
378
378
|
console.log('进入commonshowToast, 传入参数options为: ', options)
|
|
379
379
|
const params = Object.assign(
|
|
380
380
|
{},
|
|
381
381
|
{
|
|
382
382
|
title: '',
|
|
383
383
|
duration: 1500,
|
|
384
384
|
},
|
|
385
385
|
options,
|
|
386
386
|
)
|
|
387
387
|
params.duration = params.duration / 1000
|
|
388
388
|
if (isJdApp) {
|
|
389
389
|
const showSuccessType = isIosDevice
|
|
390
390
|
? ToastIosType.SUCCESS
|
|
391
391
|
: ToastAndroidType.SUCCESS
|
|
392
392
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
393
393
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
394
394
|
console.log('执行原生toast success')
|
|
395
395
|
} else {
|
|
396
396
|
showSuccessToast(options)
|
|
397
397
|
}
|
|
398
398
|
const params = Object.assign(
|
|
399
399
|
{},
|
|
400
400
|
{
|
|
401
401
|
title: '',
|
|
402
402
|
duration: 1500,
|
|
403
403
|
},
|
|
404
404
|
options,
|
|
405
405
|
)
|
|
406
406
|
params.duration = params.duration / 1000
|
|
407
407
|
if (isJdApp) {
|
|
408
408
|
const showSuccessType = isIosDevice
|
|
409
409
|
? ToastIosType.FAIL
|
|
410
410
|
: ToastAndroidType.FAIL
|
|
411
411
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
412
412
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
413
413
|
console.log('执行原生toast fail')
|
|
414
414
|
} else {
|
|
415
415
|
console.log('执行H5 toast fail')
|
|
416
416
|
showFailToast(options)
|
|
417
417
|
}
|
|
418
418
|
const params = Object.assign(
|
|
419
419
|
{},
|
|
420
420
|
{
|
|
421
421
|
title: '',
|
|
422
422
|
duration: 1500,
|
|
423
423
|
},
|
|
424
424
|
options,
|
|
425
425
|
)
|
|
426
426
|
params.duration = params.duration / 1000
|
|
427
427
|
if (isJdApp) {
|
|
428
428
|
const showSuccessType = isIosDevice ?
|
|
429
429
|
ToastIosType.NORMAL :
|
|
430
430
|
ToastAndroidType.NORMAL
|
|
431
431
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
432
432
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
433
433
|
} else {
|
|
434
434
|
showNormalToast(options)
|
|
435
435
|
}
|
|
436
436
|
const createLoadingEle = document.createElement('div')
|
|
437
437
|
createLoadingEle.id = 'J_shopLoading'
|
|
438
438
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
439
439
|
createLoadingEle.innerHTML =
|
|
440
440
|
`<div class='d-loading-content'>
|
|
441
441
|
<span class='d-shop-loading-icon'></span>
|
|
442
442
|
<p class='d-shop-text'>${text}</p>
|
|
443
443
|
</div>`
|
|
444
444
|
const getEle = document.body
|
|
445
445
|
? document.body
|
|
446
446
|
: document.getElementsByTagName('body')[0]
|
|
447
447
|
getEle.appendChild(createLoadingEle)
|
|
448
448
|
const getEle = document.getElementById('J_shopLoading')
|
|
449
449
|
getEle && getEle.remove()
|
|
450
450
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(
|
|
451
451
|
params,
|
|
452
452
|
)
|
|
453
453
|
if (!systemInfo.system && window) {
|
|
454
454
|
systemInfo.system = window.navigator.userAgent
|
|
455
455
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
456
456
|
}
|
|
457
457
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
458
458
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
459
459
|
systemInfo.navBarHeight = 0
|
|
460
460
|
systemInfo.statusBarHeight = 0
|
|
461
461
|
systemInfo.capsulePosition = null
|
|
462
462
|
systemInfo.isIOS = isIOS
|
|
463
463
|
systemInfo.isAndroid = isAndroid
|
|
464
464
|
_ShopSystemInfo = systemInfo
|
|
465
465
|
return systemInfo
|
|
466
466
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev)
|
|
467
467
|
const numScale = Number(scale)
|
|
468
468
|
if(isNaN(numScale)){
|
|
469
469
|
console.warn(`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`)
|
|
470
470
|
return false
|
|
471
471
|
}
|
|
472
472
|
const { venderId } = global.info.queryInfo || {}
|
|
473
473
|
const id = venderId
|
|
474
474
|
if(!id && numScale !== 1){
|
|
475
475
|
return false
|
|
476
476
|
}
|
|
477
477
|
const useScale = Math.max(0, Math.min(1, numScale))
|
|
478
478
|
const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0
|
|
479
479
|
if(reportKey){
|
|
480
480
|
sgmCustomReport({
|
|
481
481
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
|
|
482
482
|
msg: '灰度调用',
|
|
483
483
|
})
|
|
484
484
|
console.log(`基于KEY[${reportKey}]的灰度调用1次~`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`))
|
|
485
485
|
if(isMatch){
|
|
486
486
|
sgmCustomReport({
|
|
487
487
|
code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
|
|
488
488
|
msg: '灰度命中',
|
|
489
489
|
})
|
|
490
490
|
console.log(`基于KEY[${reportKey}]的命中1次灰度!`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`))
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
return isMatch
|
|
494
494
|
isJdApp,
|
|
495
495
|
isWxApp,
|
|
496
496
|
isIosDevice,
|
|
497
497
|
isAndroidDevice,
|
|
498
498
|
isJdAndIosDevice,
|
|
499
499
|
isJdAndAndroidDevice,
|
|
500
500
|
isJdAndHarmonyDevice,
|
|
501
501
|
isJdAndroidX5Core,
|
|
502
502
|
isMin,
|
|
503
503
|
isWxMin,
|
|
504
504
|
isWxMinAndWxapp,
|
|
505
505
|
isJdMinAndHarmony,
|
|
506
506
|
isJdMin,
|
|
507
507
|
isH5,
|
|
508
508
|
isH5AndJdShopView,
|
|
509
509
|
isChartH5,
|
|
510
510
|
isH5AndJdShopViewNativeScroll,
|
|
511
511
|
isH5AndJdShopViewH5Scroll,
|
|
512
512
|
isH5AndJdShopH5CustomScrollView,
|
|
513
513
|
isH5AndJingGouMini,
|
|
514
514
|
isWxMiniH5View,
|
|
515
515
|
urlCookie,
|
|
516
516
|
sliceArrToChunkList,
|
|
517
517
|
dealAddress,
|
|
518
518
|
objectToUrlEncode,
|
|
519
519
|
parseQueryUrlString,
|
|
520
520
|
setLowSmallPicUrl,
|
|
521
521
|
setTaroStorage,
|
|
522
522
|
getTaroStorageKeyValue,
|
|
523
523
|
removeTaroStorageKey,
|
|
524
524
|
clearTaroStorageKey,
|
|
525
525
|
getAvifSupport,
|
|
526
526
|
getWebpSupport,
|
|
527
527
|
getQualityImage,
|
|
528
528
|
countStringify,
|
|
529
529
|
getWxAppCookieStr,
|
|
530
530
|
getSystemInfos,
|
|
531
531
|
pxTransformFromData,
|
|
532
532
|
dealShopContentDataAndReport as dealShopContentData,
|
|
533
533
|
dateFormat,
|
|
534
534
|
throttle,
|
|
535
535
|
lodashThrottle,
|
|
536
536
|
debounce,
|
|
537
537
|
addHttps,
|
|
538
538
|
commonShowSuccessToast as showSuccessToast,
|
|
539
539
|
commonShowFailToast as showFailToast,
|
|
540
540
|
commonShowNormalToast as showNormalToast,
|
|
541
541
|
showShopLoading,
|
|
542
542
|
hideShopLoading,
|
|
543
543
|
stopNativeScrollEvent,
|
|
544
544
|
getAppChannelType,
|
|
545
545
|
formatTabActiveMenuType,
|
|
546
546
|
filterUrlQueryData,
|
|
547
547
|
sgmCustomReport,
|
|
548
548
|
isMemberPage,
|
|
549
549
|
getFloorDataToDataDefines,
|
|
550
550
|
isOpenJdAppUrl,
|
|
551
551
|
jdOpenAppParams,
|
|
552
552
|
createJdOpenAppUrl,
|
|
553
553
|
isEmpty,
|
|
554
554
|
getJdAppReportPageSource,
|
|
555
555
|
isAppClassifyPage,
|
|
556
556
|
isAppHomeForMarketPage,
|
|
557
557
|
isImageOptimizeEnable,
|
|
558
558
|
isPc,
|
|
559
559
|
ipLoc_djd,
|
|
560
560
|
isTjScence,
|
|
561
561
|
isH5AdnJxMini,
|
|
562
562
|
isTjM,
|
|
563
563
|
isTjJxM,
|
|
564
564
|
isTJApp,
|
|
565
565
|
isH5AdnHaoWuJie,
|
|
566
566
|
tjChannel,
|
|
567
567
|
dealJdOpenAppData,
|
|
568
568
|
jdAppVersionCompare,
|
|
569
569
|
dealNativePixelToCssPixel,
|
|
570
570
|
isAppStowShop,
|
|
571
571
|
getSgmCustomCode,
|
|
572
572
|
handleSgmCodeTaroVersion,
|
|
573
573
|
isInGrayscale,
|
|
574
574
|
isIpadDevice,
|
package/dist/utils/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {
|
|
2
1
|
isChartH5,
|
|
3
2
|
isH5AndJdShopViewH5Scroll,
|
|
4
3
|
isMemberPage,
|
|
5
4
|
isPc,
|
|
6
5
|
ipLoc_djd,
|
|
7
6
|
isChartH5,
|
|
8
7
|
isH5AndJdShopViewH5Scroll,
|
|
9
8
|
isH5AndJingGouMini,
|
|
10
9
|
urlCookie,
|
|
11
10
|
isMemberPage,
|
|
12
11
|
isPc,
|
|
13
12
|
ipLoc_djd,
|
|
13
|
+
import {
|
|
14
14
|
isMin,
|
|
15
15
|
isJdMinAndHarmony,
|
|
16
16
|
isChartH5,
|
|
17
17
|
isH5AndJdShopViewH5Scroll,
|
|
18
18
|
isH5AndJdShopH5CustomScrollView,
|
|
19
19
|
getAvifSupport,
|
|
20
20
|
getWebpSupport,
|
|
21
21
|
isMemberPage,
|
|
22
22
|
sgmCustomReport,
|
|
23
23
|
isOpenJdAppUrl,
|
|
24
24
|
jdOpenAppParams,
|
|
25
25
|
createJdOpenAppUrl,
|
|
26
26
|
isEmpty,
|
|
27
27
|
getJdAppReportPageSource,
|
|
28
28
|
isPc,
|
|
29
29
|
ipLoc_djd,
|
|
30
30
|
dealJdOpenAppData,
|
|
31
31
|
jdAppVersionCompare,
|
|
32
32
|
dealNativePixelToCssPixel,
|
|
33
33
|
isAppStowShop,
|
|
34
34
|
isImageOptimizeEnable,
|
|
35
35
|
isIpadDevice,
|
|
36
36
|
console.warn("🚗 ~~ file: index.ts:93 ~~ 通用的isInGrayscale还没有实现,不应该被调用!")
|
|
37
37
|
return false
|
|
38
38
|
isJdAndHarmonyDevice,
|
|
39
39
|
isJdAndroidX5Core,
|
|
40
40
|
isMin,
|
|
41
41
|
isJdMinAndHarmony,
|
|
42
42
|
isChartH5,
|
|
43
43
|
isH5AndJdShopViewH5Scroll,
|
|
44
44
|
isH5AndJdShopH5CustomScrollView,
|
|
45
45
|
isH5AndJingGouMini,
|
|
46
46
|
urlCookie,
|
|
47
47
|
stopNativeScrollEvent,
|
|
48
48
|
getAvifSupport,
|
|
49
49
|
getWebpSupport,
|
|
50
50
|
isMemberPage,
|
|
51
51
|
sgmCustomReport,
|
|
52
52
|
isOpenJdAppUrl,
|
|
53
53
|
jdOpenAppParams,
|
|
54
54
|
createJdOpenAppUrl,
|
|
55
55
|
isEmpty,
|
|
56
56
|
isAppHomeForMarketPage,
|
|
57
57
|
getJdAppReportPageSource,
|
|
58
58
|
isImageOptimizeEnable,
|
|
59
59
|
isPc,
|
|
60
60
|
ipLoc_djd,
|
|
61
61
|
isTjM,
|
|
62
62
|
isTjJxM,
|
|
63
63
|
isTjScence,
|
|
64
64
|
isH5AdnJxMini,
|
|
65
65
|
isTJApp,
|
|
66
66
|
isH5AdnHaoWuJie,
|
|
67
67
|
tjChannel,
|
|
68
68
|
dealJdOpenAppData,
|
|
69
69
|
jdAppVersionCompare,
|
|
70
70
|
dealNativePixelToCssPixel,
|
|
71
71
|
isAppStowShop,
|
|
72
72
|
getSgmCustomCode,
|
|
73
73
|
handleSgmCodeTaroVersion,
|
|
74
74
|
isInGrayscale,
|
|
75
75
|
isIpadDevice,
|