@conecli/cone-render 0.8.41 → 0.8.43

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