Showing
3 changed files
with
89 additions
and
34 deletions
| 1 | +import { CompDTO } from 'wdBean/Index'; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * @Description: 广告稿件 底部标签+删除按钮 | ||
| 5 | + * @Author: | ||
| 6 | + * @Email: liyubing@wondertek.com.cn | ||
| 7 | + * @CreateDate: | ||
| 8 | + * @UpdateRemark: 更新说明 | ||
| 9 | + * @Version: 1.0 | ||
| 10 | + */ | ||
| 11 | +@Component | ||
| 12 | +export struct CardAdvBottom { | ||
| 13 | + @State compDTO: CompDTO = {} as CompDTO; | ||
| 14 | + | ||
| 15 | + build() { | ||
| 16 | + | ||
| 17 | + Row() { | ||
| 18 | + Text($r('app.string.comp_advertisement')).fontSize('12fp').fontColor($r('app.color.color_B0B0B0')) | ||
| 19 | + | ||
| 20 | + Blank() | ||
| 21 | + | ||
| 22 | + Stack() { | ||
| 23 | + Image($r('app.media.comp_adv_close')) | ||
| 24 | + .width(9) | ||
| 25 | + .height(9) | ||
| 26 | + .borderRadius({ | ||
| 27 | + topLeft: '4vp', | ||
| 28 | + topRight: '4vp', | ||
| 29 | + bottomLeft: '4vp', | ||
| 30 | + bottomRight: '4vp' | ||
| 31 | + }) | ||
| 32 | + } | ||
| 33 | + .width(18) | ||
| 34 | + .height(14) | ||
| 35 | + .borderWidth(0.5) | ||
| 36 | + .borderColor($r('app.color.color_EDEDED')) | ||
| 37 | + .borderRadius(4) | ||
| 38 | + | ||
| 39 | + }.width('100%') | ||
| 40 | + } | ||
| 41 | +} |
| @@ -4,6 +4,7 @@ import { ProcessUtils } from 'wdRouter'; | @@ -4,6 +4,7 @@ import { ProcessUtils } from 'wdRouter'; | ||
| 4 | 4 | ||
| 5 | import measure from '@ohos.measure'; | 5 | import measure from '@ohos.measure'; |
| 6 | import { DisplayUtils } from 'wdKit/Index'; | 6 | import { DisplayUtils } from 'wdKit/Index'; |
| 7 | +import { CardAdvBottom } from './CardAdvBottom'; | ||
| 7 | 8 | ||
| 8 | const TAG: string = 'CardAdvSmallImageComponent'; | 9 | const TAG: string = 'CardAdvSmallImageComponent'; |
| 9 | 10 | ||
| @@ -52,51 +53,32 @@ export struct CardAdvSmallImageComponent { | @@ -52,51 +53,32 @@ export struct CardAdvSmallImageComponent { | ||
| 52 | left: { anchor: '__container__', align: HorizontalAlign.Start }, | 53 | left: { anchor: '__container__', align: HorizontalAlign.Start }, |
| 53 | }) | 54 | }) |
| 54 | .id("title_name") | 55 | .id("title_name") |
| 56 | + | ||
| 55 | // 广告图 | 57 | // 广告图 |
| 56 | Image(this.compDTO.matInfo.matImageUrl[0]) | 58 | Image(this.compDTO.matInfo.matImageUrl[0]) |
| 57 | .width('34%') | 59 | .width('34%') |
| 58 | .aspectRatio(3 / 2) | 60 | .aspectRatio(3 / 2) |
| 59 | - .borderRadius(4) | ||
| 60 | .id('adv_imag') | 61 | .id('adv_imag') |
| 62 | + .borderWidth(0.5) | ||
| 63 | + .borderColor($r('app.color.color_0D000000')) | ||
| 64 | + .borderRadius(4) | ||
| 61 | .alignRules({ | 65 | .alignRules({ |
| 62 | top: { anchor: 'title_name', align: VerticalAlign.Top }, | 66 | top: { anchor: 'title_name', align: VerticalAlign.Top }, |
| 63 | left: { anchor: 'title_name', align: HorizontalAlign.End }, | 67 | left: { anchor: 'title_name', align: HorizontalAlign.End }, |
| 64 | - | ||
| 65 | }) | 68 | }) |
| 66 | .margin({ left: 12 }) | 69 | .margin({ left: 12 }) |
| 67 | 70 | ||
| 68 | - Row() { | ||
| 69 | - Text($r('app.string.comp_advertisement')).fontSize('12fp').fontColor($r('app.color.color_B0B0B0')) | ||
| 70 | - | ||
| 71 | - Blank() | ||
| 72 | 71 | ||
| 73 | - Stack() { | ||
| 74 | - Image($r('app.media.comp_adv_close')) | ||
| 75 | - .width(9) | ||
| 76 | - .height(9) | ||
| 77 | - .borderRadius({ | ||
| 78 | - topLeft: '4vp', | ||
| 79 | - topRight: '4vp', | ||
| 80 | - bottomLeft: '4vp', | ||
| 81 | - bottomRight: '4vp' | ||
| 82 | - }) | ||
| 83 | - } | ||
| 84 | - .width(18) | ||
| 85 | - .height(14) | ||
| 86 | - .borderWidth(0.5) | ||
| 87 | - .borderColor($r('app.color.color_EDEDED')) | ||
| 88 | - .borderRadius(4) | ||
| 89 | - | ||
| 90 | - }.width('62%').alignRules({ | 72 | + CardAdvBottom().width('62%').id('bottom_adv').alignRules({ |
| 91 | bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom }, | 73 | bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom }, |
| 92 | right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start }, | 74 | right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start }, |
| 93 | - | ||
| 94 | top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom }, | 75 | top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom }, |
| 95 | left: { anchor: this.isBigThreeLine ? 'title_name' : '', align: HorizontalAlign.Start }, | 76 | left: { anchor: this.isBigThreeLine ? 'title_name' : '', align: HorizontalAlign.Start }, |
| 96 | - }).id('bottom_adv').margin({ | 77 | + }).margin({ |
| 97 | right: this.isBigThreeLine ? 0 : 12, | 78 | right: this.isBigThreeLine ? 0 : 12, |
| 98 | top: this.isBigThreeLine ? 8 : 0, | 79 | top: this.isBigThreeLine ? 8 : 0, |
| 99 | }) | 80 | }) |
| 81 | + | ||
| 100 | } | 82 | } |
| 101 | .width("100%") | 83 | .width("100%") |
| 102 | .height(this.isBigThreeLine ? 127 : 106) | 84 | .height(this.isBigThreeLine ? 127 : 106) |
| @@ -4,6 +4,7 @@ import { CommonConstants } from 'wdConstant/Index'; | @@ -4,6 +4,7 @@ import { CommonConstants } from 'wdConstant/Index'; | ||
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 7 | +import { CardAdvBottom } from './CardAdvBottom'; | ||
| 7 | 8 | ||
| 8 | const TAG: string = 'Card2Component'; | 9 | const TAG: string = 'Card2Component'; |
| 9 | 10 | ||
| @@ -17,7 +18,6 @@ const TAG: string = 'Card2Component'; | @@ -17,7 +18,6 @@ const TAG: string = 'Card2Component'; | ||
| 17 | */ | 18 | */ |
| 18 | @Component | 19 | @Component |
| 19 | export struct CardAdvThreeImageComponent { | 20 | export struct CardAdvThreeImageComponent { |
| 20 | - | ||
| 21 | @State compDTO: CompDTO = {} as CompDTO | 21 | @State compDTO: CompDTO = {} as CompDTO |
| 22 | 22 | ||
| 23 | aboutToAppear(): void { | 23 | aboutToAppear(): void { |
| @@ -31,14 +31,49 @@ export struct CardAdvThreeImageComponent { | @@ -31,14 +31,49 @@ export struct CardAdvThreeImageComponent { | ||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | build() { | 33 | build() { |
| 34 | - | ||
| 35 | Column() { | 34 | Column() { |
| 35 | + //body | ||
| 36 | + Column() { | ||
| 37 | + //新闻标题 | ||
| 36 | Text(this.compDTO.matInfo.advTitle) | 38 | Text(this.compDTO.matInfo.advTitle) |
| 37 | - .fontSize($r('app.float.font_size_17')) | 39 | + .fontSize($r('app.float.font_size_18')) |
| 38 | .fontColor($r('app.color.color_222222')) | 40 | .fontColor($r('app.color.color_222222')) |
| 39 | .maxLines(3) | 41 | .maxLines(3) |
| 40 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 41 | - .align(Alignment.Start) | 42 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 43 | + //三图 | ||
| 44 | + Row() { | ||
| 45 | + GridRow({ gutter: 2 }) { | ||
| 46 | + ForEach(this.compDTO.matInfo.matImageUrl, (url: string, index: number) => { | ||
| 47 | + if (index < 3) { | ||
| 48 | + GridCol({ span: { xs: 4 } }) { | ||
| 49 | + Image(url) | ||
| 50 | + .width('100%') | ||
| 51 | + .aspectRatio(113 / 75) | ||
| 52 | + .borderRadius({ | ||
| 53 | + topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 54 | + topRight: index === 2 ? $r('app.float.image_border_radius') : 0, | ||
| 55 | + bottomLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 56 | + bottomRight: index === 2 ? $r('app.float.image_border_radius') : 0, | ||
| 57 | + }) | ||
| 58 | + .borderColor($r('app.color.color_0D000000')) | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + }) | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + .width(CommonConstants.FULL_PARENT) | ||
| 65 | + .margin({ top: 8 }) | ||
| 66 | + | ||
| 67 | + // 广告工具组件 | ||
| 68 | + CardAdvBottom().width('100%').margin({ top: 8 }) | ||
| 69 | + } | ||
| 70 | + .width('100%') | ||
| 71 | + .justifyContent(FlexAlign.Start) | ||
| 72 | + .alignItems(HorizontalAlign.Start) | ||
| 73 | + .onClick((event: ClickEvent) => { | ||
| 74 | + ProcessUtils.openAdvDetail(this.compDTO.matInfo) | ||
| 75 | + }) | ||
| 76 | + | ||
| 42 | } | 77 | } |
| 43 | .width(CommonConstants.FULL_WIDTH) | 78 | .width(CommonConstants.FULL_WIDTH) |
| 44 | .padding({ | 79 | .padding({ |
| @@ -47,9 +82,6 @@ export struct CardAdvThreeImageComponent { | @@ -47,9 +82,6 @@ export struct CardAdvThreeImageComponent { | ||
| 47 | top: $r('app.float.card_comp_pagePadding_tb'), | 82 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 48 | bottom: $r('app.float.card_comp_pagePadding_tb') | 83 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 49 | }) | 84 | }) |
| 50 | - .onClick((event: ClickEvent) => { | ||
| 51 | - //ProcessUtils.processPage(this.contentDTO) | ||
| 52 | - }) | ||
| 53 | } | 85 | } |
| 54 | } | 86 | } |
| 55 | 87 |
-
Please register or login to post a comment