@conecli/cone-render 0.8.19 → 0.8.20-beta.2

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 (183) hide show
  1. package/README.md +7 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/assets/icon_blue_info.svg +1 -0
  4. package/dist/common/const.ts +1 -1
  5. package/dist/common/environmentType.ts +1 -0
  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/isvStorage/index.h5.ts +1 -0
  11. package/dist/common/isvStorage/index.ts +1 -0
  12. package/dist/common/jdplayerSdk.ts +1 -0
  13. package/dist/common/jssdk.ts +1 -0
  14. package/dist/common/pageType.ts +1 -0
  15. package/dist/common/sgmCustomCode.ts +1 -0
  16. package/dist/common/token/const.ts +1 -0
  17. package/dist/common/token/index.h5.ts +1 -0
  18. package/dist/common/token/index.ts +1 -0
  19. package/dist/common/token/token.jd.ts +1 -0
  20. package/dist/common/token/token.ts +1 -0
  21. package/dist/common/token/token.wxapp.ts +1 -0
  22. package/dist/common/wxappApi.jd.ts +1 -0
  23. package/dist/common/wxappApi.ts +1 -1
  24. package/dist/components/ErrorBoundary.tsx +1 -1
  25. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  26. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  27. package/dist/components/base/CountDown/index.module.scss +49 -44
  28. package/dist/components/base/CountDown/index.tsx +1 -1
  29. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  30. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  31. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  32. package/dist/components/base/CustomVideo/common.ts +1 -0
  33. package/dist/components/base/CustomVideo/const.ts +1 -0
  34. package/dist/components/base/CustomVideo/index.module.scss +40 -64
  35. package/dist/components/base/CustomVideo/index.tsx +1 -1
  36. package/dist/components/base/Dialog/index.module.scss +22 -2
  37. package/dist/components/base/Dialog/index.tsx +1 -1
  38. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  39. package/dist/components/base/ExposureSmart/const.ts +1 -0
  40. package/dist/components/base/ExposureSmart/index.h5.module.scss +30 -6
  41. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  42. package/dist/components/base/ExposureSmart/index.module.scss +20 -9
  43. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  44. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  45. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  46. package/dist/components/base/InViewRender/index.tsx +1 -1
  47. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  48. package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
  49. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
  50. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  51. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  52. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  53. package/dist/components/base/LazyLoadImage/index.h5.module.scss +24 -20
  54. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  55. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  56. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  57. package/dist/components/base/NetworkDataError/const.ts +1 -1
  58. package/dist/components/base/NetworkDataError/index.module.scss +128 -69
  59. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  60. package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
  61. package/dist/components/base/Price/Base/index.module.scss +148 -0
  62. package/dist/components/base/Price/Base/index.tsx +1 -0
  63. package/dist/components/base/Price/Double/index.module.scss +190 -0
  64. package/dist/components/base/Price/Double/index.tsx +1 -0
  65. package/dist/components/base/Price/index.tsx +1 -1
  66. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  67. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  68. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  69. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  70. package/dist/components/base/Skeleton/index.tsx +1 -1
  71. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  72. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  73. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  74. package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
  75. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  76. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  77. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  78. package/dist/components/floorItem.jd.tsx +1 -0
  79. package/dist/components/floorItem.tsx +1 -1
  80. package/dist/components/floorItem.weapp.tsx +1 -1
  81. package/dist/components/isv/Floor/index.tsx +1 -1
  82. package/dist/components/remoteFloorItem.tsx +1 -0
  83. package/dist/interface/common.ts +1 -1
  84. package/dist/interface/component.ts +1 -1
  85. package/dist/interface/jumpEventReport.ts +1 -1
  86. package/dist/interface/service.ts +1 -1
  87. package/dist/interface/utils.ts +1 -1
  88. package/dist/jumpEventReport/base.ts +1 -1
  89. package/dist/jumpEventReport/const.ts +1 -1
  90. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  91. package/dist/jumpEventReport/index.h5.ts +1 -1
  92. package/dist/jumpEventReport/index.jd.ts +1 -1
  93. package/dist/jumpEventReport/index.ts +1 -1
  94. package/dist/jumpEventReport/index.weapp.ts +1 -1
  95. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  96. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  97. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  98. package/dist/jumpEventReport/web/report.ts +1 -1
  99. package/dist/jumpEventReport/web.base.ts +1 -1
  100. package/dist/jumpEventReport/web.jd.ts +1 -1
  101. package/dist/jumpEventReport/web.jdb.ts +1 -0
  102. package/dist/jumpEventReport/web.jdjch.ts +1 -0
  103. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  104. package/dist/jumpEventReport/web.pc.ts +1 -0
  105. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  106. package/dist/jumpEventReport/web.tjm.ts +1 -0
  107. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  108. package/dist/language/en_US.json +231 -0
  109. package/dist/language/zh_CN.json +231 -0
  110. package/dist/language/zh_HK.json +231 -0
  111. package/dist/libs/taroAppReport.js +2 -2
  112. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -27
  113. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  114. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  115. package/dist/open/api/device.ts +1 -1
  116. package/dist/open/api/environment.ts +1 -1
  117. package/dist/open/api/index.ts +1 -1
  118. package/dist/open/api/jump/business.ts +1 -0
  119. package/dist/open/api/jump/index.ts +1 -0
  120. package/dist/open/api/jump/minPath.ts +1 -0
  121. package/dist/open/api/jump/side.ts +1 -0
  122. package/dist/open/api/jump/webUrl.ts +1 -0
  123. package/dist/open/api/jump copy.ts +1 -0
  124. package/dist/open/api/moduleUtil.ts +1 -1
  125. package/dist/open/api/request.ts +1 -0
  126. package/dist/open/api/shopMember.ts +1 -0
  127. package/dist/open/api/track.ts +1 -1
  128. package/dist/open/api/userToken.ts +1 -0
  129. package/dist/open/api/util.ts +1 -1
  130. package/dist/open/components/index.ts +1 -1
  131. package/dist/sass/app.h5.scss +294 -212
  132. package/dist/sass/base.scss +195 -137
  133. package/dist/service/bMallConst.ts +1 -0
  134. package/dist/service/bMallConst.weapp.ts +1 -0
  135. package/dist/service/fetchGateway.ts +1 -0
  136. package/dist/service/fetchGateway.weapp.ts +1 -0
  137. package/dist/service/fetchJsonp.ts +1 -0
  138. package/dist/service/http/colorSign.ts +1 -0
  139. package/dist/service/http/colorSign.weapp.ts +1 -0
  140. package/dist/service/http/const.ts +1 -0
  141. package/dist/service/http/h5Http.ts +1 -0
  142. package/dist/service/http/http.ts +1 -0
  143. package/dist/service/http/httpInterceptors.jd.ts +1 -0
  144. package/dist/service/http/httpInterceptors.ts +1 -0
  145. package/dist/service/http/index.h5.ts +1 -0
  146. package/dist/service/http/index.ts +1 -0
  147. package/dist/service/requestServer.h5.ts +1 -0
  148. package/dist/service/requestServer.ts +1 -0
  149. package/dist/service/requestServer.weapp.ts +1 -0
  150. package/dist/utils/connectNativeJsBridge.ts +1 -1
  151. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  152. package/dist/utils/draExceptionAndProfile.ts +1 -1
  153. package/dist/utils/h5Utils.ts +1 -1
  154. package/dist/utils/index.h5.ts +1 -1
  155. package/dist/utils/index.ts +1 -1
  156. package/dist/utils/index.weapp.ts +1 -1
  157. package/dist/utils/intersectionObserver.ts +1 -1
  158. package/dist/utils/jm-common.js +1 -1
  159. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  160. package/dist/utils/jumpExtMapUtil.ts +1 -0
  161. package/dist/utils/priceUtils.js +1 -0
  162. package/dist/utils/ready.ts +1 -0
  163. package/dist/utils/sColor.js +1 -0
  164. package/dist/utils/sgmCodeUtils.ts +1 -0
  165. package/dist/utils/taroRenderUtil.ts +1 -0
  166. package/dist/utils/utils.ts +1 -1
  167. package/dist/wxapp/api/helper.js +1 -0
  168. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  169. package/dist/wxapp/common/user_info.js +1 -1
  170. package/dist/wxapp/components/launch-app/index.js +1 -0
  171. package/dist/wxapp/components/launch-app/index.json +5 -0
  172. package/dist/wxapp/components/launch-app/index.wxml +0 -0
  173. package/dist/wxapp/components/launch-app/index.wxss +0 -0
  174. package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
  175. package/dist/wxapp/components/subscribe-guider/index.js +1 -0
  176. package/dist/wxapp/components/subscribe-guider/index.json +5 -0
  177. package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
  178. package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
  179. package/package.json +145 -114
  180. package/dist/components/base/Price/index.module.scss +0 -136
  181. package/dist/components/base/Skeleton/old.tsx +0 -1
  182. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
  183. package/dist/open/api/jump.ts +0 -1
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  TaroEventType,
3
2
  WEBVIEW_STATE,
4
3
  M_H5_ROOT_ELE_NODE,
5
4
  props: ComponentInterFace.InOrOutViewObserverProps,
6
5
  const { children, inViewCallback, outViewCallback, threshold = 0 } = props
7
6
  const [componentShowState, setComponentShowState] = useState(false)
8
7
  const componentObserverRef = useRef<HTMLElement | null>(null)
9
8
  const componentShowStateRef = useRef(false)
10
9
  if (isH5AndJdShopView) {
11
10
  useEffect(() => {
12
11
  const latestRes =
13
12
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
14
13
  dealPageScrollInfo(latestRes)
15
14
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
16
15
  dealPageScrollInfo(res)
17
16
  })
18
17
  Taro.eventCenter.on(
19
18
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
20
19
  (state) => {
21
20
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
22
21
  },
23
22
  )
24
23
  return function cleanup() {
25
24
  Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, (res) => {
26
25
  dealPageScrollInfo(res)
27
26
  })
28
27
  Taro.eventCenter.off(
29
28
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
30
29
  (state) => {
31
30
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
32
31
  },
33
32
  )
34
33
  }
35
34
  }, [])
36
35
  useEffect(() => {
37
36
  if (componentShowState) {
38
37
  typeof inViewCallback === 'function' && inViewCallback()
39
38
  console.log('app=>in可视区域')
40
39
  } else {
41
40
  typeof outViewCallback === 'function' && outViewCallback()
42
41
  console.log('app=>out可视区域')
43
42
  }
44
43
  }, [componentShowState])
45
44
 
46
45
  const handleInOrOutView = (type: boolean) => {
47
46
  componentShowStateRef.current = type
48
47
  setComponentShowState(type)
49
48
  console.log('handleInOrOutView', type)
50
49
  }
51
50
 
52
51
  const dealPageScrollInfo = (res) => {
53
52
  console.log('dealPageScrollInfo===', res)
54
53
 
55
54
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
56
55
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
57
56
  console.log(
58
57
  '处理后dealPageScrollInfo===displayHeight=offSetY',
59
58
  displayHeight,
60
59
  offSetY,
61
60
  )
62
61
  if (componentObserverRef.current) {
63
62
  const eleClientRect =
64
63
  componentObserverRef.current.getBoundingClientRect()
65
64
  const eleOffsetTop = Math.ceil(eleClientRect.top)
66
65
  const eleHeight = Math.ceil(eleClientRect.height)
67
66
  console.log(
68
67
  '==========================eleOffsetTop, eleHeight',
69
68
  eleOffsetTop,
70
69
  eleHeight,
71
70
  )
72
71
  if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
73
72
  const isOutView =
74
73
  offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
75
74
  displayHeight - (eleOffsetTop - offSetY) <
76
75
  Math.ceil(eleHeight * threshold)
77
76
 
78
77
  console.log(
79
78
  '比较isOutView',
80
79
  isOutView,
81
80
  offSetY,
82
81
  eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
83
82
  displayHeight - (eleOffsetTop - offSetY),
84
83
  Math.ceil(eleHeight * threshold),
85
84
  )
86
85
  handleInOrOutView(!isOutView)
87
86
  } else {
88
87
  const isInView =
89
88
  offSetY >
90
89
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
91
90
  offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
92
91
  console.log(
93
92
  '比较isInView',
94
93
  isInView,
95
94
  offSetY,
96
95
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
97
96
  eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
98
97
  )
99
98
  handleInOrOutView(isInView)
100
99
  }
101
100
  }
102
101
  }
103
102
  return <View ref={componentObserverRef}>{children}</View>
104
103
  } else {
105
104
  const rootDom = document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
106
105
  const { ref, inView } = useInView({
107
106
  threshold,
108
107
  triggerOnce: false,
109
108
  root: rootDom || null,
110
109
  rootMargin: `0px 0px 0px 0px`,
111
110
  })
112
111
  useEffect(() => {
113
112
  if (inView) {
114
113
  typeof inViewCallback === 'function' && inViewCallback()
115
114
  console.log('其他h5=>in可视区域')
116
115
  } else {
117
116
  typeof outViewCallback === 'function' && outViewCallback()
118
117
  console.log('其他h5=>out可视区域')
119
118
  }
120
119
  }, [inView])
121
120
  return <View ref={ref}>{children}</View>
122
121
  }
123
122
  children: null,
124
123
  className: '',
125
124
  inViewCallback: null,
126
125
  outViewCallback: null,
127
126
  threshold: 0,
127
+ import Taro from '@tarojs/taro'
128
128
  isH5AndJdShopView,
129
129
  isH5AndJdShopViewH5Scroll,
130
130
  isAppClassifyPage,
131
131
  TaroEventType,
132
132
  WEBVIEW_STATE,
133
133
  M_H5_ROOT_ELE_NODE,
134
134
  latestFromNativeMsgStorage,
135
135
  getNativePageScrollRes,
136
136
  props: ComponentInterFace.InOrOutViewObserverProps,
137
137
  const {
138
138
  children,
139
139
  style,
140
140
  inViewCallback,
141
141
  outViewCallback,
142
142
  threshold = 0,
143
143
  } = props
144
144
  const [componentShowState, setComponentShowState] = useState(false)
145
145
  const componentObserverRef = useRef<HTMLElement | null>(null)
146
146
  const componentShowStateRef = useRef(false)
147
147
  const needShowHighVersion =
148
148
  isAppClassifyPage ||
149
149
  (isH5AndJdShopViewH5Scroll &&
150
150
  !(
151
151
  global.info.queryInfo?.downgraded &&
152
152
  global.info.queryInfo.downgraded === 'true'
153
153
  ))
154
154
  const rootDom =
155
155
  isH5AndJdShopView && needShowHighVersion
156
156
  ? null
157
157
  : document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
158
158
  if (isH5AndJdShopView && !needShowHighVersion) {
159
159
  console.log('视频========属于app原生滚动')
160
160
  useEffect(() => {
161
161
  const latestRes =
162
162
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
163
163
  dealPageScrollInfo(latestRes)
164
164
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
165
165
  dealPageScrollInfo(res)
166
166
  })
167
167
  Taro.eventCenter.on(
168
168
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
169
169
  state => {
170
170
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
171
171
  },
172
172
  )
173
173
  return function cleanup() {
174
174
  Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, res => {
175
175
  dealPageScrollInfo(res)
176
176
  })
177
177
  Taro.eventCenter.off(
178
178
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
179
179
  state => {
180
180
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
181
181
  },
182
182
  )
183
183
  }
184
184
  }, [])
185
185
  useEffect(() => {
186
186
  if (componentShowState) {
187
187
  typeof inViewCallback === 'function' && inViewCallback()
188
188
  console.log('app=>in可视区域')
189
189
  } else {
190
190
  typeof outViewCallback === 'function' && outViewCallback()
191
191
  console.log('app=>out可视区域')
192
192
  }
193
193
  }, [componentShowState])
194
194
 
195
195
  const handleInOrOutView = (type: boolean) => {
196
196
  componentShowStateRef.current = type
197
197
  setComponentShowState(type)
198
198
  console.log('handleInOrOutView', type)
199
199
  }
200
200
 
201
201
  const dealPageScrollInfo = res => {
202
202
  console.log('dealPageScrollInfo===', res)
203
203
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
204
204
  if (
205
205
  typeof displayHeight === 'undefined' ||
206
206
  typeof offSetY === 'undefined'
207
207
  )
208
208
  return
209
209
  console.log(
210
210
  '处理后dealPageScrollInfo===displayHeight=offSetY',
211
211
  displayHeight,
212
212
  offSetY,
213
213
  )
214
214
  if (componentObserverRef.current) {
215
215
  const eleClientRect = componentObserverRef.current.getBoundingClientRect()
216
216
  const eleOffsetTop = Math.ceil(eleClientRect.top)
217
217
  const eleHeight = Math.ceil(eleClientRect.height)
218
218
  console.log(
219
219
  '==========================eleOffsetTop, eleHeight',
220
220
  eleOffsetTop,
221
221
  eleHeight,
222
222
  )
223
223
  if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
224
224
  const isOutView =
225
225
  offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
226
226
  displayHeight - (eleOffsetTop - offSetY) <
227
227
  Math.ceil(eleHeight * threshold)
228
228
  console.log(
229
229
  '比较isOutView',
230
230
  isOutView,
231
231
  offSetY,
232
232
  eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
233
233
  displayHeight - (eleOffsetTop - offSetY),
234
234
  Math.ceil(eleHeight * threshold),
235
235
  )
236
236
  handleInOrOutView(!isOutView)
237
237
  } else {
238
238
  const isInView =
239
239
  offSetY >
240
240
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
241
241
  offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
242
242
  console.log(
243
243
  '比较isInView',
244
244
  isInView,
245
245
  offSetY,
246
246
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
247
247
  eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
248
248
  )
249
249
  handleInOrOutView(isInView)
250
250
  }
251
251
  }
252
252
  }
253
253
  return (
254
254
  <View ref={componentObserverRef} style={style}>
255
255
  {children}
256
256
  </View>
257
257
  )
258
258
  } else {
259
259
  console.log('视频========h5滚动')
260
260
  const { ref, inView } = useInView({
261
261
  delay: 100,
262
262
  threshold,
263
263
  triggerOnce: false,
264
264
  root: rootDom || null,
265
265
  rootMargin: `0px 0px 0px 0px`,
266
266
  })
267
267
  useEffect(() => {
268
268
  if (inView) {
269
269
  typeof inViewCallback === 'function' && inViewCallback()
270
270
  console.log('其他h5=>in可视区域')
271
271
  } else {
272
272
  typeof outViewCallback === 'function' && outViewCallback()
273
273
  console.log('其他h5=>out可视区域')
274
274
  }
275
275
  }, [inView])
276
276
  return (
277
277
  <View ref={ref} style={style}>
278
278
  {children}
279
279
  </View>
280
280
  )
281
281
  }
282
282
  children: null,
283
283
  style: {},
284
284
  className: '',
285
285
  inViewCallback: null,
286
286
  outViewCallback: null,
287
287
  threshold: 0,
@@ -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
  inViewCallback
8
7
  } = props
9
8
  const [componentShowState, setComponentShowState] = useState(false)
10
9
  const [componentRenderShowState, setComponentRenderShowState] =
11
10
  useState(false)
12
11
  const componentLazyRef = useRef<HTMLElement | null>(null)
13
12
  const componentShowStateRef = useRef(false)
14
13
  if (isH5AndJdShopView) {
15
14
  useEffect(() => {
16
15
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
17
16
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
18
17
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
19
18
  !componentShowStateRef.current && dealPageScrollInfo(res)
20
19
  })
21
20
  }, [])
22
21
  useEffect(() => {
23
22
  if (componentShowState) {
24
23
  typeof inViewCallback === 'function' && inViewCallback()
25
24
  console.log('InViewRender -- 店铺H5 展示啦!')
26
25
  }
27
26
  }, [componentShowState])
28
27
 
29
28
  const dealPageScrollInfo = (res) => {
30
29
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
31
30
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
32
31
  if (componentLazyRef.current) {
33
32
  const eleClientRect =
34
33
  componentLazyRef.current.getBoundingClientRect()
35
34
  const getContainerHeightOffSetY = displayHeight + offSetY
36
35
  const eleOffsetTop = Math.ceil(eleClientRect.top)
37
36
  if (!componentShowStateRef.current) {
38
37
  if (getContainerHeightOffSetY > eleOffsetTop) {
39
38
  componentShowStateRef.current = true
40
39
  setComponentShowState(true)
41
40
  Taro.nextTick(() => {
42
41
  setComponentRenderShowState(true)
43
42
  })
44
43
  }
45
44
  }
46
45
  }
47
46
  }
48
47
  return (
49
48
  <View
50
49
  ref={componentLazyRef}
51
50
  className={classNames(
52
51
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
53
52
  'd-app-floor-lazy-load',
54
53
  )}
55
54
  style={{
56
55
  minHeight: `${componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
57
56
  }`,
58
57
  backgroundColor: componentRenderShowState
59
58
  ? 'transparent'
60
59
  : '#ffffff',
61
60
  }}
62
61
  >
63
62
  {componentShowState ? children : placeholder}
64
63
  </View>
65
64
  )
66
65
  } else {
67
66
  const rootDom = document.querySelector('#J_shopHomeRoot')
68
67
  const { ref, inView } = useInView({
69
68
  threshold: 0,
70
69
  triggerOnce: true,
71
70
  root: rootDom || null,
72
71
  rootMargin: `0px 0px 0px 0px`,
73
72
  })
74
73
  useEffect(() => {
75
74
  if (inView) {
76
75
  typeof inViewCallback === 'function' && inViewCallback()
77
76
  console.log('InViewRender -- 其它H5 展示啦!')
78
77
  }
79
78
  }, [inView])
80
79
  return (
81
80
  <View
82
81
  ref={ref}
83
82
  style={{
84
83
  minHeight: `${inView ? 'auto' : height + 'px'}`,
85
84
  backgroundColor: 'transparent',
86
85
  }}
87
86
  >
88
87
  {inView ? children : placeholder}
89
88
  </View>
90
89
  )
91
90
  }
92
91
  children: null,
93
92
  placeholder: null,
94
93
  height: 1,
95
94
  className: '',
96
95
  lazyNodeClassName: '',
97
96
  inViewCallback: null,
97
+ import Taro from '@tarojs/taro'
98
98
  getNativePageScrollRes,
99
99
  latestFromNativeMsgStorage,
100
100
  const { children, placeholder, height, className, inViewCallback } = props
101
101
  const [componentShowState, setComponentShowState] = useState(false)
102
102
  const [componentRenderShowState, setComponentRenderShowState] = useState(
103
103
  false,
104
104
  )
105
105
  const componentLazyRef = useRef<HTMLElement | null>(null)
106
106
  const componentShowStateRef = useRef(false)
107
107
  const needShowHighVersion =
108
108
  isH5AndJdShopViewH5Scroll &&
109
109
  !(
110
110
  global.info.queryInfo?.downgraded &&
111
111
  global.info.queryInfo.downgraded === 'true'
112
112
  )
113
113
  const rootDom =
114
114
  isH5AndJdShopView && needShowHighVersion
115
115
  ? null
116
116
  : document.querySelector('#J_shopHomeRoot')
117
117
  if (isH5AndJdShopView && !needShowHighVersion && !isAppStowShop) {
118
118
  useEffect(() => {
119
119
  const latestRes =
120
120
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
121
121
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
122
122
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
123
123
  !componentShowStateRef.current && dealPageScrollInfo(res)
124
124
  })
125
125
  }, [])
126
126
  useEffect(() => {
127
127
  if (componentShowState) {
128
128
  typeof inViewCallback === 'function' && inViewCallback()
129
129
  }
130
130
  }, [componentShowState])
131
131
 
132
132
  const dealPageScrollInfo = res => {
133
133
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
134
134
  if (
135
135
  typeof displayHeight === 'undefined' ||
136
136
  typeof offSetY === 'undefined'
137
137
  )
138
138
  return
139
139
  if (componentLazyRef.current) {
140
140
  const eleClientRect = componentLazyRef.current.getBoundingClientRect()
141
141
  const getContainerHeightOffSetY = displayHeight + offSetY
142
142
  const eleOffsetTop = Math.ceil(eleClientRect.top)
143
143
  if (!componentShowStateRef.current) {
144
144
  if (getContainerHeightOffSetY > eleOffsetTop) {
145
145
  componentShowStateRef.current = true
146
146
  setComponentShowState(true)
147
147
  Taro.nextTick(() => {
148
148
  setComponentRenderShowState(true)
149
149
  })
150
150
  }
151
151
  }
152
152
  }
153
153
  }
154
154
  return (
155
155
  <View
156
156
  ref={componentLazyRef}
157
157
  className={classNames(
158
158
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
159
159
  'd-app-floor-lazy-load',
160
160
  className,
161
161
  )}
162
162
  style={{
163
163
  minHeight: `${
164
164
  componentRenderShowState
165
165
  ? 'auto'
166
166
  : height + (typeof height === 'number' ? 'px' : '')
167
167
  }`,
168
168
  backgroundColor: componentRenderShowState ? 'transparent' : '#ffffff',
169
169
  }}
170
170
  >
171
171
  {componentShowState ? children : placeholder}
172
172
  </View>
173
173
  )
174
174
  } else {
175
175
  const { ref, inView } = useInView({
176
176
  threshold: 0.5,
177
177
  triggerOnce: true,
178
178
  root: rootDom || null,
179
179
  rootMargin: `0px 0px 0px 0px`,
180
180
  delay: 300,
181
181
  })
182
182
  useEffect(() => {
183
183
  if (inView) {
184
184
  typeof inViewCallback === 'function' && inViewCallback()
185
185
  }
186
186
  }, [inView])
187
187
  return (
188
188
  <View
189
189
  className={className}
190
190
  ref={ref}
191
191
  style={{
192
192
  minHeight: inView
193
193
  ? 'auto'
194
194
  : typeof height === 'number'
195
195
  ? `${height}px`
196
196
  : height,
197
197
  backgroundColor: 'transparent',
198
198
  }}
199
199
  >
200
200
  {inView ? children : placeholder}
201
201
  </View>
202
202
  )
203
203
  }
204
204
  children: null,
205
205
  placeholder: null,
206
206
  height: 1,
207
207
  className: '',
208
208
  lazyNodeClassName: '',
209
209
  inViewCallback: null,
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -0,0 +1,8 @@
1
+
2
+ .d-item-point-layout {
3
+ position: relative;
4
+ .d-item-chart-point {
5
+ opacity: 1;
6
+ z-index: 100;
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+ import React, { useRef } from 'react';
2
  const {
1
3
  className,
2
4
  pointClassName,
3
5
  children,
4
6
  reportData,
5
7
  customReportDataKey,
6
8
  customReportDataFn,
7
9
  trackCallback,
8
10
  ...otherProps
9
11
  } = props;
10
12
  const itemViewExposureRef = useRef(null);
11
13
  const isCustomReport = customReportDataKey && customReportDataFn;
12
14
  const checkReportData = Array.isArray(reportData);
13
15
  const [floorData, mInfo] = checkReportData ? reportData : [];
14
16
  const checkReportDataState = isCustomReport ? true : floorData && mInfo;
15
17
 
16
18
  floorData && mInfo && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0);
17
19
  return (
18
20
  <View
19
21
  ref={itemViewExposureRef}
20
22
  className={classNames(itemViewExposureSmartStyle['d-item-point-layout'], className)}
21
23
  {...otherProps}
22
24
  >
23
25
  {children ? children : null}
24
26
  {checkReportDataState && (
25
27
  <ExposureSmart
26
28
  className={classNames(pointClassName, {
27
29
  [itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
28
30
  })}
29
31
  innerRef={itemViewExposureRef}
30
32
  reportData={reportData}
31
33
  trackCallback={trackCallback}
32
34
  customReportDataFn={customReportDataFn}
33
35
  customReportDataKey={customReportDataKey}
34
36
  markPoint
35
37
  />
36
38
  )}
37
39
  </View>
38
40
  );
39
41
  reportData: [],
40
42
  customReportDataKey: null,
41
43
  customReportDataFn: null,
42
44
  customReportDataForMapFn: null,