王士厅

图集人民号点击头像跳转到号主页,对接评论点赞组合组件

@@ -5,7 +5,8 @@ import { @@ -5,7 +5,8 @@ import {
5 PhotoListBean, 5 PhotoListBean,
6 postInteractBrowsOperateParams, 6 postInteractBrowsOperateParams,
7 postBatchAttentionStatusParams, 7 postBatchAttentionStatusParams,
8 - postInteractAccentionOperateParams 8 + postInteractAccentionOperateParams,
  9 + Params
9 } from 'wdBean'; 10 } from 'wdBean';
10 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 11 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
11 import display from '@ohos.display'; 12 import display from '@ohos.display';
@@ -44,6 +45,7 @@ export struct MultiPictureDetailPageComponent { @@ -44,6 +45,7 @@ export struct MultiPictureDetailPageComponent {
44 @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 45 @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
45 @State showDownload: Boolean = false // 控制是否显示下载默认隐藏 46 @State showDownload: Boolean = false // 控制是否显示下载默认隐藏
46 @State publishCommentModel: publishCommentModel = new publishCommentModel() 47 @State publishCommentModel: publishCommentModel = new publishCommentModel()
  48 + @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share']
47 49
48 //watch监听页码回调 50 //watch监听页码回调
49 onCurrentPageNumUpdated(): void { 51 onCurrentPageNumUpdated(): void {
@@ -98,19 +100,31 @@ export struct MultiPictureDetailPageComponent { @@ -98,19 +100,31 @@ export struct MultiPictureDetailPageComponent {
98 if (this.contentDetailData.rmhPlatform == 1) { 100 if (this.contentDetailData.rmhPlatform == 1) {
99 Row() { 101 Row() {
100 Row({ space: 8 }) { 102 Row({ space: 8 }) {
101 - Row() {  
102 - Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)  
103 - .borderRadius(24)  
104 - .aspectRatio(1)  
105 - .border({ width: 1, color: Color.White, style: BorderStyle.Solid })  
106 - .alt($r('app.media.picture_loading'))  
107 - .width(36)  
108 - .height(36)  
109 - .objectFit(ImageFit.Fill)  
110 - .interpolation(ImageInterpolation.High) 103 + if (this.getImgUrl()){
  104 + Row() {
  105 + Image(this.getImgUrl())
  106 + .borderRadius(24)
  107 + .aspectRatio(1)
  108 + .border({ width: 1, color: Color.White, style: BorderStyle.Solid })
  109 + .width(36)
  110 + .height(36)
  111 + .objectFit(ImageFit.Fill)
  112 + .interpolation(ImageInterpolation.High)
  113 + .onClick(() => {
  114 + if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
  115 + // 号主页
  116 + const params: Params = {
  117 + creatorId: this.contentDetailData.rmhInfo.rmhId,
  118 + pageID: ''
  119 + }
  120 + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
  121 + }
  122 +
  123 + })
  124 + }
  125 + .width('13%')
  126 + .height('100%')
111 } 127 }
112 - .width('13%')  
113 - .height('100%')  
114 128
115 Row() { 129 Row() {
116 Flex({ 130 Flex({
@@ -190,6 +204,7 @@ export struct MultiPictureDetailPageComponent { @@ -190,6 +204,7 @@ export struct MultiPictureDetailPageComponent {
190 middle: { anchor: "__container__", align: HorizontalAlign.Center } 204 middle: { anchor: "__container__", align: HorizontalAlign.Center }
191 }) 205 })
192 .id('e_attention') 206 .id('e_attention')
  207 + .visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
193 } 208 }
194 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { 209 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
195 Swiper(this.swiperController) { 210 Swiper(this.swiperController) {
@@ -305,10 +320,8 @@ export struct MultiPictureDetailPageComponent { @@ -305,10 +320,8 @@ export struct MultiPictureDetailPageComponent {
305 OperRowListView({ 320 OperRowListView({
306 contentDetailData: this.contentDetailData, 321 contentDetailData: this.contentDetailData,
307 publishCommentModel: this.publishCommentModel, 322 publishCommentModel: this.publishCommentModel,
  323 + operationButtonList: this.operationButtonList,
308 }) 324 })
309 - .width('100%')  
310 - .height(56)  
311 - .border({ width: { top: 0.5 }, color: '#FFFFFF' })  
312 } 325 }
313 .visibility(!this.showDownload ? Visibility.Visible : Visibility.None) 326 .visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
314 Column(){ 327 Column(){
@@ -385,6 +398,7 @@ export struct MultiPictureDetailPageComponent { @@ -385,6 +398,7 @@ export struct MultiPictureDetailPageComponent {
385 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { 398 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
386 // 暂无内容 399 // 暂无内容
387 this.netStatus = 0 400 this.netStatus = 0
  401 + this.operationButtonList = []
388 Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`) 402 Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
389 } 403 }
390 Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) 404 Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
@@ -399,12 +413,17 @@ export struct MultiPictureDetailPageComponent { @@ -399,12 +413,17 @@ export struct MultiPictureDetailPageComponent {
399 Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); 413 Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
400 // 内容获取失败 414 // 内容获取失败
401 this.netStatus = 9 415 this.netStatus = 9
  416 + this.operationButtonList = []
402 }) 417 })
403 } catch (exception) { 418 } catch (exception) {
404 419
405 } 420 }
406 } 421 }
407 422
  423 + getImgUrl() {
  424 + return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl
  425 + }
  426 +
408 // 记录浏览历史 427 // 记录浏览历史
409 private getInteractBrowsOperate() { 428 private getInteractBrowsOperate() {
410 try { 429 try {