Showing
4 changed files
with
38 additions
and
12 deletions
| @@ -5,7 +5,6 @@ import { | @@ -5,7 +5,6 @@ import { | ||
| 5 | EmitterUtils, | 5 | EmitterUtils, |
| 6 | EmitterEventId, | 6 | EmitterEventId, |
| 7 | NetworkUtil, | 7 | NetworkUtil, |
| 8 | - DisplayUtils | ||
| 9 | } from 'wdKit'; | 8 | } from 'wdKit'; |
| 10 | import { | 9 | import { |
| 11 | Action, | 10 | Action, |
| @@ -33,6 +32,7 @@ import { CommentComponent } from '../components/comment/view/CommentComponent' | @@ -33,6 +32,7 @@ import { CommentComponent } from '../components/comment/view/CommentComponent' | ||
| 33 | import { HttpUtils } from 'wdNetwork/Index'; | 32 | import { HttpUtils } from 'wdNetwork/Index'; |
| 34 | import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | 33 | import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' |
| 35 | import { common } from '@kit.AbilityKit'; | 34 | import { common } from '@kit.AbilityKit'; |
| 35 | +import { componentUtils, window } from '@kit.ArkUI'; | ||
| 36 | 36 | ||
| 37 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 37 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 38 | 38 | ||
| @@ -58,6 +58,9 @@ export struct ImageAndTextPageComponent { | @@ -58,6 +58,9 @@ export struct ImageAndTextPageComponent { | ||
| 58 | @State likeNum: number = 0 | 58 | @State likeNum: number = 0 |
| 59 | @State reachEndIncreament: number = 0 | 59 | @State reachEndIncreament: number = 0 |
| 60 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 60 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 61 | + @State isScrollTop: boolean = true | ||
| 62 | + @State offsetY: number = 0 | ||
| 63 | + | ||
| 61 | build() { | 64 | build() { |
| 62 | Stack({ alignContent: Alignment.Top }) { | 65 | Stack({ alignContent: Alignment.Top }) { |
| 63 | Stack({ alignContent: Alignment.Bottom }) { | 66 | Stack({ alignContent: Alignment.Bottom }) { |
| @@ -125,9 +128,11 @@ export struct ImageAndTextPageComponent { | @@ -125,9 +128,11 @@ export struct ImageAndTextPageComponent { | ||
| 125 | fixedHeightMode: false, | 128 | fixedHeightMode: false, |
| 126 | reachEndIncreament: this.reachEndIncreament, | 129 | reachEndIncreament: this.reachEndIncreament, |
| 127 | reachEndLoadMoreFinish: () => { | 130 | reachEndLoadMoreFinish: () => { |
| 128 | - | ||
| 129 | } | 131 | } |
| 130 | - }).onAreaChange((oldValue: Area, newValue: Area) => { | 132 | + |
| 133 | + }).id('comment') | ||
| 134 | + | ||
| 135 | + .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 131 | this.info = newValue | 136 | this.info = newValue |
| 132 | }) | 137 | }) |
| 133 | // .onMeasureSize() | 138 | // .onMeasureSize() |
| @@ -135,6 +140,7 @@ export struct ImageAndTextPageComponent { | @@ -135,6 +140,7 @@ export struct ImageAndTextPageComponent { | ||
| 135 | } | 140 | } |
| 136 | } | 141 | } |
| 137 | } | 142 | } |
| 143 | + .id('imgTextContainer') | ||
| 138 | } | 144 | } |
| 139 | .width(CommonConstants.FULL_WIDTH) | 145 | .width(CommonConstants.FULL_WIDTH) |
| 140 | .height(CommonConstants.FULL_HEIGHT) | 146 | .height(CommonConstants.FULL_HEIGHT) |
| @@ -163,8 +169,27 @@ export struct ImageAndTextPageComponent { | @@ -163,8 +169,27 @@ export struct ImageAndTextPageComponent { | ||
| 163 | publishCommentModel: this.publishCommentModel, | 169 | publishCommentModel: this.publishCommentModel, |
| 164 | operationButtonList: this.operationButtonList, | 170 | operationButtonList: this.operationButtonList, |
| 165 | styleType: 1, | 171 | styleType: 1, |
| 172 | + onCommentIconClick: () => { | ||
| 173 | + const info = componentUtils.getRectangleById('comment'); | ||
| 174 | + console.log(JSON.stringify(info)) | ||
| 175 | + | ||
| 176 | + if (!this.offsetY) { | ||
| 177 | + this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y | ||
| 178 | + } | ||
| 179 | + // 定位到评论区域 | ||
| 180 | + if (this.isScrollTop) { | ||
| 181 | + this.scroller.scrollTo({ | ||
| 182 | + xOffset: 0, | ||
| 183 | + yOffset: this.offsetY, | ||
| 184 | + animation: true | ||
| 185 | + }) | ||
| 186 | + } else { | ||
| 187 | + this.scroller.scrollEdge(Edge.Top) | ||
| 188 | + } | ||
| 189 | + this.isScrollTop = !this.isScrollTop | ||
| 190 | + } | ||
| 166 | }) | 191 | }) |
| 167 | - .position({y: '100%'}) | 192 | + .position({ y: '100%' }) |
| 168 | } | 193 | } |
| 169 | .width(CommonConstants.FULL_WIDTH) | 194 | .width(CommonConstants.FULL_WIDTH) |
| 170 | .height(CommonConstants.FULL_HEIGHT) | 195 | .height(CommonConstants.FULL_HEIGHT) |
| @@ -174,7 +199,7 @@ export struct ImageAndTextPageComponent { | @@ -174,7 +199,7 @@ export struct ImageAndTextPageComponent { | ||
| 174 | // 发布时间 | 199 | // 发布时间 |
| 175 | Column() { | 200 | Column() { |
| 176 | Row() { | 201 | Row() { |
| 177 | - if(this.isNetConnected && !this.detailContentEmpty) { | 202 | + if (this.isNetConnected && !this.detailContentEmpty) { |
| 178 | Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) | 203 | Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) |
| 179 | .width(80) | 204 | .width(80) |
| 180 | .height(28) | 205 | .height(28) |
| @@ -207,7 +232,7 @@ export struct ImageAndTextPageComponent { | @@ -207,7 +232,7 @@ export struct ImageAndTextPageComponent { | ||
| 207 | 232 | ||
| 208 | private async getDetail() { | 233 | private async getDetail() { |
| 209 | this.isNetConnected = NetworkUtil.isNetConnected() | 234 | this.isNetConnected = NetworkUtil.isNetConnected() |
| 210 | - if(!this.isNetConnected) { | 235 | + if (!this.isNetConnected) { |
| 211 | this.emptyType = 1 | 236 | this.emptyType = 1 |
| 212 | } | 237 | } |
| 213 | let contentId: string = '' | 238 | let contentId: string = '' |
| @@ -229,7 +254,7 @@ export struct ImageAndTextPageComponent { | @@ -229,7 +254,7 @@ export struct ImageAndTextPageComponent { | ||
| 229 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 254 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 230 | // 判断内容是否已下线,空数组表示下线 | 255 | // 判断内容是否已下线,空数组表示下线 |
| 231 | this.detailContentEmpty = detailBeans.length === 0 ? true : false | 256 | this.detailContentEmpty = detailBeans.length === 0 ? true : false |
| 232 | - if(this.detailContentEmpty) { | 257 | + if (this.detailContentEmpty) { |
| 233 | this.emptyType = 18 | 258 | this.emptyType = 18 |
| 234 | } | 259 | } |
| 235 | console.log(TAG, JSON.stringify(detailBeans)) | 260 | console.log(TAG, JSON.stringify(detailBeans)) |
| @@ -270,12 +295,11 @@ export struct ImageAndTextPageComponent { | @@ -270,12 +295,11 @@ export struct ImageAndTextPageComponent { | ||
| 270 | } | 295 | } |
| 271 | 296 | ||
| 272 | //意图上报 | 297 | //意图上报 |
| 273 | - private viewBlogInsightIntentShare(){ | 298 | + private viewBlogInsightIntentShare() { |
| 274 | let context = getContext(this) as common.UIAbilityContext; | 299 | let context = getContext(this) as common.UIAbilityContext; |
| 275 | - viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactData) | 300 | + viewBlogItemInsightIntentShare(context, this.contentDetailData, this.interactData) |
| 276 | } | 301 | } |
| 277 | 302 | ||
| 278 | - | ||
| 279 | private async getRecommend() { | 303 | private async getRecommend() { |
| 280 | let params: postRecommendListParams = { | 304 | let params: postRecommendListParams = { |
| 281 | imei: HttpUtils.getImei(), | 305 | imei: HttpUtils.getImei(), |
| @@ -9,7 +9,7 @@ import { ContentDetailDTO } from 'wdBean/Index' | @@ -9,7 +9,7 @@ import { ContentDetailDTO } from 'wdBean/Index' | ||
| 9 | export struct CommentTabComponent { | 9 | export struct CommentTabComponent { |
| 10 | private onCommentFocus: () => void = () => { | 10 | private onCommentFocus: () => void = () => { |
| 11 | } | 11 | } |
| 12 | - private onLoad: (dialogController: CustomDialogController) => void = () => { | 12 | + private onLoad: (dialogController: CustomDialogController | null) => void = () => { |
| 13 | } | 13 | } |
| 14 | @ObjectLink publishCommentModel: publishCommentModel | 14 | @ObjectLink publishCommentModel: publishCommentModel |
| 15 | @Prop contentDetail: ContentDetailDTO | 15 | @Prop contentDetail: ContentDetailDTO |
| @@ -64,6 +64,7 @@ export struct OperRowListView { | @@ -64,6 +64,7 @@ export struct OperRowListView { | ||
| 64 | /** | 64 | /** |
| 65 | * 用于区分页面类型,在哪个页面嵌套就传相应的值 | 65 | * 用于区分页面类型,在哪个页面嵌套就传相应的值 |
| 66 | * 1:视频详情页 2:竖屏直播页 3:图集 4:横屏直播页 | 66 | * 1:视频详情页 2:竖屏直播页 3:图集 4:横屏直播页 |
| 67 | + * 8: 评论弹框内 | ||
| 67 | */ | 68 | */ |
| 68 | @Prop pageComponentType?: number = -1 | 69 | @Prop pageComponentType?: number = -1 |
| 69 | @Prop showBackIcon?: boolean = true | 70 | @Prop showBackIcon?: boolean = true |
| @@ -208,7 +209,7 @@ export struct OperRowListView { | @@ -208,7 +209,7 @@ export struct OperRowListView { | ||
| 208 | contentDetail: this.contentDetailData, | 209 | contentDetail: this.contentDetailData, |
| 209 | onCommentFocus: this.onCommentFocus, | 210 | onCommentFocus: this.onCommentFocus, |
| 210 | pageComponentType: this.pageComponentType, | 211 | pageComponentType: this.pageComponentType, |
| 211 | - onLoad: (dialogController: CustomDialogController) => { | 212 | + onLoad: (dialogController: CustomDialogController | null) => { |
| 212 | this.dialogController = dialogController | 213 | this.dialogController = dialogController |
| 213 | } | 214 | } |
| 214 | }) | 215 | }) |
| @@ -91,6 +91,7 @@ export struct DetailDialog { | @@ -91,6 +91,7 @@ export struct DetailDialog { | ||
| 91 | 91 | ||
| 92 | OperRowListView({ | 92 | OperRowListView({ |
| 93 | componentType: 1, | 93 | componentType: 1, |
| 94 | + pageComponentType: 8, | ||
| 94 | showBackIcon: false, | 95 | showBackIcon: false, |
| 95 | operationButtonList: ['comment', 'like', 'collect', 'share'], | 96 | operationButtonList: ['comment', 'like', 'collect', 'share'], |
| 96 | contentDetailData: this.contentDetailData, | 97 | contentDetailData: this.contentDetailData, |
-
Please register or login to post a comment