guochunsong

优化UI

... ... @@ -41,7 +41,7 @@ export struct CompParser {
} else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) {
BannerComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Single_ImageCard_03
|| compDTO.compStyle === CompStyle.Single_ImageCard_01 ) {
|| compDTO.compStyle === CompStyle.Single_ImageCard_01) {
SingleImageCardComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === "2") {
BigPicCardComponent({ compDTO: compDTO })
... ... @@ -55,12 +55,15 @@ export struct CompParser {
} else {
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
}
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02
|| compDTO.compStyle === '5') {
HeadPictureCardComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.ZhGrid_Layout_03) {
ZhGridLayoutComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Album_Card_01) {
AlbumCardComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Single_Row_02) {
}
else {
// todo:组件未实现 / Component Not Implemented
... ...
... ... @@ -33,35 +33,32 @@ export struct SingleImageCardComponent {
.fontWeight(FontWeight.Normal)
.maxLines(3)//
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
}.height("80%")
.justifyContent(FlexAlign.Start)
Row() {
if (this.compDTO.operDataList[0].source) {
Text(this.compDTO.operDataList[0].source)
.fontSize($r('app.float.font_size_12'))
.fontColor(Color.Gray)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.width('50%')
.width(this.compDTO.operDataList[0].source.length > 8 ? '50%' : '')
Image($r('app.media.point'))
.width(16)
.height(16)
}
if (this.compDTO.operDataList[0].publishTime && this.compDTO.operDataList[0].publishTime.length === 13) {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))
.fontSize($r('app.float.font_size_12'))
.fontColor(Color.Gray)
}
Text(this.compDTO.operDataList[0].visitorComment + '评')
.fontSize($r('app.float.font_size_12'))
.fontColor(Color.Gray)
.padding({
left: 10
left: 5
})
}.alignSelf(ItemAlign.Start)
.height("20%")
... ... @@ -76,7 +73,7 @@ export struct SingleImageCardComponent {
Stack() {
Image(this.compDTO.operDataList[0].coverUrl)
.borderRadius(5)
.aspectRatio(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 3 / 2 : 3 / 4 )
.aspectRatio(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 3 / 2 : 3 / 4)
.height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 90 : 180)
if (this.compDTO.operDataList[0].videoInfo) {
Row() {
... ... @@ -106,7 +103,7 @@ export struct SingleImageCardComponent {
.padding(
{ top: 16, bottom: 16, left: 14, right: 14 })
.width(FULL_PARENT)
.height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 127: 217)
.height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 127 : 217)
.justifyContent(FlexAlign.SpaceBetween)
}
}
\ No newline at end of file
... ...
... ... @@ -14,54 +14,10 @@ let listSize: number = 4;
* Zh_Grid_Layout-03
*
*/
@Preview
@Component
export struct ZhGridLayoutComponent {
@State compDTO: CompDTO = {} as CompDTO
// @State compDTO: CompDTO = {
// operDataList: [
// {
// newsTitle: '健康专栏',
// description: "description0",
// coverUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
// } as ContentDTO,
// {
// newsTitle: '金刚栏位22233',
// description: "description1",
// coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240104/image/display/c4a9b526e0994d1bbd3ac8450f5cfc6c.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
// } as ContentDTO,
// {
// newsTitle: '体育专栏2',
// description: "description2",
// coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231206/image/live/bbe6d821e92b48919d90c7dadfd1f05a.jpg?x-oss-process=image/resize,l_850/auto-orient,1/quality,q_95/format,jpg",
// } as ContentDTO,
// {
// newsTitle: '农业',
// description: "description3",
// coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231109/image/live/102e6eb9356b4ef19405b04c1f6ff875.png?x-oss-process=image/resize,l_850/auto-orient,1/quality,q_95/format,jpg'
// } as ContentDTO,
// {
// newsTitle: '民生铭记',
// description: "description4",
// coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/62bdbbb35dbd45689e00790c81f04c4b.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
// } as ContentDTO,
// {
// newsTitle: '春节大欢乐',
// description: "description5",
// coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/f79bbaa5a33b4bd88176071c4f797ff6.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
// } as ContentDTO,
// {
// newsTitle: '春节大欢乐',
// description: "description6",
// coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/2c1d917009584ce2bb4a35cbb3a860a0.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
// } as ContentDTO,
// {
// newsTitle: '旅游',
// description: "description7",
// coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231222/image/display/117dc516ca5c42d5843c0d32050c9fc6.jpeg?x-oss-process=image/resize,w_240/quality,q_90/format,jpg",
// } as ContentDTO
// ]
// } as CompDTO
aboutToAppear() {
if (this.compDTO.operDataList) {
... ...
... ... @@ -23,7 +23,8 @@ export const enum CompStyle {
Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动
Title_Abbr_01 = '11', // 标题缩略
Title_All_01 = '3', // 全标题
Single_Imagecard_03 = '13',//单图卡:3行标题
Single_ImageCard_03 = '13',//单图卡:3行标题
Single_ImageCard_01 = '6',//单图卡,竖图
ZhGrid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡
Album_Card_01 = '17' //图卡集
}
... ...