@conecli/cone-render 0.9.1-shop2.8 → 0.9.1-shop2.9

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.
Files changed (39) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/environmentType.ts +1 -0
  3. package/dist/common/index.h5.ts +1 -1
  4. package/dist/common/index.jd.ts +1 -1
  5. package/dist/common/index.ts +1 -1
  6. package/dist/common/index.weapp.ts +1 -1
  7. package/dist/common/sgmCustomCode.ts +1 -0
  8. package/dist/common/wxappApi.jd.ts +1 -0
  9. package/dist/components/ErrorBoundary.tsx +1 -1
  10. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  11. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  12. package/dist/components/floorItem.jd.tsx +1 -1
  13. package/dist/components/floorItem.weapp.tsx +1 -1
  14. package/dist/components/remoteFloorItem.tsx +1 -1
  15. package/dist/interface/common.ts +1 -1
  16. package/dist/interface/component.ts +1 -1
  17. package/dist/interface/jumpEventReport.ts +1 -1
  18. package/dist/interface/service.ts +1 -1
  19. package/dist/interface/utils.ts +1 -1
  20. package/dist/jumpEventReport/base.ts +1 -1
  21. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  22. package/dist/jumpEventReport/index.h5.ts +1 -1
  23. package/dist/jumpEventReport/index.jd.ts +1 -1
  24. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  25. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  26. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  27. package/dist/jumpEventReport/web.tjm.ts +1 -0
  28. package/dist/open/api/environment.ts +1 -1
  29. package/dist/open/api/track.ts +1 -1
  30. package/dist/service/requestServer.ts +1 -1
  31. package/dist/utils/draExceptionAndProfile.ts +1 -1
  32. package/dist/utils/h5Utils.ts +1 -1
  33. package/dist/utils/index.h5.ts +1 -1
  34. package/dist/utils/index.ts +1 -1
  35. package/dist/utils/index.weapp.ts +1 -1
  36. package/dist/utils/jm-common.js +1 -1
  37. package/dist/utils/sgmCodeUtils.ts +1 -0
  38. package/dist/utils/utils.ts +1 -1
  39. package/package.json +1 -1
@@ -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
  getBundleUrl,
12
11
  getBundleFileName,
13
12
  formatPackResult,
14
13
  const resultList: Array<any> = [],
15
14
  arrLen = arr.length
16
15
  if (arrLen) {
17
16
  if (arrLen > size) {
18
17
  for (let i = 0; i < arrLen; i = i + size) {
19
18
  resultList.push(arr.slice(i, i + size))
20
19
  }
21
20
  } else {
22
21
  resultList.push(arr)
23
22
  }
24
23
  }
25
24
  return resultList
26
25
  let _address = ids
27
26
  const _areaAreaSplit = ids.split('.')
28
27
  const _areaAreaSplit2 = ids.split('_')
29
28
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address
30
29
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address
31
30
  return _address
32
31
  const getValue = `${obj[key]}`.replace(/undefined/,'').replace(/null/,'')
33
32
  paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`
34
33
  const result = {}
35
34
  if (
36
35
  !urlOrQueryStr ||
37
36
  ('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
38
37
  ) {
39
38
  return result
40
39
  }
41
40
  if (urlOrQueryStr.indexOf('?') > -1) {
42
41
  const queryStr = urlOrQueryStr.split('?')
43
42
  const queryItemList =
44
43
  queryStr && queryStr.length > 1 ? queryStr[1].split('&') : []
45
44
  const queryItemListLen = queryItemList.length
46
45
  queryItemListLen > 0 &&
47
46
  queryItemList.forEach((item) => {
48
47
  const thisItemList = item.split('=')
49
48
  result[thisItemList[0]] = thisItemList[1]
50
49
  })
51
50
  } else {
52
51
  const queryItemList =
53
52
  urlOrQueryStr.indexOf('&') > -1
54
53
  ? urlOrQueryStr.split('&')
55
54
  : [urlOrQueryStr]
56
55
  const queryItemListLen = queryItemList.length
57
56
  queryItemListLen > 0 &&
58
57
  queryItemList.forEach((item) => {
59
58
  const thisItemList = item.split('=')
60
59
  result[thisItemList[0]] = thisItemList[1]
61
60
  })
62
61
  }
63
62
  return result
64
63
  url: string,
65
64
  size?: {
66
65
  w: number
67
66
  h: number
68
67
  },
69
68
  quality?: number,
70
69
  if (url && size) {
71
70
  const _w = Math.floor(size.w)
72
71
  const _h = Math.floor(size.h)
73
72
  if (url.match(/gif$/i)) {
74
73
  return url
75
74
  } else {
76
75
  if (_w > 0 && _h > 0) {
77
76
  url = url.replace('jfs/', `s${_w}x${_h}_jfs/`)
78
77
  }
79
78
  url += quality != null ? `!q${quality}.dpg` : '.dpg'
80
79
  }
81
80
  }
82
81
  return url
83
82
  url: string,
84
83
  jfsImgInfo: UtilsInterFace.getJfsImageInfo = {},
85
84
  if (url.match(/\.(jpg|png|dpg)$/i)) {
86
85
  const { width, height, quality } = jfsImgInfo
87
86
  if (typeof width === 'number' || typeof height === 'number') {
88
87
  url = url.replace(
89
88
  '/jfs/',
90
89
  `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`,
91
90
  )
92
91
  }
93
92
  if (
94
93
  typeof quality === 'number' &&
95
94
  quality > 0 &&
96
95
  quality < 100 &&
97
96
  url.match(/\.jpg$/i)
98
97
  ) {
99
98
  url += `!q${quality}.dpg`
100
99
  }
101
100
  }
102
101
  return addHttps(url)
103
102
  !imgUrl.match(
104
103
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
105
104
  )
106
105
  if(!imgUrl.includes('360buyimg.com')){
107
106
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
108
107
  }
109
108
  if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
110
109
  count: number,
111
110
  fixedNum = 2,
112
111
  unit = '万',
113
112
  maxNum = 10000,
114
113
  count = Number(count)
115
114
  if (count > maxNum) {
116
115
  return (count / maxNum).toFixed(fixedNum) + unit
117
116
  }
118
117
  return count
119
118
  key: string,
120
119
  value: string | object,
121
120
  successBack?: any,
122
121
  failBack?: any,
123
122
  return Taro.setStorage({
124
123
  key: key,
125
124
  data: value,
126
125
  success: successBack,
127
126
  fail: failBack,
128
127
  })
129
128
  return Taro.getStorageSync(key)
130
129
  return Taro.removeStorage({
131
130
  key: key,
132
131
  })
133
132
  return Taro.clearStorage()
134
133
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
135
134
  let gap = 0
136
135
  let width = 96
137
136
  if (systemInfo.platform === 'android') {
138
137
  gap = 8
139
138
  width = 96
140
139
  } else if (systemInfo.platform === 'devtools') {
141
140
  if (isIOS) {
142
141
  gap = 5.5
143
142
  } else {
144
143
  gap = 7.5
145
144
  }
146
145
  } else {
147
146
  gap = 4
148
147
  width = 88
149
148
  }
150
149
  rect = {
151
150
  bottom: systemInfo.statusBarHeight + gap + 32,
152
151
  height: 32,
153
152
  left: systemInfo.windowWidth - width - 10,
154
153
  right: systemInfo.windowWidth - 10,
155
154
  top: systemInfo.statusBarHeight + gap,
156
155
  width,
157
156
  }
158
157
  }
159
158
  const gap = rect.top - systemInfo.statusBarHeight
160
159
  systemInfo.navBarTopToStatusBar = gap
161
160
  systemInfo.navBarHeight = 2 * gap + rect.height
162
161
  systemInfo.capsulePosition = rect
163
162
  systemInfo.isIOS = isIOS
164
163
  systemInfo.isAndroid = isAndroid
165
164
  return systemInfo
166
165
  if (str.match(/^\/\//)) {
167
166
  str = 'https:' + str
168
167
  }
169
168
  return str
170
169
  dateTimeOrdate: Date | string | number | null,
171
170
  format = 'yyyy-MM-dd HH:mm:ss',
172
171
  noPadStart = {
173
172
  M: '0',
174
173
  d: '0',
175
174
  H: '0',
176
175
  m: '0',
177
176
  s: '0',
178
177
  },
179
178
  let dateResult = ''
180
179
  const padStarts = Object.assign(
181
180
  {
182
181
  M: '0',
183
182
  d: '0',
184
183
  H: '0',
185
184
  m: '0',
186
185
  s: '0',
187
186
  },
188
187
  noPadStart,
189
188
  )
190
189
  if (dateTimeOrdate) {
191
190
  let changeDateTimeOrdate = dateTimeOrdate
192
191
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
193
192
  if (getChangeDateTimeToNumber) {
194
193
  changeDateTimeOrdate = getChangeDateTimeToNumber
195
194
  } else {
196
195
  changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/').replace(/\./g, '/')
197
196
  }
198
197
  const nowDate =
199
198
  dateTimeOrdate instanceof Date
200
199
  ? dateTimeOrdate
201
200
  : new Date(changeDateTimeOrdate)
202
201
  const dateMap = {
203
202
  y: `${nowDate.getFullYear()}`,
204
203
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
205
204
  d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
206
205
  H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
207
206
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
208
207
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
209
208
  }
210
209
  const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
211
210
  const regYear = new RegExp('y')
212
211
  dateResult = format.replace(regDate, (v) => {
213
212
  let changeValue = v
214
213
  if (regYear.test(changeValue)) {
215
214
  const thisYear = dateMap.y
216
215
  const subValueLen = 4 - changeValue.length
217
216
  changeValue = thisYear.substr(subValueLen)
218
217
  } else {
219
218
  const dateKey = v.substr(0, 1)
220
219
  changeValue = dateMap[dateKey]
221
220
  }
222
221
  return changeValue
223
222
  })
224
223
  }
225
224
  return dateResult
226
225
  let timer: any = null
227
226
  let startTime = Date.now()
228
227
  return function () {
229
228
  const curTime = Date.now()
230
229
  const remaining = delay - (curTime - startTime)
231
230
  const context = this
232
231
  const args = arguments
233
232
  clearTimeout(timer)
234
233
  if (remaining <= 0) {
235
234
  func.apply(context, args)
236
235
  startTime = Date.now()
237
236
  } else {
238
237
  timer = setTimeout(func, remaining)
239
238
  }
240
239
  }
241
240
  let context, args, result
242
241
  let timeout = null
243
242
  let previous = 0
244
243
  if (!options) options = {}
245
244
  const later = function () {
246
245
  previous = options.leading === false ? 0 : Date.now()
247
246
  timeout = null
248
247
  result = func.apply(context, args)
249
248
  if (!timeout) context = args = null
250
249
  }
251
250
  return function () {
252
251
  const now = Date.now()
253
252
  if (!previous && options.leading === false) previous = now
254
253
  const remaining = wait - (now - previous)
255
254
  context = this
256
255
  args = arguments
257
256
  if (remaining <= 0 || remaining > wait) {
258
257
  if (timeout) {
259
258
  clearTimeout(timeout)
260
259
  timeout = null
261
260
  }
262
261
  previous = now
263
262
  result = func.apply(context, args)
264
263
  if (!timeout) context = args = null
265
264
  } else if (!timeout && options.trailing !== false) {
266
265
  timeout = setTimeout(later, remaining)
267
266
  }
268
267
  return result
269
268
  }
270
269
  let timer: any = null
271
270
  return function () {
272
271
  const context: any = this
273
272
  const args = arguments
274
273
  timer && clearTimeout(timer)
275
274
  timer = setTimeout(function () {
276
275
  fn.apply(context, args)
277
276
  }, delay)
278
277
  }
279
278
  if (txt) {
280
279
  txt = txt.trim()
281
280
  const reg = new RegExp(/[\d-]+/)
282
281
  const res = reg.exec(txt)
283
282
  if (res && res.length > 0) {
284
283
  let tel = res[0]
285
284
  if (tel && delSeparator) {
286
285
  tel = tel.replace(/-/g, '')
287
286
  }
288
287
  return tel
289
288
  }
290
289
  }
291
290
  return ''
292
291
  if (rgb) {
293
292
  const reg = /^(rgb|RGB)/
294
293
  const color = rgb
295
294
  if (reg.test(color)) {
296
295
  let strHex = '#'
297
296
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
298
297
  for (let i = 0; i < colorArr.length; i++) {
299
298
  let hex = Number(colorArr[i]).toString(16)
300
299
  if (hex === '0') {
301
300
  hex += hex
302
301
  }
303
302
  strHex += hex
304
303
  }
305
304
  return strHex
306
305
  } else {
307
306
  return String(color)
308
307
  }
309
308
  } else {
310
309
  return ''
311
310
  }
312
311
  if (hex) {
313
312
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
314
313
  let color = hex.toLowerCase()
315
314
  if (reg.test(color)) {
316
315
  if (color.length === 4) {
317
316
  let colorNew = '#'
318
317
  for (let i = 1; i < 4; i += 1) {
319
318
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
320
319
  }
321
320
  color = colorNew
322
321
  }
323
322
  const colorChange: number[] = []
324
323
  for (let i = 1; i < 7; i += 2) {
325
324
  colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
326
325
  }
327
326
  if (returnList) {
328
327
  return colorChange
329
328
  } else {
330
329
  return 'RGB(' + colorChange.join(',') + ')'
331
330
  }
332
331
  } else {
333
332
  return color
334
333
  }
335
334
  } else {
336
335
  return ''
337
336
  }
338
337
  n: number,
339
338
  m: number,
340
339
  filterNum: number | undefined = undefined,
341
340
  const c = m - n + 1
342
341
  const res = Math.floor(Math.random() * c + n)
343
342
  if (filterNum && filterNum == res) {
344
343
  console.log('随机数二次开始', res, filterNum)
345
344
  return getRandom(n, m, filterNum)
346
345
  } else {
347
346
  return res
348
347
  }
349
348
  wqCookieStr: string
350
349
  wqCookie: {
351
350
  pin?: string
352
351
  visitkey?: string
353
352
  [key: string]: any
354
353
  }
355
354
  const {
356
355
  jdpin,
357
356
  pinStatus,
358
357
  visitkey,
359
358
  unionid,
360
359
  skey,
361
360
  __jda,
362
361
  __jdv,
363
362
  __wga,
364
363
  wxapp_type,
365
364
  appType
366
365
  } = cookie
367
366
  const ret: string[] = []
368
367
  const getUserCookieObj = {}
369
368
  const createUseCookieArr = [
370
369
  jdpin,
371
370
  pinStatus,
372
371
  visitkey,
373
372
  unionid,
374
373
  skey,
375
374
  __jda,
376
375
  __jdv,
377
376
  __wga,
378
377
  wid,
379
378
  wq_skey,
380
379
  wq_uin,
381
380
  wq_auth_token,
382
381
  wxapp_scene,
383
382
  wq_unionid,
384
383
  wxapp_openid,
385
384
  wxapp_version,
386
385
  wxapp_type,
387
386
  appType
388
387
  name = name === 'jdpin' ? 'pin' : name;
389
388
  name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
390
389
  ret.push(`${name}=${encodeURIComponent(value)}`)
391
390
  getUserCookieObj[name] = value
392
391
  }
393
392
  })
394
393
  return {
395
394
  wqCookieStr: ret.join(';'),
396
395
  wqCookie: getUserCookieObj,
397
396
  }
398
397
  num,
399
398
  widthSize = 375,
400
399
  layoutWidth = windowWidth,
401
400
  const getNum = Number(num)
402
401
  return Math.round((getNum / widthSize) * layoutWidth)
403
402
  let checkState = false
404
403
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
405
404
  if (couponFloorModuleType === FloorModuleType.COUPON) {
406
405
  try {
407
406
  const dataDefines = getFloorDataToDataDefines(floorData)
408
407
  const couponDataDefine = dataDefines
409
408
  ? dataDefines.filter((item) => {
410
409
  return item.type === 'coupon'
411
410
  })
412
411
  : [],
413
412
  couponList = couponDataDefine[0]?.nodeText?.data
414
413
  ? couponDataDefine[0]?.nodeText?.data
415
414
  : [],
416
415
  couponLength = couponList.length,
417
416
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
418
417
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
419
418
  : 0
420
419
  if (numShowPerLine === 0 && couponLength > 3) {
421
420
  checkState = true
422
421
  }
423
422
  } catch (e) {
424
423
  checkState = false
425
424
  }
426
425
  return checkState
427
426
  }
428
427
  containers = [],
429
428
  floors = [],
430
429
  clearFirstContaierMarginTop = false,
431
430
  isLuxuryShop = false,
432
431
  isShowNativeImmersivePlayer=false,
433
432
  screenHeight = null,
434
433
  screenWidth = null,
435
434
  bottomBarHeight= null
436
435
  } = pageData
437
436
  exceptionReportFn
438
437
  )
439
438
  if (getFloorData) {
440
439
  containerId: item.containerId,
441
440
  containerIndex: index,
442
441
  ...getFloorData,
443
442
  }
444
443
  if(getFloorData?.floorExtInfo?.floorLoadWay === 2){
445
444
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn)
446
445
  !getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1)
447
446
  }
448
447
  if(isProd && isWxMinAndWxapp){
449
448
  shopContentContainerListData = shopContentContainerListData.filter(
450
449
  (item) =>
451
450
  item.floors.length > 0 &&
452
451
  !isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData)
453
452
  )
454
453
  }
455
454
  shopContentContainerListData = [].concat(shopContentContainerListData)
456
455
  return {
457
456
  shopContentContainerListData,
458
457
  shopContentFloorListData,
459
458
  }
460
459
  const changeOpts = {
461
460
  title: '',
462
461
  icon: 'success',
463
462
  duration: 1500,
464
463
  mask: true,
465
464
  ...options,
466
465
  }
467
466
  if (changeOpts.title.length > 7) {
468
467
  showNormalToast(options)
469
468
  } else {
470
469
  Taro.showToast(changeOpts as any)
471
470
  }
472
471
  const changeOpts = {
473
472
  title: '',
474
473
  icon: 'error',
475
474
  duration: 1500,
476
475
  mask: true,
477
476
  ...options,
478
477
  }
479
478
  if (changeOpts.title.length > 7) {
480
479
  showNormalToast(options)
481
480
  } else {
482
481
  Taro.showToast(changeOpts as any)
483
482
  }
484
483
  Taro.showToast({
485
484
  title: '',
486
485
  icon: 'none',
487
486
  duration: 1500,
488
487
  mask: true,
489
488
  ...options,
490
489
  })
491
490
  return Taro.showLoading({
492
491
  title: text,
493
492
  })
494
493
  return new Promise(() => {
495
494
  Taro.nextTick(() => {
496
495
  setTimeout(() => {
497
496
  Taro.hideLoading(options)
498
497
  }, 300)
499
498
  })
500
499
  })
501
500
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
502
501
  const {
503
502
  tabActive = SECTION_HOME_TAB_NAME_TYPE[
504
503
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
505
504
  ],
506
505
  sceneId,
507
506
  } = query
508
507
  let changeTabActive = tabActive
509
508
  if (sceneId) {
510
509
  if (isH5) {
511
510
  if (sceneId == '1002') {
512
511
  changeTabActive =
513
512
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
514
513
  }
515
514
  else if (sceneId == '1003') {
516
515
  changeTabActive =
517
516
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
518
517
  }
519
518
  } else if (isWxMinAndWxapp) {
520
519
  if (sceneId == '1001' || sceneId == '1002') {
521
520
  changeTabActive =
522
521
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
523
522
  }
524
523
  else if (sceneId == '1003') {
525
524
  changeTabActive =
526
525
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
527
526
  }
528
527
  }
529
528
  }
530
529
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
531
530
  return {
532
531
  menuType: SHOP_MENU_ID_TYPE.HOME,
533
532
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
534
533
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
535
534
  }
536
535
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
537
536
  return {
538
537
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
539
538
  tabActiveType: 0,
540
539
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
541
540
  }
542
541
  } else {
543
542
  return {
544
543
  menuType: SHOP_MENU_ID_TYPE.HOME,
545
544
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
546
545
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
547
546
  }
548
547
  }
549
548
  const deleteKeyList = [
550
549
  '$taroTimestamp',
551
550
  'cookie',
552
551
  'wdref',
553
552
  'navStart',
554
553
  'originOpts',
555
554
  'originParams',
556
555
  'originUrl',
557
556
  'referer',
558
557
  'stamp',
559
558
  ]
560
559
  let changeQueryData: any = { ...queryData }
561
560
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
562
561
  const sceneQuery =
563
562
  qrCodeScene && typeof qrCodeScene == 'string'
564
563
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
565
564
  : {}
566
565
  changeQueryData = { ...changeQueryData, ...sceneQuery }
567
566
  deleteKeyList.forEach((key) => {
568
567
  changeQueryData[key] && delete changeQueryData[key]
569
568
  })
570
569
  changeQueryData['shopid'] &&
571
570
  (changeQueryData['shopId'] = changeQueryData['shopid']) &&
572
571
  delete changeQueryData['shopid']
573
572
  changeQueryData['venderid'] &&
574
573
  (changeQueryData['venderId'] = changeQueryData['venderid']) &&
575
574
  delete changeQueryData['venderid']
576
575
  changeQueryData['vendorId'] &&
577
576
  (changeQueryData['venderId'] = changeQueryData['vendorId']) &&
578
577
  delete changeQueryData['vendorId']
579
578
  return changeQueryData
580
579
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
581
580
  const modularPackResultObj = formatPackResult(modularPackResult)
582
581
  const bundleUrl = getBundleUrl(modularPackResultObj)
583
582
  const bundleFileName = getBundleFileName(modularPackResultObj)
584
583
  if (bundleUrl && bundleFileName) {
585
584
  isUsable = true
586
585
  }
587
586
  const objContainer = containerListData.find(
588
587
  (item) => item.containerId === containerId,
589
588
  )
590
589
  return (
591
590
  objContainer?.includeUids?.some((itemUid) => {
592
591
  const objectFloor = floorListData.find(
593
592
  (floorItem) => itemUid === floorItem.uid,
594
593
  )
595
594
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
596
595
  }) ?? false
597
596
  )
598
597
  floorListData,
599
598
  containerListData,
600
599
  exceptionReportFn?,
601
600
  const unableIsvFloorListData = floorListData.filter(
602
601
  (floorItem) =>
603
602
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
604
603
  !isIsvFloorUseable(floorItem, exceptionReportFn),
605
604
  )
606
605
  const unableIsvFloorUidList = unableIsvFloorListData.map(
607
606
  (floorItem) => floorItem.uid,
608
607
  )
609
608
  const unableIsvContainerListData = containerListData.filter(
610
609
  (item) =>
611
610
  item.includeUids &&
612
611
  item.includeUids.every(
613
612
  (itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1,
614
613
  ),
615
614
  )
616
615
  return unableIsvContainerListData
617
616
  return -2
618
617
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl)
619
618
  let getParams = false
620
619
  if (isOpenJdAppUrl(openAppUrl)) {
621
620
  try {
622
621
  getParams = openAppUrl.replace(
623
622
  /openApp\.jdMobile:\/\/virtual\?params=/i,
624
623
  '',
625
624
  )
626
625
  getParams = JSON.parse(String(getParams))
627
626
  } catch (e) {
628
627
  console.log(e)
629
628
  }
630
629
  }
631
630
  return getParams
632
631
  return `openapp.jdmobile://virtual?params=${JSON.stringify(Object.assign({}, openParams))}`
633
632
  if (val === null || val === '' || typeof val === 'undefined') {
634
633
  return true
635
634
  }
636
635
  return false
637
636
  const {
638
637
  moduleId = 'none',
639
638
  entrance = 'none',
640
639
  sourceType = 'none',
641
640
  sourceValue = 'none',
642
641
  } = params
643
642
  if (isIosDevice) {
644
643
  return `${moduleId}#${entrance}`
645
644
  } else if (isAndroidDevice) {
646
645
  return `${sourceType}#${sourceValue}`
647
646
  }
648
647
  return 'none#none'
649
648
  if (data && typeof data === 'object') {
650
649
  let getOpenAppData = { ...data }
651
650
  try {
652
651
  const { sourceInfo, designerId, templateId, source } = getOpenAppData
653
652
  if (designerId && templateId) {
654
653
  getOpenAppData = Object.assign({}, getOpenAppData, {
655
654
  sourceInfo: {
656
655
  entrance: '设计师预览',
657
656
  },
658
657
  })
659
658
  } else if (sourceInfo) {
660
659
  const { entrance } = sourceInfo
661
660
  getOpenAppData.sourceInfo.entrance =
662
661
  entrance && entrance.length > 0 ? entrance : '其他'
663
662
  } else if (source && !sourceInfo) {
664
663
  if (typeof source === 'object') {
665
664
  const { sourceType, entrance, sourceValue, moduleId } = source
666
665
  getOpenAppData = Object.assign({}, getOpenAppData, {
667
666
  sourceInfo: {
668
667
  entrance: sourceType || entrance || '其他',
669
668
  moduleId: sourceValue || moduleId || '-100',
670
669
  },
671
670
  })
672
671
  } else {
673
672
  getOpenAppData = Object.assign({}, getOpenAppData, {
674
673
  sourceInfo: {
675
674
  entrance: source,
676
675
  },
677
676
  })
678
677
  }
679
678
  } else {
680
679
  getOpenAppData = Object.assign({}, getOpenAppData, {
681
680
  sourceInfo: {
682
681
  entrance: '其他',
683
682
  },
684
683
  })
685
684
  }
686
685
  } catch (e) {
687
686
  console.log(e)
688
687
  }
689
688
  return getOpenAppData
690
689
  }
691
690
  return data
692
691
  return displayObj
693
692
  isChartH5,
694
693
  isH5AndJdShopViewH5Scroll,
695
694
  isH5AndJdShopH5CustomScrollView,
696
695
  isMemberPage,
697
696
  sgmCustomReport,
698
697
  isOpenJdAppUrl,
699
698
  jdOpenAppParams,
700
699
  createJdOpenAppUrl,
701
700
  dealJdOpenAppData,
702
701
  isEmpty,
703
702
  getJdAppReportPageSource,
704
703
  isPc,
705
704
  ipLoc_djd,
706
705
  jdAppVersionCompare,
707
706
  dealNativePixelToCssPixel,
708
707
  isAppStowShop
708
+ import Taro from '@tarojs/taro'
709
709
  SHOP_MENU_ID_TYPE,
710
710
  SHOP_MENU_ID_QUERY_NAME,
711
711
  SECTION_HOME_TAB_TYPE,
712
712
  SECTION_HOME_TAB_NAME_TYPE,
713
713
  SECTION_HOME_TAB_QUERY_TYPE,
714
714
  CHANNEL_TYPE,
715
715
  JDShopViewBusinessPathType,
716
716
  FloorModuleType,
717
717
  RemoteLoadFloorList,
718
718
  getBundleUrl,
719
719
  getBundleFileName,
720
720
  formatPackResult,
721
721
  const resultList: Array<any> = [],
722
722
  arrLen = arr.length
723
723
  if (arrLen) {
724
724
  if (arrLen > size) {
725
725
  for (let i = 0; i < arrLen; i = i + size) {
726
726
  resultList.push(arr.slice(i, i + size))
727
727
  }
728
728
  } else {
729
729
  resultList.push(arr)
730
730
  }
731
731
  }
732
732
  return resultList
733
733
  let _address = ids
734
734
  const _areaAreaSplit = ids.split('.')
735
735
  const _areaAreaSplit2 = ids.split('_')
736
736
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address
737
737
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address
738
738
  return _address
739
739
  const getValue = `${obj[key]}`.replace(/undefined/,'').replace(/null/,'')
740
740
  paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`
741
741
  const result = {}
742
742
  if (
743
743
  !urlOrQueryStr ||
744
744
  ('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
745
745
  ) {
746
746
  return result
747
747
  }
748
748
  if (urlOrQueryStr.indexOf('?') > -1) {
749
749
  const queryStr = urlOrQueryStr.split('?')
750
750
  const queryItemList =
751
751
  queryStr && queryStr.length > 1 ? queryStr[1].split('&') : []
752
752
  const queryItemListLen = queryItemList.length
753
753
  queryItemListLen > 0 &&
754
754
  queryItemList.forEach((item) => {
755
755
  const thisItemList = item.split('=')
756
756
  result[thisItemList[0]] = thisItemList[1]
757
757
  })
758
758
  } else {
759
759
  const queryItemList =
760
760
  urlOrQueryStr.indexOf('&') > -1
761
761
  ? urlOrQueryStr.split('&')
762
762
  : [urlOrQueryStr]
763
763
  const queryItemListLen = queryItemList.length
764
764
  queryItemListLen > 0 &&
765
765
  queryItemList.forEach((item) => {
766
766
  const thisItemList = item.split('=')
767
767
  result[thisItemList[0]] = thisItemList[1]
768
768
  })
769
769
  }
770
770
  return result
771
771
  url: string,
772
772
  size?: {
773
773
  w: number
774
774
  h: number
775
775
  },
776
776
  quality?: number,
777
777
  if (url && size) {
778
778
  const _w = Math.floor(size.w)
779
779
  const _h = Math.floor(size.h)
780
780
  if (url.match(/gif$/i)) {
781
781
  return url
782
782
  } else {
783
783
  if (_w > 0 && _h > 0) {
784
784
  url = url.replace('jfs/', `s${_w}x${_h}_jfs/`)
785
785
  }
786
786
  url += quality != null ? `!q${quality}.dpg` : '.dpg'
787
787
  }
788
788
  }
789
789
  return url
790
790
  url: string,
791
791
  jfsImgInfo: UtilsInterFace.getJfsImageInfo = {},
792
792
  if (url.match(/\.(jpg|png|dpg)$/i)) {
793
793
  const { width, height, quality } = jfsImgInfo
794
794
  if (typeof width === 'number' || typeof height === 'number') {
795
795
  url = url.replace(
796
796
  '/jfs/',
797
797
  `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`,
798
798
  )
799
799
  }
800
800
  if (
801
801
  typeof quality === 'number' &&
802
802
  quality > 0 &&
803
803
  quality < 100 &&
804
804
  url.match(/\.jpg$/i)
805
805
  ) {
806
806
  url += `!q${quality}.dpg`
807
807
  }
808
808
  }
809
809
  return addHttps(url)
810
810
  !imgUrl.match(
811
811
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
812
812
  )
813
813
  if(!imgUrl.includes('360buyimg.com')){
814
814
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
815
815
  }
816
816
  if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
817
817
  count: number,
818
818
  fixedNum = 2,
819
819
  unit = '万',
820
820
  maxNum = 10000,
821
821
  count = Number(count)
822
822
  if (count > maxNum) {
823
823
  return (count / maxNum).toFixed(fixedNum) + unit
824
824
  }
825
825
  return count
826
826
  key: string,
827
827
  value: string | object,
828
828
  successBack?: any,
829
829
  failBack?: any,
830
830
  return Taro.setStorage({
831
831
  key: key,
832
832
  data: value,
833
833
  success: successBack,
834
834
  fail: failBack,
835
835
  })
836
836
  return Taro.getStorageSync(key)
837
837
  return Taro.removeStorage({
838
838
  key: key,
839
839
  })
840
840
  return Taro.clearStorage()
841
841
  if (str.match(/^\/\//)) {
842
842
  str = 'https:' + str
843
843
  }
844
844
  return str
845
845
  dateTimeOrdate: Date | string | number | null,
846
846
  format = 'yyyy-MM-dd HH:mm:ss',
847
847
  noPadStart = {
848
848
  M: '0',
849
849
  d: '0',
850
850
  H: '0',
851
851
  m: '0',
852
852
  s: '0',
853
853
  },
854
854
  let dateResult = ''
855
855
  const padStarts = Object.assign(
856
856
  {
857
857
  M: '0',
858
858
  d: '0',
859
859
  H: '0',
860
860
  m: '0',
861
861
  s: '0',
862
862
  },
863
863
  noPadStart,
864
864
  )
865
865
  if (dateTimeOrdate) {
866
866
  let changeDateTimeOrdate = dateTimeOrdate
867
867
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
868
868
  if (getChangeDateTimeToNumber) {
869
869
  changeDateTimeOrdate = getChangeDateTimeToNumber
870
870
  } else {
871
871
  changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/').replace(/\./g, '/')
872
872
  }
873
873
  const nowDate =
874
874
  dateTimeOrdate instanceof Date
875
875
  ? dateTimeOrdate
876
876
  : new Date(changeDateTimeOrdate)
877
877
  const dateMap = {
878
878
  y: `${nowDate.getFullYear()}`,
879
879
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
880
880
  d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
881
881
  H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
882
882
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
883
883
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
884
884
  }
885
885
  const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
886
886
  const regYear = new RegExp('y')
887
887
  dateResult = format.replace(regDate, (v) => {
888
888
  let changeValue = v
889
889
  if (regYear.test(changeValue)) {
890
890
  const thisYear = dateMap.y
891
891
  const subValueLen = 4 - changeValue.length
892
892
  changeValue = thisYear.substr(subValueLen)
893
893
  } else {
894
894
  const dateKey = v.substr(0, 1)
895
895
  changeValue = dateMap[dateKey]
896
896
  }
897
897
  return changeValue
898
898
  })
899
899
  }
900
900
  return dateResult
901
901
  let timer: any = null
902
902
  let startTime = Date.now()
903
903
  return function () {
904
904
  const curTime = Date.now()
905
905
  const remaining = delay - (curTime - startTime)
906
906
  const context = this
907
907
  const args = arguments
908
908
  clearTimeout(timer)
909
909
  if (remaining <= 0) {
910
910
  func.apply(context, args)
911
911
  startTime = Date.now()
912
912
  } else {
913
913
  timer = setTimeout(func, remaining)
914
914
  }
915
915
  }
916
916
  let context, args, result
917
917
  let timeout = null
918
918
  let previous = 0
919
919
  if (!options) options = {}
920
920
  const later = function () {
921
921
  previous = options.leading === false ? 0 : Date.now()
922
922
  timeout = null
923
923
  result = func.apply(context, args)
924
924
  if (!timeout) context = args = null
925
925
  }
926
926
  return function () {
927
927
  const now = Date.now()
928
928
  if (!previous && options.leading === false) previous = now
929
929
  const remaining = wait - (now - previous)
930
930
  context = this
931
931
  args = arguments
932
932
  if (remaining <= 0 || remaining > wait) {
933
933
  if (timeout) {
934
934
  clearTimeout(timeout)
935
935
  timeout = null
936
936
  }
937
937
  previous = now
938
938
  result = func.apply(context, args)
939
939
  if (!timeout) context = args = null
940
940
  } else if (!timeout && options.trailing !== false) {
941
941
  timeout = setTimeout(later, remaining)
942
942
  }
943
943
  return result
944
944
  }
945
945
  let timer: any = null
946
946
  return function () {
947
947
  const context: any = this
948
948
  const args = arguments
949
949
  timer && clearTimeout(timer)
950
950
  timer = setTimeout(function () {
951
951
  fn.apply(context, args)
952
952
  }, delay)
953
953
  }
954
954
  if (txt) {
955
955
  txt = txt.trim()
956
956
  const reg = new RegExp(/[\d-]+/)
957
957
  const res = reg.exec(txt)
958
958
  if (res && res.length > 0) {
959
959
  let tel = res[0]
960
960
  if (tel && delSeparator) {
961
961
  tel = tel.replace(/-/g, '')
962
962
  }
963
963
  return tel
964
964
  }
965
965
  }
966
966
  return ''
967
967
  if (rgb) {
968
968
  const reg = /^(rgb|RGB)/
969
969
  const color = rgb
970
970
  if (reg.test(color)) {
971
971
  let strHex = '#'
972
972
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
973
973
  for (let i = 0; i < colorArr.length; i++) {
974
974
  let hex = Number(colorArr[i]).toString(16)
975
975
  if (hex === '0') {
976
976
  hex += hex
977
977
  }
978
978
  strHex += hex
979
979
  }
980
980
  return strHex
981
981
  } else {
982
982
  return String(color)
983
983
  }
984
984
  } else {
985
985
  return ''
986
986
  }
987
987
  if (hex) {
988
988
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
989
989
  let color = hex.toLowerCase()
990
990
  if (reg.test(color)) {
991
991
  if (color.length === 4) {
992
992
  let colorNew = '#'
993
993
  for (let i = 1; i < 4; i += 1) {
994
994
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
995
995
  }
996
996
  color = colorNew
997
997
  }
998
998
  const colorChange: number[] = []
999
999
  for (let i = 1; i < 7; i += 2) {
1000
1000
  colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
1001
1001
  }
1002
1002
  if (returnList) {
1003
1003
  return colorChange
1004
1004
  } else {
1005
1005
  return 'RGB(' + colorChange.join(',') + ')'
1006
1006
  }
1007
1007
  } else {
1008
1008
  return color
1009
1009
  }
1010
1010
  } else {
1011
1011
  return ''
1012
1012
  }
1013
1013
  n: number,
1014
1014
  m: number,
1015
1015
  filterNum: number | undefined = undefined,
1016
1016
  const c = m - n + 1
1017
1017
  const res = Math.floor(Math.random() * c + n)
1018
1018
  if (filterNum && filterNum == res) {
1019
1019
  console.log('随机数二次开始', res, filterNum)
1020
1020
  return getRandom(n, m, filterNum)
1021
1021
  } else {
1022
1022
  return res
1023
1023
  }
1024
1024
  wqCookieStr: string
1025
1025
  wqCookie: {
1026
1026
  pin?: string
1027
1027
  visitkey?: string
1028
1028
  [key: string]: any
1029
1029
  }
1030
1030
  const {
1031
1031
  jdpin,
1032
1032
  pinStatus,
1033
1033
  visitkey,
1034
1034
  unionid,
1035
1035
  skey,
1036
1036
  __jda,
1037
1037
  __jdv,
1038
1038
  __wga,
1039
1039
  wxapp_type,
1040
1040
  appType
1041
1041
  } = cookie
1042
1042
  const ret: string[] = []
1043
1043
  const getUserCookieObj = {}
1044
1044
  const createUseCookieArr = [
1045
1045
  jdpin,
1046
1046
  pinStatus,
1047
1047
  visitkey,
1048
1048
  unionid,
1049
1049
  skey,
1050
1050
  __jda,
1051
1051
  __jdv,
1052
1052
  __wga,
1053
1053
  wid,
1054
1054
  wq_skey,
1055
1055
  wq_uin,
1056
1056
  wq_auth_token,
1057
1057
  wxapp_scene,
1058
1058
  wq_unionid,
1059
1059
  wxapp_openid,
1060
1060
  wxapp_version,
1061
1061
  wxapp_type,
1062
1062
  appType
1063
1063
  name = name === 'jdpin' ? 'pin' : name;
1064
1064
  name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
1065
1065
  ret.push(`${name}=${encodeURIComponent(value)}`)
1066
1066
  getUserCookieObj[name] = value
1067
1067
  }
1068
1068
  })
1069
1069
  return {
1070
1070
  wqCookieStr: ret.join(';'),
1071
1071
  wqCookie: getUserCookieObj,
1072
1072
  }
1073
1073
  num,
1074
1074
  widthSize = 375,
1075
1075
  layoutWidth = windowWidth,
1076
1076
  const getNum = Number(num)
1077
1077
  return Math.round((getNum / widthSize) * layoutWidth)
1078
1078
  let checkState = false
1079
1079
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
1080
1080
  if (couponFloorModuleType === FloorModuleType.COUPON) {
1081
1081
  try {
1082
1082
  const dataDefines = getFloorDataToDataDefines(floorData)
1083
1083
  const couponDataDefine = dataDefines
1084
1084
  ? dataDefines.filter((item) => {
1085
1085
  return item.type === 'coupon'
1086
1086
  })
1087
1087
  : [],
1088
1088
  couponList = couponDataDefine[0]?.nodeText?.data
1089
1089
  ? couponDataDefine[0]?.nodeText?.data
1090
1090
  : [],
1091
1091
  couponLength = couponList.length,
1092
1092
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
1093
1093
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
1094
1094
  : 0
1095
1095
  if (numShowPerLine === 0 && couponLength > 3) {
1096
1096
  checkState = true
1097
1097
  }
1098
1098
  } catch (e) {
1099
1099
  checkState = false
1100
1100
  }
1101
1101
  return checkState
1102
1102
  }
1103
1103
  containers = [],
1104
1104
  floors = [],
1105
1105
  clearFirstContaierMarginTop = false,
1106
1106
  isLuxuryShop = false,
1107
1107
  isShowNativeImmersivePlayer=false,
1108
1108
  screenHeight = null,
1109
1109
  screenWidth = null,
1110
1110
  bottomBarHeight= null
1111
1111
  } = pageData
1112
1112
  exceptionReportFn
1113
1113
  )
1114
1114
  if (getFloorData) {
1115
1115
  containerId: item.containerId,
1116
1116
  containerIndex: index,
1117
1117
  ...getFloorData,
1118
1118
  }
1119
1119
  if(getFloorData?.floorExtInfo?.floorLoadWay === 2){
1120
1120
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn)
1121
1121
  !getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1)
1122
1122
  }
1123
1123
  if(isProd && isWxMinAndWxapp){
1124
1124
  shopContentContainerListData = shopContentContainerListData.filter(
1125
1125
  (item) =>
1126
1126
  item.floors.length > 0 &&
1127
1127
  !isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData)
1128
1128
  )
1129
1129
  }
1130
1130
  shopContentContainerListData = [].concat(shopContentContainerListData)
1131
1131
  return {
1132
1132
  shopContentContainerListData,
1133
1133
  shopContentFloorListData,
1134
1134
  }
1135
1135
  const changeOpts = {
1136
1136
  title: '',
1137
1137
  icon: 'success',
1138
1138
  duration: 1500,
1139
1139
  mask: true,
1140
1140
  ...options,
1141
1141
  }
1142
1142
  if (changeOpts.title.length > 7) {
1143
1143
  showNormalToast(options)
1144
1144
  } else {
1145
1145
  Taro.showToast(changeOpts as any)
1146
1146
  }
1147
1147
  const changeOpts = {
1148
1148
  title: '',
1149
1149
  icon: 'error',
1150
1150
  duration: 1500,
1151
1151
  mask: true,
1152
1152
  ...options,
1153
1153
  }
1154
1154
  if (changeOpts.title.length > 7) {
1155
1155
  showNormalToast(options)
1156
1156
  } else {
1157
1157
  Taro.showToast(changeOpts as any)
1158
1158
  }
1159
1159
  Taro.showToast({
1160
1160
  title: '',
1161
1161
  icon: 'none',
1162
1162
  duration: 1500,
1163
1163
  mask: true,
1164
1164
  ...options,
1165
1165
  })
1166
1166
  return Taro.showLoading({
1167
1167
  title: text,
1168
1168
  })
1169
1169
  return new Promise(() => {
1170
1170
  Taro.nextTick(() => {
1171
1171
  setTimeout(() => {
1172
1172
  Taro.hideLoading(options)
1173
1173
  }, 300)
1174
1174
  })
1175
1175
  })
1176
1176
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
1177
1177
  const {
1178
1178
  tabActive = SECTION_HOME_TAB_NAME_TYPE[
1179
1179
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
1180
1180
  ],
1181
1181
  sceneId,
1182
1182
  } = query
1183
1183
  let changeTabActive = tabActive
1184
1184
  if (sceneId) {
1185
1185
  if (isH5) {
1186
1186
  if (sceneId == '1002') {
1187
1187
  changeTabActive =
1188
1188
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
1189
1189
  }
1190
1190
  else if (sceneId == '1003') {
1191
1191
  changeTabActive =
1192
1192
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
1193
1193
  }
1194
1194
  } else if (isWxMinAndWxapp) {
1195
1195
  if (sceneId == '1001' || sceneId == '1002') {
1196
1196
  changeTabActive =
1197
1197
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
1198
1198
  }
1199
1199
  else if (sceneId == '1003') {
1200
1200
  changeTabActive =
1201
1201
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
1202
1202
  }
1203
1203
  }
1204
1204
  }
1205
1205
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
1206
1206
  return {
1207
1207
  menuType: SHOP_MENU_ID_TYPE.HOME,
1208
1208
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
1209
1209
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
1210
1210
  }
1211
1211
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
1212
1212
  return {
1213
1213
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
1214
1214
  tabActiveType: 0,
1215
1215
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
1216
1216
  }
1217
1217
  } else {
1218
1218
  return {
1219
1219
  menuType: SHOP_MENU_ID_TYPE.HOME,
1220
1220
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
1221
1221
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
1222
1222
  }
1223
1223
  }
1224
1224
  const deleteKeyList = [
1225
1225
  '$taroTimestamp',
1226
1226
  'cookie',
1227
1227
  'wdref',
1228
1228
  'navStart',
1229
1229
  'originOpts',
1230
1230
  'originParams',
1231
1231
  'originUrl',
1232
1232
  'referer',
1233
1233
  'stamp',
1234
1234
  ]
1235
1235
  let changeQueryData: any = { ...queryData }
1236
1236
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
1237
1237
  const sceneQuery =
1238
1238
  qrCodeScene && typeof qrCodeScene == 'string'
1239
1239
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
1240
1240
  : {}
1241
1241
  changeQueryData = { ...changeQueryData, ...sceneQuery }
1242
1242
  deleteKeyList.forEach((key) => {
1243
1243
  changeQueryData[key] && delete changeQueryData[key]
1244
1244
  })
1245
1245
  changeQueryData['shopid'] &&
1246
1246
  (changeQueryData['shopId'] = changeQueryData['shopid']) &&
1247
1247
  delete changeQueryData['shopid']
1248
1248
  changeQueryData['venderid'] &&
1249
1249
  (changeQueryData['venderId'] = changeQueryData['venderid']) &&
1250
1250
  delete changeQueryData['venderid']
1251
1251
  changeQueryData['vendorId'] &&
1252
1252
  (changeQueryData['venderId'] = changeQueryData['vendorId']) &&
1253
1253
  delete changeQueryData['vendorId']
1254
1254
  return changeQueryData
1255
1255
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
1256
1256
  const modularPackResultObj = formatPackResult(modularPackResult)
1257
1257
  const bundleUrl = getBundleUrl(modularPackResultObj)
1258
1258
  const bundleFileName = getBundleFileName(modularPackResultObj)
1259
1259
  if (bundleUrl && bundleFileName) {
1260
1260
  isUsable = true
1261
1261
  }
1262
1262
  floorIdx: floorData?.floorIdx,
1263
1263
  uid: floorData?.uid,
1264
1264
  shopId: floorData?.floorExtInfo?.shopId,
1265
1265
  moduleId: floorData?.moduleId,
1266
1266
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
1267
1267
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
1268
1268
  floorKind: floorData?.floorExtInfo?.floorKind,
1269
1269
  middleTemplateId: floorData?.middleTemplateId,
1270
1270
  modularPackResult: modularPackResult,
1271
1271
  const objContainer = containerListData.find(
1272
1272
  (item) => item.containerId === containerId,
1273
1273
  )
1274
1274
  return (
1275
1275
  objContainer?.includeUids?.some((itemUid) => {
1276
1276
  const objectFloor = floorListData.find(
1277
1277
  (floorItem) => itemUid === floorItem.uid,
1278
1278
  )
1279
1279
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
1280
1280
  }) ?? false
1281
1281
  )
1282
1282
  floorListData,
1283
1283
  containerListData,
1284
1284
  exceptionReportFn?,
1285
1285
  const unableIsvFloorListData = floorListData.filter(
1286
1286
  (floorItem) =>
1287
1287
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
1288
1288
  !isIsvFloorUseable(floorItem, exceptionReportFn),
1289
1289
  )
1290
1290
  const unableIsvFloorUidList = unableIsvFloorListData.map(
1291
1291
  (floorItem) => floorItem.uid,
1292
1292
  )
1293
1293
  const unableIsvContainerListData = containerListData.filter(
1294
1294
  (item) =>
1295
1295
  item.includeUids &&
1296
1296
  item.includeUids.every(
1297
1297
  (itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1,
1298
1298
  ),
1299
1299
  )
1300
1300
  return unableIsvContainerListData
1301
1301
  return -2
1302
1302
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl)
1303
1303
  let getParams = false
1304
1304
  if (isOpenJdAppUrl(openAppUrl)) {
1305
1305
  try {
1306
1306
  getParams = openAppUrl.replace(
1307
1307
  /openApp\.jdMobile:\/\/virtual\?params=/i,
1308
1308
  '',
1309
1309
  )
1310
1310
  getParams = JSON.parse(String(getParams))
1311
1311
  } catch (e) {
1312
1312
  console.log(e)
1313
1313
  }
1314
1314
  }
1315
1315
  return getParams
1316
1316
  return `openapp.jdmobile://virtual?params=${JSON.stringify(Object.assign({}, openParams))}`
1317
1317
  if (val === null || val === '' || typeof val === 'undefined') {
1318
1318
  return true
1319
1319
  }
1320
1320
  return false
1321
1321
  const {
1322
1322
  moduleId = 'none',
1323
1323
  entrance = 'none',
1324
1324
  sourceType = 'none',
1325
1325
  sourceValue = 'none',
1326
1326
  } = params
1327
1327
  if (isIosDevice) {
1328
1328
  return `${moduleId}#${entrance}`
1329
1329
  } else if (isAndroidDevice) {
1330
1330
  return `${sourceType}#${sourceValue}`
1331
1331
  }
1332
1332
  return 'none#none'
1333
1333
  if (data && typeof data === 'object') {
1334
1334
  let getOpenAppData = { ...data }
1335
1335
  try {
1336
1336
  const { sourceInfo, designerId, templateId, source } = getOpenAppData
1337
1337
  if (designerId && templateId) {
1338
1338
  getOpenAppData = Object.assign({}, getOpenAppData, {
1339
1339
  sourceInfo: {
1340
1340
  entrance: '设计师预览',
1341
1341
  },
1342
1342
  })
1343
1343
  } else if (sourceInfo) {
1344
1344
  const { entrance } = sourceInfo
1345
1345
  getOpenAppData.sourceInfo.entrance =
1346
1346
  entrance && entrance.length > 0 ? entrance : '其他'
1347
1347
  } else if (source && !sourceInfo) {
1348
1348
  if (typeof source === 'object') {
1349
1349
  const { sourceType, entrance, sourceValue, moduleId } = source
1350
1350
  getOpenAppData = Object.assign({}, getOpenAppData, {
1351
1351
  sourceInfo: {
1352
1352
  entrance: sourceType || entrance || '其他',
1353
1353
  moduleId: sourceValue || moduleId || '-100',
1354
1354
  },
1355
1355
  })
1356
1356
  } else {
1357
1357
  getOpenAppData = Object.assign({}, getOpenAppData, {
1358
1358
  sourceInfo: {
1359
1359
  entrance: source,
1360
1360
  },
1361
1361
  })
1362
1362
  }
1363
1363
  } else {
1364
1364
  getOpenAppData = Object.assign({}, getOpenAppData, {
1365
1365
  sourceInfo: {
1366
1366
  entrance: '其他',
1367
1367
  },
1368
1368
  })
1369
1369
  }
1370
1370
  } catch (e) {
1371
1371
  console.log(e)
1372
1372
  }
1373
1373
  return getOpenAppData
1374
1374
  }
1375
1375
  return data
1376
1376
  return displayObj
1377
1377
  isMin,
1378
1378
  isJdMinAndHarmony,
1379
1379
  isChartH5,
1380
1380
  isH5AndJdShopViewH5Scroll,
1381
1381
  isH5AndJdShopH5CustomScrollView,
1382
1382
  isMemberPage,
1383
1383
  sgmCustomReport,
1384
1384
  isOpenJdAppUrl,
1385
1385
  jdOpenAppParams,
1386
1386
  createJdOpenAppUrl,
1387
1387
  dealJdOpenAppData,
1388
1388
  isEmpty,
1389
1389
  getJdAppReportPageSource,
1390
1390
  isPc,
1391
1391
  ipLoc_djd,
1392
1392
  jdAppVersionCompare,
1393
1393
  dealNativePixelToCssPixel,
1394
1394
  isAppStowShop