@conecli/cone-render 0.9.1-shop2.3 → 0.9.1-shop2.30

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 (113) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/assets/icon_blue_info.svg +1 -0
  3. package/dist/common/const.ts +1 -1
  4. package/dist/common/environmentType.ts +1 -0
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.ts +1 -0
  10. package/dist/common/jssdk.ts +1 -0
  11. package/dist/common/pageType.ts +1 -0
  12. package/dist/common/sgmCustomCode.ts +1 -0
  13. package/dist/common/token/index.h5.ts +1 -1
  14. package/dist/common/token/token.jd.ts +1 -1
  15. package/dist/common/token/token.ts +1 -1
  16. package/dist/common/wxappApi.jd.ts +1 -0
  17. package/dist/components/ErrorBoundary.tsx +1 -1
  18. package/dist/components/base/CountDown/index.tsx +1 -1
  19. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  20. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  21. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  22. package/dist/components/base/CustomVideo/common.ts +1 -0
  23. package/dist/components/base/CustomVideo/index.tsx +1 -1
  24. package/dist/components/base/Dialog/index.module.scss +5 -0
  25. package/dist/components/base/Dialog/index.tsx +1 -1
  26. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  28. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  29. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  30. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  31. package/dist/components/base/InViewRender/index.tsx +1 -1
  32. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  33. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  34. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  35. package/dist/components/base/LazyLoadImage/index.h5.module.scss +23 -20
  36. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  37. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  38. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  39. package/dist/components/base/NetworkDataError/const.ts +1 -1
  40. package/dist/components/base/NetworkDataError/index.module.scss +7 -0
  41. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  42. package/dist/components/base/Price/Base/index.tsx +1 -1
  43. package/dist/components/base/Price/Double/index.tsx +1 -1
  44. package/dist/components/base/Price/index.tsx +1 -1
  45. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  46. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  47. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  48. package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
  49. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  50. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  51. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  52. package/dist/components/floorItem.jd.tsx +1 -1
  53. package/dist/components/floorItem.tsx +1 -1
  54. package/dist/components/floorItem.weapp.tsx +1 -1
  55. package/dist/components/isv/Floor/index.tsx +1 -1
  56. package/dist/components/remoteFloorItem.tsx +1 -1
  57. package/dist/interface/common.ts +1 -1
  58. package/dist/interface/component.ts +1 -1
  59. package/dist/interface/jumpEventReport.ts +1 -1
  60. package/dist/interface/service.ts +1 -1
  61. package/dist/interface/utils.ts +1 -1
  62. package/dist/jumpEventReport/base.ts +1 -1
  63. package/dist/jumpEventReport/const.ts +1 -1
  64. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  65. package/dist/jumpEventReport/index.h5.ts +1 -1
  66. package/dist/jumpEventReport/index.jd.ts +1 -1
  67. package/dist/jumpEventReport/index.weapp.ts +1 -1
  68. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  69. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  70. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  71. package/dist/jumpEventReport/web/report.ts +1 -1
  72. package/dist/jumpEventReport/web.base.ts +1 -1
  73. package/dist/jumpEventReport/web.jd.ts +1 -1
  74. package/dist/jumpEventReport/web.jdb.ts +1 -1
  75. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  76. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  77. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  78. package/dist/jumpEventReport/web.tjm.ts +1 -0
  79. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  80. package/dist/modules/ContainerFloorList/index.h5.module.scss +18 -1
  81. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  82. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  83. package/dist/open/api/device.ts +1 -1
  84. package/dist/open/api/environment.ts +1 -1
  85. package/dist/open/api/index.ts +1 -1
  86. package/dist/open/api/jump copy.ts +1 -1
  87. package/dist/open/api/request.ts +1 -1
  88. package/dist/open/api/shopMember.ts +1 -1
  89. package/dist/open/api/track.ts +1 -1
  90. package/dist/open/api/util.ts +1 -1
  91. package/dist/open/components/index.ts +1 -1
  92. package/dist/sass/app.h5.scss +49 -3
  93. package/dist/sass/base.scss +57 -0
  94. package/dist/service/fetchGateway.ts +1 -1
  95. package/dist/service/http/colorSign.ts +1 -1
  96. package/dist/service/http/const.ts +1 -1
  97. package/dist/service/http/h5Http.ts +1 -0
  98. package/dist/service/http/index.h5.ts +1 -0
  99. package/dist/service/requestServer.h5.ts +1 -0
  100. package/dist/service/requestServer.ts +1 -1
  101. package/dist/utils/connectNativeJsBridge.ts +1 -1
  102. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  103. package/dist/utils/draExceptionAndProfile.ts +1 -1
  104. package/dist/utils/h5Utils.ts +1 -1
  105. package/dist/utils/index.h5.ts +1 -1
  106. package/dist/utils/index.ts +1 -1
  107. package/dist/utils/index.weapp.ts +1 -1
  108. package/dist/utils/jm-common.js +1 -1
  109. package/dist/utils/sgmCodeUtils.ts +1 -0
  110. package/dist/utils/taroRenderUtil.ts +1 -1
  111. package/dist/utils/utils.ts +1 -1
  112. package/package.json +1 -1
  113. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -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
  if(!imgUrl.includes('360buyimg.com')){
104
103
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
105
104
  }
106
105
  if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
107
106
  count: number,
108
107
  fixedNum = 2,
109
108
  unit = '万',
110
109
  maxNum = 10000,
111
110
  count = Number(count)
112
111
  if (count > maxNum) {
113
112
  return (count / maxNum).toFixed(fixedNum) + unit
114
113
  }
115
114
  return count
116
115
  key: string,
117
116
  value: string | object,
118
117
  successBack?: any,
119
118
  failBack?: any,
120
119
  return Taro.setStorage({
121
120
  key: key,
122
121
  data: value,
123
122
  success: successBack,
124
123
  fail: failBack,
125
124
  })
126
125
  return Taro.getStorageSync(key)
127
126
  return Taro.removeStorage({
128
127
  key: key,
129
128
  })
130
129
  return Taro.clearStorage()
131
130
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
132
131
  platform: '',
133
132
  model: '',
134
133
  system: '',
135
134
  }
136
135
  const isIOS = !!systemInfo.system.match(/ios/i)
137
136
  const isAndroid = !!systemInfo.system.match(/android/i)
138
137
  if (!systemInfo.statusBarHeight) {
139
138
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20
140
139
  systemInfo.navBarExtendHeight = 0
141
140
  } else {
142
141
  if (isIOS) {
143
142
  systemInfo.navBarExtendHeight = 4
144
143
  } else {
145
144
  systemInfo.navBarExtendHeight = 0
146
145
  }
147
146
  }
148
147
  let rect = Taro.getMenuButtonBoundingClientRect
149
148
  ? Taro.getMenuButtonBoundingClientRect()
150
149
  : null
151
150
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
152
151
  let gap = 0
153
152
  let width = 96
154
153
  if (systemInfo.platform === 'android') {
155
154
  gap = 8
156
155
  width = 96
157
156
  } else if (systemInfo.platform === 'devtools') {
158
157
  if (isIOS) {
159
158
  gap = 5.5
160
159
  } else {
161
160
  gap = 7.5
162
161
  }
163
162
  } else {
164
163
  gap = 4
165
164
  width = 88
166
165
  }
167
166
  rect = {
168
167
  bottom: systemInfo.statusBarHeight + gap + 32,
169
168
  height: 32,
170
169
  left: systemInfo.windowWidth - width - 10,
171
170
  right: systemInfo.windowWidth - 10,
172
171
  top: systemInfo.statusBarHeight + gap,
173
172
  width,
174
173
  }
175
174
  }
176
175
  const gap = rect.top - systemInfo.statusBarHeight
177
176
  systemInfo.navBarTopToStatusBar = gap
178
177
  systemInfo.navBarHeight = 2 * gap + rect.height
179
178
  systemInfo.capsulePosition = rect
180
179
  systemInfo.isIOS = isIOS
181
180
  systemInfo.isAndroid = isAndroid
182
181
  return systemInfo
183
182
  if (str.match(/^\/\//)) {
184
183
  str = 'https:' + str
185
184
  }
186
185
  return str
187
186
  dateTimeOrdate: Date | string | number | null,
188
187
  format = 'yyyy-MM-dd HH:mm:ss',
189
188
  noPadStart = {
190
189
  M: '0',
191
190
  d: '0',
192
191
  H: '0',
193
192
  m: '0',
194
193
  s: '0',
195
194
  },
196
195
  let dateResult = ''
197
196
  const padStarts = Object.assign(
198
197
  {
199
198
  M: '0',
200
199
  d: '0',
201
200
  H: '0',
202
201
  m: '0',
203
202
  s: '0',
204
203
  },
205
204
  noPadStart,
206
205
  )
207
206
  if (dateTimeOrdate) {
208
207
  let changeDateTimeOrdate = dateTimeOrdate
209
208
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
210
209
  if (getChangeDateTimeToNumber) {
211
210
  changeDateTimeOrdate = getChangeDateTimeToNumber
212
211
  } else {
213
212
  changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/')
214
213
  }
215
214
  const nowDate =
216
215
  dateTimeOrdate instanceof Date
217
216
  ? dateTimeOrdate
218
217
  : new Date(changeDateTimeOrdate)
219
218
  const dateMap = {
220
219
  y: `${nowDate.getFullYear()}`,
221
220
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
222
221
  d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
223
222
  H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
224
223
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
225
224
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
226
225
  }
227
226
  const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
228
227
  const regYear = new RegExp('y')
229
228
  dateResult = format.replace(regDate, (v) => {
230
229
  let changeValue = v
231
230
  if (regYear.test(changeValue)) {
232
231
  const thisYear = dateMap.y
233
232
  const subValueLen = 4 - changeValue.length
234
233
  changeValue = thisYear.substr(subValueLen)
235
234
  } else {
236
235
  const dateKey = v.substr(0, 1)
237
236
  changeValue = dateMap[dateKey]
238
237
  }
239
238
  return changeValue
240
239
  })
241
240
  }
242
241
  return dateResult
243
242
  let timer: any = null
244
243
  let startTime = Date.now()
245
244
  return function () {
246
245
  const curTime = Date.now()
247
246
  const remaining = delay - (curTime - startTime)
248
247
  const context = this
249
248
  const args = arguments
250
249
  clearTimeout(timer)
251
250
  if (remaining <= 0) {
252
251
  func.apply(context, args)
253
252
  startTime = Date.now()
254
253
  } else {
255
254
  timer = setTimeout(func, remaining)
256
255
  }
257
256
  }
258
257
  let context, args, result
259
258
  let timeout = null
260
259
  let previous = 0
261
260
  if (!options) options = {}
262
261
  const later = function () {
263
262
  previous = options.leading === false ? 0 : Date.now()
264
263
  timeout = null
265
264
  result = func.apply(context, args)
266
265
  if (!timeout) context = args = null
267
266
  }
268
267
  return function () {
269
268
  const now = Date.now()
270
269
  if (!previous && options.leading === false) previous = now
271
270
  const remaining = wait - (now - previous)
272
271
  context = this
273
272
  args = arguments
274
273
  if (remaining <= 0 || remaining > wait) {
275
274
  if (timeout) {
276
275
  clearTimeout(timeout)
277
276
  timeout = null
278
277
  }
279
278
  previous = now
280
279
  result = func.apply(context, args)
281
280
  if (!timeout) context = args = null
282
281
  } else if (!timeout && options.trailing !== false) {
283
282
  timeout = setTimeout(later, remaining)
284
283
  }
285
284
  return result
286
285
  }
287
286
  let timer: any = null
288
287
  return function () {
289
288
  const context: any = this
290
289
  const args = arguments
291
290
  timer && clearTimeout(timer)
292
291
  timer = setTimeout(function () {
293
292
  fn.apply(context, args)
294
293
  }, delay)
295
294
  }
296
295
  if (txt) {
297
296
  txt = txt.trim()
298
297
  const reg = new RegExp(/[\d-]+/)
299
298
  const res = reg.exec(txt)
300
299
  if (res && res.length > 0) {
301
300
  let tel = res[0]
302
301
  if (tel && delSeparator) {
303
302
  tel = tel.replace(/-/g, '')
304
303
  }
305
304
  return tel
306
305
  }
307
306
  }
308
307
  return ''
309
308
  if (rgb) {
310
309
  const reg = /^(rgb|RGB)/
311
310
  const color = rgb
312
311
  if (reg.test(color)) {
313
312
  let strHex = '#'
314
313
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
315
314
  for (let i = 0; i < colorArr.length; i++) {
316
315
  let hex = Number(colorArr[i]).toString(16)
317
316
  if (hex === '0') {
318
317
  hex += hex
319
318
  }
320
319
  strHex += hex
321
320
  }
322
321
  return strHex
323
322
  } else {
324
323
  return String(color)
325
324
  }
326
325
  } else {
327
326
  return ''
328
327
  }
329
328
  if (hex) {
330
329
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
331
330
  let color = hex.toLowerCase()
332
331
  if (reg.test(color)) {
333
332
  if (color.length === 4) {
334
333
  let colorNew = '#'
335
334
  for (let i = 1; i < 4; i += 1) {
336
335
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
337
336
  }
338
337
  color = colorNew
339
338
  }
340
339
  const colorChange: number[] = []
341
340
  for (let i = 1; i < 7; i += 2) {
342
341
  colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
343
342
  }
344
343
  if (returnList) {
345
344
  return colorChange
346
345
  } else {
347
346
  return 'RGB(' + colorChange.join(',') + ')'
348
347
  }
349
348
  } else {
350
349
  return color
351
350
  }
352
351
  } else {
353
352
  return ''
354
353
  }
355
354
  n: number,
356
355
  m: number,
357
356
  filterNum: number | undefined = undefined,
358
357
  const c = m - n + 1
359
358
  const res = Math.floor(Math.random() * c + n)
360
359
  if (filterNum && filterNum == res) {
361
360
  console.log('随机数二次开始', res, filterNum)
362
361
  return getRandom(n, m, filterNum)
363
362
  } else {
364
363
  return res
365
364
  }
366
365
  wqCookieStr: string
367
366
  wqCookie: {
368
367
  pin?: string
369
368
  visitkey?: string
370
369
  [key: string]: any
371
370
  }
372
371
  const {
373
372
  jdpin,
374
373
  pinStatus,
375
374
  visitkey,
376
375
  unionid,
377
376
  skey,
378
377
  __jda,
379
378
  __jdv,
380
379
  __wga,
381
380
  wxapp_type,
382
381
  appType
383
382
  } = cookie
384
383
  const ret: string[] = []
385
384
  const getUserCookieObj = {}
386
385
  const createUseCookieArr = [
387
386
  jdpin,
388
387
  pinStatus,
389
388
  visitkey,
390
389
  unionid,
391
390
  skey,
392
391
  __jda,
393
392
  __jdv,
394
393
  __wga,
395
394
  wid,
396
395
  wq_skey,
397
396
  wq_uin,
398
397
  wq_auth_token,
399
398
  wxapp_scene,
400
399
  wq_unionid,
401
400
  wxapp_openid,
402
401
  wxapp_version,
403
402
  wxapp_type,
404
403
  appType
405
404
  name = name === 'jdpin' ? 'pin' : name;
406
405
  name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
407
406
  ret.push(`${name}=${encodeURIComponent(value)}`)
408
407
  getUserCookieObj[name] = value
409
408
  }
410
409
  })
411
410
  return {
412
411
  wqCookieStr: ret.join(';'),
413
412
  wqCookie: getUserCookieObj,
414
413
  }
415
414
  num,
416
415
  widthSize = 375,
417
416
  layoutWidth = windowWidth,
418
417
  const getNum = Number(num)
419
418
  return Math.round((getNum / widthSize) * layoutWidth)
420
419
  let checkState = false
421
420
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
422
421
  if (couponFloorModuleType === FloorModuleType.COUPON) {
423
422
  try {
424
423
  const dataDefines = getFloorDataToDataDefines(floorData)
425
424
  const couponDataDefine = dataDefines
426
425
  ? dataDefines.filter((item) => {
427
426
  return item.type === 'coupon'
428
427
  })
429
428
  : [],
430
429
  couponList = couponDataDefine[0]?.nodeText?.data
431
430
  ? couponDataDefine[0]?.nodeText?.data
432
431
  : [],
433
432
  couponLength = couponList.length,
434
433
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
435
434
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
436
435
  : 0
437
436
  if (numShowPerLine === 0 && couponLength > 3) {
438
437
  checkState = true
439
438
  }
440
439
  } catch (e) {
441
440
  checkState = false
442
441
  }
443
442
  return checkState
444
443
  }
445
444
  exceptionReportFn
446
445
  if(getFloorData?.floorExtInfo?.floorLoadWay === 2){
447
446
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn)
448
447
  !getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1)
449
448
  }
450
449
  if(isProd && isWxMinAndWxapp){
451
450
  shopContentContainerListData = shopContentContainerListData.filter(
452
451
  (item) =>
453
452
  item.floors.length > 0 &&
454
453
  !isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData)
455
454
  )
456
455
  }
457
456
  shopContentContainerListData = [].concat(shopContentContainerListData)
458
457
  return {
459
458
  shopContentContainerListData,
460
459
  shopContentFloorListData,
461
460
  }
462
461
  const changeOpts = {
463
462
  title: '',
464
463
  icon: 'success',
465
464
  duration: 1500,
466
465
  mask: true,
467
466
  ...options,
468
467
  }
469
468
  if (changeOpts.title.length > 7) {
470
469
  showNormalToast(options)
471
470
  } else {
472
471
  Taro.showToast(changeOpts as any)
473
472
  }
474
473
  const changeOpts = {
475
474
  title: '',
476
475
  icon: 'error',
477
476
  duration: 1500,
478
477
  mask: true,
479
478
  ...options,
480
479
  }
481
480
  if (changeOpts.title.length > 7) {
482
481
  showNormalToast(options)
483
482
  } else {
484
483
  Taro.showToast(changeOpts as any)
485
484
  }
486
485
  Taro.showToast({
487
486
  title: '',
488
487
  icon: 'none',
489
488
  duration: 1500,
490
489
  mask: true,
491
490
  ...options,
492
491
  })
493
492
  return Taro.showLoading({
494
493
  title: text,
495
494
  })
496
495
  return new Promise(() => {
497
496
  Taro.nextTick(() => {
498
497
  setTimeout(() => {
499
498
  Taro.hideLoading(options)
500
499
  }, 300)
501
500
  })
502
501
  })
503
502
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
504
503
  const {
505
504
  tabActive = SECTION_HOME_TAB_NAME_TYPE[
506
505
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
507
506
  ],
508
507
  sceneId,
509
508
  } = query
510
509
  let changeTabActive = tabActive
511
510
  if (sceneId) {
512
511
  if (isH5) {
513
512
  if (sceneId == '1002') {
514
513
  changeTabActive =
515
514
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
516
515
  }
517
516
  else if (sceneId == '1003') {
518
517
  changeTabActive =
519
518
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
520
519
  }
521
520
  } else if (isWxMinAndWxapp) {
522
521
  if (sceneId == '1001' || sceneId == '1002') {
523
522
  changeTabActive =
524
523
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
525
524
  }
526
525
  else if (sceneId == '1003') {
527
526
  changeTabActive =
528
527
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
529
528
  }
530
529
  }
531
530
  }
532
531
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
533
532
  return {
534
533
  menuType: SHOP_MENU_ID_TYPE.HOME,
535
534
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
536
535
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
537
536
  }
538
537
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
539
538
  return {
540
539
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
541
540
  tabActiveType: 0,
542
541
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
543
542
  }
544
543
  } else {
545
544
  return {
546
545
  menuType: SHOP_MENU_ID_TYPE.HOME,
547
546
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
548
547
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
549
548
  }
550
549
  }
551
550
  const deleteKeyList = [
552
551
  '$taroTimestamp',
553
552
  'cookie',
554
553
  'wdref',
555
554
  'navStart',
556
555
  'originOpts',
557
556
  'originParams',
558
557
  'originUrl',
559
558
  'referer',
560
559
  'stamp',
561
560
  ]
562
561
  let changeQueryData: any = { ...queryData }
563
562
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
564
563
  const sceneQuery =
565
564
  qrCodeScene && typeof qrCodeScene == 'string'
566
565
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
567
566
  : {}
568
567
  changeQueryData = { ...changeQueryData, ...sceneQuery }
569
568
  deleteKeyList.forEach((key) => {
570
569
  changeQueryData[key] && delete changeQueryData[key]
571
570
  })
572
571
  changeQueryData['shopid'] &&
573
572
  (changeQueryData['shopId'] = changeQueryData['shopid']) &&
574
573
  delete changeQueryData['shopid']
575
574
  changeQueryData['venderid'] &&
576
575
  (changeQueryData['venderId'] = changeQueryData['venderid']) &&
577
576
  delete changeQueryData['venderid']
578
577
  changeQueryData['vendorId'] &&
579
578
  (changeQueryData['venderId'] = changeQueryData['vendorId']) &&
580
579
  delete changeQueryData['vendorId']
581
580
  return changeQueryData
582
581
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
583
582
  const modularPackResultObj = formatPackResult(modularPackResult)
584
583
  const bundleUrl = getBundleUrl(modularPackResultObj)
585
584
  const bundleFileName = getBundleFileName(modularPackResultObj)
586
585
  if (bundleUrl && bundleFileName) {
587
586
  isUsable = true
588
587
  }
589
588
  const objContainer = containerListData.find(
590
589
  (item) => item.containerId === containerId,
591
590
  )
592
591
  return (
593
592
  objContainer?.includeUids?.some((itemUid) => {
594
593
  const objectFloor = floorListData.find(
595
594
  (floorItem) => itemUid === floorItem.uid,
596
595
  )
597
596
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
598
597
  }) ?? false
599
598
  )
600
599
  floorListData,
601
600
  containerListData,
602
601
  exceptionReportFn?,
603
602
  const unableIsvFloorListData = floorListData.filter(
604
603
  (floorItem) =>
605
604
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
606
605
  !isIsvFloorUseable(floorItem, exceptionReportFn),
607
606
  )
608
607
  const unableIsvFloorUidList = unableIsvFloorListData.map(
609
608
  (floorItem) => floorItem.uid,
610
609
  )
611
610
  const unableIsvContainerListData = containerListData.filter(
612
611
  (item) =>
613
612
  item.includeUids &&
614
613
  item.includeUids.every(
615
614
  (itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1,
616
615
  ),
617
616
  )
618
617
  return unableIsvContainerListData
619
618
  return customObj
620
619
  isChartH5,
621
620
  isH5AndJdShopViewH5Scroll,
622
621
  isMemberPage,
623
622
  isPc,
624
623
  ipLoc_djd,
624
+ import Taro from "@tarojs/taro";
625
625
  SHOP_MENU_ID_TYPE,
626
626
  SHOP_MENU_ID_QUERY_NAME,
627
627
  SECTION_HOME_TAB_TYPE,
628
628
  SECTION_HOME_TAB_NAME_TYPE,
629
629
  SECTION_HOME_TAB_QUERY_TYPE,
630
630
  CHANNEL_TYPE,
631
631
  JDShopViewBusinessPathType,
632
632
  FloorModuleType,
633
633
  RemoteLoadFloorList,
634
634
  FLOOR_KIND,
635
635
  getBundleUrl,
636
636
  getBundleFileName,
637
637
  formatPackResult,
638
638
  getTaroVersion,
639
639
  SgmCustomCode,
640
640
  NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG,
641
641
  key: string,
642
642
  value: string | object,
643
643
  successBack?: any,
644
644
  failBack?: any,
645
645
  try{
646
646
  if(isH5 && window && !window.localStorage){
647
647
  console.log(`setTaroStorage key:${key} window.localStorage不存在:`);
648
648
  return Promise.resolve(null);
649
649
  }
650
650
  return Taro.setStorage({
651
651
  key: key,
652
652
  data: value,
653
653
  success: successBack,
654
654
  fail: failBack,
655
655
  }).catch((e) => {
656
656
  console.log(`setTaroStorage key:${key} 报错:`, e);
657
657
  return null;
658
658
  });
659
659
  }
660
660
  catch(e){
661
661
  console.log(`setTaroStorage key:${key} 报错:`, e)
662
662
  return Promise.resolve(null)
663
663
  }
664
664
  try {
665
665
  if (isH5 && window && !window.localStorage) {
666
666
  console.log(
667
667
  `getTaroStorageKeyValue key:${key} window.localStorage不存在:`,
668
668
  )
669
669
  return Promise.resolve(null)
670
670
  }
671
671
  return Taro.getStorageSync(key)
672
672
  } catch (e) {
673
673
  console.log(`getTaroStorageKeyValue key:${key} 报错:`, e)
674
674
  return null
675
675
  }
676
676
  try {
677
677
  if (isH5 && window && !window.localStorage) {
678
678
  console.log(`removeTaroStorageKey key:${key} window.localStorage不存在:`)
679
679
  return Promise.resolve(null)
680
680
  }
681
681
  return Taro.removeStorage({
682
682
  key: key,
683
683
  }).catch(e => {
684
684
  console.log(`removeTaroStorageKey key:${key} 报错:`, e)
685
685
  })
686
686
  } catch (e) {
687
687
  console.log(`removeTaroStorageKey key:${key} 报错:`, e)
688
688
  }
689
689
  try {
690
690
  if (isH5 && window && !window.localStorage) {
691
691
  console.log(`clearTaroStorageKey window.localStorage不存在`)
692
692
  return Promise.resolve(null)
693
693
  }
694
694
  return Taro.clearStorage().catch(e => {
695
695
  console.log('clearTaroStorageKey报错:', e)
696
696
  })
697
697
  } catch (e) {
698
698
  console.log('clearTaroStorageKey报错:', e)
699
699
  }
700
700
  let hasChecked = false
701
701
  if (isH5) {
702
702
  const avifCache = getTaroStorageKeyValue(KEY_AVIF)
703
703
  if (avifCache === null || avifCache === '' || forceUpdate) {
704
704
  hasChecked = true
705
705
  const img = new Image()
706
706
  img.onload = function() {
707
707
  if (img.height > 0 && img.width > 0) {
708
708
  setTaroStorage(KEY_AVIF, '1')
709
709
  } else {
710
710
  setTaroStorage(KEY_AVIF, '0')
711
711
  }
712
712
  }
713
713
  img.onerror = () => {
714
714
  setTaroStorage(KEY_AVIF, '0')
715
715
  }
716
716
  img.src =
717
717
  'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A='
718
718
  }
719
719
  const webpCache = getTaroStorageKeyValue(KEY_WEBP)
720
720
  if (webpCache === null || webpCache === '' || forceUpdate) {
721
721
  hasChecked = true
722
722
  const img = new Image()
723
723
  img.onload = function() {
724
724
  if (img.height > 0 && img.width > 0) {
725
725
  setTaroStorage(KEY_WEBP, '1')
726
726
  } else {
727
727
  setTaroStorage(KEY_WEBP, '0')
728
728
  }
729
729
  }
730
730
  img.onerror = () => {
731
731
  setTaroStorage(KEY_WEBP, '0')
732
732
  }
733
733
  img.src =
734
734
  'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA='
735
735
  }
736
736
  }
737
737
  return hasChecked
738
738
  const hasChecked = imageFormatSupport(false)
739
739
  if (!hasChecked) {
740
740
  setTimeout(imageFormatSupport, 5000)
741
741
  }
742
742
  const resultList: Array<any> = [],
743
743
  arrLen = arr.length
744
744
  if (arrLen) {
745
745
  if (arrLen > size) {
746
746
  for (let i = 0; i < arrLen; i = i + size) {
747
747
  resultList.push(arr.slice(i, i + size))
748
748
  }
749
749
  } else {
750
750
  resultList.push(arr)
751
751
  }
752
752
  }
753
753
  return resultList
754
754
  let _address = ids;
755
755
  const _areaAreaSplit = ids.split(".");
756
756
  const _areaAreaSplit2 = ids.split("_");
757
757
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
758
758
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
759
759
  return _address;
760
760
  let paramStr = ''
761
761
  obj &&
762
762
  Object.keys(obj).forEach((key, index) => {
763
763
  const getValue = `${obj[key]}`
764
764
  .replace(/undefined/, '')
765
765
  .replace(/null/, '')
766
766
  paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(
767
767
  getValue,
768
768
  )}`
769
769
  })
770
770
  return paramStr
771
771
  const result = {};
772
772
  if (
773
773
  !urlOrQueryStr ||
774
774
  ("string" !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
775
775
  ) {
776
776
  return result;
777
777
  }
778
778
  if (urlOrQueryStr.indexOf("?") > -1) {
779
779
  const queryStr = urlOrQueryStr.split("?");
780
780
  const queryItemList =
781
781
  queryStr && queryStr.length > 1 ? queryStr[1].split("&") : [];
782
782
  const queryItemListLen = queryItemList.length;
783
783
  queryItemListLen > 0 &&
784
784
  queryItemList.forEach(item => {
785
785
  const thisItemList = item.split('=')
786
786
  result[thisItemList[0]] = thisItemList[1]
787
787
  })
788
788
  } else {
789
789
  const queryItemList =
790
790
  urlOrQueryStr.indexOf("&") > -1
791
791
  ? urlOrQueryStr.split("&")
792
792
  : [urlOrQueryStr];
793
793
  const queryItemListLen = queryItemList.length;
794
794
  queryItemListLen > 0 &&
795
795
  queryItemList.forEach(item => {
796
796
  const thisItemList = item.split('=')
797
797
  result[thisItemList[0]] = thisItemList[1]
798
798
  })
799
799
  }
800
800
  return result;
801
801
  url: string,
802
802
  size?: {
803
803
  w: number;
804
804
  h: number;
805
805
  },
806
806
  quality?: number
807
807
  if (url && size) {
808
808
  const _w = Math.floor(size.w);
809
809
  const _h = Math.floor(size.h);
810
810
  if (url.match(/gif$/i)) {
811
811
  return url;
812
812
  } else {
813
813
  if (_w > 0 && _h > 0) {
814
814
  url = url.replace("jfs/", `s${_w}x${_h}_jfs/`);
815
815
  }
816
816
  url += quality != null ? `!q${quality}.dpg` : ".dpg";
817
817
  }
818
818
  }
819
819
  return url;
820
820
  url: string,
821
821
  jfsImgInfo: UtilsInterFace.getJfsImageInfo = {}
822
822
  if (url.match(/\.(jpg|png|dpg)$/i)) {
823
823
  const { width, height, quality } = jfsImgInfo;
824
824
  if (typeof width === "number" || typeof height === "number") {
825
825
  url = url.replace(
826
826
  "/jfs/",
827
827
  `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`
828
828
  );
829
829
  }
830
830
  if (
831
831
  typeof quality === "number" &&
832
832
  quality > 0 &&
833
833
  quality < 100 &&
834
834
  url.match(/\.jpg$/i)
835
835
  ) {
836
836
  url += `!q${quality}.dpg`;
837
837
  }
838
838
  }
839
839
  return addHttps(url);
840
840
  if (imgUrl) {
841
841
  if (
842
842
  !imgUrl.match(
843
843
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
844
844
  )
845
845
  ) {
846
846
  if (!imgUrl.includes('360buyimg.com')) {
847
847
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
848
848
  }
849
849
  if (quality != 100)
850
850
  imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
851
851
  }
852
852
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl
853
853
  }
854
854
  return imgUrl
855
855
  const result = value % step
856
856
  return result === 0 ? value : Math.ceil(value / step) * step
857
857
  const MAX = 3.5
858
858
  return Math.min(window?.devicePixelRatio ?? 2, MAX)
859
859
  isSkuImage: boolean
860
860
  size: number
861
861
  imgUrl: string,
862
862
  options: QualityOptions,
863
863
  isIgnoreOptimizeFromServer: boolean = false,
864
864
  if (!imgUrl) {
865
865
  console.error(
866
866
  'The input parameter imageUrl for the getQualityImage() cannot be empty!',
867
867
  )
868
868
  return imgUrl
869
869
  }
870
870
  if (isIgnoreOptimizeFromServer) {
871
871
  imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1')
872
872
  }
873
873
  if (!/^((https?):)?\/\//.test(imgUrl)) {
874
874
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
875
875
  }
876
876
  const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i
877
877
  if (!imgServerRegExp.test(imgUrl)) {
878
878
  return imgUrl
879
879
  }
880
880
  imgUrl = /^\/\//.test(imgUrl) ? `https:${imgUrl}` : imgUrl
881
881
  const { isSkuImage, size } = options || {}
882
882
  const needReduceSize = isSkuImage && size
883
883
  if (needReduceSize) {
884
884
  const devicePixelRatio = getDevicePixelRatio()
885
885
  const useWidth = getValueByStep(size * devicePixelRatio, 40)
886
886
  imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useWidth}_jfs/`)
887
887
  }
888
888
  const needCompress = !global?.info?.pageInfo?.isVipShop
889
889
  const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/)
890
890
  if (needCompress && result) {
891
891
  if (getAvifSupport() === '1') {
892
892
  imgUrl += '.avif'
893
893
  } else if (getWebpSupport() === '1') {
894
894
  imgUrl += '.webp'
895
895
  } else if (/jpe?g/.test(result[1])) {
896
896
  imgUrl += '!q80'
897
897
  }
898
898
  }
899
899
  if (needReduceSize) {
900
900
  imgUrl += '!z2'
901
901
  }
902
902
  return imgUrl
903
903
  if (imgUrl) {
904
904
  if (
905
905
  !imgUrl.match(
906
906
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
907
907
  )
908
908
  ) {
909
909
  if (!imgUrl.includes('360buyimg.com')) {
910
910
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
911
911
  }
912
912
  if (quality != 100)
913
913
  imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
914
914
  }
915
915
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl
916
916
  }
917
917
  return imgUrl
918
918
  return getTaroStorageKeyValue(KEY_AVIF) || '0'
919
919
  return getTaroStorageKeyValue(KEY_WEBP) || '0'
920
920
  count: number,
921
921
  fixedNum = 1,
922
922
  unit = '万',
923
923
  maxNum = 10000,
924
924
  count = Number(count)
925
925
  const getMaxNum = count > 100000000 ? 100000000 : maxNum
926
926
  const getUnit = count > 100000000 ? '亿' : unit
927
927
  if (count >= getMaxNum) {
928
928
  return (count / getMaxNum).toFixed(fixedNum) + getUnit
929
929
  }
930
930
  return count
931
931
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
932
932
  platform: '',
933
933
  model: '',
934
934
  system: '',
935
935
  }
936
936
  const isIOS = !!systemInfo.system.match(/ios/i)
937
937
  const isAndroid = !!systemInfo.system.match(/android/i)
938
938
  if (!systemInfo.statusBarHeight) {
939
939
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20
940
940
  systemInfo.navBarExtendHeight = 0
941
941
  } else {
942
942
  if (isIOS) {
943
943
  systemInfo.navBarExtendHeight = 4
944
944
  } else {
945
945
  systemInfo.navBarExtendHeight = 0
946
946
  }
947
947
  }
948
948
  let rect = Taro.getMenuButtonBoundingClientRect
949
949
  ? Taro.getMenuButtonBoundingClientRect()
950
950
  : null
951
951
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
952
952
  let gap = 0
953
953
  let width = 96
954
954
  if (systemInfo.platform === 'android') {
955
955
  gap = 8
956
956
  width = 96
957
957
  } else if (systemInfo.platform === 'devtools') {
958
958
  if (isIOS) {
959
959
  gap = 5.5
960
960
  } else {
961
961
  gap = 7.5
962
962
  }
963
963
  } else {
964
964
  gap = 4
965
965
  width = 88
966
966
  }
967
967
  rect = {
968
968
  bottom: systemInfo.statusBarHeight + gap + 32,
969
969
  height: 32,
970
970
  left: systemInfo.windowWidth - width - 10,
971
971
  right: systemInfo.windowWidth - 10,
972
972
  top: systemInfo.statusBarHeight + gap,
973
973
  width,
974
974
  }
975
975
  }
976
976
  const gap = rect.top - systemInfo.statusBarHeight
977
977
  systemInfo.navBarTopToStatusBar = gap
978
978
  systemInfo.navBarHeight = 2 * gap + rect.height
979
979
  systemInfo.capsulePosition = rect
980
980
  systemInfo.isIOS = isIOS
981
981
  systemInfo.isAndroid = isAndroid
982
982
  return systemInfo
983
983
  if (str.match(/^\/\//)) {
984
984
  str = "https:" + str;
985
985
  }
986
986
  return str;
987
987
  dateTimeOrdate: Date | string | number | null,
988
988
  format = "yyyy-MM-dd HH:mm:ss",
989
989
  noPadStart = {
990
990
  M: "0",
991
991
  d: "0",
992
992
  H: "0",
993
993
  m: "0",
994
994
  s: "0",
995
995
  }
996
996
  let dateResult = "";
997
997
  const padStarts = Object.assign(
998
998
  {
999
999
  M: "0",
1000
1000
  d: "0",
1001
1001
  H: "0",
1002
1002
  m: "0",
1003
1003
  s: "0",
1004
1004
  },
1005
1005
  noPadStart
1006
1006
  );
1007
1007
  if (dateTimeOrdate) {
1008
1008
  let changeDateTimeOrdate = dateTimeOrdate;
1009
1009
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
1010
1010
  if (getChangeDateTimeToNumber) {
1011
1011
  changeDateTimeOrdate = getChangeDateTimeToNumber;
1012
1012
  } else {
1013
1013
  changeDateTimeOrdate = `${changeDateTimeOrdate}`
1014
1014
  .replace(/-/g, '/')
1015
1015
  .replace(/\./g, '/')
1016
1016
  }
1017
1017
  const nowDate =
1018
1018
  dateTimeOrdate instanceof Date
1019
1019
  ? dateTimeOrdate
1020
1020
  : new Date(changeDateTimeOrdate);
1021
1021
  const dateMap = {
1022
1022
  y: `${nowDate.getFullYear()}`,
1023
1023
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts["M"]),
1024
1024
  d: `${nowDate.getDate()}`.padStart(2, padStarts["d"]),
1025
1025
  H: `${nowDate.getHours()}`.padStart(2, padStarts["H"]),
1026
1026
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts["m"]),
1027
1027
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts["s"]),
1028
1028
  };
1029
1029
  const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
1030
1030
  const regYear = new RegExp('y')
1031
1031
  dateResult = format.replace(regDate, v => {
1032
1032
  let changeValue = v
1033
1033
  if (regYear.test(changeValue)) {
1034
1034
  const thisYear = dateMap.y;
1035
1035
  const subValueLen = 4 - changeValue.length;
1036
1036
  changeValue = thisYear.substr(subValueLen);
1037
1037
  } else {
1038
1038
  const dateKey = v.substr(0, 1);
1039
1039
  changeValue = dateMap[dateKey];
1040
1040
  }
1041
1041
  return changeValue;
1042
1042
  });
1043
1043
  }
1044
1044
  return dateResult;
1045
1045
  let timer: any = null
1046
1046
  let startTime = Date.now()
1047
1047
  return function() {
1048
1048
  const curTime = Date.now()
1049
1049
  const remaining = delay - (curTime - startTime)
1050
1050
  const context = this;
1051
1051
  const args = arguments;
1052
1052
  clearTimeout(timer);
1053
1053
  if (remaining <= 0) {
1054
1054
  func.apply(context, args);
1055
1055
  startTime = Date.now();
1056
1056
  } else {
1057
1057
  timer = setTimeout(func, remaining);
1058
1058
  }
1059
1059
  };
1060
1060
  let context, args, result
1061
1061
  let timeout = null
1062
1062
  let previous = 0
1063
1063
  if (!options) options = {}
1064
1064
  const later = function() {
1065
1065
  previous = options.leading === false ? 0 : Date.now()
1066
1066
  timeout = null
1067
1067
  result = func.apply(context, args)
1068
1068
  if (!timeout) context = args = null
1069
1069
  }
1070
1070
  return function() {
1071
1071
  const now = Date.now()
1072
1072
  if (!previous && options.leading === false) previous = now
1073
1073
  const remaining = wait - (now - previous)
1074
1074
  context = this;
1075
1075
  args = arguments;
1076
1076
  if (remaining <= 0 || remaining > wait) {
1077
1077
  if (timeout) {
1078
1078
  clearTimeout(timeout);
1079
1079
  timeout = null;
1080
1080
  }
1081
1081
  previous = now;
1082
1082
  result = func.apply(context, args);
1083
1083
  if (!timeout) context = args = null;
1084
1084
  } else if (!timeout && options.trailing !== false) {
1085
1085
  timeout = setTimeout(later, remaining);
1086
1086
  }
1087
1087
  return result;
1088
1088
  };
1089
1089
  let timer: any = null;
1090
1090
  return function() {
1091
1091
  const context: any = this;
1092
1092
  const args = arguments;
1093
1093
  timer && clearTimeout(timer);
1094
1094
  timer = setTimeout(function() {
1095
1095
  fn.apply(context, args)
1096
1096
  }, delay)
1097
1097
  }
1098
1098
  if (txt) {
1099
1099
  txt = txt.trim();
1100
1100
  const reg = new RegExp(/[\d-]+/);
1101
1101
  const res = reg.exec(txt);
1102
1102
  if (res && res.length > 0) {
1103
1103
  let tel = res[0];
1104
1104
  if (tel && delSeparator) {
1105
1105
  tel = tel.replace(/-/g, "");
1106
1106
  }
1107
1107
  return tel;
1108
1108
  }
1109
1109
  }
1110
1110
  return "";
1111
1111
  if (rgb) {
1112
1112
  const reg = /^(rgb|RGB)/;
1113
1113
  const color = rgb;
1114
1114
  if (reg.test(color)) {
1115
1115
  let strHex = "#";
1116
1116
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
1117
1117
  for (let i = 0; i < colorArr.length; i++) {
1118
1118
  let hex = Number(colorArr[i]).toString(16);
1119
1119
  if (hex === "0") {
1120
1120
  hex += hex;
1121
1121
  }
1122
1122
  strHex += hex;
1123
1123
  }
1124
1124
  return strHex;
1125
1125
  } else {
1126
1126
  return String(color);
1127
1127
  }
1128
1128
  } else {
1129
1129
  return "";
1130
1130
  }
1131
1131
  if (hex) {
1132
1132
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
1133
1133
  let color = hex.toLowerCase();
1134
1134
  if (reg.test(color)) {
1135
1135
  if (color.length === 4) {
1136
1136
  let colorNew = "#";
1137
1137
  for (let i = 1; i < 4; i += 1) {
1138
1138
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
1139
1139
  }
1140
1140
  color = colorNew;
1141
1141
  }
1142
1142
  const colorChange: number[] = [];
1143
1143
  for (let i = 1; i < 7; i += 2) {
1144
1144
  colorChange.push(parseInt("0x" + color.slice(i, i + 2)));
1145
1145
  }
1146
1146
  if (returnList) {
1147
1147
  return colorChange;
1148
1148
  } else {
1149
1149
  return "RGB(" + colorChange.join(",") + ")";
1150
1150
  }
1151
1151
  } else {
1152
1152
  return color;
1153
1153
  }
1154
1154
  } else {
1155
1155
  return "";
1156
1156
  }
1157
1157
  n: number,
1158
1158
  m: number,
1159
1159
  filterNum: number | undefined = undefined
1160
1160
  const c = m - n + 1;
1161
1161
  const res = Math.floor(Math.random() * c + n);
1162
1162
  if (filterNum && filterNum == res) {
1163
1163
  console.log("随机数二次开始", res, filterNum);
1164
1164
  return getRandom(n, m, filterNum);
1165
1165
  } else {
1166
1166
  return res;
1167
1167
  }
1168
1168
  wqCookieStr: string;
1169
1169
  wqCookie: {
1170
1170
  pin?: string;
1171
1171
  visitkey?: string;
1172
1172
  [key: string]: any;
1173
1173
  };
1174
1174
  const {
1175
1175
  jdpin,
1176
1176
  pinStatus,
1177
1177
  visitkey,
1178
1178
  unionid,
1179
1179
  skey,
1180
1180
  __jda,
1181
1181
  __jdv,
1182
1182
  __wga,
1183
1183
  wid,
1184
1184
  wq_skey,
1185
1185
  wq_uin,
1186
1186
  wq_auth_token,
1187
1187
  wxapp_scene,
1188
1188
  wq_unionid,
1189
1189
  wxapp_openid,
1190
1190
  wxapp_version,
1191
1191
  wxapp_type,
1192
1192
  appType,
1193
1193
  } = cookie
1194
1194
  const ret: string[] = []
1195
1195
  const getUserCookieObj = {}
1196
1196
  const createUseCookieArr = [
1197
1197
  jdpin,
1198
1198
  pinStatus,
1199
1199
  visitkey,
1200
1200
  unionid,
1201
1201
  skey,
1202
1202
  __jda,
1203
1203
  __jdv,
1204
1204
  __wga,
1205
1205
  wid,
1206
1206
  wq_skey,
1207
1207
  wq_uin,
1208
1208
  wq_auth_token,
1209
1209
  wxapp_scene,
1210
1210
  wq_unionid,
1211
1211
  wxapp_openid,
1212
1212
  wxapp_version,
1213
1213
  wxapp_type,
1214
1214
  appType,
1215
1215
  ]
1216
1216
  createUseCookieArr.forEach(keyItem => {
1217
1217
  if (keyItem && keyItem['name']) {
1218
1218
  let { name, value } = keyItem
1219
1219
  name = name === 'jdpin' ? 'pin' : name
1220
1220
  name === 'pin' && ret.push(`pt_pin=${encodeURIComponent(value)}`)
1221
1221
  ret.push(`${name}=${encodeURIComponent(value)}`)
1222
1222
  getUserCookieObj[name] = value
1223
1223
  }
1224
1224
  });
1225
1225
  return {
1226
1226
  wqCookieStr: ret.join(";"),
1227
1227
  wqCookie: getUserCookieObj,
1228
1228
  };
1229
1229
  num,
1230
1230
  widthSize = 375,
1231
1231
  layoutWidth = windowWidth
1232
1232
  const getNum = Number(num);
1233
1233
  return Math.round((getNum / widthSize) * layoutWidth);
1234
1234
  let checkState = false
1235
1235
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
1236
1236
  if (couponFloorModuleType === FloorModuleType.COUPON) {
1237
1237
  try {
1238
1238
  const dataDefines = getFloorDataToDataDefines(floorData);
1239
1239
  const couponDataDefine = dataDefines
1240
1240
  ? dataDefines.filter(item => {
1241
1241
  return item.type === 'coupon'
1242
1242
  })
1243
1243
  : [],
1244
1244
  couponList = couponDataDefine[0]?.nodeText?.data
1245
1245
  ? couponDataDefine[0]?.nodeText?.data
1246
1246
  : [],
1247
1247
  couponLength = couponList.length,
1248
1248
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
1249
1249
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
1250
1250
  : 0;
1251
1251
  if (numShowPerLine === 0 && couponLength > 3) {
1252
1252
  checkState = true;
1253
1253
  }
1254
1254
  } catch (e) {
1255
1255
  checkState = false;
1256
1256
  }
1257
1257
  return checkState;
1258
1258
  }
1259
1259
  const {
1260
1260
  containers = [],
1261
1261
  floors = [],
1262
1262
  clearFirstContaierMarginTop = false,
1263
1263
  } = pageData
1264
1264
  console.log('dealShopContentData:', pageData, 'isvdev:', isvdev)
1265
1265
  const getThisTimeKey = Date.now()
1266
1266
  let shopContentContainerListData = containers?.filter(
1267
1267
  item => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
1268
1268
  )
1269
1269
  const shopContentFloorListData = floors?.filter(
1270
1270
  ({ floorPosition }) =>
1271
1271
  (!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') ||
1272
1272
  isvdev,
1273
1273
  )
1274
1274
  const unableIsvContainerListData = getUnableIsvContainerListData(
1275
1275
  shopContentFloorListData,
1276
1276
  shopContentContainerListData,
1277
1277
  exceptionReportFn,
1278
1278
  )
1279
1279
  shopContentContainerListData.forEach((item, index) => {
1280
1280
  item.key = `${getThisTimeKey + index}`
1281
1281
  item.floors = []
1282
1282
  item.includeUids &&
1283
1283
  item.includeUids.forEach(floorUid => {
1284
1284
  const getFloorData = shopContentFloorListData.find(
1285
1285
  floorItem => floorItem.uid === floorUid,
1286
1286
  )
1287
1287
  if (getFloorData) {
1288
1288
  const changeFloorData = {
1289
1289
  containerId: item.containerId,
1290
1290
  containerIndex: index,
1291
1291
  ...getFloorData,
1292
1292
  }
1293
1293
  const getCheckMoreCouponState = checkCouponAndChangeContainerSetData(
1294
1294
  getFloorData,
1295
1295
  )
1296
1296
  if (getCheckMoreCouponState) {
1297
1297
  item.marginLeft && (item.marginLeft = 0)
1298
1298
  item.marginRight && (item.marginRight = 0)
1299
1299
  item.borderRadius && (item.borderRadius = 0)
1300
1300
  }
1301
1301
  if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
1302
1302
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(
1303
1303
  getFloorData,
1304
1304
  exceptionReportFn,
1305
1305
  )
1306
1306
  !getSysFloorToLoadTypeRes &&
1307
1307
  (getFloorData.floorExtInfo.floorLoadWay = 1)
1308
1308
  }
1309
1309
  item.floors.push(changeFloorData)
1310
1310
  }
1311
1311
  })
1312
1312
  if (
1313
1313
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
1314
1314
  item?.containerPosition == 'content' &&
1315
1315
  item?.marginBottom > 0 &&
1316
1316
  !clearFirstContaierMarginTop
1317
1317
  ) {
1318
1318
  item.marginTop = item.marginBottom
1319
1319
  }
1320
1320
  })
1321
1321
  shopContentContainerListData = shopContentContainerListData.filter(
1322
1322
  item =>
1323
1323
  item.floors.length > 0 &&
1324
1324
  unableIsvContainerListData.every(
1325
1325
  containerItem => containerItem.containerId != item.containerId,
1326
1326
  ),
1327
1327
  )
1328
1328
  console.log(
1329
1329
  'dealShopContentData isWxMinAndWxapp:',
1330
1330
  isWxMinAndWxapp,
1331
1331
  'weappJumpToH5:',
1332
1332
  pageData?.homeExtInfo?.weappJumpToH5,
1333
1333
  )
1334
1334
  if (isProd && isWxMinAndWxapp) {
1335
1335
  shopContentContainerListData = shopContentContainerListData.filter(
1336
1336
  item =>
1337
1337
  item.floors.length > 0 &&
1338
1338
  !isIsvContainer(
1339
1339
  item.containerId,
1340
1340
  shopContentFloorListData,
1341
1341
  shopContentContainerListData,
1342
1342
  ),
1343
1343
  )
1344
1344
  }
1345
1345
  shopContentContainerListData = [].concat(shopContentContainerListData);
1346
1346
  return {
1347
1347
  shopContentContainerListData,
1348
1348
  shopContentFloorListData,
1349
1349
  };
1350
1350
  const changeOpts = {
1351
1351
  title: "",
1352
1352
  icon: "success",
1353
1353
  duration: 1500,
1354
1354
  mask: true,
1355
1355
  ...options,
1356
1356
  };
1357
1357
  if (changeOpts.title.length > 7) {
1358
1358
  showNormalToast(options);
1359
1359
  } else {
1360
1360
  Taro.showToast(changeOpts as any);
1361
1361
  }
1362
1362
  const changeOpts = {
1363
1363
  title: "",
1364
1364
  icon: "error",
1365
1365
  duration: 1500,
1366
1366
  mask: true,
1367
1367
  ...options,
1368
1368
  };
1369
1369
  if (changeOpts.title.length > 7) {
1370
1370
  showNormalToast(options);
1371
1371
  } else {
1372
1372
  Taro.showToast(changeOpts as any);
1373
1373
  }
1374
1374
  Taro.showToast({
1375
1375
  title: "",
1376
1376
  icon: "none",
1377
1377
  duration: 1500,
1378
1378
  mask: true,
1379
1379
  ...options,
1380
1380
  });
1381
1381
  return Taro.showLoading({
1382
1382
  title: text,
1383
1383
  });
1384
1384
  return new Promise(() => {
1385
1385
  Taro.nextTick(() => {
1386
1386
  setTimeout(() => {
1387
1387
  Taro.hideLoading(options);
1388
1388
  }, 300);
1389
1389
  });
1390
1390
  });
1391
1391
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
1392
1392
  const {
1393
1393
  tabActive = SECTION_HOME_TAB_NAME_TYPE[
1394
1394
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
1395
1395
  ],
1396
1396
  sceneId,
1397
1397
  } = query;
1398
1398
  let changeTabActive = tabActive;
1399
1399
  if (sceneId) {
1400
1400
  if (isH5) {
1401
1401
  if (sceneId == "1002") {
1402
1402
  changeTabActive =
1403
1403
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1404
1404
  }
1405
1405
  else if (sceneId == "1003") {
1406
1406
  changeTabActive =
1407
1407
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
1408
1408
  }
1409
1409
  } else if (isWxMinAndWxapp) {
1410
1410
  if (sceneId == "1001" || sceneId == "1002") {
1411
1411
  changeTabActive =
1412
1412
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1413
1413
  }
1414
1414
  else if (sceneId == "1003") {
1415
1415
  changeTabActive =
1416
1416
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
1417
1417
  }
1418
1418
  }
1419
1419
  }
1420
1420
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
1421
1421
  return {
1422
1422
  menuType: SHOP_MENU_ID_TYPE.HOME,
1423
1423
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
1424
1424
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
1425
1425
  };
1426
1426
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
1427
1427
  return {
1428
1428
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
1429
1429
  tabActiveType: 0,
1430
1430
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
1431
1431
  };
1432
1432
  } else {
1433
1433
  return {
1434
1434
  menuType: SHOP_MENU_ID_TYPE.HOME,
1435
1435
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
1436
1436
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
1437
1437
  };
1438
1438
  }
1439
1439
  const deleteKeyList = [
1440
1440
  '$taroTimestamp',
1441
1441
  'cookie',
1442
1442
  'wdref',
1443
1443
  'navStart',
1444
1444
  'originOpts',
1445
1445
  'originParams',
1446
1446
  'originUrl',
1447
1447
  'referer',
1448
1448
  'stamp',
1449
1449
  'hybrid',
1450
1450
  'sr',
1451
1451
  'navh',
1452
1452
  'stath',
1453
1453
  ]
1454
1454
  let changeQueryData: any = { ...queryData }
1455
1455
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
1456
1456
  const sceneQuery =
1457
1457
  qrCodeScene && typeof qrCodeScene == "string"
1458
1458
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
1459
1459
  : {}
1460
1460
  changeQueryData = { ...changeQueryData, ...sceneQuery }
1461
1461
  deleteKeyList.forEach(key => {
1462
1462
  changeQueryData[key] && delete changeQueryData[key]
1463
1463
  })
1464
1464
  changeQueryData['shopid'] &&
1465
1465
  (changeQueryData['shopId'] = changeQueryData['shopid']) &&
1466
1466
  delete changeQueryData['shopid']
1467
1467
  changeQueryData['venderid'] &&
1468
1468
  (changeQueryData['venderId'] = changeQueryData['venderid']) &&
1469
1469
  delete changeQueryData['venderid']
1470
1470
  changeQueryData['vendorId'] &&
1471
1471
  (changeQueryData['venderId'] = changeQueryData['vendorId']) &&
1472
1472
  delete changeQueryData['vendorId']
1473
1473
  changeQueryData['shopId'] &&
1474
1474
  changeQueryData['shopId'] === 'undefined' &&
1475
1475
  delete changeQueryData['shopId']
1476
1476
  changeQueryData['venderId'] &&
1477
1477
  changeQueryData['venderId'] === 'undefined' &&
1478
1478
  delete changeQueryData['venderId']
1479
1479
  return changeQueryData
1480
1480
  let isUsable = false
1481
1481
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
1482
1482
  const modularPackResultObj = formatPackResult(modularPackResult)
1483
1483
  const bundleUrl = getBundleUrl(modularPackResultObj)
1484
1484
  const bundleFileName = getBundleFileName(modularPackResultObj)
1485
1485
  const taroVersion = getTaroVersion(modularPackResultObj)
1486
1486
  if (bundleUrl && bundleFileName) {
1487
1487
  isUsable = true;
1488
1488
  }
1489
1489
  if (!isUsable && typeof exceptionReportFn === 'function') {
1490
1490
  exceptionReportFn({
1491
1491
  code: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${
1492
1492
  floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE
1493
1493
  ? SgmCustomCode.SYSTEMPDCMODULE_DATA
1494
1494
  : SgmCustomCode.REMOTEMODULE_DATA
1495
1495
  }`,
1496
1496
  msg: {
1497
1497
  msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
1498
1498
  floorIdx: floorData?.floorIdx,
1499
1499
  uid: floorData?.uid,
1500
1500
  shopId: floorData?.floorExtInfo?.shopId,
1501
1501
  moduleId: floorData?.moduleId,
1502
1502
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
1503
1503
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
1504
1504
  floorKind: floorData?.floorExtInfo?.floorKind,
1505
1505
  middleTemplateId: floorData?.middleTemplateId,
1506
1506
  modularPackResult: {
1507
1507
  bundleUrl,
1508
1508
  taroVersion,
1509
1509
  },
1510
1510
  },
1511
1511
  })
1512
1512
  }
1513
1513
  return isUsable
1514
1514
  const objContainer = containerListData.find(
1515
1515
  item => item.containerId === containerId,
1516
1516
  )
1517
1517
  return (
1518
1518
  objContainer?.includeUids?.some(itemUid => {
1519
1519
  const objectFloor = floorListData.find(
1520
1520
  floorItem => itemUid === floorItem.uid,
1521
1521
  )
1522
1522
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
1523
1523
  }) ?? false
1524
1524
  );
1525
1525
  floorListData,
1526
1526
  containerListData,
1527
1527
  exceptionReportFn?
1528
1528
  const unableIsvFloorListData = floorListData.filter(
1529
1529
  floorItem =>
1530
1530
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
1531
1531
  !isIsvFloorUseable(floorItem, exceptionReportFn)
1532
1532
  );
1533
1533
  const unableIsvFloorUidList = unableIsvFloorListData.map(
1534
1534
  floorItem => floorItem.uid,
1535
1535
  )
1536
1536
  const unableIsvContainerListData = containerListData.filter(
1537
1537
  item =>
1538
1538
  item.includeUids &&
1539
1539
  item.includeUids.every(
1540
1540
  itemUid => unableIsvFloorUidList.indexOf(itemUid) != -1,
1541
1541
  ),
1542
1542
  )
1543
1543
  return unableIsvContainerListData;
1544
1544
  return -2;
1545
1545
  return customObj
1546
1546
  return customObj
1547
1547
  return customObj
1548
1548
  return customObj
1549
1549
  return customObj
1550
1550
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl)
1551
1551
  let getParams = false
1552
1552
  if (isOpenJdAppUrl(openAppUrl)) {
1553
1553
  try {
1554
1554
  getParams = openAppUrl.replace(
1555
1555
  /openApp\.jdMobile:\/\/virtual\?params=/i,
1556
1556
  ""
1557
1557
  );
1558
1558
  getParams = JSON.parse(String(getParams));
1559
1559
  } catch (e) {
1560
1560
  console.log(e);
1561
1561
  }
1562
1562
  }
1563
1563
  return getParams;
1564
1564
  const getLastParams = Object.assign({}, openParams)
1565
1565
  return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`
1566
1566
  if (val === null || val === '' || typeof val === 'undefined') {
1567
1567
  return true
1568
1568
  }
1569
1569
  return false;
1570
1570
  const {
1571
1571
  moduleId = "none",
1572
1572
  entrance = "none",
1573
1573
  sourceType = "none",
1574
1574
  sourceValue = "none",
1575
1575
  } = params;
1576
1576
  if (isIosDevice) {
1577
1577
  return `${moduleId}#${entrance}`;
1578
1578
  } else if (isAndroidDevice) {
1579
1579
  return `${sourceType}#${sourceValue}`;
1580
1580
  }
1581
1581
  return "none#none";
1582
1582
  if (data && typeof data === 'object') {
1583
1583
  let getOpenAppData = { ...data }
1584
1584
  try {
1585
1585
  const { sourceInfo, designerId, templateId, source } = getOpenAppData;
1586
1586
  if (designerId && templateId) {
1587
1587
  getOpenAppData = Object.assign({}, getOpenAppData, {
1588
1588
  sourceInfo: {
1589
1589
  entrance: "设计师预览",
1590
1590
  },
1591
1591
  });
1592
1592
  } else if (sourceInfo) {
1593
1593
  const { entrance } = sourceInfo;
1594
1594
  getOpenAppData.sourceInfo.entrance =
1595
1595
  entrance && entrance.length > 0 ? entrance : "其他";
1596
1596
  } else if (source && !sourceInfo) {
1597
1597
  if (typeof source === "object") {
1598
1598
  const { sourceType, entrance, sourceValue, moduleId } = source;
1599
1599
  getOpenAppData = Object.assign({}, getOpenAppData, {
1600
1600
  sourceInfo: {
1601
1601
  entrance: sourceType || entrance || "其他",
1602
1602
  moduleId: sourceValue || moduleId || "-100",
1603
1603
  },
1604
1604
  });
1605
1605
  } else {
1606
1606
  getOpenAppData = Object.assign({}, getOpenAppData, {
1607
1607
  sourceInfo: {
1608
1608
  entrance: source,
1609
1609
  },
1610
1610
  });
1611
1611
  }
1612
1612
  } else {
1613
1613
  getOpenAppData = Object.assign({}, getOpenAppData, {
1614
1614
  sourceInfo: {
1615
1615
  entrance: "其他",
1616
1616
  },
1617
1617
  });
1618
1618
  }
1619
1619
  } catch (e) {
1620
1620
  console.log(e);
1621
1621
  }
1622
1622
  return getOpenAppData;
1623
1623
  }
1624
1624
  return data;
1625
1625
  return displayObj
1626
1626
  if (typeof input === 'string') {
1627
1627
  try {
1628
1628
  return JSON.parse(input)
1629
1629
  } catch (e) {
1630
1630
  console.error('JSON解析失败', e)
1631
1631
  return {}
1632
1632
  }
1633
1633
  }
1634
1634
  return input || {}
1635
1635
  return false
1636
1636
  const borderStyle: { [key: string]: any } = {}
1637
1637
  if (item?.borderRadius) {
1638
1638
  let borderTopRadius = 0
1639
1639
  let borderBottomRadius = 0
1640
1640
  if (index === 0) {
1641
1641
  borderTopRadius = item.borderRadius
1642
1642
  borderBottomRadius =
1643
1643
  floorDataLen === 1 || item?.marginBottom !== 0 ? item.borderRadius : 0
1644
1644
  } else if (index === floorDataLen - 1) {
1645
1645
  borderTopRadius =
1646
1646
  floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius
1647
1647
  borderBottomRadius = item.borderRadius
1648
1648
  } else {
1649
1649
  borderTopRadius =
1650
1650
  floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius
1651
1651
  borderBottomRadius = item?.marginBottom === 0 ? 0 : item.borderRadius
1652
1652
  }
1653
1653
  borderStyle.borderTopLeftRadius = item?.borderTopLeftRadius ? `${item?.borderTopLeftRadius}px` : `${borderTopRadius}px`
1654
1654
  borderStyle.borderTopRightRadius = item?.borderTopRightRadius ? `${item?.borderTopRightRadius}px` : `${borderTopRadius}px`
1655
1655
  borderStyle.borderBottomLeftRadius = `${borderBottomRadius}px`
1656
1656
  borderStyle.borderBottomRightRadius = `${borderBottomRadius}px`
1657
1657
  borderStyle.borderTopLeftRadius = borderStyle?.borderTopLeftRadius || '0px';
1658
1658
  borderStyle.borderTopRightRadius = borderStyle?.borderTopRightRadius || '0px';
1659
1659
  borderStyle.borderBottomRightRadius = borderStyle?.borderBottomRightRadius || '0px';
1660
1660
  borderStyle.borderBottomLeftRadius = borderStyle?.borderBottomLeftRadius || '0px';
1661
1661
  return borderStyle
1662
1662
  isJdApp,
1663
1663
  isWxApp,
1664
1664
  isIosDevice,
1665
1665
  isAndroidDevice,
1666
1666
  isJdAndIosDevice,
1667
1667
  isJdAndAndroidDevice,
1668
1668
  isWxMin,
1669
1669
  isWxMinAndWxapp,
1670
1670
  isJdMin,
1671
1671
  isMin,
1672
1672
  isJdMinAndHarmony,
1673
1673
  isH5,
1674
1674
  isH5AndJdShopView,
1675
1675
  isImageOptimizeEnable,
1676
1676
  isChartH5,
1677
1677
  isH5AndJdShopViewNativeScroll,
1678
1678
  isH5AndJdShopViewH5Scroll,
1679
1679
  isH5AndJdShopH5CustomScrollView,
1680
1680
  isWxMiniH5View,
1681
1681
  sliceArrToChunkList,
1682
1682
  dealAddress,
1683
1683
  objectToUrlEncode,
1684
1684
  parseQueryUrlString,
1685
1685
  setLowSmallPicUrl,
1686
1686
  getJfsImage,
1687
1687
  getQualityImage,
1688
1688
  countStringify,
1689
1689
  setTaroStorage,
1690
1690
  getTaroStorageKeyValue,
1691
1691
  removeTaroStorageKey,
1692
1692
  clearTaroStorageKey,
1693
1693
  getSystemInfos,
1694
1694
  addHttps,
1695
1695
  dateFormat,
1696
1696
  throttle,
1697
1697
  lodashThrottle,
1698
1698
  debounce,
1699
1699
  getTelephone,
1700
1700
  rgbToHex,
1701
1701
  hexToRgb,
1702
1702
  getRandom,
1703
1703
  getWxAppCookieStr,
1704
1704
  pxTransformFromData,
1705
1705
  dealShopContentData,
1706
1706
  showSuccessToast,
1707
1707
  showFailToast,
1708
1708
  showNormalToast,
1709
1709
  showShopLoading,
1710
1710
  hideShopLoading,
1711
1711
  getAppChannelType,
1712
1712
  formatTabActiveMenuType,
1713
1713
  filterUrlQueryData,
1714
1714
  getAvifSupport,
1715
1715
  getWebpSupport,
1716
1716
  isMemberPage,
1717
1717
  sgmCustomReport,
1718
1718
  draCustomReport,
1719
1719
  remoteCustomReport,
1720
1720
  draInterfaceCustomReport,
1721
1721
  draBusinessCustomReport,
1722
1722
  isOpenJdAppUrl,
1723
1723
  jdOpenAppParams,
1724
1724
  createJdOpenAppUrl,
1725
1725
  dealJdOpenAppData,
1726
1726
  isEmpty,
1727
1727
  getJdAppReportPageSource,
1728
1728
  isAppClassifyPage,
1729
1729
  getQualityImageNew,
1730
1730
  getQualityImageOld,
1731
1731
  isPc,
1732
1732
  ipLoc_djd,
1733
1733
  jdAppVersionCompare,
1734
1734
  dealNativePixelToCssPixel,
1735
1735
  isAppStowShop,
1736
1736
  isIpadDevice,
1737
1737
  getBorderStyle,