xugenyuan

ref |> 解决从精选评论、我的评论进入对应文章稿件详情时,自动跳转至稿件详情评论区问题

... ... @@ -163,7 +163,8 @@ export class ProcessUtils {
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as ExtraDTO,
targetLayout: content.customParamTargetLayout
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
... ... @@ -232,7 +233,8 @@ export class ProcessUtils {
relId: content?.relId,
channelId: content?.channelId,
pageId: content?.pageId
} as ExtraDTO
} as ExtraDTO,
targetLayout: content.customParamTargetLayout
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
... ... @@ -300,7 +302,8 @@ export class ProcessUtils {
channelId: content?.channelId,
sourcePage: '5',
commentId: content?.commentInfo?.commentId
} as ExtraDTO
} as ExtraDTO,
targetLayout: content.customParamTargetLayout
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
... ... @@ -316,7 +319,8 @@ export class ProcessUtils {
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as ExtraDTO,
targetLayout: content.customParamTargetLayout
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
... ... @@ -352,7 +356,8 @@ export class ProcessUtils {
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as ExtraDTO,
targetLayout: content.customParamTargetLayout
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
... ... @@ -394,7 +399,8 @@ export class ProcessUtils {
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as ExtraDTO,
targetLayout: content.customParamTargetLayout
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
... ...
... ... @@ -116,6 +116,9 @@ export class ContentDTO implements BaseDTO {
timeBlurred:number = 0
top:number = 0
// 自定义参数,用于跳转对应页面时 传递targetLayout参数用
customParamTargetLayout?: string
static clone(old: ContentDTO): ContentDTO {
let content = new ContentDTO();
content.liveType = old.liveType;
... ...
... ... @@ -24,4 +24,6 @@ export interface Params {
videoCoverUrl?: string;
pageId?: string;
backVisibility?: boolean; //展示顶部返回栏
targetLayout?: string; // "comment" 表示进入对应页面后,跳转至评论区
}
... ...
... ... @@ -66,6 +66,7 @@ export struct ImageAndTextPageComponent {
@State offsetY: number = 0
pageShowTime:number = 0;
pageHideTime:number = 0;
lastTimeoutId?: number
onPageShow() {
this.pageShowTime = DateTimeUtils.getTimeStamp()
... ... @@ -152,6 +153,8 @@ export struct ImageAndTextPageComponent {
.onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
this.checkToScrollCommentArea()
})
// .onMeasureSize()
... ... @@ -413,6 +416,7 @@ export struct ImageAndTextPageComponent {
if (this.info) {
// let height = DisplayUtils.getDeviceHeight() / 2
let offSetY = this.info?.globalPosition.y as number
Logger.debug(TAG, "滚动至yOffset: " + (offSetY - 100))
//头部距离48
this.scroller.scrollTo({
yOffset: offSetY - 100,
... ... @@ -427,4 +431,27 @@ export struct ImageAndTextPageComponent {
aboutToDisappear() {
}
checkToScrollCommentArea() {
if (!this.info) {
// 需要评论区位置,调用前 请确保它有值
return
}
if (this.action.params?.targetLayout && this.action.params.targetLayout == "comment") {
if (this.lastTimeoutId) {
clearTimeout(this.lastTimeoutId)
}
this.lastTimeoutId = setTimeout(() => {
let offSetY = this.info?.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)
}
}
}
... ...
... ... @@ -498,6 +498,7 @@ struct QualityCommentItem {
content.relType = this.item.targetRelType;
content.pageId = this.item.pageId;
content.linkUrl = this.item.h5Url;
content.customParamTargetLayout = "comment"
ProcessUtils.processPage(content)
}
... ...
... ... @@ -93,6 +93,7 @@ export struct HomePageBottomCommentComponent {
.onClick(()=>{
let content = getParams(item)
TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal,TrackParamConvert.program(content))
content.customParamTargetLayout = "comment"
ProcessUtils.processPage(content)
})
.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
... ...