Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: fix: 音频悬浮窗关闭按钮比播放按钮尺寸偏大 fix |> 修复点击评论按钮进入稿件详情页滑动到指定评论区域
Showing
6 changed files
with
55 additions
and
37 deletions
| @@ -189,7 +189,7 @@ export class ProcessUtils { | @@ -189,7 +189,7 @@ export class ProcessUtils { | ||
| 189 | if (typeof type == "number") { | 189 | if (typeof type == "number") { |
| 190 | type = `${type}` | 190 | type = `${type}` |
| 191 | } | 191 | } |
| 192 | - // console.log(TAG, 'objectType', `${JSON.stringify(content)}`); | 192 | + // Logger.debug(TAG, `objectType, ${JSON.stringify(content)}`); |
| 193 | switch (type) { | 193 | switch (type) { |
| 194 | case ContentConstants.TYPE_NONE: | 194 | case ContentConstants.TYPE_NONE: |
| 195 | // Logger.debug(TAG, "processPage, do nothing"); | 195 | // Logger.debug(TAG, "processPage, do nothing"); |
| @@ -432,7 +432,8 @@ export class ProcessUtils { | @@ -432,7 +432,8 @@ export class ProcessUtils { | ||
| 432 | commentId: content?.commentInfo?.commentId, | 432 | commentId: content?.commentInfo?.commentId, |
| 433 | title: content?.newsTitle | 433 | title: content?.newsTitle |
| 434 | } as ExtraDTO, | 434 | } as ExtraDTO, |
| 435 | - targetLayout: content.customParamTargetLayout | 435 | + targetLayout: content.customParamTargetLayout, |
| 436 | + clickComment: content.clickComment | ||
| 436 | } as Params, | 437 | } as Params, |
| 437 | }; | 438 | }; |
| 438 | WDRouterRule.jumpWithAction(taskAction) | 439 | WDRouterRule.jumpWithAction(taskAction) |
| @@ -454,7 +455,8 @@ export class ProcessUtils { | @@ -454,7 +455,8 @@ export class ProcessUtils { | ||
| 454 | sourcePage: '5', | 455 | sourcePage: '5', |
| 455 | commentId: content?.commentInfo?.commentId | 456 | commentId: content?.commentInfo?.commentId |
| 456 | } as ExtraDTO, | 457 | } as ExtraDTO, |
| 457 | - targetLayout: content.customParamTargetLayout | 458 | + targetLayout: content.customParamTargetLayout, |
| 459 | + clickComment: content.clickComment | ||
| 458 | } as Params, | 460 | } as Params, |
| 459 | }; | 461 | }; |
| 460 | WDRouterRule.jumpWithAction(taskAction) | 462 | WDRouterRule.jumpWithAction(taskAction) |
| @@ -144,6 +144,7 @@ export class ContentDTO implements BaseDTO { | @@ -144,6 +144,7 @@ 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; | ||
| 147 | 148 | ||
| 148 | static clone(old: ContentDTO): ContentDTO { | 149 | static clone(old: ContentDTO): ContentDTO { |
| 149 | let content = new ContentDTO(); | 150 | let content = new ContentDTO(); |
| @@ -24,6 +24,6 @@ export interface Params { | @@ -24,6 +24,6 @@ export interface Params { | ||
| 24 | videoCoverUrl?: string; | 24 | videoCoverUrl?: string; |
| 25 | pageId?: string; | 25 | pageId?: string; |
| 26 | backVisibility?: boolean; //展示顶部返回栏 | 26 | backVisibility?: boolean; //展示顶部返回栏 |
| 27 | - | 27 | + clickComment?:boolean;//点击评论按钮进入稿件详情页定位到评论区 |
| 28 | targetLayout?: string; // "comment" 表示进入对应页面后,跳转至评论区 | 28 | targetLayout?: string; // "comment" 表示进入对应页面后,跳转至评论区 |
| 29 | } | 29 | } |
| @@ -101,6 +101,7 @@ export struct CarderInteraction { | @@ -101,6 +101,7 @@ export struct CarderInteraction { | ||
| 101 | } | 101 | } |
| 102 | .justifyContent(FlexAlign.Center) | 102 | .justifyContent(FlexAlign.Center) |
| 103 | .onClick(() => { | 103 | .onClick(() => { |
| 104 | + this.contentDTO.clickComment = true | ||
| 104 | ProcessUtils.processPage(this.contentDTO); | 105 | ProcessUtils.processPage(this.contentDTO); |
| 105 | }) | 106 | }) |
| 106 | } | 107 | } |
| @@ -52,7 +52,7 @@ export struct ImageAndTextPageComponent { | @@ -52,7 +52,7 @@ export struct ImageAndTextPageComponent { | ||
| 52 | @State recommendList: ContentDTO[] = [] | 52 | @State recommendList: ContentDTO[] = [] |
| 53 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 53 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 54 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 54 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 55 | - @State isPageEnd: boolean = false | 55 | + // @State isPageEnd: boolean = false |
| 56 | @State publishTime: string = '' | 56 | @State publishTime: string = '' |
| 57 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 57 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 58 | // @State operationButtonList: string[] = ['comment', 'collect', 'share'] | 58 | // @State operationButtonList: string[] = ['comment', 'collect', 'share'] |
| @@ -77,6 +77,7 @@ export struct ImageAndTextPageComponent { | @@ -77,6 +77,7 @@ export struct ImageAndTextPageComponent { | ||
| 77 | lastTimeoutId?: number | 77 | lastTimeoutId?: number |
| 78 | @State needAnimation: boolean = false; | 78 | @State needAnimation: boolean = false; |
| 79 | 79 | ||
| 80 | + @State @Watch("webPageIsPageEnd") isPageEnd: boolean = false | ||
| 80 | @Consume @Watch('pageShowForUpdateData') pageShow :number | 81 | @Consume @Watch('pageShowForUpdateData') pageShow :number |
| 81 | @Consume @Watch('pageHideForUpdateData') pageHide :number | 82 | @Consume @Watch('pageHideForUpdateData') pageHide :number |
| 82 | 83 | ||
| @@ -92,6 +93,15 @@ export struct ImageAndTextPageComponent { | @@ -92,6 +93,15 @@ export struct ImageAndTextPageComponent { | ||
| 92 | TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration) | 93 | TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration) |
| 93 | } | 94 | } |
| 94 | 95 | ||
| 96 | + webPageIsPageEnd() { | ||
| 97 | + if (this.action.params?.clickComment) { | ||
| 98 | + setTimeout(()=>{ | ||
| 99 | + this.pageScrollToCommonent() | ||
| 100 | + }, | ||
| 101 | + 900) | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + | ||
| 95 | build() { | 105 | build() { |
| 96 | Stack({ alignContent: Alignment.Top }) { | 106 | Stack({ alignContent: Alignment.Top }) { |
| 97 | Stack({ alignContent: Alignment.Bottom }) { | 107 | Stack({ alignContent: Alignment.Bottom }) { |
| @@ -198,8 +208,8 @@ export struct ImageAndTextPageComponent { | @@ -198,8 +208,8 @@ export struct ImageAndTextPageComponent { | ||
| 198 | 208 | ||
| 199 | .onAreaChange((oldValue: Area, newValue: Area) => { | 209 | .onAreaChange((oldValue: Area, newValue: Area) => { |
| 200 | this.info = newValue | 210 | this.info = newValue |
| 201 | - console.log(TAG, "总页面滑动偏移量", this.scroller.currentOffset().yOffset) | ||
| 202 | - console.log(TAG, "总页面滑动偏移量111", newValue.globalPosition.y as number) | 211 | + // console.log(TAG, "总页面滑动偏移量", this.scroller.currentOffset().yOffset) |
| 212 | + // console.log(TAG, "总页面滑动偏移量111", newValue.globalPosition.y as number) | ||
| 203 | this.checkToScrollCommentArea() | 213 | this.checkToScrollCommentArea() |
| 204 | }) | 214 | }) |
| 205 | // .onMeasureSize() | 215 | // .onMeasureSize() |
| @@ -245,30 +255,7 @@ export struct ImageAndTextPageComponent { | @@ -245,30 +255,7 @@ export struct ImageAndTextPageComponent { | ||
| 245 | showMainText:this.showMainText, | 255 | showMainText:this.showMainText, |
| 246 | styleType: 1, | 256 | styleType: 1, |
| 247 | onCommentIconClick: () => { | 257 | onCommentIconClick: () => { |
| 248 | - const info = componentUtils.getRectangleById('comment'); | ||
| 249 | - console.log(TAG, "点击滑动页面", JSON.stringify(info)) | ||
| 250 | - | ||
| 251 | - //评论区当前位置 | ||
| 252 | - let currentCommonentOffSetY = this.info?.globalPosition.y as number | ||
| 253 | - let offSetY = 0 | ||
| 254 | - if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) { | ||
| 255 | - offSetY = currentCommonentOffSetY-200 | ||
| 256 | - } | ||
| 257 | - | ||
| 258 | - // if (!this.offsetY) { | ||
| 259 | - // this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y | ||
| 260 | - // } | ||
| 261 | - // 定位到评论区域 | ||
| 262 | - if (this.isScrollTop) { | ||
| 263 | - this.scroller.scrollTo({ | ||
| 264 | - xOffset: 0, | ||
| 265 | - yOffset: offSetY, | ||
| 266 | - animation: { duration: 1000, curve: Curve.Ease } | ||
| 267 | - }) | ||
| 268 | - } else { | ||
| 269 | - this.scroller.scrollEdge(Edge.Top) | ||
| 270 | - } | ||
| 271 | - this.isScrollTop = !this.isScrollTop | 258 | + this.pageScrollToCommonent() |
| 272 | } | 259 | } |
| 273 | }) | 260 | }) |
| 274 | } | 261 | } |
| @@ -288,6 +275,7 @@ export struct ImageAndTextPageComponent { | @@ -288,6 +275,7 @@ export struct ImageAndTextPageComponent { | ||
| 288 | Text(this.publishTime) | 275 | Text(this.publishTime) |
| 289 | .fontColor($r('app.color.color_B0B0B0')) | 276 | .fontColor($r('app.color.color_B0B0B0')) |
| 290 | .fontSize(13) | 277 | .fontSize(13) |
| 278 | + .height(20) | ||
| 291 | } | 279 | } |
| 292 | } | 280 | } |
| 293 | .width(CommonConstants.FULL_WIDTH) | 281 | .width(CommonConstants.FULL_WIDTH) |
| @@ -514,6 +502,29 @@ export struct ImageAndTextPageComponent { | @@ -514,6 +502,29 @@ export struct ImageAndTextPageComponent { | ||
| 514 | } | 502 | } |
| 515 | } | 503 | } |
| 516 | 504 | ||
| 505 | + private pageScrollToCommonent() { | ||
| 506 | + const info = componentUtils.getRectangleById('comment'); | ||
| 507 | + console.log(TAG, "点击滑动页面", JSON.stringify(info)) | ||
| 508 | + //评论区当前位置 | ||
| 509 | + let currentCommonentOffSetY = this.info?.globalPosition.y as number | ||
| 510 | + let offSetY = 0 | ||
| 511 | + if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) { | ||
| 512 | + offSetY = currentCommonentOffSetY-200 | ||
| 513 | + } | ||
| 514 | + | ||
| 515 | + // 定位到评论区域 | ||
| 516 | + if (this.isScrollTop) { | ||
| 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 | + this.isScrollTop = !this.isScrollTop | ||
| 526 | + } | ||
| 527 | + | ||
| 517 | aboutToAppear() { | 528 | aboutToAppear() { |
| 518 | Logger.debug(TAG, '文章详情页 aboutToAppear,开始请求接口数据'); | 529 | Logger.debug(TAG, '文章详情页 aboutToAppear,开始请求接口数据'); |
| 519 | this.getDetail() | 530 | this.getDetail() |
| @@ -35,6 +35,7 @@ struct Index { | @@ -35,6 +35,7 @@ struct Index { | ||
| 35 | @State @Watch("moveWindow") windowPosition: Position = { x: vp2px(12), y: vp2px(576) }; | 35 | @State @Watch("moveWindow") windowPosition: Position = { x: vp2px(12), y: vp2px(576) }; |
| 36 | private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.All }); | 36 | private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.All }); |
| 37 | private subWindow:window.Window | null = null | 37 | private subWindow:window.Window | null = null |
| 38 | + @State start: boolean = true | ||
| 38 | 39 | ||
| 39 | async aboutToAppear() { | 40 | async aboutToAppear() { |
| 40 | this.subWindow = window.findWindow("subWindow") | 41 | this.subWindow = window.findWindow("subWindow") |
| @@ -108,12 +109,13 @@ struct Index { | @@ -108,12 +109,13 @@ struct Index { | ||
| 108 | Stack({ alignContent: Alignment.End }) { | 109 | Stack({ alignContent: Alignment.End }) { |
| 109 | Column() { //标题 时间 进度条 | 110 | Column() { //标题 时间 进度条 |
| 110 | Marquee({ | 111 | Marquee({ |
| 111 | - start: true, | 112 | + start: this.start, |
| 112 | step: 5, | 113 | step: 5, |
| 113 | loop: Number.POSITIVE_INFINITY, | 114 | loop: Number.POSITIVE_INFINITY, |
| 114 | fromStart: true, | 115 | fromStart: true, |
| 115 | src: this.audioTitle | 116 | src: this.audioTitle |
| 116 | }) | 117 | }) |
| 118 | + .marqueeUpdateStrategy(MarqueeUpdateStrategy.DEFAULT) | ||
| 117 | .width("60%") | 119 | .width("60%") |
| 118 | .height(20) | 120 | .height(20) |
| 119 | .fontColor('#222222') | 121 | .fontColor('#222222') |
| @@ -124,9 +126,10 @@ struct Index { | @@ -124,9 +126,10 @@ struct Index { | ||
| 124 | // .onStart(() => { | 126 | // .onStart(() => { |
| 125 | // console.info('Marquee animation complete onStart') | 127 | // console.info('Marquee animation complete onStart') |
| 126 | // }) | 128 | // }) |
| 127 | - // .onBounce(() => { | ||
| 128 | - // console.info('Marquee animation complete onBounce') | ||
| 129 | - // }) | 129 | + .onBounce(() => { |
| 130 | + console.info('Marquee animation complete onBounce') | ||
| 131 | + this.start = false | ||
| 132 | + }) | ||
| 130 | // .onFinish(() => { | 133 | // .onFinish(() => { |
| 131 | // console.info('Marquee animation complete onFinish') | 134 | // console.info('Marquee animation complete onFinish') |
| 132 | // }) | 135 | // }) |
| @@ -186,8 +189,8 @@ struct Index { | @@ -186,8 +189,8 @@ struct Index { | ||
| 186 | })) | 189 | })) |
| 187 | Image($r("app.media.icon_audio_close")) | 190 | Image($r("app.media.icon_audio_close")) |
| 188 | .objectFit(ImageFit.Contain) | 191 | .objectFit(ImageFit.Contain) |
| 189 | - .width(32) | ||
| 190 | - .height(32) | 192 | + .width(24) |
| 193 | + .height(24) | ||
| 191 | .gesture( | 194 | .gesture( |
| 192 | TapGesture() | 195 | TapGesture() |
| 193 | .onAction((event: GestureEvent) => { | 196 | .onAction((event: GestureEvent) => { |
-
Please register or login to post a comment