@conecli/cone-render 0.10.1-shop3.135 → 0.10.1-shop3.136

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