@conecli/cone-render 0.10.1-shop3.1 → 0.10.1-shop3.100

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