@conecli/cone-render 0.9.1-shop2.13 → 0.9.1-shop2.15

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