@conecli/cone-render 0.10.1-shop-beta.15 → 0.10.1-shop-beta.16

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