Showing
10 changed files
with
35 additions
and
29 deletions
| @@ -84,7 +84,7 @@ export class ContentDTO implements BaseDTO { | @@ -84,7 +84,7 @@ export class ContentDTO implements BaseDTO { | ||
| 84 | openType: string = ''; | 84 | openType: string = ''; |
| 85 | extra: string = '' | 85 | extra: string = '' |
| 86 | 86 | ||
| 87 | - static clone(old:ContentDTO): ContentDTO { | 87 | + static clone(old: ContentDTO): ContentDTO { |
| 88 | let content = new ContentDTO(); | 88 | let content = new ContentDTO(); |
| 89 | content.appStyle = old.appStyle; | 89 | content.appStyle = old.appStyle; |
| 90 | content.cityCode = old.cityCode; | 90 | content.cityCode = old.cityCode; |
| 1 | -import { CommonConstants, CompStyle } from 'wdConstant'; | ||
| 2 | -import { ContentDTO } from 'wdBean'; | 1 | +import { CompStyle } from 'wdConstant'; |
| 2 | +import { CompDTO, ContentDTO } from 'wdBean'; | ||
| 3 | import { Card2Component } from './cardview/Card2Component'; | 3 | import { Card2Component } from './cardview/Card2Component'; |
| 4 | import { Card3Component } from './cardview/Card3Component'; | 4 | import { Card3Component } from './cardview/Card3Component'; |
| 5 | import { Card4Component } from './cardview/Card4Component'; | 5 | import { Card4Component } from './cardview/Card4Component'; |
| @@ -24,13 +24,14 @@ import { Card21Component } from './cardview/Card21Component'; | @@ -24,13 +24,14 @@ import { Card21Component } from './cardview/Card21Component'; | ||
| 24 | @Component | 24 | @Component |
| 25 | export struct CardParser { | 25 | export struct CardParser { |
| 26 | @State contentDTO: ContentDTO = new ContentDTO(); | 26 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 27 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 27 | 28 | ||
| 28 | build() { | 29 | build() { |
| 29 | - this.contentBuilder(this.contentDTO); | 30 | + this.contentBuilder(this.contentDTO, this.compDTO); |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | @Builder | 33 | @Builder |
| 33 | - contentBuilder(contentDTO: ContentDTO) { | 34 | + contentBuilder(contentDTO: ContentDTO, compDTO: CompDTO) { |
| 34 | if (contentDTO.appStyle === CompStyle.Card_02) { | 35 | if (contentDTO.appStyle === CompStyle.Card_02) { |
| 35 | Card2Component({ contentDTO }) | 36 | Card2Component({ contentDTO }) |
| 36 | } else if (contentDTO.appStyle === CompStyle.Card_03) { | 37 | } else if (contentDTO.appStyle === CompStyle.Card_03) { |
| @@ -38,7 +39,7 @@ export struct CardParser { | @@ -38,7 +39,7 @@ export struct CardParser { | ||
| 38 | } else if (contentDTO.appStyle === CompStyle.Card_04) { | 39 | } else if (contentDTO.appStyle === CompStyle.Card_04) { |
| 39 | Card4Component({ contentDTO }) | 40 | Card4Component({ contentDTO }) |
| 40 | } else if (contentDTO.appStyle === CompStyle.Card_05) { | 41 | } else if (contentDTO.appStyle === CompStyle.Card_05) { |
| 41 | - Card5Component({ contentDTO }) | 42 | + Card5Component({ contentDTO, titleShowPolicy: compDTO.titleShowPolicy }) |
| 42 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle | 43 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle |
| 43 | .Card_13) { | 44 | .Card_13) { |
| 44 | Card6Component({ contentDTO }) | 45 | Card6Component({ contentDTO }) |
| @@ -64,8 +65,7 @@ export struct CardParser { | @@ -64,8 +65,7 @@ export struct CardParser { | ||
| 64 | Card20Component({ contentDTO }) | 65 | Card20Component({ contentDTO }) |
| 65 | } else if (contentDTO.appStyle === CompStyle.Card_21) { | 66 | } else if (contentDTO.appStyle === CompStyle.Card_21) { |
| 66 | Card21Component({ contentDTO }) | 67 | Card21Component({ contentDTO }) |
| 67 | - } | ||
| 68 | - else { | 68 | + } else { |
| 69 | // todo:组件未实现 / Component Not Implemented | 69 | // todo:组件未实现 / Component Not Implemented |
| 70 | // Text(contentDTO.appStyle) | 70 | // Text(contentDTO.appStyle) |
| 71 | // .width(CommonConstants.FULL_PARENT) | 71 | // .width(CommonConstants.FULL_PARENT) |
| @@ -32,12 +32,12 @@ import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent' | @@ -32,12 +32,12 @@ import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent' | ||
| 32 | @Component | 32 | @Component |
| 33 | export struct CompParser { | 33 | export struct CompParser { |
| 34 | @State compDTO: CompDTO = {} as CompDTO | 34 | @State compDTO: CompDTO = {} as CompDTO |
| 35 | - @State private pageModel: PageModel = new PageModel(); | ||
| 36 | @State compIndex: number = 0; | 35 | @State compIndex: number = 0; |
| 36 | + @State private pageModel: PageModel = new PageModel(); | ||
| 37 | 37 | ||
| 38 | build() { | 38 | build() { |
| 39 | Column() { | 39 | Column() { |
| 40 | - if (this.compDTO.name !="月度排行卡") { | 40 | + if (this.compDTO.name != "月度排行卡") { |
| 41 | 41 | ||
| 42 | this.componentBuilder(this.compDTO, this.compIndex); | 42 | this.componentBuilder(this.compDTO, this.compIndex); |
| 43 | } | 43 | } |
| @@ -53,7 +53,8 @@ export struct CompParser { | @@ -53,7 +53,8 @@ export struct CompParser { | ||
| 53 | } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | 53 | } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| 54 | ZhCarouselLayout01({ compDTO: compDTO }) | 54 | ZhCarouselLayout01({ compDTO: compDTO }) |
| 55 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 55 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 56 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {// && compDTO.name ==="横划卡" | 56 | + } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && |
| 57 | + compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" | ||
| 57 | 58 | ||
| 58 | LiveHorizontalCardComponent({ compDTO: compDTO }) | 59 | LiveHorizontalCardComponent({ compDTO: compDTO }) |
| 59 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 60 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| @@ -87,7 +88,7 @@ export struct CompParser { | @@ -87,7 +88,7 @@ export struct CompParser { | ||
| 87 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 88 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 88 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | 89 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { |
| 89 | //头图卡 和comStyle 2相同, | 90 | //头图卡 和comStyle 2相同, |
| 90 | - Card5Component({ contentDTO: compDTO.operDataList[0] }) | 91 | + Card5Component({ contentDTO: compDTO.operDataList[0], titleShowPolicy: compDTO.titleShowPolicy }) |
| 91 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 92 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 92 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { | 93 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { |
| 93 | // 大图卡 | 94 | // 大图卡 |
| @@ -107,10 +108,9 @@ export struct CompParser { | @@ -107,10 +108,9 @@ export struct CompParser { | ||
| 107 | //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) | 108 | //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) |
| 108 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 109 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 109 | } else if (!Number.isNaN(Number(compDTO.compStyle))) { | 110 | } else if (!Number.isNaN(Number(compDTO.compStyle))) { |
| 110 | - CardParser({ contentDTO: compDTO.operDataList[0] }); | 111 | + CardParser({ contentDTO: compDTO.operDataList[0], compDTO }); |
| 111 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 112 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 112 | - } | ||
| 113 | - else { | 113 | + } else { |
| 114 | Text(compDTO.compStyle) | 114 | Text(compDTO.compStyle) |
| 115 | .width(CommonConstants.FULL_PARENT) | 115 | .width(CommonConstants.FULL_PARENT) |
| 116 | .padding(10) | 116 | .padding(10) |
| @@ -48,8 +48,9 @@ export struct Card10Component { | @@ -48,8 +48,9 @@ export struct Card10Component { | ||
| 48 | .onClick((event: ClickEvent) => { | 48 | .onClick((event: ClickEvent) => { |
| 49 | ProcessUtils.processPage(this.contentDTO) | 49 | ProcessUtils.processPage(this.contentDTO) |
| 50 | }) | 50 | }) |
| 51 | - | 51 | + if (this.contentDTO.objectType == '5') { |
| 52 | Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 }) | 52 | Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 }) |
| 53 | + } | ||
| 53 | }.alignContent(Alignment.BottomStart) | 54 | }.alignContent(Alignment.BottomStart) |
| 54 | 55 | ||
| 55 | // 专题列表--后端返回三个, | 56 | // 专题列表--后端返回三个, |
| @@ -106,7 +107,7 @@ export struct Card10Component { | @@ -106,7 +107,7 @@ export struct Card10Component { | ||
| 106 | .fontColor($r('app.color.color_222222')) | 107 | .fontColor($r('app.color.color_222222')) |
| 107 | .maxLines(2) | 108 | .maxLines(2) |
| 108 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 109 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 109 | - .textIndent(item.objectType == '5' ? 40 : 0) | 110 | + .textIndent(item.objectType == '5' ? 38 : 0) |
| 110 | }.alignContent(Alignment.TopStart) | 111 | }.alignContent(Alignment.TopStart) |
| 111 | 112 | ||
| 112 | CardSourceInfo( | 113 | CardSourceInfo( |
| @@ -40,7 +40,7 @@ export struct Card2Component { | @@ -40,7 +40,7 @@ export struct Card2Component { | ||
| 40 | .maxLines(2) | 40 | .maxLines(2) |
| 41 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 41 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 42 | .align(Alignment.Start) | 42 | .align(Alignment.Start) |
| 43 | - .textIndent(this.contentDTO.objectType == '5' ? 40 : 0) | 43 | + .textIndent(this.contentDTO.objectType == '5' ? 35 : 0) |
| 44 | } | 44 | } |
| 45 | .alignContent(Alignment.TopStart) | 45 | .alignContent(Alignment.TopStart) |
| 46 | 46 |
| @@ -12,7 +12,7 @@ const TAG: string = 'Card5Component'; | @@ -12,7 +12,7 @@ const TAG: string = 'Card5Component'; | ||
| 12 | @Component | 12 | @Component |
| 13 | export struct Card5Component { | 13 | export struct Card5Component { |
| 14 | @State contentDTO: ContentDTO = new ContentDTO(); | 14 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 15 | - @State titleShowPolicy: number | string = 1 | 15 | + @Prop titleShowPolicy: number | string |
| 16 | @State loadImg: boolean = false; | 16 | @State loadImg: boolean = false; |
| 17 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 18 | 18 | ||
| @@ -22,12 +22,13 @@ export struct Card5Component { | @@ -22,12 +22,13 @@ export struct Card5Component { | ||
| 22 | 22 | ||
| 23 | build() { | 23 | build() { |
| 24 | Stack() { | 24 | Stack() { |
| 25 | + | ||
| 25 | Image(this.loadImg ? this.contentDTO.coverUrl : '') | 26 | Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 26 | .backgroundColor(0xf5f5f5) | 27 | .backgroundColor(0xf5f5f5) |
| 27 | .width(CommonConstants.FULL_WIDTH) | 28 | .width(CommonConstants.FULL_WIDTH) |
| 28 | .autoResize(true) | 29 | .autoResize(true) |
| 29 | .borderRadius($r('app.float.image_border_radius')) | 30 | .borderRadius($r('app.float.image_border_radius')) |
| 30 | - // if ((this.titleShowPolicy === 1 || this.contentDTO.titleShow === 1) && this.contentDTO.newsTitle) { | 31 | + if (this.titleShowPolicy === 1) { |
| 31 | Row() | 32 | Row() |
| 32 | .width(CommonConstants.FULL_WIDTH) | 33 | .width(CommonConstants.FULL_WIDTH) |
| 33 | .height(59) | 34 | .height(59) |
| @@ -41,20 +42,21 @@ export struct Card5Component { | @@ -41,20 +42,21 @@ export struct Card5Component { | ||
| 41 | if (this.contentDTO.objectType == '5') { | 42 | if (this.contentDTO.objectType == '5') { |
| 42 | Notes({ objectType: this.contentDTO.objectType }) | 43 | Notes({ objectType: this.contentDTO.objectType }) |
| 43 | } | 44 | } |
| 45 | + | ||
| 44 | Text(this.contentDTO.newsTitle) | 46 | Text(this.contentDTO.newsTitle) |
| 45 | - .width(CommonConstants.FULL_WIDTH)// .height(CommonConstants.FULL_HEIGHT) | 47 | + .width(CommonConstants.FULL_WIDTH) |
| 46 | .fontColor(Color.White) | 48 | .fontColor(Color.White) |
| 47 | .fontSize($r('app.float.normal_text_size')) | 49 | .fontSize($r('app.float.normal_text_size')) |
| 48 | .fontWeight(FontWeight.Bold) | 50 | .fontWeight(FontWeight.Bold) |
| 49 | .maxLines(2) | 51 | .maxLines(2) |
| 50 | .align(Alignment.TopStart) | 52 | .align(Alignment.TopStart) |
| 51 | - .textIndent(this.contentDTO.objectType == '5' ? 40 : 0) | 53 | + .textIndent(this.contentDTO.objectType == '5' ? 35 : 0) |
| 52 | }.alignContent(Alignment.TopStart) | 54 | }.alignContent(Alignment.TopStart) |
| 53 | } | 55 | } |
| 54 | .justifyContent(FlexAlign.Start) | 56 | .justifyContent(FlexAlign.Start) |
| 55 | - // .height(40) | ||
| 56 | .margin({ left: 12, bottom: 10, right: 12 }) | 57 | .margin({ left: 12, bottom: 10, right: 12 }) |
| 57 | - // } | 58 | + |
| 59 | + } | ||
| 58 | } | 60 | } |
| 59 | .alignContent(Alignment.Bottom) | 61 | .alignContent(Alignment.Bottom) |
| 60 | .width(CommonConstants.FULL_WIDTH) | 62 | .width(CommonConstants.FULL_WIDTH) |
| @@ -49,7 +49,7 @@ export struct Card6Component { | @@ -49,7 +49,7 @@ export struct Card6Component { | ||
| 49 | .maxLines(3) | 49 | .maxLines(3) |
| 50 | .alignSelf(ItemAlign.Start) | 50 | .alignSelf(ItemAlign.Start) |
| 51 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 51 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 52 | - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 60 : | 52 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 53 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | 53 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || |
| 54 | this.contentDTO.objectType == '5' ? 30 : 0) | 54 | this.contentDTO.objectType == '5' ? 30 : 0) |
| 55 | }.alignContent(Alignment.TopStart) | 55 | }.alignContent(Alignment.TopStart) |
| @@ -43,8 +43,11 @@ export struct Card9Component { | @@ -43,8 +43,11 @@ export struct Card9Component { | ||
| 43 | topRight: $r('app.float.image_border_radius') | 43 | topRight: $r('app.float.image_border_radius') |
| 44 | }) | 44 | }) |
| 45 | 45 | ||
| 46 | + if (this.contentDTO.objectType == '5') { | ||
| 46 | Notes({ objectType: 5 }) | 47 | Notes({ objectType: 5 }) |
| 47 | .margin({ left: 5, bottom: 5 }) | 48 | .margin({ left: 5, bottom: 5 }) |
| 49 | + } | ||
| 50 | + | ||
| 48 | }.alignContent(Alignment.BottomStart) | 51 | }.alignContent(Alignment.BottomStart) |
| 49 | 52 | ||
| 50 | // 时间线--后端返回三个, | 53 | // 时间线--后端返回三个, |
| @@ -13,10 +13,10 @@ export struct Notes { | @@ -13,10 +13,10 @@ export struct Notes { | ||
| 13 | build() { | 13 | build() { |
| 14 | if (this.returnTypeTitleFn()) { | 14 | if (this.returnTypeTitleFn()) { |
| 15 | Text(this.returnTypeTitleFn()) | 15 | Text(this.returnTypeTitleFn()) |
| 16 | - .fontSize($r('app.float.font_size_12')) | 16 | + .fontSize($r('app.float.font_size_11')) |
| 17 | .padding({ | 17 | .padding({ |
| 18 | - left: 5, | ||
| 19 | - right: 5, | 18 | + left: 4, |
| 19 | + right: 4, | ||
| 20 | top: 3, | 20 | top: 3, |
| 21 | bottom: 3 | 21 | bottom: 3 |
| 22 | }) | 22 | }) |
| @@ -214,7 +214,7 @@ struct CarouselLayout01CardView { | @@ -214,7 +214,7 @@ struct CarouselLayout01CardView { | ||
| 214 | .align(Alignment.Bottom) | 214 | .align(Alignment.Bottom) |
| 215 | .maxLines(CompUtils.MAX_LINES_2) | 215 | .maxLines(CompUtils.MAX_LINES_2) |
| 216 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 216 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 217 | - .textIndent(this.item.objectType == '5' ? 40 : 0) | 217 | + .textIndent(this.item.objectType == '5' ? 35 : 0) |
| 218 | } | 218 | } |
| 219 | // .height(39) | 219 | // .height(39) |
| 220 | .padding({ | 220 | .padding({ |
-
Please register or login to post a comment