wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  feat: bug-18383 动态详情页,添加自动定位评论区域位置功能
  feat:UI还原问题-【uat】进入视频直播评论或抢首评,全部评论字体偏大,关闭按钮颜色和ios不一致 问题修复
@@ -6,6 +6,8 @@ import { @@ -6,6 +6,8 @@ import {
6 NumberFormatterUtils, 6 NumberFormatterUtils,
7 DisplayUtils, 7 DisplayUtils,
8 NetworkUtil, 8 NetworkUtil,
  9 + EmitterUtils,
  10 + EmitterEventId,
9 FastClickUtil 11 FastClickUtil
10 } from 'wdKit'; 12 } from 'wdKit';
11 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 13 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
@@ -45,6 +47,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'; @@ -45,6 +47,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton';
45 import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' 47 import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
46 import { common } from '@kit.AbilityKit'; 48 import { common } from '@kit.AbilityKit';
47 import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index'; 49 import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
  50 +import { componentUtils, window } from '@kit.ArkUI';
48 const TAG = 'DynamicDetailComponent' 51 const TAG = 'DynamicDetailComponent'
49 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; 52 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
50 53
@@ -79,6 +82,8 @@ export struct DynamicDetailComponent { @@ -79,6 +82,8 @@ export struct DynamicDetailComponent {
79 @State operationButtonList: string[] = [] 82 @State operationButtonList: string[] = []
80 @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 83 @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
81 @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 84 @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
  85 + @State offsetY: number = 0
  86 + @State isScrollTop: boolean = true
82 87
83 pageParam: ParamType = {} 88 pageParam: ParamType = {}
84 commentListAreaInfo?: Area 89 commentListAreaInfo?: Area
@@ -91,6 +96,27 @@ export struct DynamicDetailComponent { @@ -91,6 +96,27 @@ export struct DynamicDetailComponent {
91 // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 96 // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
92 this.likesStyle = this.contentDetailData.likesStyle 97 this.likesStyle = this.contentDetailData.likesStyle
93 this.openLikes = this.contentDetailData.openLikes == 1 ? true : false 98 this.openLikes = this.contentDetailData.openLikes == 1 ? true : false
  99 +
  100 + //注册通知,来自别的组件的评论成功通知
  101 + EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => {
  102 + if (targetId) {
  103 + if (targetId == this.publishCommentModel.targetId) {
  104 + // 滚动到评论列表
  105 + if (this.commentListAreaInfo) {
  106 + // let height = DisplayUtils.getDeviceHeight() / 2
  107 + let offSetY = this.commentListAreaInfo?.globalPosition.y as number
  108 + Logger.debug(TAG, "滚动至yOffset: " + (offSetY - 100))
  109 + //头部距离48
  110 + this.scroller.scrollTo({
  111 + yOffset: offSetY - 100,
  112 + xOffset: 0,
  113 + animation: { duration: 1000, curve: Curve.Ease }
  114 + })
  115 + }
  116 + }
  117 + }
  118 + })
  119 +
94 } 120 }
95 121
96 onPageHide() { 122 onPageHide() {
@@ -577,8 +603,28 @@ export struct DynamicDetailComponent { @@ -577,8 +603,28 @@ export struct DynamicDetailComponent {
577 publishCommentModel: this.publishCommentModel, 603 publishCommentModel: this.publishCommentModel,
578 operationButtonList: this.operationButtonList, 604 operationButtonList: this.operationButtonList,
579 styleType: 1, 605 styleType: 1,
  606 + onCommentIconClick:()=>{
  607 + const info = componentUtils.getRectangleById('comment');
  608 + console.log(JSON.stringify(info))
  609 +
  610 + if (!this.offsetY) {
  611 + this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y
  612 + }
  613 + // 定位到评论区域
  614 + if (this.isScrollTop) {
  615 + this.scroller.scrollTo({
  616 + xOffset: 0,
  617 + yOffset: this.offsetY,
  618 + animation: true
  619 + })
  620 + } else {
  621 + this.scroller.scrollEdge(Edge.Top)
  622 + }
  623 + this.isScrollTop = !this.isScrollTop
  624 + }
580 }) 625 })
581 .height(100) 626 .height(100)
  627 +
582 } 628 }
583 .margin({bottom: 65}) 629 .margin({bottom: 65})
584 } 630 }
@@ -123,7 +123,7 @@ export struct CommentComponent { @@ -123,7 +123,7 @@ export struct CommentComponent {
123 .height(16) 123 .height(16)
124 .width(3) 124 .width(3)
125 Text('全部评论') 125 Text('全部评论')
126 - .fontSize(18)// .fontColor('#222222') 126 + .fontSize(16)// .fontColor('#222222')
127 .fontColor($r('app.color.color_222222')) 127 .fontColor($r('app.color.color_222222'))
128 .fontWeight(FontWeight.Medium) 128 .fontWeight(FontWeight.Medium)
129 .margin({ left: 5 }) 129 .margin({ left: 5 })
@@ -131,7 +131,7 @@ export struct CommentComponent { @@ -131,7 +131,7 @@ export struct CommentComponent {
131 .margin({ left: 16 }) 131 .margin({ left: 16 })
132 132
133 133
134 - Image($r('app.media.close_button')) 134 + Image($r('app.media.comment_close'))
135 .height(16) 135 .height(16)
136 .width(16) 136 .width(16)
137 .margin({ right: 16 }) 137 .margin({ right: 16 })
@@ -146,14 +146,14 @@ struct CommentListDialog { @@ -146,14 +146,14 @@ struct CommentListDialog {
146 .height(16) 146 .height(16)
147 .width(3) 147 .width(3)
148 Text('全部评论') 148 Text('全部评论')
149 - .fontSize(18)// .fontColor('#222222') 149 + .fontSize(16)// .fontColor('#222222')
150 .fontColor($r('app.color.color_222222')) 150 .fontColor($r('app.color.color_222222'))
151 .fontWeight(FontWeight.Medium) 151 .fontWeight(FontWeight.Medium)
152 .margin({ left: 5 }) 152 .margin({ left: 5 })
153 } 153 }
154 .margin({ left: 16 }) 154 .margin({ left: 16 })
155 155
156 - Image($r('app.media.close_button')) 156 + Image($r('app.media.comment_close'))
157 .height(16) 157 .height(16)
158 .width(16) 158 .width(16)
159 .margin({ right: 16 })// .visibility(this.showCloseIcon ? Visibility.Visible : Visibility.Hidden) 159 .margin({ right: 16 })// .visibility(this.showCloseIcon ? Visibility.Visible : Visibility.Hidden)