Showing
7 changed files
with
154 additions
and
8 deletions
| @@ -28,6 +28,6 @@ export const enum CompStyle { | @@ -28,6 +28,6 @@ export const enum CompStyle { | ||
| 28 | ZhGrid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡 | 28 | ZhGrid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡 |
| 29 | Album_Card_01 = '17', //图卡集 | 29 | Album_Card_01 = '17', //图卡集 |
| 30 | Zh_Single_Row_04 = 'Zh_Single_Row-04', // 地方精选卡 | 30 | Zh_Single_Row_04 = 'Zh_Single_Row-04', // 地方精选卡 |
| 31 | - CompStyle_09 = 9, // 时间链卡 | ||
| 32 | - CompStyle_10 = 10, // 大专题卡 | 31 | + CompStyle_09 = '9', // 时间链卡 |
| 32 | + CompStyle_10 = '10', // 大专题卡 | ||
| 33 | } | 33 | } |
| @@ -91,3 +91,4 @@ export { OperDataList } from './src/main/ets/bean/morningevening/OperDataList'; | @@ -91,3 +91,4 @@ export { OperDataList } from './src/main/ets/bean/morningevening/OperDataList'; | ||
| 91 | 91 | ||
| 92 | export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo'; | 92 | export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo'; |
| 93 | 93 | ||
| 94 | +export { slideShows } from './src/main/ets/bean/morningevening/slideShows'; |
| @@ -2,6 +2,8 @@ import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO'; | @@ -2,6 +2,8 @@ import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO'; | ||
| 2 | import { LiveInfoDTO } from '../detail/LiveInfoDTO'; | 2 | import { LiveInfoDTO } from '../detail/LiveInfoDTO'; |
| 3 | import { VideoInfoDTO } from '../detail/VideoInfoDTO'; | 3 | import { VideoInfoDTO } from '../detail/VideoInfoDTO'; |
| 4 | import { InteractDataDTO } from './InteractDataDTO'; | 4 | import { InteractDataDTO } from './InteractDataDTO'; |
| 5 | +import { slideShows } from '../morningevening/slideShows' | ||
| 6 | + | ||
| 5 | 7 | ||
| 6 | export interface ContentDTO { | 8 | export interface ContentDTO { |
| 7 | cityCode: string; | 9 | cityCode: string; |
| @@ -58,4 +60,7 @@ export interface ContentDTO { | @@ -58,4 +60,7 @@ export interface ContentDTO { | ||
| 58 | 60 | ||
| 59 | // 二次请求接口,返回的数据,这里组装到content里;TODO 后续优化 | 61 | // 二次请求接口,返回的数据,这里组装到content里;TODO 后续优化 |
| 60 | interactData:InteractDataDTO; | 62 | interactData:InteractDataDTO; |
| 63 | + | ||
| 64 | + hasMore: number, | ||
| 65 | + slideShows: slideShows[] | ||
| 61 | } | 66 | } |
| 1 | +import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO'; | ||
| 2 | +export interface slideShows { | ||
| 3 | + fullColumnImgUrls: FullColumnImgUrlDTO[]; | ||
| 4 | + linkUrl?: string; | ||
| 5 | + newsId?: string; | ||
| 6 | + newsTitle?: string; | ||
| 7 | + newsTitleColor?: string; | ||
| 8 | + objectLevel?: string; | ||
| 9 | + objectType?: string; | ||
| 10 | + pageId?: string; | ||
| 11 | + photoNum?: string; | ||
| 12 | + publishTime: number; | ||
| 13 | + relId?: string; | ||
| 14 | + source?: string; | ||
| 15 | + timeBlurred?: string; | ||
| 16 | + videoDuration?: string; | ||
| 17 | + videoLandscape?: string; | ||
| 18 | + videoUrl?: string; | ||
| 19 | + voiceDuration?: string; | ||
| 20 | +} |
| 1 | -import { CompDTO, ContentDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO , slideShows} from 'wdBean'; |
| 2 | import { CommonConstants, CompStyle } from 'wdConstant'; | 2 | import { CommonConstants, CompStyle } from 'wdConstant'; |
| 3 | import { BannerComponent } from './view/BannerComponent'; | 3 | import { BannerComponent } from './view/BannerComponent'; |
| 4 | import { LabelComponent } from './view/LabelComponent'; | 4 | import { LabelComponent } from './view/LabelComponent'; |
| @@ -16,10 +16,10 @@ import { | @@ -16,10 +16,10 @@ import { | ||
| 16 | import { | 16 | import { |
| 17 | HorizontalStrokeCardThreeTwoRadioForOneComponent | 17 | HorizontalStrokeCardThreeTwoRadioForOneComponent |
| 18 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; | 18 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; |
| 19 | -import { | ||
| 20 | - HorizontalStrokeCardThreeTwoRadioForTwoComponent | ||
| 21 | -} from './view/HorizontalStrokeCardThreeTwoRadioForTwoComponent'; | ||
| 22 | import { AlbumCardComponent } from './view/AlbumCardComponent'; | 19 | import { AlbumCardComponent } from './view/AlbumCardComponent'; |
| 20 | +import { ZhSingleRow04 } from './view/ZhSingleRow04' | ||
| 21 | +import { CompStyle_09 } from './view/CompStyle_09' | ||
| 22 | +import { CompStyle_10 } from './view/CompStyle_10' | ||
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * comp适配器. | 25 | * comp适配器. |
| @@ -126,8 +126,12 @@ export struct CompParser { | @@ -126,8 +126,12 @@ export struct CompParser { | ||
| 126 | ZhGridLayoutComponent({ compDTO: compDTO }) | 126 | ZhGridLayoutComponent({ compDTO: compDTO }) |
| 127 | } else if (compDTO.compStyle === CompStyle.Album_Card_01) { | 127 | } else if (compDTO.compStyle === CompStyle.Album_Card_01) { |
| 128 | AlbumCardComponent({ compDTO: compDTO }) | 128 | AlbumCardComponent({ compDTO: compDTO }) |
| 129 | - } else if (compDTO.compStyle === CompStyle.Single_Row_02) { | ||
| 130 | - | 129 | + } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { |
| 130 | + ZhSingleRow04({ compDTO: compDTO}) | ||
| 131 | + } else if (compDTO.compStyle === CompStyle.CompStyle_09) { | ||
| 132 | + CompStyle_09({ compDTO: compDTO}) | ||
| 133 | + } else if (compDTO.compStyle === CompStyle.CompStyle_10) { | ||
| 134 | + CompStyle_10({ compDTO: compDTO}) | ||
| 131 | } | 135 | } |
| 132 | else { | 136 | else { |
| 133 | // todo:组件未实现 / Component Not Implemented | 137 | // todo:组件未实现 / Component Not Implemented |
| 1 | +import { CompDTO, slideShows } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant' | ||
| 3 | +import { DateTimeUtils } from 'wdKit'; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 时间链卡--CompStyle: 09 | ||
| 7 | + */ | ||
| 8 | +@Component | ||
| 9 | +export struct CompStyle_09 { | ||
| 10 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 11 | + | ||
| 12 | + build() { | ||
| 13 | + Column(){ | ||
| 14 | + // 顶部标题,最多两行 | ||
| 15 | + if(this.compDTO.operDataList[0].newsTitle) { | ||
| 16 | + Text(this.compDTO.operDataList[0].newsTitle) | ||
| 17 | + .width(CommonConstants.FULL_WIDTH) | ||
| 18 | + .fontSize($r('app.float.font_size_17')) | ||
| 19 | + .fontWeight(600) | ||
| 20 | + .maxLines(2) | ||
| 21 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 22 | + .margin({ bottom: 19 }) | ||
| 23 | + } | ||
| 24 | + // 大图 | ||
| 25 | + Image(this.compDTO.operDataList[0].coverUrl) | ||
| 26 | + .width('100%') | ||
| 27 | + // 时间线--后端返回三个, | ||
| 28 | + Column(){ | ||
| 29 | + ForEach(this.compDTO.operDataList[0].slideShows, (item:slideShows, index:number) => { | ||
| 30 | + this.timelineItem(item, index) | ||
| 31 | + }) | ||
| 32 | + } | ||
| 33 | + // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多 | ||
| 34 | + if(this.compDTO.operDataList[0].hasMore == 1) { | ||
| 35 | + Row() { | ||
| 36 | + Text("查看更多") | ||
| 37 | + .fontSize($r("app.float.font_size_14")) | ||
| 38 | + .fontColor($r("app.color.color_222222")) | ||
| 39 | + .margin({ right: 1 }) | ||
| 40 | + Image($r("app.media.more")) | ||
| 41 | + .width(14) | ||
| 42 | + .height(14) | ||
| 43 | + } | ||
| 44 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 45 | + .width(CommonConstants.FULL_WIDTH) | ||
| 46 | + .height(40) | ||
| 47 | + .borderRadius(3) | ||
| 48 | + .justifyContent(FlexAlign.Center) | ||
| 49 | + .margin({top: 5}) | ||
| 50 | + .onClick(() => { | ||
| 51 | + // TODO | ||
| 52 | + console.log('跳转到查看更多的页面') | ||
| 53 | + }) | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + .width(CommonConstants.FULL_WIDTH) | ||
| 57 | + .padding({ | ||
| 58 | + top: 14, | ||
| 59 | + left: 16, | ||
| 60 | + right: 16, | ||
| 61 | + bottom: 14 | ||
| 62 | + }) | ||
| 63 | + .backgroundColor($r("app.color.white")) | ||
| 64 | + .margin({ bottom: 8 }) | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Builder timelineItem (item:slideShows, index:number) { | ||
| 68 | + Column(){ | ||
| 69 | + Stack() { | ||
| 70 | + if(index < this.compDTO.operDataList[0].slideShows.length - 1) { | ||
| 71 | + Line() | ||
| 72 | + .width(1) | ||
| 73 | + .startPoint([4, index > 0 ? 0 : 20]) | ||
| 74 | + .endPoint([4, 100]) | ||
| 75 | + .stroke($r('app.color.color_EDEDED')) | ||
| 76 | + .strokeWidth(1) | ||
| 77 | + .strokeLineCap(LineCapStyle.Butt) | ||
| 78 | + } | ||
| 79 | + Column(){ | ||
| 80 | + Row() { | ||
| 81 | + // 标题 | ||
| 82 | + Image($r("app.media.point_icon")) | ||
| 83 | + .width(9) | ||
| 84 | + .height(6) | ||
| 85 | + .margin({ right: 5 }) | ||
| 86 | + Text(DateTimeUtils.formatDate(item.publishTime, "MM月dd日 HH:mm")) | ||
| 87 | + .fontSize($r('app.float.font_size_12')) | ||
| 88 | + .fontColor($r('app.color.color_222222')) | ||
| 89 | + .fontWeight(600) | ||
| 90 | + } | ||
| 91 | + .width(CommonConstants.FULL_WIDTH) | ||
| 92 | + .height(32) | ||
| 93 | + Row() { | ||
| 94 | + Text(item.newsTitle) | ||
| 95 | + .fontSize($r('app.float.font_size_17')) | ||
| 96 | + .fontWeight(400) | ||
| 97 | + .fontColor($r('app.color.color_222222')) | ||
| 98 | + .layoutWeight(1) | ||
| 99 | + .maxLines(2) | ||
| 100 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 101 | + .alignSelf(ItemAlign.Center) | ||
| 102 | + .margin({left: 12}) | ||
| 103 | + if(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { | ||
| 104 | + Image(item.fullColumnImgUrls[0].url) | ||
| 105 | + .width(90) | ||
| 106 | + .height(60) | ||
| 107 | + .borderRadius(4) | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + .alignContent(Alignment.Start) | ||
| 113 | + } | ||
| 114 | + .height(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url ? 100 : 78) | ||
| 115 | + } | ||
| 116 | +} |
-
Please register or login to post a comment