chenquansheng

fix |> 修复点击切换后滚动页面底部评论角标样式没有变化问题

@@ -248,34 +248,36 @@ export struct ImageAndTextPageComponent { @@ -248,34 +248,36 @@ export struct ImageAndTextPageComponent {
248 console.log(TAG, "点击滑动页面", JSON.stringify(info)) 248 console.log(TAG, "点击滑动页面", JSON.stringify(info))
249 249
250 //评论区当前位置 250 //评论区当前位置
251 - let currentCommonentOffSetY = this.info?.globalPosition.y as number  
252 - let offSetY = 0  
253 - if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) {  
254 - offSetY = currentCommonentOffSetY-200  
255 - this.showMainText = true  
256 - }else {  
257 - this.showMainText = false  
258 - }  
259 - this.scroller.scrollTo({  
260 - yOffset: offSetY,  
261 - xOffset: 0,  
262 - animation: { duration: 1000, curve: Curve.Ease }  
263 - })  
264 -  
265 - // if (!this.offsetY) {  
266 - // this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y  
267 - // }  
268 - // // 定位到评论区域  
269 - // if (this.isScrollTop) {  
270 - // this.scroller.scrollTo({  
271 - // xOffset: 0,  
272 - // yOffset: this.offsetY,  
273 - // animation: true  
274 - // })  
275 - // } else {  
276 - // this.scroller.scrollEdge(Edge.Top) 251 + // let currentCommonentOffSetY = this.info?.globalPosition.y as number
  252 + // let offSetY = 0
  253 + // if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) {
  254 + // offSetY = currentCommonentOffSetY-200
  255 + // this.showMainText = true
  256 + // }else {
  257 + // this.showMainText = false
277 // } 258 // }
278 - // this.isScrollTop = !this.isScrollTop 259 + // this.scroller.scrollTo({
  260 + // yOffset: offSetY,
  261 + // xOffset: 0,
  262 + // animation: { duration: 1000, curve: Curve.Ease }
  263 + // })
  264 +
  265 + if (!this.offsetY) {
  266 + this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y
  267 + }
  268 + // 定位到评论区域
  269 + if (this.isScrollTop) {
  270 + this.scroller.scrollTo({
  271 + xOffset: 0,
  272 + yOffset: this.offsetY,
  273 + animation: { duration: 1000, curve: Curve.Ease }
  274 + })
  275 + // this.showMainText = true
  276 + } else {
  277 + this.scroller.scrollEdge(Edge.Top)
  278 + // this.showMainText = false
  279 + }
  280 + this.isScrollTop = !this.isScrollTop
279 } 281 }
280 }) 282 })
281 } 283 }
@@ -357,7 +359,6 @@ export struct ImageAndTextPageComponent { @@ -357,7 +359,6 @@ export struct ImageAndTextPageComponent {
357 if (this.detailContentEmpty) { 359 if (this.detailContentEmpty) {
358 this.emptyType = 18 360 this.emptyType = 18
359 } 361 }
360 - console.log(TAG, "dl1111111111", JSON.stringify(detailBeans[0]))  
361 if (detailBeans && detailBeans.length > 0) { 362 if (detailBeans && detailBeans.length > 0) {
362 this.contentDetailData = detailBeans[0]; 363 this.contentDetailData = detailBeans[0];
363 let dateTime = 364 let dateTime =
@@ -560,21 +561,22 @@ export struct ImageAndTextPageComponent { @@ -560,21 +561,22 @@ export struct ImageAndTextPageComponent {
560 // 需要评论区位置,调用前 请确保它有值 561 // 需要评论区位置,调用前 请确保它有值
561 return 562 return
562 } 563 }
  564 + let offSetY = this.info?.globalPosition.y as number -60
  565 + Logger.debug(TAG, "即将滚动至yOffset: " + offSetY)
  566 + if (offSetY >= (this.screenHeight-this.bottomHeight) ) {
  567 + this.showMainText = false
  568 + }else {
  569 + this.showMainText = true
  570 + }
  571 +
563 if (this.action.params?.targetLayout && this.action.params.targetLayout == "comment") { 572 if (this.action.params?.targetLayout && this.action.params.targetLayout == "comment") {
564 if (this.lastTimeoutId) { 573 if (this.lastTimeoutId) {
565 clearTimeout(this.lastTimeoutId) 574 clearTimeout(this.lastTimeoutId)
566 } 575 }
567 this.lastTimeoutId = setTimeout(() => { 576 this.lastTimeoutId = setTimeout(() => {
568 - let offSetY = this.info?.globalPosition.y as number  
569 - Logger.debug(TAG, "即将滚动至yOffset: " + (offSetY - 100))  
570 - if (offSetY >= (this.screenHeight-this.bottomHeight) ) {  
571 - this.showMainText = true  
572 - }else {  
573 - this.showMainText = false  
574 - }  
575 //头部距离48 577 //头部距离48
576 this.scroller.scrollTo({ 578 this.scroller.scrollTo({
577 - yOffset: offSetY - 100, 579 + yOffset: offSetY,
578 xOffset: 0, 580 xOffset: 0,
579 animation: { duration: 1000, curve: Curve.Ease } 581 animation: { duration: 1000, curve: Curve.Ease }
580 }) 582 })