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
xugenyuan
2024-06-11 17:10:45 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d75bbd23ff75d81951ed95f3cd03195adacf010a
d75bbd23
1 parent
488332d1
ref |> 解决动态详情页首次进入时跳转评论区问题
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
17 deletions
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
sight_harmony/products/phone/src/main/ets/pages/detail/DynamicDetailPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
View file @
d75bbd2
...
...
@@ -17,6 +17,7 @@ import {
batchLikeAndCollectResult,
RmhInfoDTO,
InteractDataDTO,
Action,
} from 'wdBean';
import media from '@ohos.multimedia.media';
import { OperRowListView } from './view/OperRowListView';
...
...
@@ -56,9 +57,7 @@ const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
@Component
export struct DynamicDetailComponent {
//入参
private relId: string = ''
private contentId: string = ''
private relType: string = ''
action: Action = {} as Action
//出参
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
//UI
...
...
@@ -82,6 +81,8 @@ export struct DynamicDetailComponent {
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
pageParam: ParamType = {}
commentListAreaInfo?: Area
lastTimeoutId?: number
// @Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
...
...
@@ -553,6 +554,12 @@ export struct DynamicDetailComponent {
CommentComponent({
publishCommentModel: this.publishCommentModel
})
.id("comment")
.onAreaChange((oldValue: Area, newValue: Area) => {
this.commentListAreaInfo = newValue
this.checkToScrollCommentArea()
})
}
Blank().layoutWeight(1)
}
...
...
@@ -587,7 +594,10 @@ export struct DynamicDetailComponent {
private async getContentDetailData() {
this.isNetConnected = NetworkUtil.isNetConnected()
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
const relId = this.action.params?.extra?.relId || '';
const relType = this.action.params?.extra?.relType || '';
const contentId = this.action.params?.contentID || '';
let data = await MultiPictureDetailViewModel.getDetailData(relId, contentId, relType)
this.isPageEnd = true;
this.contentDetailData = data[0];
let dateTime =
...
...
@@ -804,6 +814,29 @@ export struct DynamicDetailComponent {
let context = getContext(this) as common.UIAbilityContext;
viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactDataDTO)
}
checkToScrollCommentArea() {
if (!this.commentListAreaInfo) {
// 需要评论区位置,调用前 请确保它有值
return
}
if (this.action.params?.targetLayout && this.action.params.targetLayout == "comment") {
if (this.lastTimeoutId) {
clearTimeout(this.lastTimeoutId)
}
this.lastTimeoutId = setTimeout(() => {
let offSetY = this.commentListAreaInfo?.globalPosition.y as number
Logger.debug(TAG, "即将滚动至yOffset: " + (offSetY - 100))
//头部距离48
this.scroller.scrollTo({
yOffset: offSetY - 100,
xOffset: 0,
animation: { duration: 1000, curve: Curve.Ease }
})
this.action.params!.targetLayout = undefined
}, 600)
}
}
}
interface radiusType {
...
...
sight_harmony/products/phone/src/main/ets/pages/detail/DynamicDetailPage.ets
View file @
d75bbd2
...
...
@@ -9,35 +9,25 @@ const TAG = 'DynamicDetailPage';
@Component
struct DynamicDetailPage {
pageShowTime:number = 0;
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
@Provide pageName: string = TrackConstants.PageName.DynamicDetail
@Provide pageId: string = TrackConstants.PageName.DynamicDetail
build() {
Column() {
DynamicDetailComponent({
relId: this.relId,
contentId: this.contentId,
relType: this.relType
})
DynamicDetailComponent({action: router.getParams() as Action })
}
.height('100%')
.width('100%')
.backgroundColor('#20272E')
}
aboutToAppear() {
let par:Action = router.getParams() as Action;
let params = par?.params;
this.relId = params?.extra?.relId || '';
this.relType = params?.extra?.relType || '';
this.contentId = params?.contentID || '';
}
onPageShow() {
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
onPageHide() {
//页面浏览
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.DynamicDetail,TrackConstants.PageName.DynamicDetail,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
...
...
Please
register
or
login
to post a comment