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
wangyong_wd
2024-03-28 12:32:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
95aeb5e7e2a07fba619d087e2228553188e4408d
95aeb5e7
1 parent
532939c2
新增大专题卡类型
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
0 deletions
sight_harmony/features/wdComponent/src/main/ets/components/view/CompStyle_10.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/CompStyle_10.ets
0 → 100644
View file @
95aeb5e
import { CompDTO, slideShows } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { DateTimeUtils } from 'wdKit';
/**
* 大专题卡--CompStyle: 10
*/
@Component
export struct CompStyle_10 {
@State compDTO: CompDTO = {} as CompDTO
build() {
Column(){
// 顶部标题,最多两行
if(this.compDTO.operDataList[0].newsTitle) {
Text(this.compDTO.operDataList[0].newsTitle)
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_17'))
.fontWeight(600)
.maxLines(2)
.textOverflow({overflow: TextOverflow.Ellipsis})
.margin({ bottom: 19 })
}
// 大图
Image(this.compDTO.operDataList[0].coverUrl)
.width('100%')
// 专题列表--后端返回三个,
Column(){
ForEach(this.compDTO.operDataList[0].slideShows, (item:slideShows, index:number) => {
this.timelineItem(item, index)
})
}
// 底部-查看更多。根据接口返回的isMore判断是否显示查看更多
if(this.compDTO.operDataList[0].hasMore == 1) {
Row() {
Text("查看更多")
.fontSize($r("app.float.font_size_14"))
.fontColor($r("app.color.color_222222"))
.margin({ right: 1 })
Image($r("app.media.more"))
.width(14)
.height(14)
}
.backgroundColor($r('app.color.color_F5F5F5'))
.width(CommonConstants.FULL_WIDTH)
.height(40)
.borderRadius(3)
.justifyContent(FlexAlign.Center)
.margin({top: 5})
.onClick(() => {
// TODO
console.log('跳转到查看更多的页面')
})
}
}
.width(CommonConstants.FULL_WIDTH)
.padding({
top: 14,
left: 16,
right: 16,
bottom: 14
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
}
@Builder timelineItem (item:slideShows, index:number) {
Column(){
Row() {
Column(){
Text(item.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.alignSelf(ItemAlign.Center)
Row(){
// 展示发稿人
Text(item.source)
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_B0B0B0'))
.layoutWeight(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
.maxLines(1)
Image($r('app.media.point'))
.width(16)
.height(16)
Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime))))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
}
.margin({top: 12})
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
// 右侧图片
if(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
Image(item.fullColumnImgUrls[0].url)
.width(117)
.height(78)
.objectFit(ImageFit.Cover)
.borderRadius(4)
.margin({left: 12})
}
}
.padding({top: 10, bottom: 10})
}
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment