fix |> 点击已关注号主的动态图文内容下方评论按钮,进入动态详情页,应锚定评论区
http://192.168.1.3:8080/zentao/bug-view-20393.html Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
5 changed files
with
27 additions
and
56 deletions
| @@ -399,22 +399,6 @@ export class ProcessUtils { | @@ -399,22 +399,6 @@ export class ProcessUtils { | ||
| 399 | return | 399 | return |
| 400 | } | 400 | } |
| 401 | ProcessUtils.processPage(contentBean) | 401 | ProcessUtils.processPage(contentBean) |
| 402 | - // let taskAction: Action = { | ||
| 403 | - // type: 'JUMP_INNER_NEW_PAGE', | ||
| 404 | - // params: { | ||
| 405 | - // contentID: content?.newsId, | ||
| 406 | - // url:content?.linkUrl, | ||
| 407 | - // pageID: 'IMAGE_TEXT_DETAIL', | ||
| 408 | - // extra: { | ||
| 409 | - // relType: content?.relType, | ||
| 410 | - // relId: content?.relId, | ||
| 411 | - // sourcePage: '5', | ||
| 412 | - // commentId: content?.commentId | ||
| 413 | - // } as ExtraDTO | ||
| 414 | - // } as Params, | ||
| 415 | - // }; | ||
| 416 | - // WDRouterRule.jumpWithAction(taskAction) | ||
| 417 | - // Logger.debug(TAG, `commentGotoWeb, ${content.newsId}`); | ||
| 418 | } | 402 | } |
| 419 | 403 | ||
| 420 | public static gotoH5NewsWeb(content: ContentDTO) { | 404 | public static gotoH5NewsWeb(content: ContentDTO) { |
| @@ -433,7 +417,6 @@ export class ProcessUtils { | @@ -433,7 +417,6 @@ export class ProcessUtils { | ||
| 433 | title: content?.newsTitle | 417 | title: content?.newsTitle |
| 434 | } as ExtraDTO, | 418 | } as ExtraDTO, |
| 435 | targetLayout: content.customParamTargetLayout, | 419 | targetLayout: content.customParamTargetLayout, |
| 436 | - clickComment: content.clickComment | ||
| 437 | } as Params, | 420 | } as Params, |
| 438 | }; | 421 | }; |
| 439 | WDRouterRule.jumpWithAction(taskAction) | 422 | WDRouterRule.jumpWithAction(taskAction) |
| @@ -456,7 +439,6 @@ export class ProcessUtils { | @@ -456,7 +439,6 @@ export class ProcessUtils { | ||
| 456 | commentId: content?.commentInfo?.commentId | 439 | commentId: content?.commentInfo?.commentId |
| 457 | } as ExtraDTO, | 440 | } as ExtraDTO, |
| 458 | targetLayout: content.customParamTargetLayout, | 441 | targetLayout: content.customParamTargetLayout, |
| 459 | - clickComment: content.clickComment | ||
| 460 | } as Params, | 442 | } as Params, |
| 461 | }; | 443 | }; |
| 462 | WDRouterRule.jumpWithAction(taskAction) | 444 | WDRouterRule.jumpWithAction(taskAction) |
| @@ -144,7 +144,6 @@ export class ContentDTO implements BaseDTO { | @@ -144,7 +144,6 @@ export class ContentDTO implements BaseDTO { | ||
| 144 | isMourning?: boolean = false; | 144 | isMourning?: boolean = false; |
| 145 | 145 | ||
| 146 | author: string = ""; ///撰稿人 | 146 | author: string = ""; ///撰稿人 |
| 147 | - clickComment:boolean = false; | ||
| 148 | 147 | ||
| 149 | // 号主页评论列表点击跳转到视频详情判断评论弹框是否展开 | 148 | // 号主页评论列表点击跳转到视频详情判断评论弹框是否展开 |
| 150 | showComment?:boolean = false; | 149 | showComment?:boolean = false; |
| @@ -24,6 +24,5 @@ export interface Params { | @@ -24,6 +24,5 @@ export interface Params { | ||
| 24 | videoCoverUrl?: string; | 24 | videoCoverUrl?: string; |
| 25 | pageId?: string; | 25 | pageId?: string; |
| 26 | backVisibility?: boolean; //展示顶部返回栏 | 26 | backVisibility?: boolean; //展示顶部返回栏 |
| 27 | - clickComment?:boolean;//点击评论按钮进入稿件详情页定位到评论区 | ||
| 28 | targetLayout?: string; // "comment" 表示进入对应页面后,跳转至评论区 | 27 | targetLayout?: string; // "comment" 表示进入对应页面后,跳转至评论区 |
| 29 | } | 28 | } |
| @@ -125,7 +125,7 @@ export struct CarderInteraction { | @@ -125,7 +125,7 @@ export struct CarderInteraction { | ||
| 125 | } | 125 | } |
| 126 | .justifyContent(FlexAlign.Center) | 126 | .justifyContent(FlexAlign.Center) |
| 127 | .onClick(() => { | 127 | .onClick(() => { |
| 128 | - this.contentDTO.clickComment = true | 128 | + this.contentDTO.customParamTargetLayout = "comment" |
| 129 | ProcessUtils.processPage(this.contentDTO); | 129 | ProcessUtils.processPage(this.contentDTO); |
| 130 | }) | 130 | }) |
| 131 | } | 131 | } |
| @@ -93,12 +93,7 @@ export struct ImageAndTextPageComponent { | @@ -93,12 +93,7 @@ export struct ImageAndTextPageComponent { | ||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | webPageIsPageEnd() { | 95 | webPageIsPageEnd() { |
| 96 | - if (this.action.params?.clickComment) { | ||
| 97 | - setTimeout(()=>{ | ||
| 98 | - this.pageScrollToCommonent() | ||
| 99 | - }, | ||
| 100 | - 800) | ||
| 101 | - } | 96 | + this.checkToScrollCommentArea() |
| 102 | } | 97 | } |
| 103 | 98 | ||
| 104 | build() { | 99 | build() { |
| @@ -255,7 +250,7 @@ export struct ImageAndTextPageComponent { | @@ -255,7 +250,7 @@ export struct ImageAndTextPageComponent { | ||
| 255 | showMainText:this.showMainText, | 250 | showMainText:this.showMainText, |
| 256 | styleType: 1, | 251 | styleType: 1, |
| 257 | onCommentIconClick: () => { | 252 | onCommentIconClick: () => { |
| 258 | - this.pageScrollToCommonent() | 253 | + this.toggleScrollToCommonentOrTop() |
| 259 | } | 254 | } |
| 260 | }) | 255 | }) |
| 261 | } | 256 | } |
| @@ -502,28 +497,6 @@ export struct ImageAndTextPageComponent { | @@ -502,28 +497,6 @@ export struct ImageAndTextPageComponent { | ||
| 502 | } | 497 | } |
| 503 | } | 498 | } |
| 504 | 499 | ||
| 505 | - private pageScrollToCommonent() { | ||
| 506 | - const info = componentUtils.getRectangleById('comment'); | ||
| 507 | - //评论区当前位置 | ||
| 508 | - let currentCommonentOffSetY = this.info?.globalPosition.y as number - 70 | ||
| 509 | - // 当前页面滚动位置 | ||
| 510 | - let currentScrollOffSetY = this.scroller.currentOffset().yOffset | ||
| 511 | - let offSetY = 0 | ||
| 512 | - if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) { | ||
| 513 | - offSetY = currentScrollOffSetY + (currentCommonentOffSetY - this.screenHeight+this.bottomHeight) + 400 | ||
| 514 | - } | ||
| 515 | - // 定位到评论区域 | ||
| 516 | - if (!this.showMainText) { | ||
| 517 | - this.scroller.scrollTo({ | ||
| 518 | - xOffset: 0, | ||
| 519 | - yOffset: offSetY, | ||
| 520 | - animation: { duration: 1000, curve: Curve.Ease } | ||
| 521 | - }) | ||
| 522 | - } else { | ||
| 523 | - this.scroller.scrollEdge(Edge.Top) | ||
| 524 | - } | ||
| 525 | - } | ||
| 526 | - | ||
| 527 | aboutToAppear() { | 500 | aboutToAppear() { |
| 528 | // Logger.debug(TAG, '文章详情页 aboutToAppear,开始请求接口数据'); | 501 | // Logger.debug(TAG, '文章详情页 aboutToAppear,开始请求接口数据'); |
| 529 | this.getDetail() | 502 | this.getDetail() |
| @@ -582,19 +555,37 @@ export struct ImageAndTextPageComponent { | @@ -582,19 +555,37 @@ export struct ImageAndTextPageComponent { | ||
| 582 | this.showMainText = true | 555 | this.showMainText = true |
| 583 | } | 556 | } |
| 584 | 557 | ||
| 585 | - if (this.action.params?.targetLayout && this.action.params.targetLayout == "comment") { | 558 | + if (!this.showMainText && this.action.params?.targetLayout == "comment") { |
| 586 | if (this.lastTimeoutId) { | 559 | if (this.lastTimeoutId) { |
| 587 | clearTimeout(this.lastTimeoutId) | 560 | clearTimeout(this.lastTimeoutId) |
| 588 | } | 561 | } |
| 589 | this.lastTimeoutId = setTimeout(() => { | 562 | this.lastTimeoutId = setTimeout(() => { |
| 590 | - //头部距离48 | 563 | + this.toggleScrollToCommonentOrTop(true) |
| 564 | + this.action.params!.targetLayout = undefined | ||
| 565 | + }, 600) | ||
| 566 | + } | ||
| 567 | + } | ||
| 568 | + | ||
| 569 | + private toggleScrollToCommonentOrTop(forceToComment?: boolean) { | ||
| 570 | + | ||
| 571 | + // 定位到评论区域 | ||
| 572 | + if ((forceToComment == undefined || forceToComment == false) && this.showMainText) { | ||
| 573 | + this.scroller.scrollEdge(Edge.Top) | ||
| 574 | + return | ||
| 575 | + } | ||
| 576 | + | ||
| 577 | + //评论区当前位置 | ||
| 578 | + let currentCommonentOffSetY = this.info?.globalPosition.y as number - 70 | ||
| 579 | + // 当前页面滚动位置 | ||
| 580 | + let currentScrollOffSetY = this.scroller.currentOffset().yOffset | ||
| 581 | + let offSetY = 0 | ||
| 582 | + if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) { | ||
| 583 | + offSetY = currentScrollOffSetY + (currentCommonentOffSetY - this.screenHeight+this.bottomHeight) + 400 | ||
| 584 | + } | ||
| 591 | this.scroller.scrollTo({ | 585 | this.scroller.scrollTo({ |
| 592 | - yOffset: offSetY, | ||
| 593 | xOffset: 0, | 586 | xOffset: 0, |
| 587 | + yOffset: offSetY, | ||
| 594 | animation: { duration: 1000, curve: Curve.Ease } | 588 | animation: { duration: 1000, curve: Curve.Ease } |
| 595 | }) | 589 | }) |
| 596 | - this.action.params!.targetLayout = undefined | ||
| 597 | - }, 600) | ||
| 598 | - } | ||
| 599 | } | 590 | } |
| 600 | } | 591 | } |
-
Please register or login to post a comment