@conecli/cone-render 0.10.1-shop3.76 → 0.10.1-shop3.79

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