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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/assets/icon_blue_info.svg +1 -0
  3. package/dist/common/const.ts +1 -1
  4. package/dist/common/environmentType.ts +1 -0
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.ts +1 -0
  10. package/dist/common/jssdk.ts +1 -0
  11. package/dist/common/pageType.ts +1 -0
  12. package/dist/common/sgmCustomCode.ts +1 -0
  13. package/dist/common/token/index.h5.ts +1 -1
  14. package/dist/common/token/token.jd.ts +1 -1
  15. package/dist/common/token/token.ts +1 -1
  16. package/dist/common/wxappApi.jd.ts +1 -0
  17. package/dist/components/ErrorBoundary.tsx +1 -1
  18. package/dist/components/base/CountDown/index.tsx +1 -1
  19. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  20. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  21. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  22. package/dist/components/base/CustomVideo/common.ts +1 -0
  23. package/dist/components/base/CustomVideo/index.tsx +1 -1
  24. package/dist/components/base/Dialog/index.module.scss +5 -0
  25. package/dist/components/base/Dialog/index.tsx +1 -1
  26. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  28. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  29. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  30. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  31. package/dist/components/base/InViewRender/index.tsx +1 -1
  32. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  33. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  34. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  35. package/dist/components/base/LazyLoadImage/index.h5.module.scss +23 -20
  36. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  37. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  38. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  39. package/dist/components/base/NetworkDataError/const.ts +1 -1
  40. package/dist/components/base/NetworkDataError/index.module.scss +7 -0
  41. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  42. package/dist/components/base/Price/Base/index.tsx +1 -1
  43. package/dist/components/base/Price/Double/index.tsx +1 -1
  44. package/dist/components/base/Price/index.tsx +1 -1
  45. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  46. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  47. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  48. package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
  49. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  50. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  51. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  52. package/dist/components/floorItem.jd.tsx +1 -1
  53. package/dist/components/floorItem.tsx +1 -1
  54. package/dist/components/floorItem.weapp.tsx +1 -1
  55. package/dist/components/isv/Floor/index.tsx +1 -1
  56. package/dist/components/remoteFloorItem.tsx +1 -1
  57. package/dist/interface/common.ts +1 -1
  58. package/dist/interface/component.ts +1 -1
  59. package/dist/interface/jumpEventReport.ts +1 -1
  60. package/dist/interface/service.ts +1 -1
  61. package/dist/interface/utils.ts +1 -1
  62. package/dist/jumpEventReport/base.ts +1 -1
  63. package/dist/jumpEventReport/const.ts +1 -1
  64. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  65. package/dist/jumpEventReport/index.h5.ts +1 -1
  66. package/dist/jumpEventReport/index.jd.ts +1 -1
  67. package/dist/jumpEventReport/index.weapp.ts +1 -1
  68. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  69. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  70. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  71. package/dist/jumpEventReport/web/report.ts +1 -1
  72. package/dist/jumpEventReport/web.base.ts +1 -1
  73. package/dist/jumpEventReport/web.jd.ts +1 -1
  74. package/dist/jumpEventReport/web.jdb.ts +1 -1
  75. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  76. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  77. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  78. package/dist/jumpEventReport/web.tjm.ts +1 -0
  79. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  80. package/dist/modules/ContainerFloorList/index.h5.module.scss +18 -1
  81. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  82. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  83. package/dist/open/api/device.ts +1 -1
  84. package/dist/open/api/environment.ts +1 -1
  85. package/dist/open/api/index.ts +1 -1
  86. package/dist/open/api/jump copy.ts +1 -1
  87. package/dist/open/api/request.ts +1 -1
  88. package/dist/open/api/shopMember.ts +1 -1
  89. package/dist/open/api/track.ts +1 -1
  90. package/dist/open/api/util.ts +1 -1
  91. package/dist/open/components/index.ts +1 -1
  92. package/dist/sass/app.h5.scss +49 -3
  93. package/dist/sass/base.scss +57 -0
  94. package/dist/service/fetchGateway.ts +1 -1
  95. package/dist/service/http/colorSign.ts +1 -1
  96. package/dist/service/http/const.ts +1 -1
  97. package/dist/service/http/h5Http.ts +1 -0
  98. package/dist/service/http/index.h5.ts +1 -0
  99. package/dist/service/requestServer.h5.ts +1 -0
  100. package/dist/service/requestServer.ts +1 -1
  101. package/dist/utils/connectNativeJsBridge.ts +1 -1
  102. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  103. package/dist/utils/draExceptionAndProfile.ts +1 -1
  104. package/dist/utils/h5Utils.ts +1 -1
  105. package/dist/utils/index.h5.ts +1 -1
  106. package/dist/utils/index.ts +1 -1
  107. package/dist/utils/index.weapp.ts +1 -1
  108. package/dist/utils/jm-common.js +1 -1
  109. package/dist/utils/sgmCodeUtils.ts +1 -0
  110. package/dist/utils/taroRenderUtil.ts +1 -1
  111. package/dist/utils/utils.ts +1 -1
  112. package/package.json +1 -1
  113. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  TaroEventType,
3
2
  const {
4
3
  children,
5
4
  placeholder,
6
5
  height,
7
6
  className,
8
7
  inViewCallback
9
8
  } = props
10
9
  const [componentShowState, setComponentShowState] = useState(false)
11
10
  const [componentRenderShowState, setComponentRenderShowState] =
12
11
  useState(false)
13
12
  const componentLazyRef = useRef<HTMLElement | null>(null)
14
13
  const componentShowStateRef = useRef(false)
15
14
  const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
16
15
  const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
17
16
  if (isH5AndJdShopView && !needShowHighVersion) {
18
17
  useEffect(() => {
19
18
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
20
19
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
21
20
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
22
21
  !componentShowStateRef.current && dealPageScrollInfo(res)
23
22
  })
24
23
  }, [])
25
24
  useEffect(() => {
26
25
  if (componentShowState) {
27
26
  typeof inViewCallback === 'function' && inViewCallback()
28
27
  console.log('InViewRender -- 店铺H5 展示啦!')
29
28
  }
30
29
  }, [componentShowState])
31
30
 
32
31
  const dealPageScrollInfo = (res) => {
33
32
  console.log(
34
33
  '收到滚动信息和模块元素以及容器显示状态',
35
34
  res,
36
35
  typeof componentLazyRef.current,
37
36
  componentShowStateRef.current,
38
37
  )
39
38
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
40
39
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
41
40
  if (componentLazyRef.current) {
42
41
  const eleClientRect =
43
42
  componentLazyRef.current.getBoundingClientRect()
44
43
  const getContainerHeightOffSetY = displayHeight + offSetY
45
44
  const eleOffsetTop = Math.ceil(eleClientRect.top)
46
45
  if (!componentShowStateRef.current) {
47
46
  if (getContainerHeightOffSetY > eleOffsetTop) {
48
47
  componentShowStateRef.current = true
49
48
  setComponentShowState(true)
50
49
  Taro.nextTick(() => {
51
50
  setComponentRenderShowState(true)
52
51
  })
53
52
  }
54
53
  }
55
54
  }
56
55
  }
57
56
  return (
58
57
  <View
59
58
  ref={componentLazyRef}
60
59
  className={classNames(
61
60
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
62
61
  'd-app-floor-lazy-load',
63
62
  className
64
63
  )}
65
64
  style={{
66
65
  minHeight: `${componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
67
66
  }`,
68
67
  backgroundColor: componentRenderShowState
69
68
  ? 'transparent'
70
69
  : '#ffffff',
71
70
  }}
72
71
  >
73
72
  {componentShowState ? children : placeholder}
74
73
  </View>
75
74
  )
76
75
  }else {
77
76
  const { ref, inView } = useInView({
78
77
  threshold: 0.5,
79
78
  triggerOnce: true,
80
79
  root: rootDom || null,
81
80
  rootMargin: `0px 0px 0px 0px`,
82
81
  delay: 300,
83
82
  })
84
83
  useEffect(() => {
85
84
  if (inView) {
86
85
  typeof inViewCallback === 'function' && inViewCallback()
87
86
  console.log('InViewRender -- 其它H5 展示啦!')
88
87
  }
89
88
  }, [inView])
90
89
  return (
91
90
  <View
92
91
  className={className}
93
92
  ref={ref}
94
93
  style={{
95
94
  minHeight: inView ? 'auto' : typeof height === 'number' ? `${height}px` : height,
96
95
  backgroundColor: 'transparent',
97
96
  }}
98
97
  >
99
98
  {inView ? children : placeholder}
100
99
  </View>
101
100
  )
102
101
  }
103
102
  children: null,
104
103
  placeholder: null,
105
104
  height: 1,
106
105
  className: '',
107
106
  lazyNodeClassName: '',
108
107
  inViewCallback: null,
108
+ import Taro from '@tarojs/taro'
109
109
  getNativePageScrollRes,
110
110
  latestFromNativeMsgStorage,
111
111
  const { children, placeholder, height, className, inViewCallback } = props
112
112
  const [componentShowState, setComponentShowState] = useState(false)
113
113
  const [componentRenderShowState, setComponentRenderShowState] = useState(
114
114
  false,
115
115
  )
116
116
  const componentLazyRef = useRef<HTMLElement | null>(null)
117
117
  const componentShowStateRef = useRef(false)
118
118
  const needShowHighVersion =
119
119
  isH5AndJdShopViewH5Scroll &&
120
120
  !(
121
121
  global.info.queryInfo?.downgraded &&
122
122
  global.info.queryInfo.downgraded === 'true'
123
123
  )
124
124
  const rootDom =
125
125
  isH5AndJdShopView && needShowHighVersion
126
126
  ? null
127
127
  : document.querySelector('#J_shopHomeRoot')
128
128
  if (isH5AndJdShopView && !needShowHighVersion && !isAppStowShop) {
129
129
  useEffect(() => {
130
130
  const latestRes =
131
131
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
132
132
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
133
133
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
134
134
  !componentShowStateRef.current && dealPageScrollInfo(res)
135
135
  })
136
136
  }, [])
137
137
  useEffect(() => {
138
138
  if (componentShowState) {
139
139
  typeof inViewCallback === 'function' && inViewCallback()
140
140
  }
141
141
  }, [componentShowState])
142
142
 
143
143
  const dealPageScrollInfo = res => {
144
144
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
145
145
  if (
146
146
  typeof displayHeight === 'undefined' ||
147
147
  typeof offSetY === 'undefined'
148
148
  )
149
149
  return
150
150
  if (componentLazyRef.current) {
151
151
  const eleClientRect = componentLazyRef.current.getBoundingClientRect()
152
152
  const getContainerHeightOffSetY = displayHeight + offSetY
153
153
  const eleOffsetTop = Math.ceil(eleClientRect.top)
154
154
  if (!componentShowStateRef.current) {
155
155
  if (getContainerHeightOffSetY > eleOffsetTop) {
156
156
  componentShowStateRef.current = true
157
157
  setComponentShowState(true)
158
158
  Taro.nextTick(() => {
159
159
  setComponentRenderShowState(true)
160
160
  })
161
161
  }
162
162
  }
163
163
  }
164
164
  }
165
165
  return (
166
166
  <View
167
167
  ref={componentLazyRef}
168
168
  className={classNames(
169
169
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
170
170
  'd-app-floor-lazy-load',
171
171
  className,
172
172
  )}
173
173
  style={{
174
174
  minHeight: `${
175
175
  componentRenderShowState
176
176
  ? 'auto'
177
177
  : height + (typeof height === 'number' ? 'px' : '')
178
178
  }`,
179
179
  backgroundColor: componentRenderShowState ? 'transparent' : '#ffffff',
180
180
  }}
181
181
  >
182
182
  {componentShowState ? children : placeholder}
183
183
  </View>
184
184
  )
185
185
  } else {
186
186
  const { ref, inView } = useInView({
187
187
  threshold: 0.5,
188
188
  triggerOnce: true,
189
189
  root: rootDom || null,
190
190
  rootMargin: `0px 0px 0px 0px`,
191
191
  delay: 300,
192
192
  })
193
193
  useEffect(() => {
194
194
  if (inView) {
195
195
  typeof inViewCallback === 'function' && inViewCallback()
196
196
  }
197
197
  }, [inView])
198
198
  return (
199
199
  <View
200
200
  className={className}
201
201
  ref={ref}
202
202
  style={{
203
203
  minHeight: inView
204
204
  ? 'auto'
205
205
  : typeof height === 'number'
206
206
  ? `${height}px`
207
207
  : height,
208
208
  backgroundColor: 'transparent',
209
209
  }}
210
210
  >
211
211
  {inView ? children : placeholder}
212
212
  </View>
213
213
  )
214
214
  }
215
215
  children: null,
216
216
  placeholder: null,
217
217
  height: 1,
218
218
  className: '',
219
219
  lazyNodeClassName: '',
220
220
  inViewCallback: null,
@@ -1 +1 @@
1
- import React from 'react'
2
1
  const { className, pointClassName, children, reportData, trackCallback, ...otherProps } =
3
2
  props
4
3
  const [floorData, mInfo] = reportData
5
4
  const checkReportDataState = floorData && mInfo
6
5
 
7
6
  checkReportDataState && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0)
8
7
  return (
9
8
  <View
10
9
  ref={ref}
11
10
  className={classNames(
12
11
  itemViewExposureSmartStyle['d-item-point-layout'],
13
12
  className,
14
13
  )}
15
14
  {...otherProps}
16
15
  >
17
16
  {children ? children : null}
18
17
  {checkReportDataState && (
19
18
  <ExposureSmart
20
19
  className={classNames(pointClassName,{
21
20
  [itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
22
21
  })}
23
22
  reportData={reportData}
24
23
  trackCallback={trackCallback}
25
24
  markPoint
26
25
  />
27
26
  )}
28
27
  </View>
29
28
  )
29
+ import React from 'react'
30
30
  const { className, pointClassName, children, reportData, customReportDataKey,customReportDataFn, trackCallback, ...otherProps } =
31
31
  props
32
32
  const isCustomReport = customReportDataKey && customReportDataFn
33
33
  const checkReportData = Array.isArray(reportData)
34
34
  const [floorData, mInfo] = checkReportData ? reportData : []
35
35
  const checkReportDataState = isCustomReport ? true : floorData && mInfo
36
36
 
37
37
  floorData && mInfo && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0)
38
38
  return (
39
39
  <View
40
40
  ref={ref}
41
41
  className={classNames(
42
42
  itemViewExposureSmartStyle['d-item-point-layout'],
43
43
  className,
44
44
  )}
45
45
  {...otherProps}
46
46
  >
47
47
  {children ? children : null}
48
48
  {checkReportDataState && (
49
49
  <ExposureSmart
50
50
  className={classNames(pointClassName,{
51
51
  [itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
52
52
  })}
53
53
  reportData={reportData}
54
54
  trackCallback={trackCallback}
55
55
  customReportDataFn={customReportDataFn}
56
56
  customReportDataKey={customReportDataKey}
57
57
  markPoint
58
58
  />
59
59
  )}
60
60
  </View>
61
61
  )
62
62
  reportData: [],
63
63
  customReportDataKey: null,
64
64
  customReportDataFn: null
@@ -1 +1 @@
1
- import Taro, { useRouter } from "@tarojs/taro";
2
1
  SECTION_HOME_TAB_TYPE,
3
2
  SECTION_HOME_TAB_NAME_TYPE,
4
3
  TaroEventType,
5
4
  latestFromNativeMsgStorage,
6
5
  nativePageRegisterMessage,
7
6
  Message_Type,
8
7
  getNativePageScrollRes,
9
8
  const {
10
9
  children,
11
10
  containerId,
12
11
  type,
13
12
  placeholder,
14
13
  height,
15
14
  floorData = {},
16
15
  sectionType,
17
16
  lazyNodeClassName,
18
17
  } = props;
19
18
  const getRouterInfo = useRouter();
20
19
  const getQueryData = getRouterInfo?.params || {};
21
20
  const [componentShowState, setComponentShowState] = useState(false);
22
21
  const [componentRenderShowState, setComponentRenderShowState] =
23
22
  useState(false);
24
23
  const componentLazyRef = useRef<HTMLElement | null>(null);
25
24
  const componentShowStateRef = useRef(false);
26
25
  const needShowHighVersion =
27
26
  isH5AndJdShopViewH5Scroll &&
28
27
  !(
29
28
  global.info.queryInfo?.downgraded &&
30
29
  global.info.queryInfo.downgraded === "true"
31
30
  );
32
31
  const rootDom =
33
32
  isH5AndJdShopView && needShowHighVersion
34
33
  ? null
35
34
  : document.querySelector("#J_shopHomeRoot");
36
35
  const { ref, inView } = useInView({
37
36
  threshold: 0,
38
37
  triggerOnce: true,
39
38
  root: rootDom,
40
39
  rootMargin: `0px 0px ${window.innerHeight}px 0px`,
41
40
  });
42
41
  useEffect(() => {
43
42
  if (needShowHighVersion) return;
44
43
  if (type === LazyType.FLOOR) {
45
44
  const latestRes =
46
45
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {};
47
46
  !componentShowStateRef.current && dealPageScrollInfo(latestRes);
48
47
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
49
48
  !componentShowStateRef.current && dealPageScrollInfo(res);
50
49
  });
51
50
  }
52
51
  }, []);
53
52
  useEffect(() => {
54
53
  if (
55
54
  (!needShowHighVersion && componentShowState === true) ||
56
55
  (needShowHighVersion && inView && isH5AndJdShopView)
57
56
  ) {
58
57
  console.log(
59
58
  ">>>>>>>>>>>>>>>>>>> 楼层【id=" + containerId + "】已经渲染!"
60
59
  );
61
60
  const modularPackResultObj = formatPackResult(
62
61
  floorData?.floorExtInfo?.modularPackResult
63
62
  );
64
63
  const bundleUrl = getBundleUrl(modularPackResultObj);
65
64
  if (bundleUrl) {
66
65
  nativePageRegisterMessage(Message_Type.NATIVE_INJECT_JS_FILE, {
67
66
  data: {
68
67
  bundleUrl: [bundleUrl],
69
68
  },
70
69
  });
71
70
  }
72
71
  }
73
72
  }, [componentShowState, inView]);
74
73
 
75
74
  const dealPageScrollInfo = (res) => {
76
75
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {};
77
76
  if (typeof displayHeight === "undefined" || typeof offSetY === "undefined")
78
77
  return;
79
78
  if (componentLazyRef.current) {
80
79
  const eleClientRect = componentLazyRef.current.getBoundingClientRect();
81
80
  const getContainerHeightOffSetY = displayHeight + offSetY;
82
81
  const eleOffsetTop = Math.ceil(eleClientRect.top);
83
82
  const eleOffsetHeight = Math.ceil(eleClientRect.height);
84
83
  const eleOffsetTopHeight = eleOffsetTop + eleOffsetHeight;
85
84
  if (!componentShowStateRef.current) {
86
85
  if (getContainerHeightOffSetY > eleOffsetTop) {
87
86
  componentShowStateRef.current = true;
88
87
  setComponentShowState(true);
89
88
  Taro.nextTick(() => {
90
89
  setComponentRenderShowState(true);
91
90
  });
92
91
  }
93
92
  }
94
93
  }
95
94
  };
96
95
  return isH5AndJdShopView && !needShowHighVersion ? (
97
96
  <div
98
97
  id={`${containerId}_lazy`}
99
98
  ref={componentLazyRef}
100
99
  className={classNames(
101
100
  lazyLayoutLoadStyle["d-app-floor-lazy-layout-load"],
102
101
  "d-app-floor-lazy-load"
103
102
  )}
104
103
  style={{
105
104
  minHeight: `${componentRenderShowState ? "auto" : height + "px"}`,
106
105
  backgroundColor: componentRenderShowState ? "transparent" : "#ffffff",
107
106
  }}
108
107
  >
109
108
  {componentShowState ? children : placeholder}
110
109
  </div>
111
110
  ) : (
112
111
  <div
113
112
  id={`${containerId}_lazy`}
114
113
  className={classNames(
115
114
  lazyLayoutLoadStyle["d-mobile-floor-lazy-layout-load"],
116
115
  "d-mobile-floor-lazy-load"
117
116
  )}
118
117
  ref={ref}
119
118
  style={{
120
119
  minHeight: `${inView ? "auto" : height + "px"}`,
121
120
  backgroundColor: inView ? "transparent" : "#ffffff",
122
121
  }}
123
122
  >
124
123
  {inView ? children : placeholder}
125
124
  </div>
126
125
  );
127
126
  sectionType:
128
127
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
129
128
  type: LazyType.FLOOR,
130
129
  children: null,
131
130
  placeholder: null,
132
131
  height: 200,
133
132
  className: "",
134
133
  lazyNodeClassName: "",
134
+ import Taro, { useRouter } from '@tarojs/taro'
135
135
  SECTION_HOME_TAB_TYPE,
136
136
  SECTION_HOME_TAB_NAME_TYPE,
137
137
  TaroEventType,
138
138
  const {
139
139
  children,
140
140
  containerId,
141
141
  type,
142
142
  placeholder,
143
143
  height,
144
144
  floorData = {},
145
145
  sectionType,
146
146
  lazyNodeClassName,
147
147
  } = props
148
148
  const getRouterInfo = useRouter()
149
149
  const getQueryData = getRouterInfo?.params || {}
150
150
  const [componentShowState, setComponentShowState] = useState(false)
151
151
  const [componentRenderShowState, setComponentRenderShowState] =
152
152
  useState(false)
153
153
  const componentLazyRef = useRef<HTMLElement | null>(null)
154
154
  const componentShowStateRef = useRef(false)
155
155
  const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
156
156
  const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
157
157
  const { ref, inView } = useInView({
158
158
  threshold: 0,
159
159
  triggerOnce: true,
160
160
  root: rootDom,
161
161
  rootMargin: `0px 0px ${window.innerHeight}px 0px`,
162
162
  })
163
163
  useEffect(() => {
164
164
  if(needShowHighVersion || !isH5AndJdShopView) return
165
165
  if (type === LazyType.FLOOR) {
166
166
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
167
167
  !componentShowStateRef.current && dealPageScrollInfo(latestRes,false)
168
168
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
169
169
  !componentShowStateRef.current && dealPageScrollInfo(res,true)
170
170
  })
171
171
  }
172
172
  }, [])
173
173
  useEffect(() => {
174
174
  if((!needShowHighVersion && componentShowState === true) ||
175
175
  (needShowHighVersion && inView && isH5AndJdShopView)
176
176
  ) {
177
177
  console.log('>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!')
178
178
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
179
179
  const modularPackResultObj = typeof modularPackResult === 'string' ? JSON.parse(modularPackResult) : modularPackResult
180
180
  if (modularPackResultObj && modularPackResultObj.bundleUrl) {
181
181
  const { bundleUrl } = modularPackResultObj
182
182
  nativePageRegisterMessage(
183
183
  Message_Type.NATIVE_INJECT_JS_FILE,
184
184
  {
185
185
  data: {
186
186
  "bundleUrl": [bundleUrl]
187
187
  },
188
188
  },
189
189
  )
190
190
  }
191
191
  }
192
192
  }, [componentShowState,inView])
193
193
 
194
194
  const dealPageScrollInfo = (res,pageScrollTrigger) => {
195
195
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
196
196
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') {
197
197
  const shopId = floorData?.floorExtInfo?.shopId
198
198
  if(!lazyLayoutLoadErrorShopId[`${shopId}`] && pageScrollTrigger) {
199
199
  const opt = {
200
200
  msg: `店铺楼层懒加载失败。楼层顺序-floorIdx: ${floorData?.floorIdx}。`,
201
201
  uid: floorData?.uid,
202
202
  floorIdx: floorData?.floorIdx,
203
203
  shopId: shopId,
204
204
  moduleId: floorData?.moduleId,
205
205
  moduleName: floorData?.moduleName,
206
206
  middleTemplateId: floorData?.middleTemplateId
207
207
  }
208
208
  sgmCustomReport({
209
209
  code: getSgmCustomCode(SgmCustomCode.FLOORLAZYLOAD_DATA),
210
210
  msg: opt,
211
211
  })
212
212
  lazyLayoutLoadErrorShopId[`${shopId}`] = true
213
213
  }
214
214
  return
215
215
  }
216
216
  if (componentLazyRef.current) {
217
217
  const eleClientRect =
218
218
  componentLazyRef.current.getBoundingClientRect()
219
219
  const getContainerHeightOffSetY = displayHeight + offSetY
220
220
  const eleOffsetTop = Math.ceil(eleClientRect.top)
221
221
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
222
222
  const eleOffsetTopHeight = eleOffsetTop + eleOffsetHeight
223
223
  if (!componentShowStateRef.current) {
224
224
  if (getContainerHeightOffSetY > eleOffsetTop) {
225
225
  componentShowStateRef.current = true
226
226
  setComponentShowState(true)
227
227
  Taro.nextTick(() => {
228
228
  setComponentRenderShowState(true)
229
229
  })
230
230
  }
231
231
  }
232
232
  }
233
233
  }
234
234
  return isH5AndJdShopView && !needShowHighVersion ? (
235
235
  <div
236
236
  id={`${containerId}_lazy`}
237
237
  ref={componentLazyRef}
238
238
  className={classNames(
239
239
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
240
240
  'd-app-floor-lazy-load',
241
241
  )}
242
242
  style={{
243
243
  minHeight: `${
244
244
  componentRenderShowState ? 'auto' : height + 'px'
245
245
  }`,
246
246
  backgroundColor: componentRenderShowState
247
247
  ? 'transparent'
248
248
  : '#ffffff',
249
249
  }}
250
250
  >
251
251
  {componentShowState ? children : placeholder}
252
252
  </div>
253
253
  ) : (
254
254
  <div
255
255
  id={`${containerId}_lazy`}
256
256
  className={classNames(
257
257
  lazyLayoutLoadStyle["d-mobile-floor-lazy-layout-load"],
258
258
  "d-mobile-floor-lazy-load",
259
259
  lazyNodeClassName,
260
260
  )}
261
261
  ref={ref}
262
262
  style={{
263
263
  minHeight: `${inView ? 'auto' : height + 'px'}`,
264
264
  backgroundColor: inView ? 'transparent' : '#ffffff',
265
265
  }}
266
266
  >
267
267
  {inView ? children : placeholder}
268
268
  </div>
269
269
  );
270
270
  sectionType:
271
271
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
272
272
  type: LazyType.FLOOR,
273
273
  children: null,
274
274
  placeholder: null,
275
275
  height: 200,
276
276
  className: '',
277
277
  lazyNodeClassName: '',
@@ -1 +1 @@
1
- export const NetWorkTypeQuality = {
1
+ export const NetWorkTypeQuality = {
@@ -1,24 +1,27 @@
1
1
 
2
2
  .d-lazy-image,
3
3
  .d-app-lazy-image {
4
- //background: #F8F8F8 url("../../resoure/jd_logo_bg.png") center center/50% no-repeat;
5
- background: #fff
6
- url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAAeCAMAAABT0xOcAAAAe1BMVEUAAADx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fELy0NOAAAAKHRSTlMApwmfFtYm9rWveHDm70yJHYJaD2k8IeIr6pY2X0HHfsGRZDHdu1XNmO+CqgAAAu9JREFUSMfNlNmymzAQRAchkCUhdrMZbLze/v8vjIRMKN8kRR7ykFNeVIPV9Ewj039P1TR8+eILjL7RdLFFJUO8QMS7ZmyDJvZ0nDYGY+aKKDSJpY3OwWX6uFUEY/peCNEbY4Rp6AABixFYkLQRAK3VOmAjUrawMt1GrfWtXD7rlFF3uiA6HV/p0TF1tBECEVskYe+7qqW08mqT1jruneu21/72JfHoSZ7faj2bJu6mOlgEa3qjEXKeL/ACV1s5YSbqYP6stXUeX2FZnV3wuBSZqnVWqDNCIvaFRzZIiGAIw+CS/1brQCslgOQdUBoW10C2EFJei7AkygOlAnmGeMprJq/NjhZpAIrepOpOte2Oq9EXjupIMVoiXduQ9rTo7KsODhxJYaAGuJPjgRvdkRD1KP9CawRwettyF5SbVLZ49ZbuMJxGW93XisXPKA/oXNMDEReJT6N0OfZ2V4RqX4tFQPbOQbntwrl8oXCOQmu2hVosSr6j5QcW+uvukZJP37CWzL7tQs2lH8B53Nd6eq192N/72mdfa52XhdXPx6zcXKYgikLXbaNP66M27edoAO2X+RkQ9tVRhoWC6IZkCZAbHHa1SgDHNdHDsbrLr0ojKTkfDWp6+WPh1APakMAXbVrb6B/Mn+311zlETJZOCJYChttWxedUIyvyi9bLt+J4IPcLvVYypBNaDG5TguCzmct3rUkAPSdHJRLyDEjXQ6Un3GZQBamxaU09gJg+/r+4gqV0uzixXjBfLnDzixrjhDJGNoDXXqvK76OEJaO3L1bx/FQOCSxqcfJVUWiXCydEPowHeIqaZnf3wmvNRsBiC28ttEnS+1oy+lNtOMVAzayZCwsQ5ESNREgvKKuNjjI/ewNHr9Y4N5Is98llx2U8iOQXcKczhDwAM6ObayaanfWDDwhJcMvpU8ucr6+cPji5a8+UEVMCMNo97tLm0MU2uoMmi850yrc8s8Khyzuj7+Q6U7GPMCt8mOtGljP6l/wAUcBZ6lceL/8AAAAASUVORK5CYII=')
7
- center center no-repeat;
8
- &.d-lazy-sku-image {
9
- background-image: url('https://img14.360buyimg.com/imagetools/jfs/t1/222907/25/7012/5824/61c4797cEbcd17c7f/6c76fc71e4fdb5a5.png');
10
- background-size: cover;
11
- }
12
- &.d-load-completed {
13
- background: none;
14
- }
15
- img {
16
- display: block;
17
- width: 100%;
18
- }
19
- &.d-hide-image-error {
20
- img {
21
- opacity: 0;
22
- }
23
- }
4
+ //background: #F8F8F8 url("../../resoure/jd_logo_bg.png") center center/50% no-repeat;
5
+ background: #fff
6
+ url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAAeCAMAAABT0xOcAAAAe1BMVEUAAADx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fELy0NOAAAAKHRSTlMApwmfFtYm9rWveHDm70yJHYJaD2k8IeIr6pY2X0HHfsGRZDHdu1XNmO+CqgAAAu9JREFUSMfNlNmymzAQRAchkCUhdrMZbLze/v8vjIRMKN8kRR7ykFNeVIPV9Ewj039P1TR8+eILjL7RdLFFJUO8QMS7ZmyDJvZ0nDYGY+aKKDSJpY3OwWX6uFUEY/peCNEbY4Rp6AABixFYkLQRAK3VOmAjUrawMt1GrfWtXD7rlFF3uiA6HV/p0TF1tBECEVskYe+7qqW08mqT1jruneu21/72JfHoSZ7faj2bJu6mOlgEa3qjEXKeL/ACV1s5YSbqYP6stXUeX2FZnV3wuBSZqnVWqDNCIvaFRzZIiGAIw+CS/1brQCslgOQdUBoW10C2EFJei7AkygOlAnmGeMprJq/NjhZpAIrepOpOte2Oq9EXjupIMVoiXduQ9rTo7KsODhxJYaAGuJPjgRvdkRD1KP9CawRwettyF5SbVLZ49ZbuMJxGW93XisXPKA/oXNMDEReJT6N0OfZ2V4RqX4tFQPbOQbntwrl8oXCOQmu2hVosSr6j5QcW+uvukZJP37CWzL7tQs2lH8B53Nd6eq192N/72mdfa52XhdXPx6zcXKYgikLXbaNP66M27edoAO2X+RkQ9tVRhoWC6IZkCZAbHHa1SgDHNdHDsbrLr0ojKTkfDWp6+WPh1APakMAXbVrb6B/Mn+311zlETJZOCJYChttWxedUIyvyi9bLt+J4IPcLvVYypBNaDG5TguCzmct3rUkAPSdHJRLyDEjXQ6Un3GZQBamxaU09gJg+/r+4gqV0uzixXjBfLnDzixrjhDJGNoDXXqvK76OEJaO3L1bx/FQOCSxqcfJVUWiXCydEPowHeIqaZnf3wmvNRsBiC28ttEnS+1oy+lNtOMVAzayZCwsQ5ESNREgvKKuNjjI/ewNHr9Y4N5Is98llx2U8iOQXcKczhDwAM6ObayaanfWDDwhJcMvpU8ucr6+cPji5a8+UEVMCMNo97tLm0MU2uoMmi850yrc8s8Khyzuj7+Q6U7GPMCt8mOtGljP6l/wAUcBZ6lceL/8AAAAASUVORK5CYII=')
7
+ center center no-repeat;
8
+ &.d-lazy-sku-image {
9
+ background-image: url('https://img14.360buyimg.com/imagetools/jfs/t1/222907/25/7012/5824/61c4797cEbcd17c7f/6c76fc71e4fdb5a5.png');
10
+ background-size: cover;
11
+ }
12
+ &.d-load-completed {
13
+ background: none;
14
+ }
15
+ &[mode="heightFix"] > img{
16
+ width: auto;
17
+ }
18
+ img {
19
+ display: block;
20
+ width: 100%;
21
+ }
22
+ &.d-hide-image-error {
23
+ img {
24
+ opacity: 0;
25
+ }
26
+ }
24
27
  }