guochunsong

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

@@ -40,7 +40,8 @@ export struct CompParser { @@ -40,7 +40,8 @@ export struct CompParser {
40 TitleAllComponent({ compDTO: compDTO }) 40 TitleAllComponent({ compDTO: compDTO })
41 } else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) { 41 } else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) {
42 BannerComponent({ compDTO: compDTO }) 42 BannerComponent({ compDTO: compDTO })
43 - } else if (compDTO.compStyle === CompStyle.Single_Imagecard_03) { 43 + } else if (compDTO.compStyle === CompStyle.Single_ImageCard_03
  44 + || compDTO.compStyle === CompStyle.Single_ImageCard_01 ) {
44 SingleImageCardComponent({ compDTO: compDTO }) 45 SingleImageCardComponent({ compDTO: compDTO })
45 } else if (compDTO.compStyle === "2") { 46 } else if (compDTO.compStyle === "2") {
46 BigPicCardComponent({ compDTO: compDTO }) 47 BigPicCardComponent({ compDTO: compDTO })
1 import { Action, CompDTO, Params } from 'wdBean'; 1 import { Action, CompDTO, Params } from 'wdBean';
2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; 2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
  3 +import { CompStyle } from 'wdConstant';
3 import { Logger, DateTimeUtils } from 'wdKit'; 4 import { Logger, DateTimeUtils } from 'wdKit';
4 import { WDRouterRule } from 'wdRouter'; 5 import { WDRouterRule } from 'wdRouter';
5 import { ProcessUtils } from '../../utils/ProcessUtils'; 6 import { ProcessUtils } from '../../utils/ProcessUtils';
@@ -26,17 +27,20 @@ export struct SingleImageCardComponent { @@ -26,17 +27,20 @@ export struct SingleImageCardComponent {
26 build() { 27 build() {
27 Row() { 28 Row() {
28 Column() { 29 Column() {
  30 + Column() {
29 Text(this.compDTO.operDataList[0].newsTitle) 31 Text(this.compDTO.operDataList[0].newsTitle)
30 .fontSize(16) 32 .fontSize(16)
31 .fontWeight(FontWeight.Normal) 33 .fontWeight(FontWeight.Normal)
32 .maxLines(3)// 34 .maxLines(3)//
33 .alignSelf(ItemAlign.Start) 35 .alignSelf(ItemAlign.Start)
34 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 36 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
35 - .height("80%") 37 + }.height("80%")
  38 + .justifyContent(FlexAlign.Start)
  39 +
36 Row() { 40 Row() {
37 if (this.compDTO.operDataList[0].source) { 41 if (this.compDTO.operDataList[0].source) {
38 Text(this.compDTO.operDataList[0].source) 42 Text(this.compDTO.operDataList[0].source)
39 - .height(40) 43 +
40 .fontSize($r('app.float.font_size_12')) 44 .fontSize($r('app.float.font_size_12'))
41 .fontColor(Color.Gray) 45 .fontColor(Color.Gray)
42 .maxLines(1) 46 .maxLines(1)
@@ -48,12 +52,12 @@ export struct SingleImageCardComponent { @@ -48,12 +52,12 @@ export struct SingleImageCardComponent {
48 } 52 }
49 if (this.compDTO.operDataList[0].publishTime && this.compDTO.operDataList[0].publishTime.length === 13) { 53 if (this.compDTO.operDataList[0].publishTime && this.compDTO.operDataList[0].publishTime.length === 13) {
50 Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime))) 54 Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))
51 - .height(40) 55 +
52 .fontSize($r('app.float.font_size_12')) 56 .fontSize($r('app.float.font_size_12'))
53 .fontColor(Color.Gray) 57 .fontColor(Color.Gray)
54 } 58 }
55 Text(this.compDTO.operDataList[0].visitorComment + '评') 59 Text(this.compDTO.operDataList[0].visitorComment + '评')
56 - .height(40) 60 +
57 .fontSize($r('app.float.font_size_12')) 61 .fontSize($r('app.float.font_size_12'))
58 .fontColor(Color.Gray) 62 .fontColor(Color.Gray)
59 .padding({ 63 .padding({
@@ -61,10 +65,10 @@ export struct SingleImageCardComponent { @@ -61,10 +65,10 @@ export struct SingleImageCardComponent {
61 }) 65 })
62 }.alignSelf(ItemAlign.Start) 66 }.alignSelf(ItemAlign.Start)
63 .height("20%") 67 .height("20%")
64 - .justifyContent(FlexAlign.SpaceBetween) 68 + .justifyContent(FlexAlign.Start)
65 } 69 }
66 .alignItems(HorizontalAlign.Start) 70 .alignItems(HorizontalAlign.Start)
67 - .justifyContent(FlexAlign.SpaceBetween) 71 + .justifyContent(FlexAlign.Start)
68 .width('58%') 72 .width('58%')
69 73
70 Blank(16) 74 Blank(16)
@@ -72,8 +76,8 @@ export struct SingleImageCardComponent { @@ -72,8 +76,8 @@ export struct SingleImageCardComponent {
72 Stack() { 76 Stack() {
73 Image(this.compDTO.operDataList[0].coverUrl) 77 Image(this.compDTO.operDataList[0].coverUrl)
74 .borderRadius(5) 78 .borderRadius(5)
75 - .aspectRatio(3 / 2)  
76 - .height('78vp') 79 + .aspectRatio(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 3 / 2 : 3 / 4 )
  80 + .height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 90 : 180)
77 if (this.compDTO.operDataList[0].videoInfo) { 81 if (this.compDTO.operDataList[0].videoInfo) {
78 Row() { 82 Row() {
79 Image($r('app.media.iv_card_play_yellow_flag')) 83 Image($r('app.media.iv_card_play_yellow_flag'))
@@ -102,7 +106,7 @@ export struct SingleImageCardComponent { @@ -102,7 +106,7 @@ export struct SingleImageCardComponent {
102 .padding( 106 .padding(
103 { top: 16, bottom: 16, left: 14, right: 14 }) 107 { top: 16, bottom: 16, left: 14, right: 14 })
104 .width(FULL_PARENT) 108 .width(FULL_PARENT)
105 - .height('127vp') 109 + .height(this.compDTO.compStyle === CompStyle.Single_ImageCard_03 ? 127: 217)
106 .justifyContent(FlexAlign.SpaceBetween) 110 .justifyContent(FlexAlign.SpaceBetween)
107 } 111 }
108 } 112 }