@conecli/cone-render 0.10.1-shop3.37 → 0.10.1-shop3.39

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