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