张善主

feat(动态):丢失代码还原,动态详情处理

@@ -58,10 +58,9 @@ export class ProcessUtils { @@ -58,10 +58,9 @@ export class ProcessUtils {
58 break; 58 break;
59 //动态详情页(动态图文) 59 //动态详情页(动态图文)
60 case ContentConstants.TYPE_FOURTEEN: 60 case ContentConstants.TYPE_FOURTEEN:
61 - break;  
62 //动态详情页(动态视频) 61 //动态详情页(动态视频)
63 case ContentConstants.TYPE_FIFTEEN: 62 case ContentConstants.TYPE_FIFTEEN:
64 - ProcessUtils.gotoWeb(content); 63 + ProcessUtils.gotoDynamicDetailPage(content);
65 break; 64 break;
66 default: 65 default:
67 break; 66 break;
@@ -76,7 +75,7 @@ export class ProcessUtils { @@ -76,7 +75,7 @@ export class ProcessUtils {
76 let taskAction: Action = { 75 let taskAction: Action = {
77 type: 'JUMP_DETAIL_PAGE', 76 type: 'JUMP_DETAIL_PAGE',
78 params: { 77 params: {
79 - detailPageType: 14, 78 + detailPageType: Number.parseInt(content.objectType),
80 contentID: content?.objectId, 79 contentID: content?.objectId,
81 extra: { 80 extra: {
82 relType: content?.relType, 81 relType: content?.relType,
1 -import { AccountManagerUtils, Logger } from 'wdKit'; 1 +import { AccountManagerUtils, Logger, DateTimeUtils } from 'wdKit';
2 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 2 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
3 import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams, 3 import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams,
4 PhotoListBean, 4 PhotoListBean,
@@ -10,6 +10,8 @@ import { WDPlayerController } from 'wdPlayer/Index'; @@ -10,6 +10,8 @@ import { WDPlayerController } from 'wdPlayer/Index';
10 import { ContentConstants } from '../constants/ContentConstants'; 10 import { ContentConstants } from '../constants/ContentConstants';
11 import { ProcessUtils } from 'wdRouter'; 11 import { ProcessUtils } from 'wdRouter';
12 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; 12 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
  13 +import display from '@ohos.display';
  14 +import { BusinessError } from '@ohos.base';
13 15
14 const TAG = 'DynamicDetailComponent' 16 const TAG = 'DynamicDetailComponent'
15 @Preview 17 @Preview
@@ -38,6 +40,12 @@ export struct DynamicDetailComponent { @@ -38,6 +40,12 @@ export struct DynamicDetailComponent {
38 //跳转 40 //跳转
39 private mJumpInfo: ContentDTO = {} as ContentDTO; 41 private mJumpInfo: ContentDTO = {} as ContentDTO;
40 42
  43 + // 获取当前所有的display对象
  44 + promise: Promise<Array<display.Display>> = display.getAllDisplays()
  45 +
  46 + // 屏幕宽度(单位px)
  47 + screenWidth: number = 0;
  48 +
41 async aboutToAppear() { 49 async aboutToAppear() {
42 await this.getContentDetailData() 50 await this.getContentDetailData()
43 } 51 }
@@ -120,8 +128,8 @@ export struct DynamicDetailComponent { @@ -120,8 +128,8 @@ export struct DynamicDetailComponent {
120 }) 128 })
121 } else { 129 } else {
122 Text('已关注') 130 Text('已关注')
123 - .width($r('app.float.margin_60'))  
124 - .height($r('app.float.margin_48')) 131 + .width($r('app.float.margin_54'))
  132 + .height($r('app.float.margin_24'))
125 .borderWidth(1) 133 .borderWidth(1)
126 .textAlign(TextAlign.Center) 134 .textAlign(TextAlign.Center)
127 .fontSize($r('app.float.font_size_12')) 135 .fontSize($r('app.float.font_size_12'))
@@ -166,7 +174,7 @@ export struct DynamicDetailComponent { @@ -166,7 +174,7 @@ export struct DynamicDetailComponent {
166 }) 174 })
167 } 175 }
168 }else{ 176 }else{
169 - this.buildItemCard(this.contentDetailData.videoInfo[0].firstFrameImageUri, this.contentDetailData.photoList.length, 0); 177 + this.buildItemCard(this.contentDetailData.videoInfo[0].firstFrameImageUri, 1, 0);
170 } 178 }
171 } 179 }
172 //特别声明 180 //特别声明
@@ -230,6 +238,7 @@ export struct DynamicDetailComponent { @@ -230,6 +238,7 @@ export struct DynamicDetailComponent {
230 } 238 }
231 this.getBatchAttentionStatus 239 this.getBatchAttentionStatus
232 this.getInteractDataStatus 240 this.getInteractDataStatus
  241 + this.getScreenWidth
233 } 242 }
234 243
235 // 查询当前登录用户点赞状态 244 // 查询当前登录用户点赞状态
@@ -276,7 +285,10 @@ export struct DynamicDetailComponent { @@ -276,7 +285,10 @@ export struct DynamicDetailComponent {
276 setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){ 285 setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){
277 //四角圆角 286 //四角圆角
278 Image(picPath) 287 Image(picPath)
279 - .width(44).aspectRatio(1 / 1).margin(16).borderRadius({topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight}) 288 + .width('100%')
  289 + .height('100%')
  290 + .borderRadius({topLeft: topLeft, topRight: topRight,
  291 + bottomLeft: bottomLeft, bottomRight: bottomRight})
280 } 292 }
281 /** 293 /**
282 * 组件项 294 * 组件项
@@ -301,7 +313,20 @@ export struct DynamicDetailComponent { @@ -301,7 +313,20 @@ export struct DynamicDetailComponent {
301 .width(48) 313 .width(48)
302 .padding({bottom: 9}) 314 .padding({bottom: 9})
303 } 315 }
304 - .width('100%') 316 + .width(
  317 + //图片类型
  318 + this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN?'100%'
  319 + //视频横屏 横版16:9
  320 + :this.contentDetailData.videoInfo[0].videoLandScape == 1?this.screenWidth-32
  321 + //视频竖屏 竖版3:4
  322 + :(this.screenWidth-32)/2)
  323 + .height(
  324 + //图片类型
  325 + this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN?'100%'
  326 + //视频横屏 横版16:9
  327 + :this.contentDetailData.videoInfo[0].videoLandScape == 1?(this.screenWidth-32)*9/16
  328 + //视频竖屏 竖版3:4
  329 + :(this.screenWidth-32)/2*4/3)
305 .onClick((event: ClickEvent) => { 330 .onClick((event: ClickEvent) => {
306 if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){ 331 if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
307 //fixme 跳转到查看图片页面(带页脚/下载按钮) 332 //fixme 跳转到查看图片页面(带页脚/下载按钮)
@@ -460,4 +485,14 @@ export struct DynamicDetailComponent { @@ -460,4 +485,14 @@ export struct DynamicDetailComponent {
460 } 485 }
461 } 486 }
462 } 487 }
  488 +
  489 + getScreenWidth(){
  490 + this.promise.then((data: Array<display.Display>) => {
  491 + console.log(`所有的屏幕信息:${JSON.stringify(data)}`)
  492 + //单位为像素
  493 + this.screenWidth = data[0]["width"]
  494 + }).catch((err: BusinessError) => {
  495 + console.error(`Failed to obtain all the display objects. Code: ${JSON.stringify(err)}`)
  496 + })
  497 + }
463 } 498 }