Showing
2 changed files
with
9 additions
and
99 deletions
| @@ -29,7 +29,10 @@ export struct BigPicCardComponent { | @@ -29,7 +29,10 @@ export struct BigPicCardComponent { | ||
| 29 | //大图 | 29 | //大图 |
| 30 | Stack() { | 30 | Stack() { |
| 31 | Image(this.compDTO.operDataList[0].coverUrl) | 31 | Image(this.compDTO.operDataList[0].coverUrl) |
| 32 | + .backgroundColor('#888888') | ||
| 32 | .borderRadius(4) | 33 | .borderRadius(4) |
| 34 | + .width('100%') | ||
| 35 | + .aspectRatio(343 / 192) | ||
| 33 | 36 | ||
| 34 | 37 | ||
| 35 | //播放状态+时长 | 38 | //播放状态+时长 |
| @@ -50,7 +53,6 @@ export struct BigPicCardComponent { | @@ -50,7 +53,6 @@ export struct BigPicCardComponent { | ||
| 50 | 53 | ||
| 51 | } | 54 | } |
| 52 | .width('100%') | 55 | .width('100%') |
| 53 | - .height(192) | ||
| 54 | .alignContent(Alignment.BottomEnd) | 56 | .alignContent(Alignment.BottomEnd) |
| 55 | .margin({top:8}) | 57 | .margin({top:8}) |
| 56 | 58 | ||
| @@ -91,97 +93,6 @@ export struct BigPicCardComponent { | @@ -91,97 +93,6 @@ export struct BigPicCardComponent { | ||
| 91 | 93 | ||
| 92 | } | 94 | } |
| 93 | 95 | ||
| 94 | - | ||
| 95 | - | ||
| 96 | -/** | ||
| 97 | - * 大图卡 中部 | ||
| 98 | - * 包括:视频图、视频时长 | ||
| 99 | - */ | ||
| 100 | -@Component | ||
| 101 | -export struct myBigCard_body { | ||
| 102 | - private newsSrc:string ="https://k.sinaimg.cn/n/default/crawl/190/w550h440/20240118/6772-7c2385bb2741c6f88906af3514d27343.png/w700d1q75cms.jpg"; | ||
| 103 | - private newsTitle:string ="时政微观察丨新征程金融工作怎么干?“新年第一课”这样讲"; | ||
| 104 | - | ||
| 105 | - build() { | ||
| 106 | - Column() { | ||
| 107 | - //新闻标题 | ||
| 108 | - Text(this.newsTitle) | ||
| 109 | - .fontSize(17) | ||
| 110 | - .fontColor('#222222') | ||
| 111 | - .maxLines(3) | ||
| 112 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 113 | - //大图 | ||
| 114 | - Stack() { | ||
| 115 | - Image(this.newsSrc) | ||
| 116 | - .borderRadius(4) | ||
| 117 | - | ||
| 118 | - | ||
| 119 | - //播放状态+时长 | ||
| 120 | - Row() { | ||
| 121 | - Image($r('app.media.icon_live')) | ||
| 122 | - .width(22) | ||
| 123 | - .height(18) | ||
| 124 | - | ||
| 125 | - Stack() { | ||
| 126 | - Text('直播中') | ||
| 127 | - .fontColor('#FFFFFF') | ||
| 128 | - .fontSize(11) | ||
| 129 | - } | ||
| 130 | - .width(44) | ||
| 131 | - .height(18) | ||
| 132 | - .backgroundColor('#4d000000') | ||
| 133 | - }.margin({right:8,bottom:8}) | ||
| 134 | - | ||
| 135 | - } | ||
| 136 | - .width('100%') | ||
| 137 | - .height(192) | ||
| 138 | - .alignContent(Alignment.BottomEnd) | ||
| 139 | - .margin({top:8}) | ||
| 140 | - | ||
| 141 | - } | ||
| 142 | - .width('100%') | ||
| 143 | - .justifyContent(FlexAlign.Start) | ||
| 144 | - } | ||
| 145 | - | ||
| 146 | -} | ||
| 147 | - | ||
| 148 | -/** | ||
| 149 | - * 大图卡 底部 | ||
| 150 | - * 包括:分享、评论、点赞 三个按钮 | ||
| 151 | - */ | ||
| 152 | - | ||
| 153 | -@Component | ||
| 154 | -export struct myBigCard_bottom { | ||
| 155 | - private bottom_height:number = 18 | ||
| 156 | - private itemSubtitle1:string = "人民日报" | ||
| 157 | - private itemSubtitle2:string = "25分钟前" | ||
| 158 | - private itemSubtitle3:string = "786条评论" | ||
| 159 | - build() { | ||
| 160 | - //子标题 | ||
| 161 | - Row() { | ||
| 162 | - Text(this.itemSubtitle1) | ||
| 163 | - .bottomTextStyle() | ||
| 164 | - //间隔点 | ||
| 165 | - Image($r('app.media.point')) | ||
| 166 | - .width(12) | ||
| 167 | - .height(12) | ||
| 168 | - | ||
| 169 | - Text(this.itemSubtitle2) | ||
| 170 | - .bottomTextStyle() | ||
| 171 | - Text(' ') | ||
| 172 | - | ||
| 173 | - Text(this.itemSubtitle3) | ||
| 174 | - .bottomTextStyle() | ||
| 175 | - | ||
| 176 | - } | ||
| 177 | - .width('100%') | ||
| 178 | - .height(this.bottom_height) | ||
| 179 | - .justifyContent(FlexAlign.Start) | ||
| 180 | - | ||
| 181 | - } | ||
| 182 | - | ||
| 183 | -} | ||
| 184 | - | ||
| 185 | @Extend(Text) function bottomTextStyle() { | 96 | @Extend(Text) function bottomTextStyle() { |
| 186 | .fontSize(12) | 97 | .fontSize(12) |
| 187 | .fontColor('#B0B0B0') | 98 | .fontColor('#B0B0B0') |
| 1 | //全标题 "compStyle":"4", | 1 | //全标题 "compStyle":"4", |
| 2 | import { CommonConstants } from 'wdConstant' | 2 | import { CommonConstants } from 'wdConstant' |
| 3 | +import { DateTimeUtils } from 'wdKit'; | ||
| 3 | import { CompDTO } from '../../repository/bean/CompDTO' | 4 | import { CompDTO } from '../../repository/bean/CompDTO' |
| 4 | const TAG: string = 'TriPicCardComponent'; | 5 | const TAG: string = 'TriPicCardComponent'; |
| 5 | 6 | ||
| @@ -10,7 +11,7 @@ const TAG: string = 'TriPicCardComponent'; | @@ -10,7 +11,7 @@ const TAG: string = 'TriPicCardComponent'; | ||
| 10 | * 卡片宽度:充满父窗口 | 11 | * 卡片宽度:充满父窗口 |
| 11 | * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: | 12 | * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: |
| 12 | */ | 13 | */ |
| 13 | -// @Entry | 14 | +@Entry |
| 14 | @Component | 15 | @Component |
| 15 | export struct TriPicCardComponent { | 16 | export struct TriPicCardComponent { |
| 16 | @State compDTO: CompDTO = {} as CompDTO | 17 | @State compDTO: CompDTO = {} as CompDTO |
| @@ -31,23 +32,21 @@ export struct TriPicCardComponent { | @@ -31,23 +32,21 @@ export struct TriPicCardComponent { | ||
| 31 | Row() { | 32 | Row() { |
| 32 | Image(this.compDTO.operDataList[0].fullColumnImgUrls[0]?.url) | 33 | Image(this.compDTO.operDataList[0].fullColumnImgUrls[0]?.url) |
| 33 | .width('32%') | 34 | .width('32%') |
| 34 | - | ||
| 35 | - .height(75) | 35 | + .aspectRatio(113 / 75) |
| 36 | .borderRadius({ topLeft:4,bottomLeft:4 }) | 36 | .borderRadius({ topLeft:4,bottomLeft:4 }) |
| 37 | 37 | ||
| 38 | Image(this.compDTO.operDataList[0].fullColumnImgUrls[1]?.url) | 38 | Image(this.compDTO.operDataList[0].fullColumnImgUrls[1]?.url) |
| 39 | .width('32%') | 39 | .width('32%') |
| 40 | - .height(75) | 40 | + .aspectRatio(113 / 75) |
| 41 | 41 | ||
| 42 | Image(this.compDTO.operDataList[0].fullColumnImgUrls[2]?.url) | 42 | Image(this.compDTO.operDataList[0].fullColumnImgUrls[2]?.url) |
| 43 | .width('32%') | 43 | .width('32%') |
| 44 | - .height(75) | 44 | + .aspectRatio(113 / 75) |
| 45 | .borderRadius({ topRight:4,bottomRight:4 }) | 45 | .borderRadius({ topRight:4,bottomRight:4 }) |
| 46 | 46 | ||
| 47 | } | 47 | } |
| 48 | .justifyContent(FlexAlign.SpaceBetween) | 48 | .justifyContent(FlexAlign.SpaceBetween) |
| 49 | .width('100%') | 49 | .width('100%') |
| 50 | - .height(75) | ||
| 51 | .margin({top:8}) | 50 | .margin({top:8}) |
| 52 | .borderRadius(8) | 51 | .borderRadius(8) |
| 53 | 52 | ||
| @@ -67,7 +66,7 @@ export struct TriPicCardComponent { | @@ -67,7 +66,7 @@ export struct TriPicCardComponent { | ||
| 67 | .width(12) | 66 | .width(12) |
| 68 | .height(12) | 67 | .height(12) |
| 69 | 68 | ||
| 70 | - Text(this.compDTO.operDataList[0].publishTime) | 69 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime))) |
| 71 | .bottomTextStyle() | 70 | .bottomTextStyle() |
| 72 | Text(' ') | 71 | Text(' ') |
| 73 | 72 |
-
Please register or login to post a comment