@conecli/cone-render 0.9.1-shop2.25 → 0.9.1-shop2.26

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