guochunsong

适配单图卡竖图,compstyle: 13/6

... ... @@ -40,7 +40,8 @@ export struct CompParser {
TitleAllComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) {
BannerComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Single_Imagecard_03) {
} else if (compDTO.compStyle === CompStyle.Single_ImageCard_03
|| compDTO.compStyle === CompStyle.Single_ImageCard_01 ) {
SingleImageCardComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === "2") {
BigPicCardComponent({ compDTO: compDTO })
... ...
import { Action, CompDTO, Params } from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { CompStyle } from 'wdConstant';
import { Logger, DateTimeUtils } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
import { ProcessUtils } from '../../utils/ProcessUtils';
... ... @@ -26,17 +27,20 @@ export struct SingleImageCardComponent {
build() {
Row() {
Column() {
Column() {
Text(this.compDTO.operDataList[0].newsTitle)
.fontSize(16)
.fontWeight(FontWeight.Normal)
.maxLines(3)//
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.height("80%")
}.height("80%")
.justifyContent(FlexAlign.Start)
Row() {
if (this.compDTO.operDataList[0].source) {
Text(this.compDTO.operDataList[0].source)
.height(40)
.fontSize($r('app.float.font_size_12'))
.fontColor(Color.Gray)
.maxLines(1)
... ... @@ -48,12 +52,12 @@ export struct SingleImageCardComponent {
}
if (this.compDTO.operDataList[0].publishTime && this.compDTO.operDataList[0].publishTime.length === 13) {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))
.height(40)
.fontSize($r('app.float.font_size_12'))
.fontColor(Color.Gray)
}
Text(this.compDTO.operDataList[0].visitorComment + '评')
.height(40)
.fontSize($r('app.float.font_size_12'))
.fontColor(Color.Gray)
.padding({
... ... @@ -61,10 +65,10 @@ export struct SingleImageCardComponent {
})
}.alignSelf(ItemAlign.Start)
.height("20%")
.justifyContent(FlexAlign.SpaceBetween)
.justifyContent(FlexAlign.Start)
}
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.SpaceBetween)
.justifyContent(FlexAlign.Start)
.width('58%')
Blank(16)
... ... @@ -72,8 +76,8 @@ export struct SingleImageCardComponent {
Stack() {
Image(this.compDTO.operDataList[0].coverUrl)
.borderRadius(5)
.aspectRatio(3 / 2)
.height('78vp')
.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() {
Image($r('app.media.iv_card_play_yellow_flag'))
... ... @@ -102,7 +106,7 @@ export struct SingleImageCardComponent {
.padding(
{ top: 16, bottom: 16, left: 14, right: 14 })
.width(FULL_PARENT)
.height('127vp')
.height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 127: 217)
.justifyContent(FlexAlign.SpaceBetween)
}
}
\ No newline at end of file
... ...