@conecli/cone-render 0.8.38 → 0.8.40

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 (117) hide show
  1. package/README.md +7 -1
  2. package/dist/api/index.ts +1 -1
  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/common/wxappApi.ts +1 -1
  18. package/dist/components/ErrorBoundary.tsx +1 -1
  19. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  20. package/dist/components/base/CountDown/index.tsx +1 -1
  21. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  22. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  23. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  24. package/dist/components/base/CustomVideo/index.tsx +1 -1
  25. package/dist/components/base/Dialog/index.module.scss +5 -0
  26. package/dist/components/base/Dialog/index.tsx +1 -1
  27. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  28. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  29. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  30. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  31. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  32. package/dist/components/base/InViewRender/index.tsx +1 -1
  33. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  34. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  35. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  36. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  37. package/dist/components/base/LazyLoadImage/index.h5.module.scss +20 -20
  38. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  39. package/dist/components/base/MobileCommonHeader/index.module.scss +9 -0
  40. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  41. package/dist/components/base/NetworkDataError/const.ts +1 -1
  42. package/dist/components/base/NetworkDataError/index.module.scss +4 -0
  43. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  44. package/dist/components/base/Price/Double/index.tsx +1 -1
  45. package/dist/components/base/Price/index.tsx +1 -1
  46. package/dist/components/base/Skeleton/index.tsx +1 -1
  47. package/dist/components/decorate/DecorateFloorModule/index.module.scss +21 -2
  48. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  49. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  50. package/dist/components/floorItem.jd.tsx +1 -1
  51. package/dist/components/floorItem.tsx +1 -1
  52. package/dist/components/floorItem.weapp.tsx +1 -1
  53. package/dist/components/isv/Floor/index.tsx +1 -1
  54. package/dist/components/remoteFloorItem.tsx +1 -1
  55. package/dist/interface/common.ts +1 -1
  56. package/dist/interface/component.ts +1 -1
  57. package/dist/interface/jumpEventReport.ts +1 -1
  58. package/dist/interface/service.ts +1 -1
  59. package/dist/interface/utils.ts +1 -1
  60. package/dist/jumpEventReport/base.ts +1 -1
  61. package/dist/jumpEventReport/const.ts +1 -1
  62. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  63. package/dist/jumpEventReport/index.h5.ts +1 -1
  64. package/dist/jumpEventReport/index.jd.ts +1 -1
  65. package/dist/jumpEventReport/index.weapp.ts +1 -1
  66. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  67. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  68. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  69. package/dist/jumpEventReport/web/report.ts +1 -1
  70. package/dist/jumpEventReport/web.base.ts +1 -1
  71. package/dist/jumpEventReport/web.jd.ts +1 -1
  72. package/dist/jumpEventReport/web.jdb.ts +1 -1
  73. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  74. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  75. package/dist/jumpEventReport/web.pc.ts +1 -0
  76. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  77. package/dist/jumpEventReport/web.tjm.ts +1 -0
  78. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  79. package/dist/modules/ContainerFloorList/index.h5.module.scss +17 -1
  80. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  81. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  82. package/dist/open/api/environment.ts +1 -1
  83. package/dist/open/api/index.ts +1 -1
  84. package/dist/open/api/jump copy.ts +1 -1
  85. package/dist/open/api/shopMember.ts +1 -1
  86. package/dist/open/api/track.ts +1 -1
  87. package/dist/open/api/util.ts +1 -1
  88. package/dist/open/components/index.ts +1 -1
  89. package/dist/sass/app.h5.scss +39 -3
  90. package/dist/sass/base.scss +12 -0
  91. package/dist/service/fetchGateway.ts +1 -1
  92. package/dist/service/http/const.ts +1 -1
  93. package/dist/service/requestServer.ts +1 -1
  94. package/dist/utils/connectNativeJsBridge.ts +1 -1
  95. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  96. package/dist/utils/draExceptionAndProfile.ts +1 -1
  97. package/dist/utils/h5Utils.ts +1 -1
  98. package/dist/utils/index.h5.ts +1 -1
  99. package/dist/utils/index.ts +1 -1
  100. package/dist/utils/index.weapp.ts +1 -1
  101. package/dist/utils/jm-common.js +1 -1
  102. package/dist/utils/sgmCodeUtils.ts +1 -0
  103. package/dist/utils/taroRenderUtil.ts +1 -0
  104. package/dist/utils/utils.ts +1 -1
  105. package/dist/wxapp/api/helper.js +1 -0
  106. package/dist/wxapp/components/launch-app/index.js +1 -0
  107. package/dist/wxapp/components/launch-app/index.json +5 -0
  108. package/dist/wxapp/components/launch-app/index.wxml +0 -0
  109. package/dist/wxapp/components/launch-app/index.wxss +0 -0
  110. package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
  111. package/dist/wxapp/components/subscribe-guider/index.js +1 -0
  112. package/dist/wxapp/components/subscribe-guider/index.json +5 -0
  113. package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
  114. package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
  115. package/package.json +2 -1
  116. package/dist/components/base/Skeleton/old.tsx +0 -1
  117. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  const getValue = `${obj[key]}`.replace(/undefined/,'').replace(/null/,'')
3
2
  paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`
4
3
  if(!imgUrl.includes('360buyimg.com')){
5
4
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
6
5
  }
7
6
  if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
8
7
  pin?: string
9
8
  visitkey?: string
10
9
  [key: string]: any
11
10
  }
12
11
  jdpin,
13
12
  pinStatus,
14
13
  visitkey,
15
14
  unionid,
16
15
  skey,
17
16
  __jda,
18
17
  __jdv,
19
18
  __wga,
20
19
  wxapp_type,
21
20
  appType
22
21
  } = cookie
23
22
  const getUserCookieObj = {}
24
23
  jdpin,
25
24
  pinStatus,
26
25
  visitkey,
27
26
  unionid,
28
27
  skey,
29
28
  __jda,
30
29
  __jdv,
31
30
  __wga,
32
31
  wid,
33
32
  wq_skey,
34
33
  wq_uin,
35
34
  wq_auth_token,
36
35
  wxapp_scene,
37
36
  wq_unionid,
38
37
  wxapp_openid,
39
38
  wxapp_version,
40
39
  wxapp_type,
41
40
  appType
42
41
  name = name === 'jdpin' ? 'pin' : name;
43
42
  name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
44
43
  ret.push(`${name}=${encodeURIComponent(value)}`)
45
44
  getUserCookieObj[name] = value
46
45
  }
47
46
  wqCookie: getUserCookieObj
48
47
  exceptionReportFn
49
48
  const isIsvContainer = (containerId, floorListData, containerListData) => {
50
49
  const objContainer = containerListData.find(item => item.containerId === containerId)
51
50
  (itemUid) => {
52
51
  const objectFloor = floorListData.find(floorItem => itemUid === floorItem.uid)
53
52
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
54
53
  }
55
54
  )?? false
56
55
  isChartH5,
57
56
  isH5AndJdShopViewH5Scroll,
58
57
  isMemberPage,
59
58
  sgmCustomReport
59
+ import Taro from "@tarojs/taro";
60
60
  SHOP_MENU_ID_TYPE,
61
61
  SHOP_MENU_ID_QUERY_NAME,
62
62
  SECTION_HOME_TAB_TYPE,
63
63
  SECTION_HOME_TAB_NAME_TYPE,
64
64
  SECTION_HOME_TAB_QUERY_TYPE,
65
65
  CHANNEL_TYPE,
66
66
  JDShopViewBusinessPathType,
67
67
  FloorModuleType,
68
68
  RemoteLoadFloorList,
69
69
  getBundleUrl,
70
70
  getBundleFileName,
71
71
  formatPackResult,
72
72
  const resultList: Array<any> = [],
73
73
  arrLen = arr.length
74
74
  if (arrLen) {
75
75
  if (arrLen > size) {
76
76
  for (let i = 0; i < arrLen; i = i + size) {
77
77
  resultList.push(arr.slice(i, i + size))
78
78
  }
79
79
  } else {
80
80
  resultList.push(arr)
81
81
  }
82
82
  }
83
83
  return resultList
84
84
  let _address = ids;
85
85
  const _areaAreaSplit = ids.split(".");
86
86
  const _areaAreaSplit2 = ids.split("_");
87
87
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
88
88
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
89
89
  return _address;
90
90
  let paramStr = "";
91
91
  obj &&
92
92
  Object.keys(obj).forEach((key, index) => {
93
93
  const getValue = `${obj[key]}`
94
94
  .replace(/undefined/, "")
95
95
  .replace(/null/, "");
96
96
  paramStr += `${index === 0 ? "" : "&"}${key}=${encodeURIComponent(
97
97
  getValue
98
98
  )}`;
99
99
  });
100
100
  return paramStr;
101
101
  const result = {};
102
102
  if (
103
103
  !urlOrQueryStr ||
104
104
  ("string" !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
105
105
  ) {
106
106
  return result;
107
107
  }
108
108
  if (urlOrQueryStr.indexOf("?") > -1) {
109
109
  const queryStr = urlOrQueryStr.split("?");
110
110
  const queryItemList =
111
111
  queryStr && queryStr.length > 1 ? queryStr[1].split("&") : [];
112
112
  const queryItemListLen = queryItemList.length;
113
113
  queryItemListLen > 0 &&
114
114
  queryItemList.forEach((item) => {
115
115
  const thisItemList = item.split("=");
116
116
  result[thisItemList[0]] = thisItemList[1];
117
117
  });
118
118
  } else {
119
119
  const queryItemList =
120
120
  urlOrQueryStr.indexOf("&") > -1
121
121
  ? urlOrQueryStr.split("&")
122
122
  : [urlOrQueryStr];
123
123
  const queryItemListLen = queryItemList.length;
124
124
  queryItemListLen > 0 &&
125
125
  queryItemList.forEach((item) => {
126
126
  const thisItemList = item.split("=");
127
127
  result[thisItemList[0]] = thisItemList[1];
128
128
  });
129
129
  }
130
130
  return result;
131
131
  url: string,
132
132
  size?: {
133
133
  w: number;
134
134
  h: number;
135
135
  },
136
136
  quality?: number
137
137
  if (url && size) {
138
138
  const _w = Math.floor(size.w);
139
139
  const _h = Math.floor(size.h);
140
140
  if (url.match(/gif$/i)) {
141
141
  return url;
142
142
  } else {
143
143
  if (_w > 0 && _h > 0) {
144
144
  url = url.replace("jfs/", `s${_w}x${_h}_jfs/`);
145
145
  }
146
146
  url += quality != null ? `!q${quality}.dpg` : ".dpg";
147
147
  }
148
148
  }
149
149
  return url;
150
150
  url: string,
151
151
  jfsImgInfo: UtilsInterFace.getJfsImageInfo = {}
152
152
  if (url.match(/\.(jpg|png|dpg)$/i)) {
153
153
  const { width, height, quality } = jfsImgInfo;
154
154
  if (typeof width === "number" || typeof height === "number") {
155
155
  url = url.replace(
156
156
  "/jfs/",
157
157
  `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`
158
158
  );
159
159
  }
160
160
  if (
161
161
  typeof quality === "number" &&
162
162
  quality > 0 &&
163
163
  quality < 100 &&
164
164
  url.match(/\.jpg$/i)
165
165
  ) {
166
166
  url += `!q${quality}.dpg`;
167
167
  }
168
168
  }
169
169
  return addHttps(url);
170
170
  if (imgUrl) {
171
171
  if (
172
172
  !imgUrl.match(
173
173
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i
174
174
  )
175
175
  ) {
176
176
  if (!imgUrl.includes("360buyimg.com")) {
177
177
  imgUrl = "//m.360buyimg.com/cms/" + imgUrl;
178
178
  }
179
179
  if (quality != 100)
180
180
  imgUrl += /\.png/.test(imgUrl) ? ".dpg" : `!q${quality}`;
181
181
  }
182
182
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
183
183
  }
184
184
  return imgUrl;
185
185
  count: number,
186
186
  fixedNum = 2,
187
187
  unit = "万",
188
188
  maxNum = 10000
189
189
  count = Number(count);
190
190
  if (count > maxNum) {
191
191
  return (count / maxNum).toFixed(fixedNum) + unit;
192
192
  }
193
193
  return count;
194
194
  key: string,
195
195
  value: string | object,
196
196
  successBack?: any,
197
197
  failBack?: any
198
198
  return Taro.setStorage({
199
199
  key: key,
200
200
  data: value,
201
201
  success: successBack,
202
202
  fail: failBack,
203
203
  });
204
204
  return Taro.getStorageSync(key);
205
205
  return Taro.removeStorage({
206
206
  key: key,
207
207
  });
208
208
  return Taro.clearStorage();
209
209
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
210
210
  platform: "",
211
211
  model: "",
212
212
  system: "",
213
213
  };
214
214
  const isIOS = !!systemInfo.system.match(/ios/i);
215
215
  const isAndroid = !!systemInfo.system.match(/android/i);
216
216
  if (!systemInfo.statusBarHeight) {
217
217
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20;
218
218
  systemInfo.navBarExtendHeight = 0;
219
219
  } else {
220
220
  if (isIOS) {
221
221
  systemInfo.navBarExtendHeight = 4;
222
222
  } else {
223
223
  systemInfo.navBarExtendHeight = 0;
224
224
  }
225
225
  }
226
226
  let rect = Taro.getMenuButtonBoundingClientRect
227
227
  ? Taro.getMenuButtonBoundingClientRect()
228
228
  : null;
229
229
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
230
230
  let gap = 0;
231
231
  let width = 96;
232
232
  if (systemInfo.platform === "android") {
233
233
  gap = 8;
234
234
  width = 96;
235
235
  } else if (systemInfo.platform === "devtools") {
236
236
  if (isIOS) {
237
237
  gap = 5.5;
238
238
  } else {
239
239
  gap = 7.5;
240
240
  }
241
241
  } else {
242
242
  gap = 4;
243
243
  width = 88;
244
244
  }
245
245
  rect = {
246
246
  bottom: systemInfo.statusBarHeight + gap + 32,
247
247
  height: 32,
248
248
  left: systemInfo.windowWidth - width - 10,
249
249
  right: systemInfo.windowWidth - 10,
250
250
  top: systemInfo.statusBarHeight + gap,
251
251
  width,
252
252
  };
253
253
  }
254
254
  const gap = rect.top - systemInfo.statusBarHeight;
255
255
  systemInfo.navBarTopToStatusBar = gap;
256
256
  systemInfo.navBarHeight = 2 * gap + rect.height;
257
257
  systemInfo.capsulePosition = rect;
258
258
  systemInfo.isIOS = isIOS;
259
259
  systemInfo.isAndroid = isAndroid;
260
260
  return systemInfo;
261
261
  if (str.match(/^\/\//)) {
262
262
  str = "https:" + str;
263
263
  }
264
264
  return str;
265
265
  dateTimeOrdate: Date | string | number | null,
266
266
  format = "yyyy-MM-dd HH:mm:ss",
267
267
  noPadStart = {
268
268
  M: "0",
269
269
  d: "0",
270
270
  H: "0",
271
271
  m: "0",
272
272
  s: "0",
273
273
  }
274
274
  let dateResult = "";
275
275
  const padStarts = Object.assign(
276
276
  {
277
277
  M: "0",
278
278
  d: "0",
279
279
  H: "0",
280
280
  m: "0",
281
281
  s: "0",
282
282
  },
283
283
  noPadStart
284
284
  );
285
285
  if (dateTimeOrdate) {
286
286
  let changeDateTimeOrdate = dateTimeOrdate;
287
287
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
288
288
  if (getChangeDateTimeToNumber) {
289
289
  changeDateTimeOrdate = getChangeDateTimeToNumber;
290
290
  } else {
291
291
  changeDateTimeOrdate = `${changeDateTimeOrdate}`
292
292
  .replace(/-/g, "/")
293
293
  .replace(/\./g, "/");
294
294
  }
295
295
  const nowDate =
296
296
  dateTimeOrdate instanceof Date
297
297
  ? dateTimeOrdate
298
298
  : new Date(changeDateTimeOrdate);
299
299
  const dateMap = {
300
300
  y: `${nowDate.getFullYear()}`,
301
301
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts["M"]),
302
302
  d: `${nowDate.getDate()}`.padStart(2, padStarts["d"]),
303
303
  H: `${nowDate.getHours()}`.padStart(2, padStarts["H"]),
304
304
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts["m"]),
305
305
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts["s"]),
306
306
  };
307
307
  const regDate = new RegExp("y+|M+|d+|H+|m+|s+", "g");
308
308
  const regYear = new RegExp("y");
309
309
  dateResult = format.replace(regDate, (v) => {
310
310
  let changeValue = v;
311
311
  if (regYear.test(changeValue)) {
312
312
  const thisYear = dateMap.y;
313
313
  const subValueLen = 4 - changeValue.length;
314
314
  changeValue = thisYear.substr(subValueLen);
315
315
  } else {
316
316
  const dateKey = v.substr(0, 1);
317
317
  changeValue = dateMap[dateKey];
318
318
  }
319
319
  return changeValue;
320
320
  });
321
321
  }
322
322
  return dateResult;
323
323
  let timer: any = null;
324
324
  let startTime = Date.now();
325
325
  return function () {
326
326
  const curTime = Date.now();
327
327
  const remaining = delay - (curTime - startTime);
328
328
  const context = this;
329
329
  const args = arguments;
330
330
  clearTimeout(timer);
331
331
  if (remaining <= 0) {
332
332
  func.apply(context, args);
333
333
  startTime = Date.now();
334
334
  } else {
335
335
  timer = setTimeout(func, remaining);
336
336
  }
337
337
  };
338
338
  let context, args, result;
339
339
  let timeout = null;
340
340
  let previous = 0;
341
341
  if (!options) options = {};
342
342
  const later = function () {
343
343
  previous = options.leading === false ? 0 : Date.now();
344
344
  timeout = null;
345
345
  result = func.apply(context, args);
346
346
  if (!timeout) context = args = null;
347
347
  };
348
348
  return function () {
349
349
  const now = Date.now();
350
350
  if (!previous && options.leading === false) previous = now;
351
351
  const remaining = wait - (now - previous);
352
352
  context = this;
353
353
  args = arguments;
354
354
  if (remaining <= 0 || remaining > wait) {
355
355
  if (timeout) {
356
356
  clearTimeout(timeout);
357
357
  timeout = null;
358
358
  }
359
359
  previous = now;
360
360
  result = func.apply(context, args);
361
361
  if (!timeout) context = args = null;
362
362
  } else if (!timeout && options.trailing !== false) {
363
363
  timeout = setTimeout(later, remaining);
364
364
  }
365
365
  return result;
366
366
  };
367
367
  let timer: any = null;
368
368
  return function () {
369
369
  const context: any = this;
370
370
  const args = arguments;
371
371
  timer && clearTimeout(timer);
372
372
  timer = setTimeout(function () {
373
373
  fn.apply(context, args);
374
374
  }, delay);
375
375
  };
376
376
  if (txt) {
377
377
  txt = txt.trim();
378
378
  const reg = new RegExp(/[\d-]+/);
379
379
  const res = reg.exec(txt);
380
380
  if (res && res.length > 0) {
381
381
  let tel = res[0];
382
382
  if (tel && delSeparator) {
383
383
  tel = tel.replace(/-/g, "");
384
384
  }
385
385
  return tel;
386
386
  }
387
387
  }
388
388
  return "";
389
389
  if (rgb) {
390
390
  const reg = /^(rgb|RGB)/;
391
391
  const color = rgb;
392
392
  if (reg.test(color)) {
393
393
  let strHex = "#";
394
394
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
395
395
  for (let i = 0; i < colorArr.length; i++) {
396
396
  let hex = Number(colorArr[i]).toString(16);
397
397
  if (hex === "0") {
398
398
  hex += hex;
399
399
  }
400
400
  strHex += hex;
401
401
  }
402
402
  return strHex;
403
403
  } else {
404
404
  return String(color);
405
405
  }
406
406
  } else {
407
407
  return "";
408
408
  }
409
409
  if (hex) {
410
410
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
411
411
  let color = hex.toLowerCase();
412
412
  if (reg.test(color)) {
413
413
  if (color.length === 4) {
414
414
  let colorNew = "#";
415
415
  for (let i = 1; i < 4; i += 1) {
416
416
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
417
417
  }
418
418
  color = colorNew;
419
419
  }
420
420
  const colorChange: number[] = [];
421
421
  for (let i = 1; i < 7; i += 2) {
422
422
  colorChange.push(parseInt("0x" + color.slice(i, i + 2)));
423
423
  }
424
424
  if (returnList) {
425
425
  return colorChange;
426
426
  } else {
427
427
  return "RGB(" + colorChange.join(",") + ")";
428
428
  }
429
429
  } else {
430
430
  return color;
431
431
  }
432
432
  } else {
433
433
  return "";
434
434
  }
435
435
  n: number,
436
436
  m: number,
437
437
  filterNum: number | undefined = undefined
438
438
  const c = m - n + 1;
439
439
  const res = Math.floor(Math.random() * c + n);
440
440
  if (filterNum && filterNum == res) {
441
441
  console.log("随机数二次开始", res, filterNum);
442
442
  return getRandom(n, m, filterNum);
443
443
  } else {
444
444
  return res;
445
445
  }
446
446
  wqCookieStr: string;
447
447
  wqCookie: {
448
448
  pin?: string;
449
449
  visitkey?: string;
450
450
  [key: string]: any;
451
451
  };
452
452
  const {
453
453
  jdpin,
454
454
  pinStatus,
455
455
  visitkey,
456
456
  unionid,
457
457
  skey,
458
458
  __jda,
459
459
  __jdv,
460
460
  __wga,
461
461
  wid,
462
462
  wq_skey,
463
463
  wq_uin,
464
464
  wq_auth_token,
465
465
  wxapp_scene,
466
466
  wq_unionid,
467
467
  wxapp_openid,
468
468
  wxapp_version,
469
469
  wxapp_type,
470
470
  appType,
471
471
  } = cookie;
472
472
  const ret: string[] = [];
473
473
  const getUserCookieObj = {};
474
474
  const createUseCookieArr = [
475
475
  jdpin,
476
476
  pinStatus,
477
477
  visitkey,
478
478
  unionid,
479
479
  skey,
480
480
  __jda,
481
481
  __jdv,
482
482
  __wga,
483
483
  wid,
484
484
  wq_skey,
485
485
  wq_uin,
486
486
  wq_auth_token,
487
487
  wxapp_scene,
488
488
  wq_unionid,
489
489
  wxapp_openid,
490
490
  wxapp_version,
491
491
  wxapp_type,
492
492
  appType,
493
493
  ];
494
494
  createUseCookieArr.forEach((keyItem) => {
495
495
  if (keyItem && keyItem["name"]) {
496
496
  let { name, value } = keyItem;
497
497
  name = name === "jdpin" ? "pin" : name;
498
498
  name === "pin" && ret.push(`pt_pin=${encodeURIComponent(value)}`);
499
499
  ret.push(`${name}=${encodeURIComponent(value)}`);
500
500
  getUserCookieObj[name] = value;
501
501
  }
502
502
  });
503
503
  return {
504
504
  wqCookieStr: ret.join(";"),
505
505
  wqCookie: getUserCookieObj,
506
506
  };
507
507
  num,
508
508
  widthSize = 375,
509
509
  layoutWidth = windowWidth
510
510
  const getNum = Number(num);
511
511
  return Math.round((getNum / widthSize) * layoutWidth);
512
512
  let checkState = false;
513
513
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag;
514
514
  if (couponFloorModuleType === FloorModuleType.COUPON) {
515
515
  try {
516
516
  const dataDefines = getFloorDataToDataDefines(floorData);
517
517
  const couponDataDefine = dataDefines
518
518
  ? dataDefines.filter((item) => {
519
519
  return item.type === "coupon";
520
520
  })
521
521
  : [],
522
522
  couponList = couponDataDefine[0]?.nodeText?.data
523
523
  ? couponDataDefine[0]?.nodeText?.data
524
524
  : [],
525
525
  couponLength = couponList.length,
526
526
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
527
527
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
528
528
  : 0;
529
529
  if (numShowPerLine === 0 && couponLength > 3) {
530
530
  checkState = true;
531
531
  }
532
532
  } catch (e) {
533
533
  checkState = false;
534
534
  }
535
535
  return checkState;
536
536
  }
537
537
  const {
538
538
  containers = [],
539
539
  floors = [],
540
540
  clearFirstContaierMarginTop = false,
541
541
  isLuxuryShop = false,
542
542
  isShowNativeImmersivePlayer = false,
543
543
  screenHeight = null,
544
544
  screenWidth = null,
545
545
  bottomBarHeight = null,
546
546
  } = pageData;
547
547
  console.log("dealShopContentData:", pageData, "isvdev:", isvdev);
548
548
  const getThisTimeKey = Date.now();
549
549
  let shopContentContainerListData = containers?.filter(
550
550
  (item) => (!isvdev && item.typeCode !== "mShopHeader") || isvdev
551
551
  );
552
552
  const shopContentFloorListData = floors?.filter(
553
553
  ({ floorPosition }) =>
554
554
  (!isvdev && floorPosition !== "header" && floorPosition !== "footer") ||
555
555
  isvdev
556
556
  );
557
557
  const unableIsvContainerListData = getUnableIsvContainerListData(
558
558
  shopContentFloorListData,
559
559
  shopContentContainerListData,
560
560
  exceptionReportFn
561
561
  );
562
562
  shopContentContainerListData.forEach((item, index) => {
563
563
  item.key = `${getThisTimeKey + index}`;
564
564
  item.floors = [];
565
565
  item.includeUids &&
566
566
  item.includeUids.forEach((floorUid) => {
567
567
  const getFloorData = shopContentFloorListData.find(
568
568
  (floorItem) => floorItem.uid === floorUid
569
569
  );
570
570
  if (getFloorData) {
571
571
  const changeFloorData = {
572
572
  containerId: item.containerId,
573
573
  containerIndex: index,
574
574
  ...getFloorData,
575
575
  };
576
576
  const getCheckMoreCouponState =
577
577
  checkCouponAndChangeContainerSetData(getFloorData);
578
578
  if (getCheckMoreCouponState) {
579
579
  item.marginLeft && (item.marginLeft = 0);
580
580
  item.marginRight && (item.marginRight = 0);
581
581
  item.borderRadius && (item.borderRadius = 0);
582
582
  }
583
583
  if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
584
584
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(
585
585
  getFloorData,
586
586
  exceptionReportFn
587
587
  );
588
588
  !getSysFloorToLoadTypeRes &&
589
589
  (getFloorData.floorExtInfo.floorLoadWay = 1);
590
590
  }
591
591
  item.floors.push(changeFloorData);
592
592
  }
593
593
  });
594
594
  if (
595
595
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
596
596
  item?.containerPosition == "content" &&
597
597
  item?.marginBottom > 0 &&
598
598
  !clearFirstContaierMarginTop
599
599
  ) {
600
600
  item.marginTop = item.marginBottom;
601
601
  }
602
602
  });
603
603
  shopContentContainerListData = shopContentContainerListData.filter(
604
604
  (item) =>
605
605
  item.floors.length > 0 &&
606
606
  unableIsvContainerListData.every(
607
607
  (containerItem) => containerItem.containerId != item.containerId
608
608
  )
609
609
  );
610
610
  console.log(
611
611
  "dealShopContentData isWxMinAndWxapp:",
612
612
  isWxMinAndWxapp,
613
613
  "weappJumpToH5:",
614
614
  pageData?.homeExtInfo?.weappJumpToH5
615
615
  );
616
616
  if (isProd && isWxMinAndWxapp) {
617
617
  shopContentContainerListData = shopContentContainerListData.filter(
618
618
  (item) =>
619
619
  item.floors.length > 0 &&
620
620
  !isIsvContainer(
621
621
  item.containerId,
622
622
  shopContentFloorListData,
623
623
  shopContentContainerListData
624
624
  )
625
625
  );
626
626
  }
627
627
  shopContentContainerListData = [].concat(shopContentContainerListData);
628
628
  return {
629
629
  shopContentContainerListData,
630
630
  shopContentFloorListData,
631
631
  };
632
632
  const changeOpts = {
633
633
  title: "",
634
634
  icon: "success",
635
635
  duration: 1500,
636
636
  mask: true,
637
637
  ...options,
638
638
  };
639
639
  if (changeOpts.title.length > 7) {
640
640
  showNormalToast(options);
641
641
  } else {
642
642
  Taro.showToast(changeOpts as any);
643
643
  }
644
644
  const changeOpts = {
645
645
  title: "",
646
646
  icon: "error",
647
647
  duration: 1500,
648
648
  mask: true,
649
649
  ...options,
650
650
  };
651
651
  if (changeOpts.title.length > 7) {
652
652
  showNormalToast(options);
653
653
  } else {
654
654
  Taro.showToast(changeOpts as any);
655
655
  }
656
656
  Taro.showToast({
657
657
  title: "",
658
658
  icon: "none",
659
659
  duration: 1500,
660
660
  mask: true,
661
661
  ...options,
662
662
  });
663
663
  return Taro.showLoading({
664
664
  title: text,
665
665
  });
666
666
  return new Promise(() => {
667
667
  Taro.nextTick(() => {
668
668
  setTimeout(() => {
669
669
  Taro.hideLoading(options);
670
670
  }, 300);
671
671
  });
672
672
  });
673
673
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
674
674
  const {
675
675
  tabActive = SECTION_HOME_TAB_NAME_TYPE[
676
676
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
677
677
  ],
678
678
  sceneId,
679
679
  } = query;
680
680
  let changeTabActive = tabActive;
681
681
  if (sceneId) {
682
682
  if (isH5) {
683
683
  if (sceneId == "1002") {
684
684
  changeTabActive =
685
685
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
686
686
  }
687
687
  else if (sceneId == "1003") {
688
688
  changeTabActive =
689
689
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
690
690
  }
691
691
  } else if (isWxMinAndWxapp) {
692
692
  if (sceneId == "1001" || sceneId == "1002") {
693
693
  changeTabActive =
694
694
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
695
695
  }
696
696
  else if (sceneId == "1003") {
697
697
  changeTabActive =
698
698
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
699
699
  }
700
700
  }
701
701
  }
702
702
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
703
703
  return {
704
704
  menuType: SHOP_MENU_ID_TYPE.HOME,
705
705
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
706
706
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
707
707
  };
708
708
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
709
709
  return {
710
710
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
711
711
  tabActiveType: 0,
712
712
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
713
713
  };
714
714
  } else {
715
715
  return {
716
716
  menuType: SHOP_MENU_ID_TYPE.HOME,
717
717
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
718
718
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
719
719
  };
720
720
  }
721
721
  const deleteKeyList = [
722
722
  "$taroTimestamp",
723
723
  "cookie",
724
724
  "wdref",
725
725
  "navStart",
726
726
  "originOpts",
727
727
  "originParams",
728
728
  "originUrl",
729
729
  "referer",
730
730
  "stamp",
731
731
  ];
732
732
  let changeQueryData: any = { ...queryData };
733
733
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
734
734
  const sceneQuery =
735
735
  qrCodeScene && typeof qrCodeScene == "string"
736
736
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
737
737
  : {};
738
738
  changeQueryData = { ...changeQueryData, ...sceneQuery };
739
739
  deleteKeyList.forEach((key) => {
740
740
  changeQueryData[key] && delete changeQueryData[key];
741
741
  });
742
742
  changeQueryData["shopid"] &&
743
743
  (changeQueryData["shopId"] = changeQueryData["shopid"]) &&
744
744
  delete changeQueryData["shopid"];
745
745
  changeQueryData["venderid"] &&
746
746
  (changeQueryData["venderId"] = changeQueryData["venderid"]) &&
747
747
  delete changeQueryData["venderid"];
748
748
  changeQueryData["vendorId"] &&
749
749
  (changeQueryData["venderId"] = changeQueryData["vendorId"]) &&
750
750
  delete changeQueryData["vendorId"];
751
751
  return changeQueryData;
752
752
  let isUsable = false;
753
753
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
754
754
  const modularPackResultObj = formatPackResult(modularPackResult);
755
755
  const bundleUrl = getBundleUrl(modularPackResultObj);
756
756
  const bundleFileName = getBundleFileName(modularPackResultObj);
757
757
  if (bundleUrl && bundleFileName) {
758
758
  isUsable = true;
759
759
  }
760
760
  if (!isUsable && typeof exceptionReportFn === "function") {
761
761
  exceptionReportFn({
762
762
  code: getSgmCustomCode(SgmCustomCode.REMOTEMODULE_DATA),
763
763
  msg: {
764
764
  msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
765
765
  floorIdx: floorData?.floorIdx,
766
766
  uid: floorData?.uid,
767
767
  shopId: floorData?.floorExtInfo?.shopId,
768
768
  moduleId: floorData?.moduleId,
769
769
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
770
770
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
771
771
  floorKind: floorData?.floorExtInfo?.floorKind,
772
772
  middleTemplateId: floorData?.middleTemplateId,
773
773
  modularPackResult: modularPackResult,
774
774
  },
775
775
  });
776
776
  }
777
777
  return isUsable;
778
778
  const objContainer = containerListData.find(
779
779
  (item) => item.containerId === containerId
780
780
  );
781
781
  return (
782
782
  objContainer?.includeUids?.some((itemUid) => {
783
783
  const objectFloor = floorListData.find(
784
784
  (floorItem) => itemUid === floorItem.uid
785
785
  );
786
786
  return RemoteLoadFloorList.includes(
787
787
  objectFloor?.floorExtInfo?.moduleFlag
788
788
  );
789
789
  }) ?? false
790
790
  );
791
791
  floorListData,
792
792
  containerListData,
793
793
  exceptionReportFn?
794
794
  const unableIsvFloorListData = floorListData.filter(
795
795
  (floorItem) =>
796
796
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
797
797
  !isIsvFloorUseable(floorItem, exceptionReportFn)
798
798
  );
799
799
  const unableIsvFloorUidList = unableIsvFloorListData.map(
800
800
  (floorItem) => floorItem.uid
801
801
  );
802
802
  const unableIsvContainerListData = containerListData.filter(
803
803
  (item) =>
804
804
  item.includeUids &&
805
805
  item.includeUids.every(
806
806
  (itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1
807
807
  )
808
808
  );
809
809
  return unableIsvContainerListData;
810
810
  return -2;
811
811
  return customObj;
812
812
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl);
813
813
  let getParams = false;
814
814
  if (isOpenJdAppUrl(openAppUrl)) {
815
815
  try {
816
816
  getParams = openAppUrl.replace(
817
817
  /openApp\.jdMobile:\/\/virtual\?params=/i,
818
818
  ""
819
819
  );
820
820
  getParams = JSON.parse(String(getParams));
821
821
  } catch (e) {
822
822
  console.log(e);
823
823
  }
824
824
  }
825
825
  return getParams;
826
826
  return `openapp.jdmobile:
827
827
  Object.assign({}, openParams)
828
828
  )}`;
829
829
  if (val === null || val === "" || typeof val === "undefined") {
830
830
  return true;
831
831
  }
832
832
  return false;
833
833
  const {
834
834
  moduleId = "none",
835
835
  entrance = "none",
836
836
  sourceType = "none",
837
837
  sourceValue = "none",
838
838
  } = params;
839
839
  if (isIosDevice) {
840
840
  return `${moduleId}#${entrance}`;
841
841
  } else if (isAndroidDevice) {
842
842
  return `${sourceType}#${sourceValue}`;
843
843
  }
844
844
  return "none#none";
845
845
  if (data && typeof data === "object") {
846
846
  let getOpenAppData = { ...data };
847
847
  try {
848
848
  const { sourceInfo, designerId, templateId, source } = getOpenAppData;
849
849
  if (designerId && templateId) {
850
850
  getOpenAppData = Object.assign({}, getOpenAppData, {
851
851
  sourceInfo: {
852
852
  entrance: "设计师预览",
853
853
  },
854
854
  });
855
855
  } else if (sourceInfo) {
856
856
  const { entrance } = sourceInfo;
857
857
  getOpenAppData.sourceInfo.entrance =
858
858
  entrance && entrance.length > 0 ? entrance : "其他";
859
859
  } else if (source && !sourceInfo) {
860
860
  if (typeof source === "object") {
861
861
  const { sourceType, entrance, sourceValue, moduleId } = source;
862
862
  getOpenAppData = Object.assign({}, getOpenAppData, {
863
863
  sourceInfo: {
864
864
  entrance: sourceType || entrance || "其他",
865
865
  moduleId: sourceValue || moduleId || "-100",
866
866
  },
867
867
  });
868
868
  } else {
869
869
  getOpenAppData = Object.assign({}, getOpenAppData, {
870
870
  sourceInfo: {
871
871
  entrance: source,
872
872
  },
873
873
  });
874
874
  }
875
875
  } else {
876
876
  getOpenAppData = Object.assign({}, getOpenAppData, {
877
877
  sourceInfo: {
878
878
  entrance: "其他",
879
879
  },
880
880
  });
881
881
  }
882
882
  } catch (e) {
883
883
  console.log(e);
884
884
  }
885
885
  return getOpenAppData;
886
886
  }
887
887
  return data;
888
888
  return displayObj;
889
889
  if (typeof input === "string") {
890
890
  try {
891
891
  return JSON.parse(input);
892
892
  } catch (e) {
893
893
  console.error("JSON解析失败", e);
894
894
  return {};
895
895
  }
896
896
  }
897
897
  return input || {};
898
898
  isJdApp,
899
899
  isWxApp,
900
900
  isIosDevice,
901
901
  isAndroidDevice,
902
902
  isJdAndIosDevice,
903
903
  isJdAndAndroidDevice,
904
904
  isWxMin,
905
905
  isWxMinAndWxapp,
906
906
  isJdMin,
907
907
  isMin,
908
908
  isJdMinAndHarmony,
909
909
  isH5,
910
910
  isH5AndJdShopView,
911
911
  isChartH5,
912
912
  isH5AndJdShopViewNativeScroll,
913
913
  isH5AndJdShopViewH5Scroll,
914
914
  isH5AndJdShopH5CustomScrollView,
915
915
  isWxMiniH5View,
916
916
  sliceArrToChunkList,
917
917
  dealAddress,
918
918
  objectToUrlEncode,
919
919
  parseQueryUrlString,
920
920
  setLowSmallPicUrl,
921
921
  getJfsImage,
922
922
  getQualityImage,
923
923
  countStringify,
924
924
  setTaroStorage,
925
925
  getTaroStorageKeyValue,
926
926
  removeTaroStorageKey,
927
927
  clearTaroStorageKey,
928
928
  getSystemInfos,
929
929
  addHttps,
930
930
  dateFormat,
931
931
  throttle,
932
932
  lodashThrottle,
933
933
  debounce,
934
934
  getTelephone,
935
935
  rgbToHex,
936
936
  hexToRgb,
937
937
  getRandom,
938
938
  getWxAppCookieStr,
939
939
  pxTransformFromData,
940
940
  dealShopContentData,
941
941
  showSuccessToast,
942
942
  showFailToast,
943
943
  showNormalToast,
944
944
  showShopLoading,
945
945
  hideShopLoading,
946
946
  getAppChannelType,
947
947
  formatTabActiveMenuType,
948
948
  filterUrlQueryData,
949
949
  isMemberPage,
950
950
  sgmCustomReport,
951
951
  isOpenJdAppUrl,
952
952
  jdOpenAppParams,
953
953
  createJdOpenAppUrl,
954
954
  dealJdOpenAppData,
955
955
  isEmpty,
956
956
  getJdAppReportPageSource,
957
957
  isAppClassifyPage,
958
958
  isPc,
959
959
  ipLoc_djd,
960
960
  jdAppVersionCompare,
961
961
  dealNativePixelToCssPixel,
962
962
  isAppStowShop,