@conecli/cone-render 0.8.42 → 0.8.44

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.
Files changed (34) hide show
  1. package/dist/common/const.ts +1 -1
  2. package/dist/common/index.h5.ts +1 -1
  3. package/dist/common/index.weapp.ts +1 -1
  4. package/dist/common/sgmCustomCode.ts +1 -1
  5. package/dist/components/ErrorBoundary.tsx +1 -1
  6. package/dist/components/base/CustomVideo/index.tsx +1 -1
  7. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  8. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  9. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  10. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  11. package/dist/components/remoteFloorItem.tsx +1 -1
  12. package/dist/interface/component.ts +1 -1
  13. package/dist/jumpEventReport/base.ts +1 -1
  14. package/dist/jumpEventReport/const.ts +1 -1
  15. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  16. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  17. package/dist/jumpEventReport/web.base.ts +1 -1
  18. package/dist/jumpEventReport/web.jd.ts +1 -1
  19. package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -0
  20. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  21. package/dist/open/api/request.ts +1 -1
  22. package/dist/open/api/shopMember.ts +1 -1
  23. package/dist/open/components/index.ts +1 -1
  24. package/dist/sass/app.h5.scss +5 -0
  25. package/dist/service/requestServer.ts +1 -1
  26. package/dist/utils/connectNativeJsBridge.ts +1 -1
  27. package/dist/utils/h5Utils.ts +1 -1
  28. package/dist/utils/index.h5.ts +1 -1
  29. package/dist/utils/index.ts +1 -1
  30. package/dist/utils/index.weapp.ts +1 -1
  31. package/dist/utils/sgmCodeUtils.ts +1 -1
  32. package/dist/utils/taroRenderUtil.ts +1 -1
  33. package/dist/utils/utils.ts +1 -1
  34. package/package.json +1 -1
@@ -1 +1 @@
1
- import Taro from "@tarojs/taro";
2
1
  SHOP_MENU_ID_TYPE,
3
2
  SHOP_MENU_ID_QUERY_NAME,
4
3
  SECTION_HOME_TAB_TYPE,
5
4
  SECTION_HOME_TAB_NAME_TYPE,
6
5
  SECTION_HOME_TAB_QUERY_TYPE,
7
6
  CHANNEL_TYPE,
8
7
  JDShopViewBusinessPathType,
9
8
  FloorModuleType,
10
9
  RemoteLoadFloorList,
11
10
  getBundleUrl,
12
11
  getBundleFileName,
13
12
  formatPackResult,
14
13
  SgmCustomCode,
15
14
  NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG,
16
15
  if(isH5){
17
16
  const avifCache = getTaroStorageKeyValue(KEY_AVIF)
18
17
  if(avifCache === null || avifCache === ''){
19
18
  const img = new Image()
20
19
  img.onload = function() {
21
20
  if (img.height > 0 && img.width > 0) {
22
21
  setTaroStorage(KEY_AVIF, '1')
23
22
  } else {
24
23
  setTaroStorage(KEY_AVIF, '0')
25
24
  }
26
25
  }
27
26
  img.onerror = () => {
28
27
  setTaroStorage(KEY_AVIF, '0')
29
28
  }
30
29
  img.src = 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
31
30
  }
32
31
  const webpCache = getTaroStorageKeyValue(KEY_WEBP)
33
32
  if(webpCache === null || webpCache === ''){
34
33
  const img = new Image()
35
34
  img.onload = function() {
36
35
  if (img.height > 0 && img.width > 0) {
37
36
  setTaroStorage(KEY_WEBP, '1')
38
37
  } else {
39
38
  setTaroStorage(KEY_WEBP, '0')
40
39
  }
41
40
  }
42
41
  img.onerror = () => {
43
42
  setTaroStorage(KEY_WEBP, '0')
44
43
  }
45
44
  img.src = 'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA=';
46
45
  }
47
46
  }
48
47
  const resultList: Array<any> = [],
49
48
  arrLen = arr.length
50
49
  if (arrLen) {
51
50
  if (arrLen > size) {
52
51
  for (let i = 0; i < arrLen; i = i + size) {
53
52
  resultList.push(arr.slice(i, i + size))
54
53
  }
55
54
  } else {
56
55
  resultList.push(arr)
57
56
  }
58
57
  }
59
58
  return resultList
60
59
  let _address = ids;
61
60
  const _areaAreaSplit = ids.split(".");
62
61
  const _areaAreaSplit2 = ids.split("_");
63
62
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
64
63
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
65
64
  return _address;
66
65
  let paramStr = "";
67
66
  obj &&
68
67
  Object.keys(obj).forEach((key, index) => {
69
68
  const getValue = `${obj[key]}`
70
69
  .replace(/undefined/, "")
71
70
  .replace(/null/, "");
72
71
  paramStr += `${index === 0 ? "" : "&"}${key}=${encodeURIComponent(
73
72
  getValue
74
73
  )}`;
75
74
  });
76
75
  return paramStr;
77
76
  const result = {};
78
77
  if (
79
78
  !urlOrQueryStr ||
80
79
  ("string" !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
81
80
  ) {
82
81
  return result;
83
82
  }
84
83
  if (urlOrQueryStr.indexOf("?") > -1) {
85
84
  const queryStr = urlOrQueryStr.split("?");
86
85
  const queryItemList =
87
86
  queryStr && queryStr.length > 1 ? queryStr[1].split("&") : [];
88
87
  const queryItemListLen = queryItemList.length;
89
88
  queryItemListLen > 0 &&
90
89
  queryItemList.forEach((item) => {
91
90
  const thisItemList = item.split("=");
92
91
  result[thisItemList[0]] = thisItemList[1];
93
92
  });
94
93
  } else {
95
94
  const queryItemList =
96
95
  urlOrQueryStr.indexOf("&") > -1
97
96
  ? urlOrQueryStr.split("&")
98
97
  : [urlOrQueryStr];
99
98
  const queryItemListLen = queryItemList.length;
100
99
  queryItemListLen > 0 &&
101
100
  queryItemList.forEach((item) => {
102
101
  const thisItemList = item.split("=");
103
102
  result[thisItemList[0]] = thisItemList[1];
104
103
  });
105
104
  }
106
105
  return result;
107
106
  url: string,
108
107
  size?: {
109
108
  w: number;
110
109
  h: number;
111
110
  },
112
111
  quality?: number
113
112
  if (url && size) {
114
113
  const _w = Math.floor(size.w);
115
114
  const _h = Math.floor(size.h);
116
115
  if (url.match(/gif$/i)) {
117
116
  return url;
118
117
  } else {
119
118
  if (_w > 0 && _h > 0) {
120
119
  url = url.replace("jfs/", `s${_w}x${_h}_jfs/`);
121
120
  }
122
121
  url += quality != null ? `!q${quality}.dpg` : ".dpg";
123
122
  }
124
123
  }
125
124
  return url;
126
125
  url: string,
127
126
  jfsImgInfo: UtilsInterFace.getJfsImageInfo = {}
128
127
  if (url.match(/\.(jpg|png|dpg)$/i)) {
129
128
  const { width, height, quality } = jfsImgInfo;
130
129
  if (typeof width === "number" || typeof height === "number") {
131
130
  url = url.replace(
132
131
  "/jfs/",
133
132
  `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`
134
133
  );
135
134
  }
136
135
  if (
137
136
  typeof quality === "number" &&
138
137
  quality > 0 &&
139
138
  quality < 100 &&
140
139
  url.match(/\.jpg$/i)
141
140
  ) {
142
141
  url += `!q${quality}.dpg`;
143
142
  }
144
143
  }
145
144
  return addHttps(url);
146
145
  if (imgUrl) {
147
146
  if (
148
147
  !imgUrl.match(
149
148
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i
150
149
  )
151
150
  ) {
152
151
  if (!imgUrl.includes("360buyimg.com")) {
153
152
  imgUrl = "//m.360buyimg.com/cms/" + imgUrl;
154
153
  }
155
154
  if (quality != 100)
156
155
  imgUrl += /\.png/.test(imgUrl) ? ".dpg" : `!q${quality}`;
157
156
  }
158
157
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
159
158
  }
160
159
  return imgUrl;
161
160
  const result = value % step
162
161
  return result === 0? value: (Math.ceil(value / step) * step)
163
162
  const MAX = 3.5
164
163
  return Math.min(window?.devicePixelRatio ?? 2, MAX)
165
164
  isSkuImage: boolean,
166
165
  size: number
167
166
  if (!imgUrl) {
168
167
  console.error('The input parameter imageUrl for the getQualityImage() cannot be empty!')
169
168
  return imgUrl
170
169
  }
171
170
  if(isIgnoreOptimizeFromServer){
172
171
  imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1')
173
172
  }
174
173
  if(!/^((https?):)?\/\//.test(imgUrl)){
175
174
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
176
175
  }
177
176
  const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i
178
177
  if (!imgServerRegExp.test(imgUrl)) {
179
178
  return imgUrl
180
179
  }
181
180
  const {isSkuImage, size} = options || {}
182
181
  const needReduceSize = isSkuImage && size
183
182
  if (needReduceSize){
184
183
  const devicePixelRatio = getDevicePixelRatio()
185
184
  const useWidth = getValueByStep(size * devicePixelRatio, 40)
186
185
  imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useWidth}_jfs/`)
187
186
  }
188
187
  const needCompress = !global?.info?.pageInfo?.isVipShop
189
188
  const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/)
190
189
  if(needCompress && result){
191
190
  if(getAvifSupport() === '1'){
192
191
  imgUrl += '.avif'
193
192
  }else if(getWebpSupport() === '1'){
194
193
  imgUrl += '.webp'
195
194
  }else if(/jpe?g/.test(result[1])){
196
195
  imgUrl += '!q80'
197
196
  }
198
197
  }
199
198
  if (needReduceSize){
200
199
  imgUrl += '!z2'
201
200
  }
202
201
  if(!imgUrl.includes('360buyimg.com')){
203
202
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
204
203
  }
205
204
  if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
206
205
  return getTaroStorageKeyValue(KEY_AVIF) || '0'
207
206
  return getTaroStorageKeyValue(KEY_WEBP) || '0'
208
207
  count: number,
209
208
  fixedNum = 2,
210
209
  unit = "万",
211
210
  maxNum = 10000
212
211
  count = Number(count);
213
212
  if (count > maxNum) {
214
213
  return (count / maxNum).toFixed(fixedNum) + unit;
215
214
  }
216
215
  return count;
217
216
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
218
217
  platform: "",
219
218
  model: "",
220
219
  system: "",
221
220
  };
222
221
  const isIOS = !!systemInfo.system.match(/ios/i);
223
222
  const isAndroid = !!systemInfo.system.match(/android/i);
224
223
  if (!systemInfo.statusBarHeight) {
225
224
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20;
226
225
  systemInfo.navBarExtendHeight = 0;
227
226
  } else {
228
227
  if (isIOS) {
229
228
  systemInfo.navBarExtendHeight = 4;
230
229
  } else {
231
230
  systemInfo.navBarExtendHeight = 0;
232
231
  }
233
232
  }
234
233
  let rect = Taro.getMenuButtonBoundingClientRect
235
234
  ? Taro.getMenuButtonBoundingClientRect()
236
235
  : null;
237
236
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
238
237
  let gap = 0;
239
238
  let width = 96;
240
239
  if (systemInfo.platform === "android") {
241
240
  gap = 8;
242
241
  width = 96;
243
242
  } else if (systemInfo.platform === "devtools") {
244
243
  if (isIOS) {
245
244
  gap = 5.5;
246
245
  } else {
247
246
  gap = 7.5;
248
247
  }
249
248
  } else {
250
249
  gap = 4;
251
250
  width = 88;
252
251
  }
253
252
  rect = {
254
253
  bottom: systemInfo.statusBarHeight + gap + 32,
255
254
  height: 32,
256
255
  left: systemInfo.windowWidth - width - 10,
257
256
  right: systemInfo.windowWidth - 10,
258
257
  top: systemInfo.statusBarHeight + gap,
259
258
  width,
260
259
  };
261
260
  }
262
261
  const gap = rect.top - systemInfo.statusBarHeight;
263
262
  systemInfo.navBarTopToStatusBar = gap;
264
263
  systemInfo.navBarHeight = 2 * gap + rect.height;
265
264
  systemInfo.capsulePosition = rect;
266
265
  systemInfo.isIOS = isIOS;
267
266
  systemInfo.isAndroid = isAndroid;
268
267
  return systemInfo;
269
268
  if (str.match(/^\/\//)) {
270
269
  str = "https:" + str;
271
270
  }
272
271
  return str;
273
272
  dateTimeOrdate: Date | string | number | null,
274
273
  format = "yyyy-MM-dd HH:mm:ss",
275
274
  noPadStart = {
276
275
  M: "0",
277
276
  d: "0",
278
277
  H: "0",
279
278
  m: "0",
280
279
  s: "0",
281
280
  }
282
281
  let dateResult = "";
283
282
  const padStarts = Object.assign(
284
283
  {
285
284
  M: "0",
286
285
  d: "0",
287
286
  H: "0",
288
287
  m: "0",
289
288
  s: "0",
290
289
  },
291
290
  noPadStart
292
291
  );
293
292
  if (dateTimeOrdate) {
294
293
  let changeDateTimeOrdate = dateTimeOrdate;
295
294
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
296
295
  if (getChangeDateTimeToNumber) {
297
296
  changeDateTimeOrdate = getChangeDateTimeToNumber;
298
297
  } else {
299
298
  changeDateTimeOrdate = `${changeDateTimeOrdate}`
300
299
  .replace(/-/g, "/")
301
300
  .replace(/\./g, "/");
302
301
  }
303
302
  const nowDate =
304
303
  dateTimeOrdate instanceof Date
305
304
  ? dateTimeOrdate
306
305
  : new Date(changeDateTimeOrdate);
307
306
  const dateMap = {
308
307
  y: `${nowDate.getFullYear()}`,
309
308
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts["M"]),
310
309
  d: `${nowDate.getDate()}`.padStart(2, padStarts["d"]),
311
310
  H: `${nowDate.getHours()}`.padStart(2, padStarts["H"]),
312
311
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts["m"]),
313
312
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts["s"]),
314
313
  };
315
314
  const regDate = new RegExp("y+|M+|d+|H+|m+|s+", "g");
316
315
  const regYear = new RegExp("y");
317
316
  dateResult = format.replace(regDate, (v) => {
318
317
  let changeValue = v;
319
318
  if (regYear.test(changeValue)) {
320
319
  const thisYear = dateMap.y;
321
320
  const subValueLen = 4 - changeValue.length;
322
321
  changeValue = thisYear.substr(subValueLen);
323
322
  } else {
324
323
  const dateKey = v.substr(0, 1);
325
324
  changeValue = dateMap[dateKey];
326
325
  }
327
326
  return changeValue;
328
327
  });
329
328
  }
330
329
  return dateResult;
331
330
  let timer: any = null;
332
331
  let startTime = Date.now();
333
332
  return function () {
334
333
  const curTime = Date.now();
335
334
  const remaining = delay - (curTime - startTime);
336
335
  const context = this;
337
336
  const args = arguments;
338
337
  clearTimeout(timer);
339
338
  if (remaining <= 0) {
340
339
  func.apply(context, args);
341
340
  startTime = Date.now();
342
341
  } else {
343
342
  timer = setTimeout(func, remaining);
344
343
  }
345
344
  };
346
345
  let context, args, result;
347
346
  let timeout = null;
348
347
  let previous = 0;
349
348
  if (!options) options = {};
350
349
  const later = function () {
351
350
  previous = options.leading === false ? 0 : Date.now();
352
351
  timeout = null;
353
352
  result = func.apply(context, args);
354
353
  if (!timeout) context = args = null;
355
354
  };
356
355
  return function () {
357
356
  const now = Date.now();
358
357
  if (!previous && options.leading === false) previous = now;
359
358
  const remaining = wait - (now - previous);
360
359
  context = this;
361
360
  args = arguments;
362
361
  if (remaining <= 0 || remaining > wait) {
363
362
  if (timeout) {
364
363
  clearTimeout(timeout);
365
364
  timeout = null;
366
365
  }
367
366
  previous = now;
368
367
  result = func.apply(context, args);
369
368
  if (!timeout) context = args = null;
370
369
  } else if (!timeout && options.trailing !== false) {
371
370
  timeout = setTimeout(later, remaining);
372
371
  }
373
372
  return result;
374
373
  };
375
374
  let timer: any = null;
376
375
  return function () {
377
376
  const context: any = this;
378
377
  const args = arguments;
379
378
  timer && clearTimeout(timer);
380
379
  timer = setTimeout(function () {
381
380
  fn.apply(context, args);
382
381
  }, delay);
383
382
  };
384
383
  if (txt) {
385
384
  txt = txt.trim();
386
385
  const reg = new RegExp(/[\d-]+/);
387
386
  const res = reg.exec(txt);
388
387
  if (res && res.length > 0) {
389
388
  let tel = res[0];
390
389
  if (tel && delSeparator) {
391
390
  tel = tel.replace(/-/g, "");
392
391
  }
393
392
  return tel;
394
393
  }
395
394
  }
396
395
  return "";
397
396
  if (rgb) {
398
397
  const reg = /^(rgb|RGB)/;
399
398
  const color = rgb;
400
399
  if (reg.test(color)) {
401
400
  let strHex = "#";
402
401
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
403
402
  for (let i = 0; i < colorArr.length; i++) {
404
403
  let hex = Number(colorArr[i]).toString(16);
405
404
  if (hex === "0") {
406
405
  hex += hex;
407
406
  }
408
407
  strHex += hex;
409
408
  }
410
409
  return strHex;
411
410
  } else {
412
411
  return String(color);
413
412
  }
414
413
  } else {
415
414
  return "";
416
415
  }
417
416
  if (hex) {
418
417
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
419
418
  let color = hex.toLowerCase();
420
419
  if (reg.test(color)) {
421
420
  if (color.length === 4) {
422
421
  let colorNew = "#";
423
422
  for (let i = 1; i < 4; i += 1) {
424
423
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
425
424
  }
426
425
  color = colorNew;
427
426
  }
428
427
  const colorChange: number[] = [];
429
428
  for (let i = 1; i < 7; i += 2) {
430
429
  colorChange.push(parseInt("0x" + color.slice(i, i + 2)));
431
430
  }
432
431
  if (returnList) {
433
432
  return colorChange;
434
433
  } else {
435
434
  return "RGB(" + colorChange.join(",") + ")";
436
435
  }
437
436
  } else {
438
437
  return color;
439
438
  }
440
439
  } else {
441
440
  return "";
442
441
  }
443
442
  n: number,
444
443
  m: number,
445
444
  filterNum: number | undefined = undefined
446
445
  const c = m - n + 1;
447
446
  const res = Math.floor(Math.random() * c + n);
448
447
  if (filterNum && filterNum == res) {
449
448
  console.log("随机数二次开始", res, filterNum);
450
449
  return getRandom(n, m, filterNum);
451
450
  } else {
452
451
  return res;
453
452
  }
454
453
  wqCookieStr: string;
455
454
  wqCookie: {
456
455
  pin?: string;
457
456
  visitkey?: string;
458
457
  [key: string]: any;
459
458
  };
460
459
  const {
461
460
  jdpin,
462
461
  pinStatus,
463
462
  visitkey,
464
463
  unionid,
465
464
  skey,
466
465
  __jda,
467
466
  __jdv,
468
467
  __wga,
469
468
  wid,
470
469
  wq_skey,
471
470
  wq_uin,
472
471
  wq_auth_token,
473
472
  wxapp_scene,
474
473
  wq_unionid,
475
474
  wxapp_openid,
476
475
  wxapp_version,
477
476
  wxapp_type,
478
477
  appType,
479
478
  } = cookie;
480
479
  const ret: string[] = [];
481
480
  const getUserCookieObj = {};
482
481
  const createUseCookieArr = [
483
482
  jdpin,
484
483
  pinStatus,
485
484
  visitkey,
486
485
  unionid,
487
486
  skey,
488
487
  __jda,
489
488
  __jdv,
490
489
  __wga,
491
490
  wid,
492
491
  wq_skey,
493
492
  wq_uin,
494
493
  wq_auth_token,
495
494
  wxapp_scene,
496
495
  wq_unionid,
497
496
  wxapp_openid,
498
497
  wxapp_version,
499
498
  wxapp_type,
500
499
  appType,
501
500
  ];
502
501
  createUseCookieArr.forEach((keyItem) => {
503
502
  if (keyItem && keyItem["name"]) {
504
503
  let { name, value } = keyItem;
505
504
  name = name === "jdpin" ? "pin" : name;
506
505
  name === "pin" && ret.push(`pt_pin=${encodeURIComponent(value)}`);
507
506
  ret.push(`${name}=${encodeURIComponent(value)}`);
508
507
  getUserCookieObj[name] = value;
509
508
  }
510
509
  });
511
510
  return {
512
511
  wqCookieStr: ret.join(";"),
513
512
  wqCookie: getUserCookieObj,
514
513
  };
515
514
  num,
516
515
  widthSize = 375,
517
516
  layoutWidth = windowWidth
518
517
  const getNum = Number(num);
519
518
  return Math.round((getNum / widthSize) * layoutWidth);
520
519
  let checkState = false;
521
520
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag;
522
521
  if (couponFloorModuleType === FloorModuleType.COUPON) {
523
522
  try {
524
523
  const dataDefines = getFloorDataToDataDefines(floorData);
525
524
  const couponDataDefine = dataDefines
526
525
  ? dataDefines.filter((item) => {
527
526
  return item.type === "coupon";
528
527
  })
529
528
  : [],
530
529
  couponList = couponDataDefine[0]?.nodeText?.data
531
530
  ? couponDataDefine[0]?.nodeText?.data
532
531
  : [],
533
532
  couponLength = couponList.length,
534
533
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
535
534
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
536
535
  : 0;
537
536
  if (numShowPerLine === 0 && couponLength > 3) {
538
537
  checkState = true;
539
538
  }
540
539
  } catch (e) {
541
540
  checkState = false;
542
541
  }
543
542
  return checkState;
544
543
  }
545
544
  const {
546
545
  containers = [],
547
546
  floors = [],
548
547
  clearFirstContaierMarginTop = false,
549
548
  isLuxuryShop = false,
550
549
  isShowNativeImmersivePlayer = false,
551
550
  screenHeight = null,
552
551
  screenWidth = null,
553
552
  bottomBarHeight = null,
554
553
  } = pageData;
555
554
  console.log("dealShopContentData:", pageData, "isvdev:", isvdev);
556
555
  const getThisTimeKey = Date.now();
557
556
  let shopContentContainerListData = containers?.filter(
558
557
  (item) => (!isvdev && item.typeCode !== "mShopHeader") || isvdev
559
558
  );
560
559
  const shopContentFloorListData = floors?.filter(
561
560
  ({ floorPosition }) =>
562
561
  (!isvdev && floorPosition !== "header" && floorPosition !== "footer") ||
563
562
  isvdev
564
563
  );
565
564
  const unableIsvContainerListData = getUnableIsvContainerListData(
566
565
  shopContentFloorListData,
567
566
  shopContentContainerListData,
568
567
  exceptionReportFn
569
568
  );
570
569
  shopContentContainerListData.forEach((item, index) => {
571
570
  item.key = `${getThisTimeKey + index}`;
572
571
  item.floors = [];
573
572
  item.includeUids &&
574
573
  item.includeUids.forEach((floorUid) => {
575
574
  const getFloorData = shopContentFloorListData.find(
576
575
  (floorItem) => floorItem.uid === floorUid
577
576
  );
578
577
  if (getFloorData) {
579
578
  const changeFloorData = {
580
579
  containerId: item.containerId,
581
580
  containerIndex: index,
582
581
  ...getFloorData,
583
582
  };
584
583
  const getCheckMoreCouponState =
585
584
  checkCouponAndChangeContainerSetData(getFloorData);
586
585
  if (getCheckMoreCouponState) {
587
586
  item.marginLeft && (item.marginLeft = 0);
588
587
  item.marginRight && (item.marginRight = 0);
589
588
  item.borderRadius && (item.borderRadius = 0);
590
589
  }
591
590
  if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
592
591
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(
593
592
  getFloorData,
594
593
  exceptionReportFn
595
594
  );
596
595
  !getSysFloorToLoadTypeRes &&
597
596
  (getFloorData.floorExtInfo.floorLoadWay = 1);
598
597
  }
599
598
  item.floors.push(changeFloorData);
600
599
  }
601
600
  });
602
601
  if (
603
602
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
604
603
  item?.containerPosition == "content" &&
605
604
  item?.marginBottom > 0 &&
606
605
  !clearFirstContaierMarginTop
607
606
  ) {
608
607
  item.marginTop = item.marginBottom;
609
608
  }
610
609
  });
611
610
  shopContentContainerListData = shopContentContainerListData.filter(
612
611
  (item) =>
613
612
  item.floors.length > 0 &&
614
613
  unableIsvContainerListData.every(
615
614
  (containerItem) => containerItem.containerId != item.containerId
616
615
  )
617
616
  );
618
617
  console.log(
619
618
  "dealShopContentData isWxMinAndWxapp:",
620
619
  isWxMinAndWxapp,
621
620
  "weappJumpToH5:",
622
621
  pageData?.homeExtInfo?.weappJumpToH5
623
622
  );
624
623
  if (isProd && isWxMinAndWxapp) {
625
624
  shopContentContainerListData = shopContentContainerListData.filter(
626
625
  (item) =>
627
626
  item.floors.length > 0 &&
628
627
  !isIsvContainer(
629
628
  item.containerId,
630
629
  shopContentFloorListData,
631
630
  shopContentContainerListData
632
631
  )
633
632
  );
634
633
  }
635
634
  shopContentContainerListData = [].concat(shopContentContainerListData);
636
635
  return {
637
636
  shopContentContainerListData,
638
637
  shopContentFloorListData,
639
638
  };
640
639
  const changeOpts = {
641
640
  title: "",
642
641
  icon: "success",
643
642
  duration: 1500,
644
643
  mask: true,
645
644
  ...options,
646
645
  };
647
646
  if (changeOpts.title.length > 7) {
648
647
  showNormalToast(options);
649
648
  } else {
650
649
  Taro.showToast(changeOpts as any);
651
650
  }
652
651
  const changeOpts = {
653
652
  title: "",
654
653
  icon: "error",
655
654
  duration: 1500,
656
655
  mask: true,
657
656
  ...options,
658
657
  };
659
658
  if (changeOpts.title.length > 7) {
660
659
  showNormalToast(options);
661
660
  } else {
662
661
  Taro.showToast(changeOpts as any);
663
662
  }
664
663
  Taro.showToast({
665
664
  title: "",
666
665
  icon: "none",
667
666
  duration: 1500,
668
667
  mask: true,
669
668
  ...options,
670
669
  });
671
670
  return Taro.showLoading({
672
671
  title: text,
673
672
  });
674
673
  return new Promise(() => {
675
674
  Taro.nextTick(() => {
676
675
  setTimeout(() => {
677
676
  Taro.hideLoading(options);
678
677
  }, 300);
679
678
  });
680
679
  });
681
680
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
682
681
  const {
683
682
  tabActive = SECTION_HOME_TAB_NAME_TYPE[
684
683
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
685
684
  ],
686
685
  sceneId,
687
686
  } = query;
688
687
  let changeTabActive = tabActive;
689
688
  if (sceneId) {
690
689
  if (isH5) {
691
690
  if (sceneId == "1002") {
692
691
  changeTabActive =
693
692
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
694
693
  }
695
694
  else if (sceneId == "1003") {
696
695
  changeTabActive =
697
696
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
698
697
  }
699
698
  } else if (isWxMinAndWxapp) {
700
699
  if (sceneId == "1001" || sceneId == "1002") {
701
700
  changeTabActive =
702
701
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
703
702
  }
704
703
  else if (sceneId == "1003") {
705
704
  changeTabActive =
706
705
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
707
706
  }
708
707
  }
709
708
  }
710
709
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
711
710
  return {
712
711
  menuType: SHOP_MENU_ID_TYPE.HOME,
713
712
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
714
713
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
715
714
  };
716
715
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
717
716
  return {
718
717
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
719
718
  tabActiveType: 0,
720
719
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
721
720
  };
722
721
  } else {
723
722
  return {
724
723
  menuType: SHOP_MENU_ID_TYPE.HOME,
725
724
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
726
725
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
727
726
  };
728
727
  }
729
728
  const deleteKeyList = [
730
729
  "$taroTimestamp",
731
730
  "cookie",
732
731
  "wdref",
733
732
  "navStart",
734
733
  "originOpts",
735
734
  "originParams",
736
735
  "originUrl",
737
736
  "referer",
738
737
  "stamp",
739
738
  ];
740
739
  let changeQueryData: any = { ...queryData };
741
740
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
742
741
  const sceneQuery =
743
742
  qrCodeScene && typeof qrCodeScene == "string"
744
743
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
745
744
  : {};
746
745
  changeQueryData = { ...changeQueryData, ...sceneQuery };
747
746
  deleteKeyList.forEach((key) => {
748
747
  changeQueryData[key] && delete changeQueryData[key];
749
748
  });
750
749
  changeQueryData["shopid"] &&
751
750
  (changeQueryData["shopId"] = changeQueryData["shopid"]) &&
752
751
  delete changeQueryData["shopid"];
753
752
  changeQueryData["venderid"] &&
754
753
  (changeQueryData["venderId"] = changeQueryData["venderid"]) &&
755
754
  delete changeQueryData["venderid"];
756
755
  changeQueryData["vendorId"] &&
757
756
  (changeQueryData["venderId"] = changeQueryData["vendorId"]) &&
758
757
  delete changeQueryData["vendorId"];
759
758
  return changeQueryData;
760
759
  let isUsable = false;
761
760
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
762
761
  const modularPackResultObj = formatPackResult(modularPackResult);
763
762
  const bundleUrl = getBundleUrl(modularPackResultObj);
764
763
  const bundleFileName = getBundleFileName(modularPackResultObj);
765
764
  if (bundleUrl && bundleFileName) {
766
765
  isUsable = true;
767
766
  }
768
767
  if (!isUsable && typeof exceptionReportFn === "function") {
769
768
  exceptionReportFn({
770
769
  code: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${SgmCustomCode.REMOTEMODULE_DATA}`,
771
770
  msg: {
772
771
  msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
773
772
  floorIdx: floorData?.floorIdx,
774
773
  uid: floorData?.uid,
775
774
  shopId: floorData?.floorExtInfo?.shopId,
776
775
  moduleId: floorData?.moduleId,
777
776
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
778
777
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
779
778
  floorKind: floorData?.floorExtInfo?.floorKind,
780
779
  middleTemplateId: floorData?.middleTemplateId,
781
780
  modularPackResult: modularPackResult,
782
781
  },
783
782
  });
784
783
  }
785
784
  return isUsable;
786
785
  const objContainer = containerListData.find(
787
786
  (item) => item.containerId === containerId
788
787
  );
789
788
  return (
790
789
  objContainer?.includeUids?.some((itemUid) => {
791
790
  const objectFloor = floorListData.find(
792
791
  (floorItem) => itemUid === floorItem.uid
793
792
  );
794
793
  return RemoteLoadFloorList.includes(
795
794
  objectFloor?.floorExtInfo?.moduleFlag
796
795
  );
797
796
  }) ?? false
798
797
  );
799
798
  floorListData,
800
799
  containerListData,
801
800
  exceptionReportFn?
802
801
  const unableIsvFloorListData = floorListData.filter(
803
802
  (floorItem) =>
804
803
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
805
804
  !isIsvFloorUseable(floorItem, exceptionReportFn)
806
805
  );
807
806
  const unableIsvFloorUidList = unableIsvFloorListData.map(
808
807
  (floorItem) => floorItem.uid
809
808
  );
810
809
  const unableIsvContainerListData = containerListData.filter(
811
810
  (item) =>
812
811
  item.includeUids &&
813
812
  item.includeUids.every(
814
813
  (itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1
815
814
  )
816
815
  );
817
816
  return unableIsvContainerListData;
818
817
  return -2;
819
818
  return customObj;
820
819
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl);
821
820
  let getParams = false;
822
821
  if (isOpenJdAppUrl(openAppUrl)) {
823
822
  try {
824
823
  getParams = openAppUrl.replace(
825
824
  /openApp\.jdMobile:\/\/virtual\?params=/i,
826
825
  ""
827
826
  );
828
827
  getParams = JSON.parse(String(getParams));
829
828
  } catch (e) {
830
829
  console.log(e);
831
830
  }
832
831
  }
833
832
  return getParams;
834
833
  const getLastParams = Object.assign({}, openParams)
835
834
  return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`;
836
835
  if (val === null || val === "" || typeof val === "undefined") {
837
836
  return true;
838
837
  }
839
838
  return false;
840
839
  const {
841
840
  moduleId = "none",
842
841
  entrance = "none",
843
842
  sourceType = "none",
844
843
  sourceValue = "none",
845
844
  } = params;
846
845
  if (isIosDevice) {
847
846
  return `${moduleId}#${entrance}`;
848
847
  } else if (isAndroidDevice) {
849
848
  return `${sourceType}#${sourceValue}`;
850
849
  }
851
850
  return "none#none";
852
851
  if (data && typeof data === "object") {
853
852
  let getOpenAppData = { ...data };
854
853
  try {
855
854
  const { sourceInfo, designerId, templateId, source } = getOpenAppData;
856
855
  if (designerId && templateId) {
857
856
  getOpenAppData = Object.assign({}, getOpenAppData, {
858
857
  sourceInfo: {
859
858
  entrance: "设计师预览",
860
859
  },
861
860
  });
862
861
  } else if (sourceInfo) {
863
862
  const { entrance } = sourceInfo;
864
863
  getOpenAppData.sourceInfo.entrance =
865
864
  entrance && entrance.length > 0 ? entrance : "其他";
866
865
  } else if (source && !sourceInfo) {
867
866
  if (typeof source === "object") {
868
867
  const { sourceType, entrance, sourceValue, moduleId } = source;
869
868
  getOpenAppData = Object.assign({}, getOpenAppData, {
870
869
  sourceInfo: {
871
870
  entrance: sourceType || entrance || "其他",
872
871
  moduleId: sourceValue || moduleId || "-100",
873
872
  },
874
873
  });
875
874
  } else {
876
875
  getOpenAppData = Object.assign({}, getOpenAppData, {
877
876
  sourceInfo: {
878
877
  entrance: source,
879
878
  },
880
879
  });
881
880
  }
882
881
  } else {
883
882
  getOpenAppData = Object.assign({}, getOpenAppData, {
884
883
  sourceInfo: {
885
884
  entrance: "其他",
886
885
  },
887
886
  });
888
887
  }
889
888
  } catch (e) {
890
889
  console.log(e);
891
890
  }
892
891
  return getOpenAppData;
893
892
  }
894
893
  return data;
895
894
  return displayObj;
896
895
  if (typeof input === "string") {
897
896
  try {
898
897
  return JSON.parse(input);
899
898
  } catch (e) {
900
899
  console.error("JSON解析失败", e);
901
900
  return {};
902
901
  }
903
902
  }
904
903
  return input || {};
905
904
  return false
906
905
  isJdApp,
907
906
  isWxApp,
908
907
  isIosDevice,
909
908
  isAndroidDevice,
910
909
  isJdAndIosDevice,
911
910
  isJdAndAndroidDevice,
912
911
  isWxMin,
913
912
  isWxMinAndWxapp,
914
913
  isJdMin,
915
914
  isMin,
916
915
  isJdMinAndHarmony,
917
916
  isH5,
918
917
  isH5AndJdShopView,
919
918
  isImageOptimizeEnable,
920
919
  isChartH5,
921
920
  isH5AndJdShopViewNativeScroll,
922
921
  isH5AndJdShopViewH5Scroll,
923
922
  isH5AndJdShopH5CustomScrollView,
924
923
  isWxMiniH5View,
925
924
  sliceArrToChunkList,
926
925
  dealAddress,
927
926
  objectToUrlEncode,
928
927
  parseQueryUrlString,
929
928
  setLowSmallPicUrl,
930
929
  getJfsImage,
931
930
  getQualityImage,
932
931
  countStringify,
933
932
  setTaroStorage,
934
933
  getTaroStorageKeyValue,
935
934
  removeTaroStorageKey,
936
935
  clearTaroStorageKey,
937
936
  getSystemInfos,
938
937
  addHttps,
939
938
  dateFormat,
940
939
  throttle,
941
940
  lodashThrottle,
942
941
  debounce,
943
942
  getTelephone,
944
943
  rgbToHex,
945
944
  hexToRgb,
946
945
  getRandom,
947
946
  getWxAppCookieStr,
948
947
  pxTransformFromData,
949
948
  dealShopContentData,
950
949
  showSuccessToast,
951
950
  showFailToast,
952
951
  showNormalToast,
953
952
  showShopLoading,
954
953
  hideShopLoading,
955
954
  getAppChannelType,
956
955
  formatTabActiveMenuType,
957
956
  filterUrlQueryData,
958
957
  getAvifSupport,
959
958
  getWebpSupport,
960
959
  isMemberPage,
961
960
  sgmCustomReport,
962
961
  isOpenJdAppUrl,
963
962
  jdOpenAppParams,
964
963
  createJdOpenAppUrl,
965
964
  dealJdOpenAppData,
966
965
  isEmpty,
967
966
  getJdAppReportPageSource,
968
967
  isAppClassifyPage,
969
968
  getQualityImageNew,
970
969
  getQualityImageOld,
971
970
  isPc,
972
971
  ipLoc_djd,
973
972
  jdAppVersionCompare,
974
973
  dealNativePixelToCssPixel,
975
974
  isAppStowShop,
975
+ import Taro from "@tarojs/taro";
976
976
  SHOP_MENU_ID_TYPE,
977
977
  SHOP_MENU_ID_QUERY_NAME,
978
978
  SECTION_HOME_TAB_TYPE,
979
979
  SECTION_HOME_TAB_NAME_TYPE,
980
980
  SECTION_HOME_TAB_QUERY_TYPE,
981
981
  CHANNEL_TYPE,
982
982
  JDShopViewBusinessPathType,
983
983
  FloorModuleType,
984
984
  RemoteLoadFloorList,
985
985
  FLOOR_KIND
986
986
  getBundleUrl,
987
987
  getBundleFileName,
988
988
  formatPackResult,
989
989
  getTaroVersion,
990
990
  SgmCustomCode,
991
991
  NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG,
992
992
  if(isH5){
993
993
  const avifCache = getTaroStorageKeyValue(KEY_AVIF)
994
994
  if(avifCache === null || avifCache === ''){
995
995
  const img = new Image()
996
996
  img.onload = function() {
997
997
  if (img.height > 0 && img.width > 0) {
998
998
  setTaroStorage(KEY_AVIF, '1')
999
999
  } else {
1000
1000
  setTaroStorage(KEY_AVIF, '0')
1001
1001
  }
1002
1002
  }
1003
1003
  img.onerror = () => {
1004
1004
  setTaroStorage(KEY_AVIF, '0')
1005
1005
  }
1006
1006
  img.src = 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
1007
1007
  }
1008
1008
  const webpCache = getTaroStorageKeyValue(KEY_WEBP)
1009
1009
  if(webpCache === null || webpCache === ''){
1010
1010
  const img = new Image()
1011
1011
  img.onload = function() {
1012
1012
  if (img.height > 0 && img.width > 0) {
1013
1013
  setTaroStorage(KEY_WEBP, '1')
1014
1014
  } else {
1015
1015
  setTaroStorage(KEY_WEBP, '0')
1016
1016
  }
1017
1017
  }
1018
1018
  img.onerror = () => {
1019
1019
  setTaroStorage(KEY_WEBP, '0')
1020
1020
  }
1021
1021
  img.src = 'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA=';
1022
1022
  }
1023
1023
  }
1024
1024
  const resultList: Array<any> = [],
1025
1025
  arrLen = arr.length
1026
1026
  if (arrLen) {
1027
1027
  if (arrLen > size) {
1028
1028
  for (let i = 0; i < arrLen; i = i + size) {
1029
1029
  resultList.push(arr.slice(i, i + size))
1030
1030
  }
1031
1031
  } else {
1032
1032
  resultList.push(arr)
1033
1033
  }
1034
1034
  }
1035
1035
  return resultList
1036
1036
  let _address = ids;
1037
1037
  const _areaAreaSplit = ids.split(".");
1038
1038
  const _areaAreaSplit2 = ids.split("_");
1039
1039
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
1040
1040
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
1041
1041
  return _address;
1042
1042
  let paramStr = "";
1043
1043
  obj &&
1044
1044
  Object.keys(obj).forEach((key, index) => {
1045
1045
  const getValue = `${obj[key]}`
1046
1046
  .replace(/undefined/, "")
1047
1047
  .replace(/null/, "");
1048
1048
  paramStr += `${index === 0 ? "" : "&"}${key}=${encodeURIComponent(
1049
1049
  getValue
1050
1050
  )}`;
1051
1051
  });
1052
1052
  return paramStr;
1053
1053
  const result = {};
1054
1054
  if (
1055
1055
  !urlOrQueryStr ||
1056
1056
  ("string" !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
1057
1057
  ) {
1058
1058
  return result;
1059
1059
  }
1060
1060
  if (urlOrQueryStr.indexOf("?") > -1) {
1061
1061
  const queryStr = urlOrQueryStr.split("?");
1062
1062
  const queryItemList =
1063
1063
  queryStr && queryStr.length > 1 ? queryStr[1].split("&") : [];
1064
1064
  const queryItemListLen = queryItemList.length;
1065
1065
  queryItemListLen > 0 &&
1066
1066
  queryItemList.forEach((item) => {
1067
1067
  const thisItemList = item.split("=");
1068
1068
  result[thisItemList[0]] = thisItemList[1];
1069
1069
  });
1070
1070
  } else {
1071
1071
  const queryItemList =
1072
1072
  urlOrQueryStr.indexOf("&") > -1
1073
1073
  ? urlOrQueryStr.split("&")
1074
1074
  : [urlOrQueryStr];
1075
1075
  const queryItemListLen = queryItemList.length;
1076
1076
  queryItemListLen > 0 &&
1077
1077
  queryItemList.forEach((item) => {
1078
1078
  const thisItemList = item.split("=");
1079
1079
  result[thisItemList[0]] = thisItemList[1];
1080
1080
  });
1081
1081
  }
1082
1082
  return result;
1083
1083
  url: string,
1084
1084
  size?: {
1085
1085
  w: number;
1086
1086
  h: number;
1087
1087
  },
1088
1088
  quality?: number
1089
1089
  if (url && size) {
1090
1090
  const _w = Math.floor(size.w);
1091
1091
  const _h = Math.floor(size.h);
1092
1092
  if (url.match(/gif$/i)) {
1093
1093
  return url;
1094
1094
  } else {
1095
1095
  if (_w > 0 && _h > 0) {
1096
1096
  url = url.replace("jfs/", `s${_w}x${_h}_jfs/`);
1097
1097
  }
1098
1098
  url += quality != null ? `!q${quality}.dpg` : ".dpg";
1099
1099
  }
1100
1100
  }
1101
1101
  return url;
1102
1102
  url: string,
1103
1103
  jfsImgInfo: UtilsInterFace.getJfsImageInfo = {}
1104
1104
  if (url.match(/\.(jpg|png|dpg)$/i)) {
1105
1105
  const { width, height, quality } = jfsImgInfo;
1106
1106
  if (typeof width === "number" || typeof height === "number") {
1107
1107
  url = url.replace(
1108
1108
  "/jfs/",
1109
1109
  `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`
1110
1110
  );
1111
1111
  }
1112
1112
  if (
1113
1113
  typeof quality === "number" &&
1114
1114
  quality > 0 &&
1115
1115
  quality < 100 &&
1116
1116
  url.match(/\.jpg$/i)
1117
1117
  ) {
1118
1118
  url += `!q${quality}.dpg`;
1119
1119
  }
1120
1120
  }
1121
1121
  return addHttps(url);
1122
1122
  if (imgUrl) {
1123
1123
  if (
1124
1124
  !imgUrl.match(
1125
1125
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i
1126
1126
  )
1127
1127
  ) {
1128
1128
  if (!imgUrl.includes("360buyimg.com")) {
1129
1129
  imgUrl = "//m.360buyimg.com/cms/" + imgUrl;
1130
1130
  }
1131
1131
  if (quality != 100)
1132
1132
  imgUrl += /\.png/.test(imgUrl) ? ".dpg" : `!q${quality}`;
1133
1133
  }
1134
1134
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
1135
1135
  }
1136
1136
  return imgUrl;
1137
1137
  const result = value % step
1138
1138
  return result === 0? value: (Math.ceil(value / step) * step)
1139
1139
  const MAX = 3.5
1140
1140
  return Math.min(window?.devicePixelRatio ?? 2, MAX)
1141
1141
  isSkuImage: boolean,
1142
1142
  size: number
1143
1143
  if (!imgUrl) {
1144
1144
  console.error('The input parameter imageUrl for the getQualityImage() cannot be empty!')
1145
1145
  return imgUrl
1146
1146
  }
1147
1147
  if(isIgnoreOptimizeFromServer){
1148
1148
  imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1')
1149
1149
  }
1150
1150
  if(!/^((https?):)?\/\//.test(imgUrl)){
1151
1151
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
1152
1152
  }
1153
1153
  const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i
1154
1154
  if (!imgServerRegExp.test(imgUrl)) {
1155
1155
  return imgUrl
1156
1156
  }
1157
1157
  const {isSkuImage, size} = options || {}
1158
1158
  const needReduceSize = isSkuImage && size
1159
1159
  if (needReduceSize){
1160
1160
  const devicePixelRatio = getDevicePixelRatio()
1161
1161
  const useWidth = getValueByStep(size * devicePixelRatio, 40)
1162
1162
  imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useWidth}_jfs/`)
1163
1163
  }
1164
1164
  const needCompress = !global?.info?.pageInfo?.isVipShop
1165
1165
  const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/)
1166
1166
  if(needCompress && result){
1167
1167
  if(getAvifSupport() === '1'){
1168
1168
  imgUrl += '.avif'
1169
1169
  }else if(getWebpSupport() === '1'){
1170
1170
  imgUrl += '.webp'
1171
1171
  }else if(/jpe?g/.test(result[1])){
1172
1172
  imgUrl += '!q80'
1173
1173
  }
1174
1174
  }
1175
1175
  if (needReduceSize){
1176
1176
  imgUrl += '!z2'
1177
1177
  }
1178
1178
  if(!imgUrl.includes('360buyimg.com')){
1179
1179
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
1180
1180
  }
1181
1181
  if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
1182
1182
  return getTaroStorageKeyValue(KEY_AVIF) || '0'
1183
1183
  return getTaroStorageKeyValue(KEY_WEBP) || '0'
1184
1184
  count: number,
1185
1185
  fixedNum = 1,
1186
1186
  unit = "万",
1187
1187
  maxNum = 10000
1188
1188
  count = Number(count);
1189
1189
  const getMaxNum = count > 100000000 ? 100000000 : maxNum
1190
1190
  const getUnit = count > 100000000 ? '亿' : unit
1191
1191
  if (count >= getMaxNum) {
1192
1192
  return (count / getMaxNum).toFixed(fixedNum) + getUnit;
1193
1193
  }
1194
1194
  return count;
1195
1195
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
1196
1196
  platform: "",
1197
1197
  model: "",
1198
1198
  system: "",
1199
1199
  };
1200
1200
  const isIOS = !!systemInfo.system.match(/ios/i);
1201
1201
  const isAndroid = !!systemInfo.system.match(/android/i);
1202
1202
  if (!systemInfo.statusBarHeight) {
1203
1203
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20;
1204
1204
  systemInfo.navBarExtendHeight = 0;
1205
1205
  } else {
1206
1206
  if (isIOS) {
1207
1207
  systemInfo.navBarExtendHeight = 4;
1208
1208
  } else {
1209
1209
  systemInfo.navBarExtendHeight = 0;
1210
1210
  }
1211
1211
  }
1212
1212
  let rect = Taro.getMenuButtonBoundingClientRect
1213
1213
  ? Taro.getMenuButtonBoundingClientRect()
1214
1214
  : null;
1215
1215
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
1216
1216
  let gap = 0;
1217
1217
  let width = 96;
1218
1218
  if (systemInfo.platform === "android") {
1219
1219
  gap = 8;
1220
1220
  width = 96;
1221
1221
  } else if (systemInfo.platform === "devtools") {
1222
1222
  if (isIOS) {
1223
1223
  gap = 5.5;
1224
1224
  } else {
1225
1225
  gap = 7.5;
1226
1226
  }
1227
1227
  } else {
1228
1228
  gap = 4;
1229
1229
  width = 88;
1230
1230
  }
1231
1231
  rect = {
1232
1232
  bottom: systemInfo.statusBarHeight + gap + 32,
1233
1233
  height: 32,
1234
1234
  left: systemInfo.windowWidth - width - 10,
1235
1235
  right: systemInfo.windowWidth - 10,
1236
1236
  top: systemInfo.statusBarHeight + gap,
1237
1237
  width,
1238
1238
  };
1239
1239
  }
1240
1240
  const gap = rect.top - systemInfo.statusBarHeight;
1241
1241
  systemInfo.navBarTopToStatusBar = gap;
1242
1242
  systemInfo.navBarHeight = 2 * gap + rect.height;
1243
1243
  systemInfo.capsulePosition = rect;
1244
1244
  systemInfo.isIOS = isIOS;
1245
1245
  systemInfo.isAndroid = isAndroid;
1246
1246
  return systemInfo;
1247
1247
  if (str.match(/^\/\//)) {
1248
1248
  str = "https:" + str;
1249
1249
  }
1250
1250
  return str;
1251
1251
  dateTimeOrdate: Date | string | number | null,
1252
1252
  format = "yyyy-MM-dd HH:mm:ss",
1253
1253
  noPadStart = {
1254
1254
  M: "0",
1255
1255
  d: "0",
1256
1256
  H: "0",
1257
1257
  m: "0",
1258
1258
  s: "0",
1259
1259
  }
1260
1260
  let dateResult = "";
1261
1261
  const padStarts = Object.assign(
1262
1262
  {
1263
1263
  M: "0",
1264
1264
  d: "0",
1265
1265
  H: "0",
1266
1266
  m: "0",
1267
1267
  s: "0",
1268
1268
  },
1269
1269
  noPadStart
1270
1270
  );
1271
1271
  if (dateTimeOrdate) {
1272
1272
  let changeDateTimeOrdate = dateTimeOrdate;
1273
1273
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
1274
1274
  if (getChangeDateTimeToNumber) {
1275
1275
  changeDateTimeOrdate = getChangeDateTimeToNumber;
1276
1276
  } else {
1277
1277
  changeDateTimeOrdate = `${changeDateTimeOrdate}`
1278
1278
  .replace(/-/g, "/")
1279
1279
  .replace(/\./g, "/");
1280
1280
  }
1281
1281
  const nowDate =
1282
1282
  dateTimeOrdate instanceof Date
1283
1283
  ? dateTimeOrdate
1284
1284
  : new Date(changeDateTimeOrdate);
1285
1285
  const dateMap = {
1286
1286
  y: `${nowDate.getFullYear()}`,
1287
1287
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts["M"]),
1288
1288
  d: `${nowDate.getDate()}`.padStart(2, padStarts["d"]),
1289
1289
  H: `${nowDate.getHours()}`.padStart(2, padStarts["H"]),
1290
1290
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts["m"]),
1291
1291
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts["s"]),
1292
1292
  };
1293
1293
  const regDate = new RegExp("y+|M+|d+|H+|m+|s+", "g");
1294
1294
  const regYear = new RegExp("y");
1295
1295
  dateResult = format.replace(regDate, (v) => {
1296
1296
  let changeValue = v;
1297
1297
  if (regYear.test(changeValue)) {
1298
1298
  const thisYear = dateMap.y;
1299
1299
  const subValueLen = 4 - changeValue.length;
1300
1300
  changeValue = thisYear.substr(subValueLen);
1301
1301
  } else {
1302
1302
  const dateKey = v.substr(0, 1);
1303
1303
  changeValue = dateMap[dateKey];
1304
1304
  }
1305
1305
  return changeValue;
1306
1306
  });
1307
1307
  }
1308
1308
  return dateResult;
1309
1309
  let timer: any = null;
1310
1310
  let startTime = Date.now();
1311
1311
  return function () {
1312
1312
  const curTime = Date.now();
1313
1313
  const remaining = delay - (curTime - startTime);
1314
1314
  const context = this;
1315
1315
  const args = arguments;
1316
1316
  clearTimeout(timer);
1317
1317
  if (remaining <= 0) {
1318
1318
  func.apply(context, args);
1319
1319
  startTime = Date.now();
1320
1320
  } else {
1321
1321
  timer = setTimeout(func, remaining);
1322
1322
  }
1323
1323
  };
1324
1324
  let context, args, result;
1325
1325
  let timeout = null;
1326
1326
  let previous = 0;
1327
1327
  if (!options) options = {};
1328
1328
  const later = function () {
1329
1329
  previous = options.leading === false ? 0 : Date.now();
1330
1330
  timeout = null;
1331
1331
  result = func.apply(context, args);
1332
1332
  if (!timeout) context = args = null;
1333
1333
  };
1334
1334
  return function () {
1335
1335
  const now = Date.now();
1336
1336
  if (!previous && options.leading === false) previous = now;
1337
1337
  const remaining = wait - (now - previous);
1338
1338
  context = this;
1339
1339
  args = arguments;
1340
1340
  if (remaining <= 0 || remaining > wait) {
1341
1341
  if (timeout) {
1342
1342
  clearTimeout(timeout);
1343
1343
  timeout = null;
1344
1344
  }
1345
1345
  previous = now;
1346
1346
  result = func.apply(context, args);
1347
1347
  if (!timeout) context = args = null;
1348
1348
  } else if (!timeout && options.trailing !== false) {
1349
1349
  timeout = setTimeout(later, remaining);
1350
1350
  }
1351
1351
  return result;
1352
1352
  };
1353
1353
  let timer: any = null;
1354
1354
  return function () {
1355
1355
  const context: any = this;
1356
1356
  const args = arguments;
1357
1357
  timer && clearTimeout(timer);
1358
1358
  timer = setTimeout(function () {
1359
1359
  fn.apply(context, args);
1360
1360
  }, delay);
1361
1361
  };
1362
1362
  if (txt) {
1363
1363
  txt = txt.trim();
1364
1364
  const reg = new RegExp(/[\d-]+/);
1365
1365
  const res = reg.exec(txt);
1366
1366
  if (res && res.length > 0) {
1367
1367
  let tel = res[0];
1368
1368
  if (tel && delSeparator) {
1369
1369
  tel = tel.replace(/-/g, "");
1370
1370
  }
1371
1371
  return tel;
1372
1372
  }
1373
1373
  }
1374
1374
  return "";
1375
1375
  if (rgb) {
1376
1376
  const reg = /^(rgb|RGB)/;
1377
1377
  const color = rgb;
1378
1378
  if (reg.test(color)) {
1379
1379
  let strHex = "#";
1380
1380
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
1381
1381
  for (let i = 0; i < colorArr.length; i++) {
1382
1382
  let hex = Number(colorArr[i]).toString(16);
1383
1383
  if (hex === "0") {
1384
1384
  hex += hex;
1385
1385
  }
1386
1386
  strHex += hex;
1387
1387
  }
1388
1388
  return strHex;
1389
1389
  } else {
1390
1390
  return String(color);
1391
1391
  }
1392
1392
  } else {
1393
1393
  return "";
1394
1394
  }
1395
1395
  if (hex) {
1396
1396
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
1397
1397
  let color = hex.toLowerCase();
1398
1398
  if (reg.test(color)) {
1399
1399
  if (color.length === 4) {
1400
1400
  let colorNew = "#";
1401
1401
  for (let i = 1; i < 4; i += 1) {
1402
1402
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
1403
1403
  }
1404
1404
  color = colorNew;
1405
1405
  }
1406
1406
  const colorChange: number[] = [];
1407
1407
  for (let i = 1; i < 7; i += 2) {
1408
1408
  colorChange.push(parseInt("0x" + color.slice(i, i + 2)));
1409
1409
  }
1410
1410
  if (returnList) {
1411
1411
  return colorChange;
1412
1412
  } else {
1413
1413
  return "RGB(" + colorChange.join(",") + ")";
1414
1414
  }
1415
1415
  } else {
1416
1416
  return color;
1417
1417
  }
1418
1418
  } else {
1419
1419
  return "";
1420
1420
  }
1421
1421
  n: number,
1422
1422
  m: number,
1423
1423
  filterNum: number | undefined = undefined
1424
1424
  const c = m - n + 1;
1425
1425
  const res = Math.floor(Math.random() * c + n);
1426
1426
  if (filterNum && filterNum == res) {
1427
1427
  console.log("随机数二次开始", res, filterNum);
1428
1428
  return getRandom(n, m, filterNum);
1429
1429
  } else {
1430
1430
  return res;
1431
1431
  }
1432
1432
  wqCookieStr: string;
1433
1433
  wqCookie: {
1434
1434
  pin?: string;
1435
1435
  visitkey?: string;
1436
1436
  [key: string]: any;
1437
1437
  };
1438
1438
  const {
1439
1439
  jdpin,
1440
1440
  pinStatus,
1441
1441
  visitkey,
1442
1442
  unionid,
1443
1443
  skey,
1444
1444
  __jda,
1445
1445
  __jdv,
1446
1446
  __wga,
1447
1447
  wid,
1448
1448
  wq_skey,
1449
1449
  wq_uin,
1450
1450
  wq_auth_token,
1451
1451
  wxapp_scene,
1452
1452
  wq_unionid,
1453
1453
  wxapp_openid,
1454
1454
  wxapp_version,
1455
1455
  wxapp_type,
1456
1456
  appType,
1457
1457
  } = cookie;
1458
1458
  const ret: string[] = [];
1459
1459
  const getUserCookieObj = {};
1460
1460
  const createUseCookieArr = [
1461
1461
  jdpin,
1462
1462
  pinStatus,
1463
1463
  visitkey,
1464
1464
  unionid,
1465
1465
  skey,
1466
1466
  __jda,
1467
1467
  __jdv,
1468
1468
  __wga,
1469
1469
  wid,
1470
1470
  wq_skey,
1471
1471
  wq_uin,
1472
1472
  wq_auth_token,
1473
1473
  wxapp_scene,
1474
1474
  wq_unionid,
1475
1475
  wxapp_openid,
1476
1476
  wxapp_version,
1477
1477
  wxapp_type,
1478
1478
  appType,
1479
1479
  ];
1480
1480
  createUseCookieArr.forEach((keyItem) => {
1481
1481
  if (keyItem && keyItem["name"]) {
1482
1482
  let { name, value } = keyItem;
1483
1483
  name = name === "jdpin" ? "pin" : name;
1484
1484
  name === "pin" && ret.push(`pt_pin=${encodeURIComponent(value)}`);
1485
1485
  ret.push(`${name}=${encodeURIComponent(value)}`);
1486
1486
  getUserCookieObj[name] = value;
1487
1487
  }
1488
1488
  });
1489
1489
  return {
1490
1490
  wqCookieStr: ret.join(";"),
1491
1491
  wqCookie: getUserCookieObj,
1492
1492
  };
1493
1493
  num,
1494
1494
  widthSize = 375,
1495
1495
  layoutWidth = windowWidth
1496
1496
  const getNum = Number(num);
1497
1497
  return Math.round((getNum / widthSize) * layoutWidth);
1498
1498
  let checkState = false;
1499
1499
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag;
1500
1500
  if (couponFloorModuleType === FloorModuleType.COUPON) {
1501
1501
  try {
1502
1502
  const dataDefines = getFloorDataToDataDefines(floorData);
1503
1503
  const couponDataDefine = dataDefines
1504
1504
  ? dataDefines.filter((item) => {
1505
1505
  return item.type === "coupon";
1506
1506
  })
1507
1507
  : [],
1508
1508
  couponList = couponDataDefine[0]?.nodeText?.data
1509
1509
  ? couponDataDefine[0]?.nodeText?.data
1510
1510
  : [],
1511
1511
  couponLength = couponList.length,
1512
1512
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
1513
1513
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
1514
1514
  : 0;
1515
1515
  if (numShowPerLine === 0 && couponLength > 3) {
1516
1516
  checkState = true;
1517
1517
  }
1518
1518
  } catch (e) {
1519
1519
  checkState = false;
1520
1520
  }
1521
1521
  return checkState;
1522
1522
  }
1523
1523
  const {
1524
1524
  containers = [],
1525
1525
  floors = [],
1526
1526
  clearFirstContaierMarginTop = false,
1527
1527
  } = pageData;
1528
1528
  console.log("dealShopContentData:", pageData, "isvdev:", isvdev);
1529
1529
  const getThisTimeKey = Date.now();
1530
1530
  let shopContentContainerListData = containers?.filter(
1531
1531
  (item) => (!isvdev && item.typeCode !== "mShopHeader") || isvdev
1532
1532
  );
1533
1533
  const shopContentFloorListData = floors?.filter(
1534
1534
  ({ floorPosition }) =>
1535
1535
  (!isvdev && floorPosition !== "header" && floorPosition !== "footer") ||
1536
1536
  isvdev
1537
1537
  );
1538
1538
  const unableIsvContainerListData = getUnableIsvContainerListData(
1539
1539
  shopContentFloorListData,
1540
1540
  shopContentContainerListData,
1541
1541
  exceptionReportFn
1542
1542
  );
1543
1543
  shopContentContainerListData.forEach((item, index) => {
1544
1544
  item.key = `${getThisTimeKey + index}`;
1545
1545
  item.floors = [];
1546
1546
  item.includeUids &&
1547
1547
  item.includeUids.forEach((floorUid) => {
1548
1548
  const getFloorData = shopContentFloorListData.find(
1549
1549
  (floorItem) => floorItem.uid === floorUid
1550
1550
  );
1551
1551
  if (getFloorData) {
1552
1552
  const changeFloorData = {
1553
1553
  containerId: item.containerId,
1554
1554
  containerIndex: index,
1555
1555
  ...getFloorData,
1556
1556
  };
1557
1557
  const getCheckMoreCouponState =
1558
1558
  checkCouponAndChangeContainerSetData(getFloorData);
1559
1559
  if (getCheckMoreCouponState) {
1560
1560
  item.marginLeft && (item.marginLeft = 0);
1561
1561
  item.marginRight && (item.marginRight = 0);
1562
1562
  item.borderRadius && (item.borderRadius = 0);
1563
1563
  }
1564
1564
  if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
1565
1565
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(
1566
1566
  getFloorData,
1567
1567
  exceptionReportFn
1568
1568
  );
1569
1569
  !getSysFloorToLoadTypeRes &&
1570
1570
  (getFloorData.floorExtInfo.floorLoadWay = 1);
1571
1571
  }
1572
1572
  item.floors.push(changeFloorData);
1573
1573
  }
1574
1574
  });
1575
1575
  if (
1576
1576
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
1577
1577
  item?.containerPosition == "content" &&
1578
1578
  item?.marginBottom > 0 &&
1579
1579
  !clearFirstContaierMarginTop
1580
1580
  ) {
1581
1581
  item.marginTop = item.marginBottom;
1582
1582
  }
1583
1583
  });
1584
1584
  shopContentContainerListData = shopContentContainerListData.filter(
1585
1585
  (item) =>
1586
1586
  item.floors.length > 0 &&
1587
1587
  unableIsvContainerListData.every(
1588
1588
  (containerItem) => containerItem.containerId != item.containerId
1589
1589
  )
1590
1590
  );
1591
1591
  console.log(
1592
1592
  "dealShopContentData isWxMinAndWxapp:",
1593
1593
  isWxMinAndWxapp,
1594
1594
  "weappJumpToH5:",
1595
1595
  pageData?.homeExtInfo?.weappJumpToH5
1596
1596
  );
1597
1597
  if (isProd && isWxMinAndWxapp) {
1598
1598
  shopContentContainerListData = shopContentContainerListData.filter(
1599
1599
  (item) =>
1600
1600
  item.floors.length > 0 &&
1601
1601
  !isIsvContainer(
1602
1602
  item.containerId,
1603
1603
  shopContentFloorListData,
1604
1604
  shopContentContainerListData
1605
1605
  )
1606
1606
  );
1607
1607
  }
1608
1608
  shopContentContainerListData = [].concat(shopContentContainerListData);
1609
1609
  return {
1610
1610
  shopContentContainerListData,
1611
1611
  shopContentFloorListData,
1612
1612
  };
1613
1613
  const changeOpts = {
1614
1614
  title: "",
1615
1615
  icon: "success",
1616
1616
  duration: 1500,
1617
1617
  mask: true,
1618
1618
  ...options,
1619
1619
  };
1620
1620
  if (changeOpts.title.length > 7) {
1621
1621
  showNormalToast(options);
1622
1622
  } else {
1623
1623
  Taro.showToast(changeOpts as any);
1624
1624
  }
1625
1625
  const changeOpts = {
1626
1626
  title: "",
1627
1627
  icon: "error",
1628
1628
  duration: 1500,
1629
1629
  mask: true,
1630
1630
  ...options,
1631
1631
  };
1632
1632
  if (changeOpts.title.length > 7) {
1633
1633
  showNormalToast(options);
1634
1634
  } else {
1635
1635
  Taro.showToast(changeOpts as any);
1636
1636
  }
1637
1637
  Taro.showToast({
1638
1638
  title: "",
1639
1639
  icon: "none",
1640
1640
  duration: 1500,
1641
1641
  mask: true,
1642
1642
  ...options,
1643
1643
  });
1644
1644
  return Taro.showLoading({
1645
1645
  title: text,
1646
1646
  });
1647
1647
  return new Promise(() => {
1648
1648
  Taro.nextTick(() => {
1649
1649
  setTimeout(() => {
1650
1650
  Taro.hideLoading(options);
1651
1651
  }, 300);
1652
1652
  });
1653
1653
  });
1654
1654
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
1655
1655
  const {
1656
1656
  tabActive = SECTION_HOME_TAB_NAME_TYPE[
1657
1657
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
1658
1658
  ],
1659
1659
  sceneId,
1660
1660
  } = query;
1661
1661
  let changeTabActive = tabActive;
1662
1662
  if (sceneId) {
1663
1663
  if (isH5) {
1664
1664
  if (sceneId == "1002") {
1665
1665
  changeTabActive =
1666
1666
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1667
1667
  }
1668
1668
  else if (sceneId == "1003") {
1669
1669
  changeTabActive =
1670
1670
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
1671
1671
  }
1672
1672
  } else if (isWxMinAndWxapp) {
1673
1673
  if (sceneId == "1001" || sceneId == "1002") {
1674
1674
  changeTabActive =
1675
1675
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1676
1676
  }
1677
1677
  else if (sceneId == "1003") {
1678
1678
  changeTabActive =
1679
1679
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
1680
1680
  }
1681
1681
  }
1682
1682
  }
1683
1683
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
1684
1684
  return {
1685
1685
  menuType: SHOP_MENU_ID_TYPE.HOME,
1686
1686
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
1687
1687
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
1688
1688
  };
1689
1689
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
1690
1690
  return {
1691
1691
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
1692
1692
  tabActiveType: 0,
1693
1693
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
1694
1694
  };
1695
1695
  } else {
1696
1696
  return {
1697
1697
  menuType: SHOP_MENU_ID_TYPE.HOME,
1698
1698
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
1699
1699
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
1700
1700
  };
1701
1701
  }
1702
1702
  const deleteKeyList = [
1703
1703
  "$taroTimestamp",
1704
1704
  "cookie",
1705
1705
  "wdref",
1706
1706
  "navStart",
1707
1707
  "originOpts",
1708
1708
  "originParams",
1709
1709
  "originUrl",
1710
1710
  "referer",
1711
1711
  "stamp",
1712
1712
  ];
1713
1713
  let changeQueryData: any = { ...queryData };
1714
1714
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
1715
1715
  const sceneQuery =
1716
1716
  qrCodeScene && typeof qrCodeScene == "string"
1717
1717
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
1718
1718
  : {};
1719
1719
  changeQueryData = { ...changeQueryData, ...sceneQuery };
1720
1720
  deleteKeyList.forEach((key) => {
1721
1721
  changeQueryData[key] && delete changeQueryData[key];
1722
1722
  });
1723
1723
  changeQueryData["shopid"] &&
1724
1724
  (changeQueryData["shopId"] = changeQueryData["shopid"]) &&
1725
1725
  delete changeQueryData["shopid"];
1726
1726
  changeQueryData["venderid"] &&
1727
1727
  (changeQueryData["venderId"] = changeQueryData["venderid"]) &&
1728
1728
  delete changeQueryData["venderid"];
1729
1729
  changeQueryData["vendorId"] &&
1730
1730
  (changeQueryData["venderId"] = changeQueryData["vendorId"]) &&
1731
1731
  delete changeQueryData["vendorId"];
1732
1732
  return changeQueryData;
1733
1733
  let isUsable = false;
1734
1734
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
1735
1735
  const modularPackResultObj = formatPackResult(modularPackResult);
1736
1736
  const bundleUrl = getBundleUrl(modularPackResultObj);
1737
1737
  const bundleFileName = getBundleFileName(modularPackResultObj);
1738
1738
  const taroVersion = getTaroVersion(modularPackResultObj)
1739
1739
  if (bundleUrl && bundleFileName) {
1740
1740
  isUsable = true;
1741
1741
  }
1742
1742
  if (!isUsable && typeof exceptionReportFn === "function") {
1743
1743
  exceptionReportFn({
1744
1744
  code: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${
1745
1745
  floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE
1746
1746
  ? SgmCustomCode.SYSTEMPDCMODULE_DATA
1747
1747
  : SgmCustomCode.REMOTEMODULE_DATA
1748
1748
  }`,
1749
1749
  msg: {
1750
1750
  msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
1751
1751
  floorIdx: floorData?.floorIdx,
1752
1752
  uid: floorData?.uid,
1753
1753
  shopId: floorData?.floorExtInfo?.shopId,
1754
1754
  moduleId: floorData?.moduleId,
1755
1755
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
1756
1756
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
1757
1757
  floorKind: floorData?.floorExtInfo?.floorKind,
1758
1758
  middleTemplateId: floorData?.middleTemplateId,
1759
1759
  modularPackResult: {
1760
1760
  bundleUrl,
1761
1761
  taroVersion,
1762
1762
  },
1763
1763
  },
1764
1764
  })
1765
1765
  }
1766
1766
  return isUsable;
1767
1767
  const objContainer = containerListData.find(
1768
1768
  (item) => item.containerId === containerId
1769
1769
  );
1770
1770
  return (
1771
1771
  objContainer?.includeUids?.some((itemUid) => {
1772
1772
  const objectFloor = floorListData.find(
1773
1773
  (floorItem) => itemUid === floorItem.uid
1774
1774
  );
1775
1775
  return RemoteLoadFloorList.includes(
1776
1776
  objectFloor?.floorExtInfo?.moduleFlag
1777
1777
  );
1778
1778
  }) ?? false
1779
1779
  );
1780
1780
  floorListData,
1781
1781
  containerListData,
1782
1782
  exceptionReportFn?
1783
1783
  const unableIsvFloorListData = floorListData.filter(
1784
1784
  (floorItem) =>
1785
1785
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
1786
1786
  !isIsvFloorUseable(floorItem, exceptionReportFn)
1787
1787
  );
1788
1788
  const unableIsvFloorUidList = unableIsvFloorListData.map(
1789
1789
  (floorItem) => floorItem.uid
1790
1790
  );
1791
1791
  const unableIsvContainerListData = containerListData.filter(
1792
1792
  (item) =>
1793
1793
  item.includeUids &&
1794
1794
  item.includeUids.every(
1795
1795
  (itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1
1796
1796
  )
1797
1797
  );
1798
1798
  return unableIsvContainerListData;
1799
1799
  return -2;
1800
1800
  return customObj;
1801
1801
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl);
1802
1802
  let getParams = false;
1803
1803
  if (isOpenJdAppUrl(openAppUrl)) {
1804
1804
  try {
1805
1805
  getParams = openAppUrl.replace(
1806
1806
  /openApp\.jdMobile:\/\/virtual\?params=/i,
1807
1807
  ""
1808
1808
  );
1809
1809
  getParams = JSON.parse(String(getParams));
1810
1810
  } catch (e) {
1811
1811
  console.log(e);
1812
1812
  }
1813
1813
  }
1814
1814
  return getParams;
1815
1815
  const getLastParams = Object.assign({}, openParams)
1816
1816
  return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`;
1817
1817
  if (val === null || val === "" || typeof val === "undefined") {
1818
1818
  return true;
1819
1819
  }
1820
1820
  return false;
1821
1821
  const {
1822
1822
  moduleId = "none",
1823
1823
  entrance = "none",
1824
1824
  sourceType = "none",
1825
1825
  sourceValue = "none",
1826
1826
  } = params;
1827
1827
  if (isIosDevice) {
1828
1828
  return `${moduleId}#${entrance}`;
1829
1829
  } else if (isAndroidDevice) {
1830
1830
  return `${sourceType}#${sourceValue}`;
1831
1831
  }
1832
1832
  return "none#none";
1833
1833
  if (data && typeof data === "object") {
1834
1834
  let getOpenAppData = { ...data };
1835
1835
  try {
1836
1836
  const { sourceInfo, designerId, templateId, source } = getOpenAppData;
1837
1837
  if (designerId && templateId) {
1838
1838
  getOpenAppData = Object.assign({}, getOpenAppData, {
1839
1839
  sourceInfo: {
1840
1840
  entrance: "设计师预览",
1841
1841
  },
1842
1842
  });
1843
1843
  } else if (sourceInfo) {
1844
1844
  const { entrance } = sourceInfo;
1845
1845
  getOpenAppData.sourceInfo.entrance =
1846
1846
  entrance && entrance.length > 0 ? entrance : "其他";
1847
1847
  } else if (source && !sourceInfo) {
1848
1848
  if (typeof source === "object") {
1849
1849
  const { sourceType, entrance, sourceValue, moduleId } = source;
1850
1850
  getOpenAppData = Object.assign({}, getOpenAppData, {
1851
1851
  sourceInfo: {
1852
1852
  entrance: sourceType || entrance || "其他",
1853
1853
  moduleId: sourceValue || moduleId || "-100",
1854
1854
  },
1855
1855
  });
1856
1856
  } else {
1857
1857
  getOpenAppData = Object.assign({}, getOpenAppData, {
1858
1858
  sourceInfo: {
1859
1859
  entrance: source,
1860
1860
  },
1861
1861
  });
1862
1862
  }
1863
1863
  } else {
1864
1864
  getOpenAppData = Object.assign({}, getOpenAppData, {
1865
1865
  sourceInfo: {
1866
1866
  entrance: "其他",
1867
1867
  },
1868
1868
  });
1869
1869
  }
1870
1870
  } catch (e) {
1871
1871
  console.log(e);
1872
1872
  }
1873
1873
  return getOpenAppData;
1874
1874
  }
1875
1875
  return data;
1876
1876
  return displayObj;
1877
1877
  if (typeof input === "string") {
1878
1878
  try {
1879
1879
  return JSON.parse(input);
1880
1880
  } catch (e) {
1881
1881
  console.error("JSON解析失败", e);
1882
1882
  return {};
1883
1883
  }
1884
1884
  }
1885
1885
  return input || {};
1886
1886
  return false
1887
1887
  isJdApp,
1888
1888
  isWxApp,
1889
1889
  isIosDevice,
1890
1890
  isAndroidDevice,
1891
1891
  isJdAndIosDevice,
1892
1892
  isJdAndAndroidDevice,
1893
1893
  isWxMin,
1894
1894
  isWxMinAndWxapp,
1895
1895
  isJdMin,
1896
1896
  isMin,
1897
1897
  isJdMinAndHarmony,
1898
1898
  isH5,
1899
1899
  isH5AndJdShopView,
1900
1900
  isImageOptimizeEnable,
1901
1901
  isChartH5,
1902
1902
  isH5AndJdShopViewNativeScroll,
1903
1903
  isH5AndJdShopViewH5Scroll,
1904
1904
  isH5AndJdShopH5CustomScrollView,
1905
1905
  isWxMiniH5View,
1906
1906
  sliceArrToChunkList,
1907
1907
  dealAddress,
1908
1908
  objectToUrlEncode,
1909
1909
  parseQueryUrlString,
1910
1910
  setLowSmallPicUrl,
1911
1911
  getJfsImage,
1912
1912
  getQualityImage,
1913
1913
  countStringify,
1914
1914
  setTaroStorage,
1915
1915
  getTaroStorageKeyValue,
1916
1916
  removeTaroStorageKey,
1917
1917
  clearTaroStorageKey,
1918
1918
  getSystemInfos,
1919
1919
  addHttps,
1920
1920
  dateFormat,
1921
1921
  throttle,
1922
1922
  lodashThrottle,
1923
1923
  debounce,
1924
1924
  getTelephone,
1925
1925
  rgbToHex,
1926
1926
  hexToRgb,
1927
1927
  getRandom,
1928
1928
  getWxAppCookieStr,
1929
1929
  pxTransformFromData,
1930
1930
  dealShopContentData,
1931
1931
  showSuccessToast,
1932
1932
  showFailToast,
1933
1933
  showNormalToast,
1934
1934
  showShopLoading,
1935
1935
  hideShopLoading,
1936
1936
  getAppChannelType,
1937
1937
  formatTabActiveMenuType,
1938
1938
  filterUrlQueryData,
1939
1939
  getAvifSupport,
1940
1940
  getWebpSupport,
1941
1941
  isMemberPage,
1942
1942
  sgmCustomReport,
1943
1943
  isOpenJdAppUrl,
1944
1944
  jdOpenAppParams,
1945
1945
  createJdOpenAppUrl,
1946
1946
  dealJdOpenAppData,
1947
1947
  isEmpty,
1948
1948
  getJdAppReportPageSource,
1949
1949
  isAppClassifyPage,
1950
1950
  getQualityImageNew,
1951
1951
  getQualityImageOld,
1952
1952
  isPc,
1953
1953
  ipLoc_djd,
1954
1954
  jdAppVersionCompare,
1955
1955
  dealNativePixelToCssPixel,
1956
1956
  isAppStowShop,