张善主

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

... ... @@ -58,10 +58,9 @@ export class ProcessUtils {
break;
//动态详情页(动态图文)
case ContentConstants.TYPE_FOURTEEN:
break;
//动态详情页(动态视频)
case ContentConstants.TYPE_FIFTEEN:
ProcessUtils.gotoWeb(content);
ProcessUtils.gotoDynamicDetailPage(content);
break;
default:
break;
... ... @@ -76,7 +75,7 @@ export class ProcessUtils {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 14,
detailPageType: Number.parseInt(content.objectType),
contentID: content?.objectId,
extra: {
relType: content?.relType,
... ...
import { AccountManagerUtils, Logger } from 'wdKit';
import { AccountManagerUtils, Logger, DateTimeUtils } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams,
PhotoListBean,
... ... @@ -10,6 +10,8 @@ import { WDPlayerController } from 'wdPlayer/Index';
import { ContentConstants } from '../constants/ContentConstants';
import { ProcessUtils } from 'wdRouter';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
import display from '@ohos.display';
import { BusinessError } from '@ohos.base';
const TAG = 'DynamicDetailComponent'
@Preview
... ... @@ -38,6 +40,12 @@ export struct DynamicDetailComponent {
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
// 获取当前所有的display对象
promise: Promise<Array<display.Display>> = display.getAllDisplays()
// 屏幕宽度(单位px)
screenWidth: number = 0;
async aboutToAppear() {
await this.getContentDetailData()
}
... ... @@ -120,8 +128,8 @@ export struct DynamicDetailComponent {
})
} else {
Text('已关注')
.width($r('app.float.margin_60'))
.height($r('app.float.margin_48'))
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.borderWidth(1)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
... ... @@ -166,7 +174,7 @@ export struct DynamicDetailComponent {
})
}
}else{
this.buildItemCard(this.contentDetailData.videoInfo[0].firstFrameImageUri, this.contentDetailData.photoList.length, 0);
this.buildItemCard(this.contentDetailData.videoInfo[0].firstFrameImageUri, 1, 0);
}
}
//特别声明
... ... @@ -230,6 +238,7 @@ export struct DynamicDetailComponent {
}
this.getBatchAttentionStatus
this.getInteractDataStatus
this.getScreenWidth
}
// 查询当前登录用户点赞状态
... ... @@ -276,7 +285,10 @@ export struct DynamicDetailComponent {
setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){
//四角圆角
Image(picPath)
.width(44).aspectRatio(1 / 1).margin(16).borderRadius({topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight})
.width('100%')
.height('100%')
.borderRadius({topLeft: topLeft, topRight: topRight,
bottomLeft: bottomLeft, bottomRight: bottomRight})
}
/**
* 组件项
... ... @@ -301,7 +313,20 @@ export struct DynamicDetailComponent {
.width(48)
.padding({bottom: 9})
}
.width('100%')
.width(
//图片类型
this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN?'100%'
//视频横屏 横版16:9
:this.contentDetailData.videoInfo[0].videoLandScape == 1?this.screenWidth-32
//视频竖屏 竖版3:4
:(this.screenWidth-32)/2)
.height(
//图片类型
this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN?'100%'
//视频横屏 横版16:9
:this.contentDetailData.videoInfo[0].videoLandScape == 1?(this.screenWidth-32)*9/16
//视频竖屏 竖版3:4
:(this.screenWidth-32)/2*4/3)
.onClick((event: ClickEvent) => {
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
//fixme 跳转到查看图片页面(带页脚/下载按钮)
... ... @@ -460,4 +485,14 @@ export struct DynamicDetailComponent {
}
}
}
getScreenWidth(){
this.promise.then((data: Array<display.Display>) => {
console.log(`所有的屏幕信息:${JSON.stringify(data)}`)
//单位为像素
this.screenWidth = data[0]["width"]
}).catch((err: BusinessError) => {
console.error(`Failed to obtain all the display objects. Code: ${JSON.stringify(err)}`)
})
}
}
\ No newline at end of file
... ...