@conecli/cone-render 0.10.1-shop3.36 → 0.10.1-shop3.38

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