Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
chenquansheng
2024-09-19 16:36:13 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
80f1746346e3205b63c861fc30fc015c87c2d500
80f17463
1 parent
61d7f6c5
fix |> 修复稿件详情页评论区域滚动到可视区域的问题
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
13 deletions
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
View file @
80f1746
...
...
@@ -65,7 +65,6 @@ export struct ImageAndTextPageComponent {
@State reachEndIncreament: number = 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State isScrollTop: boolean = true
@State offsetY: number = 0
@State executedStartTime: number = new Date().getTime()
private screenHeight: number = 0
...
...
@@ -208,8 +207,9 @@ export struct ImageAndTextPageComponent {
.onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
// console.log(TAG, "总页面滑动偏移量", this.scroller.currentOffset().yOffset)
// console.log(TAG, "总页面滑动偏移量111", newValue.globalPosition.y as number)
// console.log(TAG, ">>>>>当前页面滚动位置:", this.scroller.currentOffset().yOffset)
// console.log(TAG, ">>>>>当前评论区位置:", newValue.globalPosition.y as number)
// console.log(TAG, ">>>>>当前屏幕宽度和底部高度:", this.screenHeight,this.bottomHeight)
this.checkToScrollCommentArea()
})
// .onMeasureSize()
...
...
@@ -467,7 +467,7 @@ export struct ImageAndTextPageComponent {
* 查询点赞、收藏数量
*/
queryContentInteractCount() {
console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData))
//
console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData))
const params: contentInteractParams = {
contentId: this.contentDetailData?.newsId + '',
...
...
@@ -504,16 +504,16 @@ export struct ImageAndTextPageComponent {
private pageScrollToCommonent() {
const info = componentUtils.getRectangleById('comment');
console.log(TAG, "点击滑动页面", JSON.stringify(info))
//评论区当前位置
let currentCommonentOffSetY = this.info?.globalPosition.y as number
let currentCommonentOffSetY = this.info?.globalPosition.y as number - 70
// 当前页面滚动位置
let currentScrollOffSetY = this.scroller.currentOffset().yOffset
let offSetY = 0
if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) {
offSetY = current
CommonentOffSetY-2
00
offSetY = current
ScrollOffSetY + (currentCommonentOffSetY - this.screenHeight+this.bottomHeight) + 4
00
}
// 定位到评论区域
if (
this.isScrollTop
) {
if (
!this.showMainText
) {
this.scroller.scrollTo({
xOffset: 0,
yOffset: offSetY,
...
...
@@ -522,11 +522,10 @@ export struct ImageAndTextPageComponent {
} else {
this.scroller.scrollEdge(Edge.Top)
}
this.isScrollTop = !this.isScrollTop
}
aboutToAppear() {
Logger.debug(TAG, '文章详情页 aboutToAppear,开始请求接口数据');
//
Logger.debug(TAG, '文章详情页 aboutToAppear,开始请求接口数据');
this.getDetail()
this.screenHeight = DisplayUtils.getDeviceHeight()
this.initAnimationConfig();
...
...
@@ -576,8 +575,7 @@ export struct ImageAndTextPageComponent {
// 需要评论区位置,调用前 请确保它有值
return
}
let offSetY = this.info?.globalPosition.y as number -60
Logger.debug(TAG, "即将滚动至yOffset: " + offSetY)
let offSetY = this.info?.globalPosition.y as number -70
if (offSetY >= (this.screenHeight-this.bottomHeight) ) {
this.showMainText = false
}else {
...
...
Please
register
or
login
to post a comment