fanmingyou3_wd

修改早晚报

@@ -13,6 +13,8 @@ export { ItemBean } from './src/main/ets/bean/ItemBean'; @@ -13,6 +13,8 @@ export { ItemBean } from './src/main/ets/bean/ItemBean';
13 // Content 13 // Content
14 export { ContentDTO } from './src/main/ets/bean/content/ContentDTO'; 14 export { ContentDTO } from './src/main/ets/bean/content/ContentDTO';
15 15
  16 +export { AudioDTO } from './src/main/ets/bean/content/AudioDTO';
  17 +
16 export { Action } from './src/main/ets/bean/content/Action' 18 export { Action } from './src/main/ets/bean/content/Action'
17 19
18 export { Params } from './src/main/ets/bean/content/Params' 20 export { Params } from './src/main/ets/bean/content/Params'
@@ -33,7 +35,6 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO'; @@ -33,7 +35,6 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO';
33 35
34 export { CompDTO } from './src/main/ets/bean/component/CompDTO'; 36 export { CompDTO } from './src/main/ets/bean/component/CompDTO';
35 37
36 -  
37 export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean'; 38 export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean';
38 39
39 export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean'; 40 export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean';
  1 +import { AudioDTO } from '../content/AudioDTO';
1 import { ContentDTO } from '../content/ContentDTO'; 2 import { ContentDTO } from '../content/ContentDTO';
2 3
3 export interface CompDTO { 4 export interface CompDTO {
@@ -27,4 +28,5 @@ export interface CompDTO { @@ -27,4 +28,5 @@ export interface CompDTO {
27 sortValue: number; 28 sortValue: number;
28 subType: string; 29 subType: string;
29 imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 30 imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2
  31 + audioDataList:AudioDTO[]
30 } 32 }
  1 +import { ReLInfoDTO } from '../detail/ReLInfoDTO';
  2 +
  3 +export interface AudioDTO {
  4 + audioUrl: string;
  5 + coverUrl: string;
  6 + duration: number;
  7 + objectId: number;
  8 + objectType: number;
  9 + reLInfo: ReLInfoDTO;
  10 + title: string;
  11 +}
@@ -34,7 +34,7 @@ export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperIte @@ -34,7 +34,7 @@ export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperIte
34 34
35 export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog" 35 export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog"
36 36
37 -export { MorningEveningPaperComponent } from "./src/main/ets/components/MorningEveningPaperComponent" 37 +export { MorningEveningPaperComponent } from "./src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent"
38 38
39 export { ImageAndTextPageComponent } from "./src/main/ets/components/ImageAndTextPageComponent" 39 export { ImageAndTextPageComponent } from "./src/main/ets/components/ImageAndTextPageComponent"
40 40
  1 +import { AudioDTO } from 'wdBean';
  2 +
  3 +/**
  4 + * 早晚报页面音频bar
  5 + */
  6 +@Entry
  7 +@Component
  8 +export struct AudioBarView {
  9 + @State audioDataList?: AudioDTO[] = []
  10 +
  11 + aboutToAppear() {
  12 + }
  13 +
  14 + build() {
  15 + Row() {
  16 + Stack({ alignContent: Alignment.Start }) {
  17 + Image($r('app.media.listen_left_bg'))
  18 + .width('100%')
  19 + .height('100%')
  20 + .objectFit(ImageFit.Contain)
  21 + Image($r('app.media.icon_listen'))
  22 + .width(24)
  23 + .height(24)
  24 + .margin({ left: 10 })
  25 + .alignSelf(ItemAlign.Start)
  26 +
  27 + Text('晚上好, 请收听今日新闻播报')
  28 + .fontSize(14)
  29 + .margin({ left: 50 })
  30 + .fontColor(Color.Black)
  31 + .maxLines(1)
  32 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  33 + }
  34 + .layoutWeight(1)
  35 + .height('100%')
  36 +
  37 + Stack({ alignContent: Alignment.Center }) {
  38 + Image($r('app.media.listen_right_bg'))
  39 + .width('100%')
  40 + .height('100%')
  41 + .objectFit(ImageFit.Contain)
  42 +
  43 + Image($r('app.media.ic_red_triangle'))
  44 + .width(24)
  45 + .height(24)
  46 + .margin({ left: 10 })// .alignSelf(ItemAlign.Center)
  47 + .objectFit(ImageFit.Contain)
  48 + }
  49 + // .aspectRatio(7 / 4)
  50 + .height('100%')
  51 + // .justifyContent(FlexAlign.Center)
  52 + // .width(94)
  53 + // .width(140)
  54 + .width('20%')
  55 + // .height(56)
  56 + .onClick(() => {
  57 + // console.info(TAG, `onClick listen_right_bg`);
  58 + })
  59 + }
  60 + // .width('100%')
  61 + .height(56)
  62 + .alignItems(VerticalAlign.Center)
  63 + .justifyContent(FlexAlign.SpaceBetween)
  64 + }
  65 +}
  1 +import { MorningEveningPaperDTO } from 'wdBean'
  2 +import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils';
  3 +import { AudioBarView } from './AudioBarView';
  4 +import { PaperTitleComponent } from './PaperTitleComponent';
  5 +import { SingleColumn999Component } from './SingleColumn999Component';
  6 +import { topicInfoView } from './topicInfoView';
  7 +
  8 +const TAG = 'MorningEveningPaperComponent';
  9 +
  10 +const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包含中文年月日
  11 +
  12 +@Entry
  13 +@Component
  14 +export struct MorningEveningPaperComponent {
  15 + @State morningEveningPaperDTO: MorningEveningPaperDTO = {
  16 + name: "新闻夜读",
  17 + topicInfo: {
  18 + frontLinkObject: {
  19 + coverSize: "599*798",
  20 + coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/9a91a96077174087852cf93c5e26acce.jpeg",
  21 + newsId: "30002086032",
  22 + newsRelId: 500000256225,
  23 + summary: "欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计划达成一致。欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计",
  24 + title: "匈牙利总理欧尔班妥协,阻碍欧盟向乌克兰援助的最后一个障碍被解"
  25 + },
  26 + title: "新闻夜读",
  27 + topicDate: "2024-01-16",
  28 + topicId: "10000002068",
  29 + }
  30 + } as MorningEveningPaperDTO
  31 + @State subTitle: string = ''
  32 +
  33 + aboutToAppear() {
  34 + console.info(TAG, `aboutToAppear`);
  35 + let dateTime = DateTimeUtils.parseDate(this.morningEveningPaperDTO?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN);
  36 + this.subTitle = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
  37 + }
  38 +
  39 + build() {
  40 + Column() {
  41 + PaperTitleComponent({
  42 + title: this.morningEveningPaperDTO?.topicInfo?.title ?? "",
  43 + // subtitle: this.morningEveningPaperDTO?.topicInfo?.topicDate ?? ''
  44 + subtitle: this.subTitle
  45 + })
  46 +
  47 + List() {
  48 + ListItem() {
  49 + topicInfoView({ frontLinkObject: this.morningEveningPaperDTO?.topicInfo?.frontLinkObject })
  50 + }
  51 +
  52 + ListItem() {
  53 + AudioBarView()
  54 + }
  55 +
  56 + ListItem() {
  57 + SingleColumn999Component()
  58 + }
  59 +
  60 + // ListItem() {
  61 + // Text("已显示全部内容")
  62 + // .width("100%")
  63 + // .height(100)
  64 + // .padding(9)
  65 + // .fontColor(Color.White)
  66 + // .fontSize($r('app.float.font_size_16'))
  67 + // .fontWeight(FontWeight.Medium)
  68 + // .textAlign(TextAlign.Center)
  69 + // .align(Alignment.Bottom)
  70 + // .maxLines(1)
  71 + // .textOverflow({ overflow: TextOverflow.Ellipsis })
  72 + // }
  73 + }
  74 + // .backgroundColor('#FFF1F3F5')
  75 + // .backgroundColor(Color.Blue)
  76 + .margin({ left: 14, right: 14 })
  77 + }.width('100%')
  78 + }
  79 +}
  1 +import router from '@ohos.router';
  2 +
  3 +/**
  4 + * 早晚报页面标题bar
  5 + */
  6 +@Entry
  7 +@Component
  8 +export struct PaperTitleComponent {
  9 + @State title?: string = 'title'
  10 + @State subtitle?: string = 'subtitle'
  11 +
  12 + aboutToAppear() {
  13 + }
  14 +
  15 + build() {
  16 + RelativeContainer() {
  17 + Image($r('app.media.icon_read_paper'))
  18 + .height($r('app.float.top_arrow_size'))
  19 + .width($r('app.float.top_arrow_size'))
  20 + .alignRules({
  21 + left: { anchor: "__container__", align: HorizontalAlign.Start },
  22 + center: { anchor: "__container__", align: VerticalAlign.Center }
  23 + })
  24 + .visibility(Visibility.None)
  25 + .id('img_logo1')
  26 +
  27 + Row() {
  28 + Text(this.title ?? "")
  29 + .margin({ left: 5 })
  30 + .fontSize(20)
  31 + .fontColor($r('app.color.white'))
  32 + .maxLines(1)
  33 +
  34 + Text(this.subtitle ?? '')// Text('2024年\n1月16日')
  35 + // .width(50)
  36 + .margin({ left: 5 })
  37 + .fontSize(12)
  38 + .fontColor($r('app.color.white'))
  39 + .maxLines(2)
  40 +
  41 + Image($r('app.media.bg_event_status_end'))
  42 + .height($r('app.float.top_arrow_size'))
  43 + .width(100)
  44 + .visibility(Visibility.None)
  45 + }
  46 + .height('100%')
  47 + .alignItems(VerticalAlign.Center)
  48 + .alignRules({
  49 + left: { anchor: "img_logo1", align: HorizontalAlign.End },
  50 + center: { anchor: "__container__", align: VerticalAlign.Center } })
  51 + .id('row_paper_date')
  52 +
  53 + Image($r('app.media.icon_close'))
  54 + .height($r('app.float.top_arrow_size'))
  55 + .width($r('app.float.top_arrow_size'))
  56 + .alignRules({
  57 + right: { anchor: "__container__", align: HorizontalAlign.End },
  58 + center: { anchor: "__container__", align: VerticalAlign.Center } })
  59 + .id('img_close')
  60 + .onClick((event: ClickEvent) => {
  61 + // console.info(TAG, "img_close")
  62 + router.back()
  63 + })
  64 +
  65 + Image($r('app.media.icon_share'))
  66 + .height($r('app.float.top_arrow_size'))
  67 + .width($r('app.float.top_arrow_size'))
  68 + .alignRules({
  69 + right: { anchor: "img_close", align: HorizontalAlign.Start },
  70 + center: { anchor: "__container__", align: VerticalAlign.Center } })
  71 + .id('img_share')
  72 + }
  73 + .margin({ left: 14, right: 14 })
  74 + .height($r('app.float.top_bar_height'))
  75 + .backgroundColor(Color.Black)
  76 + }
  77 +}
  1 +import { CompDTO, ContentDTO, VideoInfoDTO, } from 'wdBean';
  2 +import { BreakpointConstants } from 'wdConstant';
  3 +import { Logger } from 'wdKit';
  4 +import { PaperSingleColumn999CardView } from '../page/CardView';
  5 +import { EmptyComponent } from '../view/EmptyComponent';
  6 +
  7 +const TAG = 'SingleColumn999Component';
  8 +
  9 +/**
  10 + * 早晚报数据组件
  11 + */
  12 +@Component
  13 +export struct SingleColumn999Component {
  14 + @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
  15 + @State compDTO: CompDTO = {
  16 + compStyle: 'compStyle3',
  17 + operDataList: [
  18 + {
  19 + newsTitle: '时政微观察丨从外贸“成绩单”看中国经济新亮色',
  20 + description: "description0",
  21 + coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/a9028e7011bb440e94ba7c63d80b39b7.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
  22 + } as ContentDTO,
  23 + {
  24 + newsTitle: '画好强国建设、民族复兴的最大同心圆',
  25 + description: "description1",
  26 + coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/80351784d4da4fc08b8987ba45a7647f.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
  27 + } as ContentDTO,
  28 + {
  29 + newsTitle: '绿色“一带一路”十周年创新理念与实践案例',
  30 + description: "description2",
  31 + newsSummary: "共建“一带一路”倡议提出10年多来,在各方共同努力下,共建“一带一路”绿色发展取得积极进展,理念引领不断增强,交流机制不断完善,务实合作不断深化。",
  32 + coverUrl: "",
  33 + } as ContentDTO,
  34 + {
  35 + newsTitle: '瞭望 | 在深海聆听“幽灵粒子”',
  36 + description: "description3",
  37 + coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/b77a3577594d4d24b84e7b2b20e38e41.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
  38 + } as ContentDTO,
  39 + {
  40 + newsTitle: '一图读懂|未来三年,长三角示范区安排了这些重大项目',
  41 + description: "description4",
  42 + coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/8d54ef1cbbe14ef08d6ab38f07867e4c.jpeg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
  43 + } as ContentDTO,
  44 + {
  45 + newsTitle: '一头江豚的自述',
  46 + description: "description5",
  47 + newsSummary: "我是生活在长江里的一头江豚,是长江中唯一的水生哺乳动物,更是国家一级保护动物。但曾几何时,我和我的江中小伙伴出现了生存危机……直到有一天,我突然发现,打渔人变成护渔人,江水变清澈了,长江逐渐恢复了生机,我的家族数量上升到了1249头。当长江之水再一次悠悠流淌,我们相拥在清澈波光中起舞。长江,我的家园。",
  48 + coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/2ec7bccff2324b05ac4b6503d868a381.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
  49 + visitorComment: 10,
  50 + videoInfo: {
  51 + // clarity: 0,
  52 + // resolutionHeight: 0,
  53 + // resolutionWidth: 0,
  54 + videoDuration: "229",
  55 + videoLandScape: 1,
  56 + // videoType: 0,
  57 + videoUrl: "https://cdnjdout.aikan.pdnews.cn/zhbj-20240116/vod/content/output/c72f4170db2c4d34befa453f60d39a69_opt.mp4",
  58 + firstFrameImageUri: ""
  59 + } as VideoInfoDTO
  60 + } as ContentDTO,
  61 + {
  62 + newsTitle: '遇见习近平丨北京正在书写历史',
  63 + description: "description6",
  64 + coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/7c54d59b63844464a261dcbba82c7aed.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
  65 + } as ContentDTO
  66 + ]
  67 + } as CompDTO
  68 +
  69 + watchCurrentBreakpoint() {
  70 + Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
  71 + }
  72 +
  73 + aboutToAppear() {
  74 + Logger.info(TAG, `aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`);
  75 + }
  76 +
  77 + aboutToDisappear() {
  78 + Logger.info(TAG, 'aboutToDisappear');
  79 + }
  80 +
  81 + onPageShow() {
  82 + Logger.info(TAG, 'onPageShow');
  83 + }
  84 +
  85 + onPageHide() {
  86 + Logger.info(TAG, 'onPageHide');
  87 + }
  88 +
  89 + onBackPress() {
  90 + Logger.info(TAG, 'onBackPress');
  91 + }
  92 +
  93 + @Builder
  94 + itemFooter(text: string) {
  95 + Text("已显示全部内容")
  96 + .width("100%")
  97 + .height(100)
  98 + .padding(9)
  99 + .fontColor(Color.White)
  100 + .fontSize($r('app.float.font_size_16'))
  101 + .fontWeight(FontWeight.Medium)
  102 + .textAlign(TextAlign.Center)
  103 + .align(Alignment.Bottom)
  104 + .maxLines(1)
  105 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  106 + }
  107 +
  108 + build() {
  109 + if (this.compDTO && this.compDTO?.operDataList?.length > 0) {
  110 + List({ space: 2, initialIndex: 0 }) {
  111 + ListItemGroup({
  112 + // footer: this.itemFooter("")
  113 + }) {
  114 + ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {
  115 + ListItem() {
  116 + this.buildPaperItem(item, index)
  117 + }
  118 + }, (item: ContentDTO, index: number) => JSON.stringify(item))
  119 + }
  120 +
  121 + // .divider({ strokeWidth: 1, color: '#EFEFEF' }) // 每行之间的分界线
  122 + }
  123 + .width('100%')
  124 + .height("100%") // 必须设置height
  125 + // .margin({ left: $r('app.float.main_margin'), right: $r('app.float.main_margin') })
  126 + // .listDirection(Axis.Vertical) // 默认值:Axis.Vertical
  127 + // .lanes(this.buildLanes()) // 行/列数,一列 // 默认值:1
  128 + .cachedCount(2)
  129 + .sticky(StickyStyle.Header) // 吸顶
  130 + .scrollBar(BarState.Off)
  131 + .nestedScroll({
  132 + scrollForward: NestedScrollMode.PARENT_FIRST,
  133 + scrollBackward: NestedScrollMode.SELF_FIRST
  134 + })
  135 + } else {
  136 + EmptyComponent({ emptyHeight: 200 })
  137 + }
  138 + }
  139 +
  140 + // public buildLanes(): number {
  141 + // return new BreakPointType({ xs: 1, sm: 1, md: 2, lg: 3 }).getValue(this.currentBreakpoint)
  142 + // }
  143 +
  144 + /**
  145 + * 组件项
  146 + *
  147 + * @param programmeBean item 组件项
  148 + */
  149 + @Builder
  150 + buildPaperItem(item: ContentDTO, index: number) {
  151 + PaperSingleColumn999CardView({
  152 + item: item,
  153 + index: index
  154 + })
  155 + }
  156 +}
  1 +import { FrontLinkObject } from 'wdBean';
  2 +
  3 +/**
  4 + * 早晚报,topic
  5 + */
  6 +@Entry
  7 +@Component
  8 +export struct topicInfoView {
  9 + @State frontLinkObject: FrontLinkObject = {
  10 + coverSize: "599*798",
  11 + coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/9a91a96077174087852cf93c5e26acce.jpeg",
  12 + newsId: "30002086032",
  13 + newsRelId: 500000256225,
  14 + summary: "欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计划达成一致。欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计",
  15 + title: "匈牙利总理欧尔班妥协,阻碍欧盟向乌克兰援助的最后一个障碍被解"
  16 + } as FrontLinkObject
  17 +
  18 + aboutToAppear() {
  19 + }
  20 +
  21 + build() {
  22 + RelativeContainer() {
  23 + Image(this.frontLinkObject?.coverUrl)
  24 + .width("100%")
  25 + .height("100%")
  26 + .alignRules({
  27 + top: { anchor: '__container__', align: VerticalAlign.Top },
  28 + left: { anchor: '__container__', align: HorizontalAlign.Start }
  29 + })
  30 + .id('img_cover')
  31 +
  32 + Row() {
  33 + Text("查看详情")
  34 + .fontSize(16)
  35 + .fontColor($r('app.color.white'))
  36 + .maxLines(1)
  37 +
  38 + Image($r('app.media.more'))
  39 + .height($r('app.float.top_arrow_size'))
  40 + .width(20)
  41 + }
  42 + .margin({ top: 10 })
  43 + // .backgroundColor(Color.Red)
  44 + .alignRules({
  45 + left: { anchor: "__container__", align: HorizontalAlign.Start },
  46 + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
  47 + })
  48 + .id('row_detail')
  49 +
  50 + Text(this.frontLinkObject?.summary ?? "")
  51 + .margin({ top: 10 })
  52 + .fontSize(14)
  53 + .fontColor($r('app.color.white'))
  54 + .maxLines(3)
  55 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  56 + .alignRules({
  57 + left: { anchor: "__container__", align: HorizontalAlign.Start },
  58 + bottom: { anchor: "row_detail", align: VerticalAlign.Top }
  59 + })
  60 + .id('txt_summary')
  61 +
  62 + Text(this.frontLinkObject?.title ?? "")
  63 + .fontSize(24)
  64 + .fontColor($r('app.color.white'))
  65 + .maxLines(2)
  66 + .alignRules({
  67 + left: { anchor: "__container__", align: HorizontalAlign.Start },
  68 + bottom: { anchor: "txt_summary", align: VerticalAlign.Top }
  69 + })
  70 + .id('txt_title')
  71 + }
  72 + .width("100%")
  73 + .aspectRatio(3 / 4)
  74 + // .aspectRatio(1)
  75 + // .backgroundColor(Color.Orange)
  76 + // .hoverEffect(HoverEffect.Scale)
  77 + .onClick((event: ClickEvent) => {
  78 + // console.info(TAG, `buildTopicInfoView onClick event`);
  79 + // let taskAction: Action = {
  80 + // type: 'JUMP_H5_BY_WEB_VIEW',
  81 + // params: {
  82 + // url: ConfigConstants.DETAIL_URL
  83 + // } as Params,
  84 + // };
  85 + // WDRouterRule.jumpWithAction(taskAction)
  86 +
  87 + // let taskAction: Action = {
  88 + // type: 'JUMP_DETAIL_PAGE',
  89 + // params: {
  90 + // detailPageType: 7, // 沉浸式竖屏详情页
  91 + // contentID: '863556812'
  92 + // } as Params,
  93 + // };
  94 + // WDRouterRule.jumpWithAction(taskAction)
  95 + })
  96 + }
  97 +}
1 -import router from '@ohos.router'  
2 -import { FrontLinkObject, MorningEveningPaperDTO } from 'wdBean'  
3 -  
4 -// import { Logger } from 'wdKit';  
5 -// import PageViewModel from '../viewmodel/PageViewModel';  
6 -// import { PageComponent } from './page/PageComponent';  
7 -  
8 -const TAG = 'MorningEveningPaperComponent';  
9 -  
10 -@Entry  
11 -@Component  
12 -export struct MorningEveningPaperComponent {  
13 - @State currentTopNavSelectedIndex: number = 0;  
14 - paperPageId: string = '21549'  
15 - @State groupId: string = ''  
16 - @State message: string = 'Hello World'  
17 - @State morningEveningPaperDTO: MorningEveningPaperDTO = {  
18 - name: "新闻夜读",  
19 - topicInfo: {  
20 - frontLinkObject: {  
21 - coverSize: "599*798",  
22 - coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/9a91a96077174087852cf93c5e26acce.jpeg",  
23 - newsId: "30002086032",  
24 - newsRelId: 500000256225,  
25 - summary: "欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计划达成一致。欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计",  
26 - title: "匈牙利总理欧尔班妥协,阻碍欧盟向乌克兰援助的最后一个障碍被解"  
27 - },  
28 - title: "新闻夜读",  
29 - topicDate: "2024-01-16",  
30 - topicId: "10000002068",  
31 - }  
32 - } as MorningEveningPaperDTO  
33 -  
34 - // @State morningEveningPaperDTO: MorningEveningPaperDTO = {} as MorningEveningPaperDTO  
35 -  
36 - async aboutToAppear() {  
37 - console.info(TAG, `aboutToAppear`);  
38 - // let paperDTO = await PageViewModel.getMorningEveningPaperData(this.paperPageId)  
39 - // if (paperDTO) {  
40 - // this.morningEveningPaperDTO = paperDTO;  
41 - // if (paperDTO.groups && paperDTO.groups.length > 0) {  
42 - // this.groupId = paperDTO.groups[0].id + ''  
43 - // }  
44 - // Logger.info(TAG, `aboutToAppear, paperDTO is not empty`);  
45 - // }  
46 - }  
47 -  
48 - build() {  
49 - Column() {  
50 - RelativeContainer() {  
51 - Image($r('app.media.icon_read_paper'))  
52 - .height($r('app.float.top_arrow_size'))  
53 - .width($r('app.float.top_arrow_size'))  
54 - .alignRules({  
55 - left: { anchor: "__container__", align: HorizontalAlign.Start },  
56 - center: { anchor: "__container__", align: VerticalAlign.Center }  
57 - })  
58 - .id('img_logo1')  
59 -  
60 -  
61 - Row() {  
62 - Text(this.morningEveningPaperDTO?.topicInfo?.title ?? "")  
63 - .fontSize(20)  
64 - .fontColor($r('app.color.white'))  
65 - .maxLines(1)  
66 -  
67 - Text(this.morningEveningPaperDTO?.topicInfo?.topicDate ?? '')// Text('2024年\n1月16日')  
68 - .width(50)  
69 - .fontSize(12)  
70 - .fontColor($r('app.color.white'))  
71 - .maxLines(2)  
72 -  
73 - Image($r('app.media.bg_event_status_end'))  
74 - .height($r('app.float.top_arrow_size'))  
75 - .width(100)  
76 - }  
77 - .alignItems(VerticalAlign.Bottom)  
78 - .alignRules({  
79 - left: { anchor: "img_logo1", align: HorizontalAlign.End },  
80 - center: { anchor: "__container__", align: VerticalAlign.Center } })  
81 - .id('row_paper_date')  
82 -  
83 - Image($r('app.media.icon_close'))  
84 - .height($r('app.float.top_arrow_size'))  
85 - .width($r('app.float.top_arrow_size'))  
86 - .alignRules({  
87 - right: { anchor: "__container__", align: HorizontalAlign.End },  
88 - center: { anchor: "__container__", align: VerticalAlign.Center } })  
89 - .id('img_close')  
90 - .onClick((event: ClickEvent) => {  
91 - console.info(TAG, "img_close")  
92 - router.back()  
93 - })  
94 -  
95 - Image($r('app.media.icon_share'))  
96 - .height($r('app.float.top_arrow_size'))  
97 - .width($r('app.float.top_arrow_size'))  
98 - .alignRules({  
99 - right: { anchor: "img_close", align: HorizontalAlign.Start },  
100 - center: { anchor: "__container__", align: VerticalAlign.Center } })  
101 - .id('img_share')  
102 - }  
103 - .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })  
104 - .height($r('app.float.top_bar_height'))  
105 - .backgroundColor(Color.Black)  
106 -  
107 - List() {  
108 - ListItem() {  
109 - this.buildTopicInfoView(this.morningEveningPaperDTO?.topicInfo?.frontLinkObject)  
110 - }  
111 -  
112 - ListItem() {  
113 - Row() {  
114 - Stack({ alignContent: Alignment.Start }) {  
115 - Image($r('app.media.listen_left_bg'))  
116 - .width('100%')  
117 - .height('100%')  
118 - .objectFit(ImageFit.Contain)  
119 - Image($r('app.media.icon_listen'))  
120 - .width(24)  
121 - .height(24)  
122 - .margin({ left: 10 })  
123 - .alignSelf(ItemAlign.Start)  
124 -  
125 - Text('晚上好, 请收听今日新闻播报')  
126 - .fontSize(14)  
127 - .margin({ left: 50 })  
128 - .fontColor(Color.Black)  
129 - .maxLines(1)  
130 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
131 - }  
132 - .layoutWeight(1)  
133 - .height('100%')  
134 -  
135 - Stack({ alignContent: Alignment.Center }) {  
136 - Image($r('app.media.listen_right_bg'))  
137 - .width('100%')  
138 - .height('100%')  
139 - .objectFit(ImageFit.Contain)  
140 -  
141 - Image($r('app.media.ic_red_triangle'))  
142 - .width(24)  
143 - .height(24)  
144 - .margin({ left: 10 })// .alignSelf(ItemAlign.Center)  
145 - .objectFit(ImageFit.Contain)  
146 - }  
147 - // .aspectRatio(7 / 4)  
148 - .height('100%')  
149 - // .justifyContent(FlexAlign.Center)  
150 - // .width(94)  
151 - // .width(140)  
152 - .width('20%')  
153 - // .height(56)  
154 - .onClick(() => {  
155 - console.info(TAG, `onClick listen_right_bg`);  
156 - })  
157 - }  
158 - // .width('100%')  
159 - .height(56)  
160 - .alignItems(VerticalAlign.Center)  
161 - .justifyContent(FlexAlign.SpaceBetween)  
162 - // .backgroundColor(Color.Red)  
163 - }  
164 -  
165 - ListItem() {  
166 - // PageComponent({  
167 - // currentTopNavSelectedIndex: $currentTopNavSelectedIndex,  
168 - // navIndex: 0,  
169 - // pageId: '31320', //this.groupId,  
170 - // channelId: ''  
171 - // })  
172 - }.height(500)  
173 - }  
174 - // .backgroundColor('#FFF1F3F5')  
175 - // .backgroundColor(Color.Blue)  
176 - .margin({ left: 14, right: 14 })  
177 -  
178 - // .alignListItem(ListItemAlign.Center)  
179 - }.width('100%')  
180 -  
181 - // Row() {  
182 - // Column() {  
183 - // Text(this.message)  
184 - // .fontSize(50)  
185 - // .fontWeight(FontWeight.Bold)  
186 - // }  
187 - // .width('100%')  
188 - // }  
189 - // .height('100%')  
190 - }  
191 -  
192 - /**  
193 - * 布局描述  
194 - *  
195 - * @param FrontLinkObject item 组件项  
196 - * @param index  
197 - */  
198 - @Builder  
199 - buildTopicInfoView(item: FrontLinkObject) {  
200 - RelativeContainer() {  
201 - Image(item?.coverUrl)  
202 - .width("100%")  
203 - .height("100%")  
204 - .alignRules({  
205 - top: { anchor: '__container__', align: VerticalAlign.Top },  
206 - left: { anchor: '__container__', align: HorizontalAlign.Start }  
207 - })  
208 - .id('img_cover')  
209 -  
210 - Row() {  
211 - Text("查看详情")  
212 - .fontSize(20)  
213 - .fontColor($r('app.color.white'))  
214 - .maxLines(1)  
215 -  
216 - Image($r('app.media.more'))  
217 - .height($r('app.float.top_arrow_size'))  
218 - .width(20)  
219 - }  
220 - .margin({ top: 10 })  
221 - // .backgroundColor(Color.Red)  
222 - .alignRules({  
223 - left: { anchor: "__container__", align: HorizontalAlign.Start },  
224 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom }  
225 - })  
226 - .id('row_detail')  
227 -  
228 - Text(item?.summary ?? "")  
229 - .margin({ top: 10 })  
230 - .fontSize(14)  
231 - .fontColor($r('app.color.white'))  
232 - .maxLines(3)  
233 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
234 - .alignRules({  
235 - left: { anchor: "__container__", align: HorizontalAlign.Start },  
236 - bottom: { anchor: "row_detail", align: VerticalAlign.Top }  
237 - })  
238 - .id('txt_summary')  
239 -  
240 - Text(item?.title ?? "")  
241 - .fontSize(24)  
242 - .fontColor($r('app.color.white'))  
243 - .maxLines(2)  
244 - .alignRules({  
245 - left: { anchor: "__container__", align: HorizontalAlign.Start },  
246 - bottom: { anchor: "txt_summary", align: VerticalAlign.Top }  
247 - })  
248 - .id('txt_title')  
249 - }  
250 - .width("100%")  
251 - .aspectRatio(3 / 4)  
252 - // .aspectRatio(1)  
253 - // .backgroundColor(Color.Orange)  
254 - // .hoverEffect(HoverEffect.Scale)  
255 - .onClick((event: ClickEvent) => {  
256 - console.info(TAG, `buildTopicInfoView onClick event`);  
257 - // let taskAction: Action = {  
258 - // type: 'JUMP_H5_BY_WEB_VIEW',  
259 - // params: {  
260 - // url: ConfigConstants.DETAIL_URL  
261 - // } as Params,  
262 - // };  
263 - // WDRouterRule.jumpWithAction(taskAction)  
264 -  
265 - // let taskAction: Action = {  
266 - // type: 'JUMP_DETAIL_PAGE',  
267 - // params: {  
268 - // detailPageType: 7, // 沉浸式竖屏详情页  
269 - // contentID: '863556812'  
270 - // } as Params,  
271 - // };  
272 - // WDRouterRule.jumpWithAction(taskAction)  
273 - })  
274 - }  
275 -}  
@@ -384,3 +384,64 @@ export struct MasonryLayout01CardView { @@ -384,3 +384,64 @@ export struct MasonryLayout01CardView {
384 }) 384 })
385 } 385 }
386 } 386 }
  387 +
  388 +/**
  389 + * 早晚报数据卡片
  390 + */
  391 +@Component
  392 +export struct PaperSingleColumn999CardView {
  393 + private item: ContentDTO = {} as ContentDTO;
  394 + private index: number = -1;
  395 +
  396 + build() {
  397 + Column() {
  398 + Text(this.item?.newsTitle)
  399 + .fontSize(16)
  400 + .fontWeight(FontWeight.Bold)
  401 + .alignSelf(ItemAlign.Start)
  402 + .maxLines(3)
  403 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  404 + if (this.item?.coverUrl) {
  405 + Stack({ alignContent: Alignment.BottomEnd }) {
  406 + Image(this.item?.coverUrl)
  407 + .borderRadius(5)
  408 + .aspectRatio(16 / 9)
  409 + .padding({ top: 10 })
  410 + if (this.item?.videoInfo) {
  411 + Stack() {
  412 + Text(this.item?.videoInfo.videoDuration)
  413 + .backgroundColor(Color.Black)
  414 + .opacity(0.6)
  415 + .width(CommonConstants.FULL_PARENT)
  416 + .padding({ left: 40 })
  417 + Image($r('app.media.iv_card_play_yellow_flag'))
  418 + .fitOriginalSize(true)
  419 + }.width(CommonConstants.FULL_PARENT)
  420 + }
  421 + }
  422 + }
  423 + if (this.item?.newsSummary) {
  424 + Text(this.item?.newsSummary)
  425 + .fontSize(14)
  426 + .padding({ top: 10 })
  427 + .alignSelf(ItemAlign.Start)
  428 + .maxLines(3)
  429 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  430 + }
  431 + if (this.item?.visitorComment) {
  432 + Row() {
  433 + Text(this.item?.visitorComment + "评")
  434 + .fontSize(12)
  435 + .fontColor(Color.Gray)
  436 + Image($r('app.media.icon_share'))
  437 + .width(16)
  438 + .height(16)
  439 + .margin(10)
  440 + .backgroundColor(Color.Brown)
  441 + }.width(CommonConstants.FULL_PARENT)
  442 + .justifyContent(FlexAlign.SpaceBetween)
  443 + }
  444 + }
  445 + .margin({ bottom: 5 })
  446 + }
  447 +}
1 { 1 {
2 "src": [ 2 "src": [
3 - "components/MorningEveningPaperComponent" 3 + "components/MorningEveningPaper/MorningEveningPaperComponent"
4 ] 4 ]
5 } 5 }
6 6