Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
张善主
2024-04-23 14:11:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bc84b8f060f61fb17e21eee26dc3a5a4e93d37ae
bc84b8f0
1 parent
4006bb72
feat(动态):丢失代码还原,动态详情处理
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
9 deletions
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
View file @
bc84b8f
...
...
@@ -58,10 +58,9 @@ export class ProcessUtils {
break;
//动态详情页(动态图文)
case ContentConstants.TYPE_FOURTEEN:
break;
//动态详情页(动态视频)
case ContentConstants.TYPE_FIFTEEN:
ProcessUtils.goto
Web
(content);
ProcessUtils.goto
DynamicDetailPage
(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,
...
...
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
View file @
bc84b8f
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
...
...
Please
register
or
login
to post a comment