@conecli/cone-render 0.10.1-shop3.22 → 0.10.1-shop3.24

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