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
guochunsong
2024-02-04 14:18:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0a33bce3f4ccafcdb4fa273a7fa5e922824f2d55
0a33bce3
1 parent
5d7a7563
修改部分样式
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
34 deletions
sight_harmony/wdBean/src/main/ets/bean/detail/VideoInfoDTO.ts
sight_harmony/wdComponent/src/main/ets/components/view/LiveHorizontalCardComponent.ets
sight_harmony/wdComponent/src/main/ets/components/view/LiveHorizontalCardForOneComponent.ets
sight_harmony/wdComponent/src/main/ets/components/view/SingleImageCardAppComponent.ets
sight_harmony/wdComponent/src/main/ets/components/view/SingleImageCardComponent.ets
sight_harmony/wdBean/src/main/ets/bean/detail/VideoInfoDTO.ts
View file @
0a33bce
...
...
@@ -2,7 +2,7 @@ export interface VideoInfoDTO {
clarity
:
number
;
resolutionHeight
:
number
;
resolutionWidth
:
number
;
videoDuration
:
string
;
// 视频时长
videoDuration
:
number
;
// 视频时长
videoLandScape
:
number
;
// 1横屏 2竖屏
videoType
:
number
;
videoUrl
:
string
;
//视频播放地址
...
...
sight_harmony/wdComponent/src/main/ets/components/view/LiveHorizontalCardComponent.ets
View file @
0a33bce
...
...
@@ -59,7 +59,7 @@ export struct LiveHorizontalCardComponent {
right: 4
})
} else if (item.objectType === '1' && item.videoInfo) {
LiveVideoTypeComponent({ nType: 1, name: item.videoInfo.videoDuration })
LiveVideoTypeComponent({ nType: 1, name: item.videoInfo.videoDuration
+ ""
})
.padding({
bottom: 4,
right: 4
...
...
sight_harmony/wdComponent/src/main/ets/components/view/LiveHorizontalCardForOneComponent.ets
View file @
0a33bce
...
...
@@ -27,7 +27,7 @@ export struct LiveHorizontalCardForOneComponent {
right: 2
})
} else if (this.contentDTO.objectType === '1' && this.contentDTO.videoInfo) {
LiveVideoTypeComponent({ nType: 1, name: this.contentDTO.videoInfo.videoDuration ?? '00:00' })
LiveVideoTypeComponent({ nType: 1, name: this.contentDTO.videoInfo.videoDuration
+ ""
?? '00:00' })
.padding({
bottom: 2,
right: 2
...
...
sight_harmony/wdComponent/src/main/ets/components/view/SingleImageCardAppComponent.ets
View file @
0a33bce
import { Action, CompDTO, ContentDTO, Params } from 'wdBean';
import { CompStyle } from 'wdConstant';
import { Logger } from 'wdKit';
import { Logger
, DateTimeUtils
} from 'wdKit';
import { WDRouterRule } from 'wdRouter';
const TAG = 'SingleImageCardApp
2
Component';
const TAG = 'SingleImageCardAppComponent';
const FULL_PARENT: string = '100%';
/**
...
...
@@ -30,11 +30,11 @@ export struct SingleImageCardAppComponent {
// clarity: 1,
resolutionHeight: 20,
resolutionWidth: 20,
videoDuration:
'229'
,
videoDuration:
229
,
videoLandScape: 1,
videoType: 1,
videoUrl: "https://cdnjdout.aikan.pdnews.cn/zhbj-20240116/vod/content/output/c72f4170db2c4d34befa453f60d39a69_opt.mp4",
firstFrameImageUri:
"", // 首帧图;【视频内容,contentPictures中】
firstFrameImageUri: "", // 首帧图;【视频内容,contentPictures中】
},
} as ContentDTO
...
...
@@ -57,19 +57,27 @@ export struct SingleImageCardAppComponent {
Image(this.compDTO.operDataList[0].coverUrl)
.borderRadius(5)
.aspectRatio(16 / 9)
.padding({ top: 10 })
if(this.compDTO.operDataList[0].videoInfo) {
Stack() {
Text(this.compDTO.operDataList[0].videoInfo.videoDuration)
.backgroundColor(Color.Black)
.opacity(0.6)
.width(FULL_PARENT)
.padding({left:40})
.padding({ top: 10 })
if (this.compDTO.operDataList[0].videoInfo) {
Row() {
Image($r('app.media.iv_card_play_yellow_flag'))
.fitOriginalSize(true)
}.width(FULL_PARENT)
.width(22)
.height(18)
Text(DateTimeUtils.getFormattedDuration(this.compDTO.operDataList[0].videoInfo.videoDuration * 1000))
.fontSize($r('app.float.font_size_13'))
.fontWeight(400)
.fontColor($r('app.color.color_fff'))
}
.alignItems(VerticalAlign.Bottom)
.height(18)
.padding({ right: 4 })
.margin({
right: 4,
bottom: 4
})
.backgroundColor($r('app.color.color_4d000000'))
}
}
}
.alignContent(Alignment.BottomEnd)
}
if (this.compDTO.operDataList[0].newsSummary) {
Text(this.compDTO.operDataList[0].newsSummary)
...
...
sight_harmony/wdComponent/src/main/ets/components/view/SingleImageCardComponent.ets
View file @
0a33bce
import { Action, CompDTO, Params } from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { Logger, DateTimeUtils } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
import { ProcessUtils } from '../../utils/ProcessUtils';
...
...
@@ -16,15 +17,10 @@ const FULL_PARENT: string = '100%';
@Component
export struct SingleImageCardComponent {
@State compDTO: CompDTO = {} as CompDTO
@State titleNumber: number = 3 //标题行数
aboutToAppear() {
// Logger.debug(TAG + "" + JSON.stringify(this.compDTO.operDataList));
if (this.compDTO.operDataList[0].newsTitle.length > 26) {
this.titleNumber = 3;
} else {
this.titleNumber = 2;
}
//Logger.debug(TAG + "" + JSON.stringify(this.compDTO.operDataList));
}
build() {
...
...
@@ -33,12 +29,12 @@ export struct SingleImageCardComponent {
Text(this.compDTO.operDataList[0].newsTitle)
.fontSize(16)
.fontWeight(FontWeight.Normal)
.maxLines(
this.titleNumber
)//
.maxLines(
3
)//
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.height(
this.titleNumber === 3 ? "80%" : '65%'
)
.height(
"80%"
)
Row() {
Text('人民日报')
Text(
this.compDTO.operDataList[0].source ? this.compDTO.operDataList[0].source :
'人民日报')
.height(40)
.fontSize(14)
.fontColor(Color.Gray)
...
...
@@ -57,7 +53,7 @@ export struct SingleImageCardComponent {
left: 10
})
}.alignSelf(ItemAlign.Start)
.height(
this.titleNumber === 3 ? "20%" : '35%'
)
.height(
"20%"
)
.justifyContent(FlexAlign.SpaceBetween)
}
.alignItems(HorizontalAlign.Start)
...
...
@@ -65,10 +61,33 @@ export struct SingleImageCardComponent {
.width('58%')
Blank(16)
Image(this.compDTO.operDataList[0].coverUrl)
.height('78vp')
.borderRadius(5)
.aspectRatio(3 / 2)
if (this.compDTO.operDataList[0].coverUrl) {
Stack() {
Image(this.compDTO.operDataList[0].coverUrl)
.borderRadius(5)
.aspectRatio(3 / 2)
.height('78vp')
if (this.compDTO.operDataList[0].videoInfo) {
Row() {
Image($r('app.media.iv_card_play_yellow_flag'))
.width(22)
.height(18)
Text(DateTimeUtils.getFormattedDuration(this.compDTO.operDataList[0].videoInfo.videoDuration * 1000))
.fontSize($r('app.float.font_size_13'))
.fontWeight(400)
.fontColor($r('app.color.color_fff'))
}
.alignItems(VerticalAlign.Bottom)
.height(18)
.padding({ right: 4 })
.margin({
right: 4,
bottom: 4
})
.backgroundColor($r('app.color.color_4d000000'))
}
}.alignContent(Alignment.BottomEnd)
}
}
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.compDTO?.operDataList[0])
...
...
@@ -76,7 +95,7 @@ export struct SingleImageCardComponent {
.padding(
{ top: 16, bottom: 16, left: 14, right: 14 })
.width(FULL_PARENT)
.height(
this.titleNumber === 3 ? '127vp' : '106
vp')
.height(
'127
vp')
.justifyContent(FlexAlign.SpaceBetween)
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment