fanmingyou3_wd

修改早晚报

... ... @@ -13,6 +13,8 @@ export { ItemBean } from './src/main/ets/bean/ItemBean';
// Content
export { ContentDTO } from './src/main/ets/bean/content/ContentDTO';
export { AudioDTO } from './src/main/ets/bean/content/AudioDTO';
export { Action } from './src/main/ets/bean/content/Action'
export { Params } from './src/main/ets/bean/content/Params'
... ... @@ -33,7 +35,6 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO';
export { CompDTO } from './src/main/ets/bean/component/CompDTO';
export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean';
export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean';
... ...
import { AudioDTO } from '../content/AudioDTO';
import { ContentDTO } from '../content/ContentDTO';
export interface CompDTO {
... ... @@ -27,4 +28,5 @@ export interface CompDTO {
sortValue: number;
subType: string;
imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2
audioDataList:AudioDTO[]
}
\ No newline at end of file
... ...
import { ReLInfoDTO } from '../detail/ReLInfoDTO';
export interface AudioDTO {
audioUrl: string;
coverUrl: string;
duration: number;
objectId: number;
objectType: number;
reLInfo: ReLInfoDTO;
title: string;
}
\ No newline at end of file
... ...
... ... @@ -34,7 +34,7 @@ export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperIte
export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog"
export { MorningEveningPaperComponent } from "./src/main/ets/components/MorningEveningPaperComponent"
export { MorningEveningPaperComponent } from "./src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent"
export { ImageAndTextPageComponent } from "./src/main/ets/components/ImageAndTextPageComponent"
... ...
import { AudioDTO } from 'wdBean';
/**
* 早晚报页面音频bar
*/
@Entry
@Component
export struct AudioBarView {
@State audioDataList?: AudioDTO[] = []
aboutToAppear() {
}
build() {
Row() {
Stack({ alignContent: Alignment.Start }) {
Image($r('app.media.listen_left_bg'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Contain)
Image($r('app.media.icon_listen'))
.width(24)
.height(24)
.margin({ left: 10 })
.alignSelf(ItemAlign.Start)
Text('晚上好, 请收听今日新闻播报')
.fontSize(14)
.margin({ left: 50 })
.fontColor(Color.Black)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.layoutWeight(1)
.height('100%')
Stack({ alignContent: Alignment.Center }) {
Image($r('app.media.listen_right_bg'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Contain)
Image($r('app.media.ic_red_triangle'))
.width(24)
.height(24)
.margin({ left: 10 })// .alignSelf(ItemAlign.Center)
.objectFit(ImageFit.Contain)
}
// .aspectRatio(7 / 4)
.height('100%')
// .justifyContent(FlexAlign.Center)
// .width(94)
// .width(140)
.width('20%')
// .height(56)
.onClick(() => {
// console.info(TAG, `onClick listen_right_bg`);
})
}
// .width('100%')
.height(56)
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
}
}
\ No newline at end of file
... ...
import { MorningEveningPaperDTO } from 'wdBean'
import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils';
import { AudioBarView } from './AudioBarView';
import { PaperTitleComponent } from './PaperTitleComponent';
import { SingleColumn999Component } from './SingleColumn999Component';
import { topicInfoView } from './topicInfoView';
const TAG = 'MorningEveningPaperComponent';
const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包含中文年月日
@Entry
@Component
export struct MorningEveningPaperComponent {
@State morningEveningPaperDTO: MorningEveningPaperDTO = {
name: "新闻夜读",
topicInfo: {
frontLinkObject: {
coverSize: "599*798",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/9a91a96077174087852cf93c5e26acce.jpeg",
newsId: "30002086032",
newsRelId: 500000256225,
summary: "欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计划达成一致。欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计",
title: "匈牙利总理欧尔班妥协,阻碍欧盟向乌克兰援助的最后一个障碍被解"
},
title: "新闻夜读",
topicDate: "2024-01-16",
topicId: "10000002068",
}
} as MorningEveningPaperDTO
@State subTitle: string = ''
aboutToAppear() {
console.info(TAG, `aboutToAppear`);
let dateTime = DateTimeUtils.parseDate(this.morningEveningPaperDTO?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN);
this.subTitle = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
}
build() {
Column() {
PaperTitleComponent({
title: this.morningEveningPaperDTO?.topicInfo?.title ?? "",
// subtitle: this.morningEveningPaperDTO?.topicInfo?.topicDate ?? ''
subtitle: this.subTitle
})
List() {
ListItem() {
topicInfoView({ frontLinkObject: this.morningEveningPaperDTO?.topicInfo?.frontLinkObject })
}
ListItem() {
AudioBarView()
}
ListItem() {
SingleColumn999Component()
}
// ListItem() {
// Text("已显示全部内容")
// .width("100%")
// .height(100)
// .padding(9)
// .fontColor(Color.White)
// .fontSize($r('app.float.font_size_16'))
// .fontWeight(FontWeight.Medium)
// .textAlign(TextAlign.Center)
// .align(Alignment.Bottom)
// .maxLines(1)
// .textOverflow({ overflow: TextOverflow.Ellipsis })
// }
}
// .backgroundColor('#FFF1F3F5')
// .backgroundColor(Color.Blue)
.margin({ left: 14, right: 14 })
}.width('100%')
}
}
\ No newline at end of file
... ...
import router from '@ohos.router';
/**
* 早晚报页面标题bar
*/
@Entry
@Component
export struct PaperTitleComponent {
@State title?: string = 'title'
@State subtitle?: string = 'subtitle'
aboutToAppear() {
}
build() {
RelativeContainer() {
Image($r('app.media.icon_read_paper'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.visibility(Visibility.None)
.id('img_logo1')
Row() {
Text(this.title ?? "")
.margin({ left: 5 })
.fontSize(20)
.fontColor($r('app.color.white'))
.maxLines(1)
Text(this.subtitle ?? '')// Text('2024年\n1月16日')
// .width(50)
.margin({ left: 5 })
.fontSize(12)
.fontColor($r('app.color.white'))
.maxLines(2)
Image($r('app.media.bg_event_status_end'))
.height($r('app.float.top_arrow_size'))
.width(100)
.visibility(Visibility.None)
}
.height('100%')
.alignItems(VerticalAlign.Center)
.alignRules({
left: { anchor: "img_logo1", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.id('row_paper_date')
Image($r('app.media.icon_close'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.id('img_close')
.onClick((event: ClickEvent) => {
// console.info(TAG, "img_close")
router.back()
})
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "img_close", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.id('img_share')
}
.margin({ left: 14, right: 14 })
.height($r('app.float.top_bar_height'))
.backgroundColor(Color.Black)
}
}
\ No newline at end of file
... ...
import { CompDTO, ContentDTO, VideoInfoDTO, } from 'wdBean';
import { BreakpointConstants } from 'wdConstant';
import { Logger } from 'wdKit';
import { PaperSingleColumn999CardView } from '../page/CardView';
import { EmptyComponent } from '../view/EmptyComponent';
const TAG = 'SingleColumn999Component';
/**
* 早晚报数据组件
*/
@Component
export struct SingleColumn999Component {
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
@State compDTO: CompDTO = {
compStyle: 'compStyle3',
operDataList: [
{
newsTitle: '时政微观察丨从外贸“成绩单”看中国经济新亮色',
description: "description0",
coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/a9028e7011bb440e94ba7c63d80b39b7.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
} as ContentDTO,
{
newsTitle: '画好强国建设、民族复兴的最大同心圆',
description: "description1",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/80351784d4da4fc08b8987ba45a7647f.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
newsTitle: '绿色“一带一路”十周年创新理念与实践案例',
description: "description2",
newsSummary: "共建“一带一路”倡议提出10年多来,在各方共同努力下,共建“一带一路”绿色发展取得积极进展,理念引领不断增强,交流机制不断完善,务实合作不断深化。",
coverUrl: "",
} as ContentDTO,
{
newsTitle: '瞭望 | 在深海聆听“幽灵粒子”',
description: "description3",
coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/b77a3577594d4d24b84e7b2b20e38e41.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
} as ContentDTO,
{
newsTitle: '一图读懂|未来三年,长三角示范区安排了这些重大项目',
description: "description4",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/8d54ef1cbbe14ef08d6ab38f07867e4c.jpeg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
newsTitle: '一头江豚的自述',
description: "description5",
newsSummary: "我是生活在长江里的一头江豚,是长江中唯一的水生哺乳动物,更是国家一级保护动物。但曾几何时,我和我的江中小伙伴出现了生存危机……直到有一天,我突然发现,打渔人变成护渔人,江水变清澈了,长江逐渐恢复了生机,我的家族数量上升到了1249头。当长江之水再一次悠悠流淌,我们相拥在清澈波光中起舞。长江,我的家园。",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/2ec7bccff2324b05ac4b6503d868a381.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
visitorComment: 10,
videoInfo: {
// clarity: 0,
// resolutionHeight: 0,
// resolutionWidth: 0,
videoDuration: "229",
videoLandScape: 1,
// videoType: 0,
videoUrl: "https://cdnjdout.aikan.pdnews.cn/zhbj-20240116/vod/content/output/c72f4170db2c4d34befa453f60d39a69_opt.mp4",
firstFrameImageUri: ""
} as VideoInfoDTO
} as ContentDTO,
{
newsTitle: '遇见习近平丨北京正在书写历史',
description: "description6",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/7c54d59b63844464a261dcbba82c7aed.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO
]
} as CompDTO
watchCurrentBreakpoint() {
Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
}
aboutToAppear() {
Logger.info(TAG, `aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`);
}
aboutToDisappear() {
Logger.info(TAG, 'aboutToDisappear');
}
onPageShow() {
Logger.info(TAG, 'onPageShow');
}
onPageHide() {
Logger.info(TAG, 'onPageHide');
}
onBackPress() {
Logger.info(TAG, 'onBackPress');
}
@Builder
itemFooter(text: string) {
Text("已显示全部内容")
.width("100%")
.height(100)
.padding(9)
.fontColor(Color.White)
.fontSize($r('app.float.font_size_16'))
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.align(Alignment.Bottom)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
build() {
if (this.compDTO && this.compDTO?.operDataList?.length > 0) {
List({ space: 2, initialIndex: 0 }) {
ListItemGroup({
// footer: this.itemFooter("")
}) {
ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {
ListItem() {
this.buildPaperItem(item, index)
}
}, (item: ContentDTO, index: number) => JSON.stringify(item))
}
// .divider({ strokeWidth: 1, color: '#EFEFEF' }) // 每行之间的分界线
}
.width('100%')
.height("100%") // 必须设置height
// .margin({ left: $r('app.float.main_margin'), right: $r('app.float.main_margin') })
// .listDirection(Axis.Vertical) // 默认值:Axis.Vertical
// .lanes(this.buildLanes()) // 行/列数,一列 // 默认值:1
.cachedCount(2)
.sticky(StickyStyle.Header) // 吸顶
.scrollBar(BarState.Off)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
} else {
EmptyComponent({ emptyHeight: 200 })
}
}
// public buildLanes(): number {
// return new BreakPointType({ xs: 1, sm: 1, md: 2, lg: 3 }).getValue(this.currentBreakpoint)
// }
/**
* 组件项
*
* @param programmeBean item 组件项
*/
@Builder
buildPaperItem(item: ContentDTO, index: number) {
PaperSingleColumn999CardView({
item: item,
index: index
})
}
}
\ No newline at end of file
... ...
import { FrontLinkObject } from 'wdBean';
/**
* 早晚报,topic
*/
@Entry
@Component
export struct topicInfoView {
@State frontLinkObject: FrontLinkObject = {
coverSize: "599*798",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/9a91a96077174087852cf93c5e26acce.jpeg",
newsId: "30002086032",
newsRelId: 500000256225,
summary: "欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计划达成一致。欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计",
title: "匈牙利总理欧尔班妥协,阻碍欧盟向乌克兰援助的最后一个障碍被解"
} as FrontLinkObject
aboutToAppear() {
}
build() {
RelativeContainer() {
Image(this.frontLinkObject?.coverUrl)
.width("100%")
.height("100%")
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top },
left: { anchor: '__container__', align: HorizontalAlign.Start }
})
.id('img_cover')
Row() {
Text("查看详情")
.fontSize(16)
.fontColor($r('app.color.white'))
.maxLines(1)
Image($r('app.media.more'))
.height($r('app.float.top_arrow_size'))
.width(20)
}
.margin({ top: 10 })
// .backgroundColor(Color.Red)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
})
.id('row_detail')
Text(this.frontLinkObject?.summary ?? "")
.margin({ top: 10 })
.fontSize(14)
.fontColor($r('app.color.white'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "row_detail", align: VerticalAlign.Top }
})
.id('txt_summary')
Text(this.frontLinkObject?.title ?? "")
.fontSize(24)
.fontColor($r('app.color.white'))
.maxLines(2)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "txt_summary", align: VerticalAlign.Top }
})
.id('txt_title')
}
.width("100%")
.aspectRatio(3 / 4)
// .aspectRatio(1)
// .backgroundColor(Color.Orange)
// .hoverEffect(HoverEffect.Scale)
.onClick((event: ClickEvent) => {
// console.info(TAG, `buildTopicInfoView onClick event`);
// let taskAction: Action = {
// type: 'JUMP_H5_BY_WEB_VIEW',
// params: {
// url: ConfigConstants.DETAIL_URL
// } as Params,
// };
// WDRouterRule.jumpWithAction(taskAction)
// let taskAction: Action = {
// type: 'JUMP_DETAIL_PAGE',
// params: {
// detailPageType: 7, // 沉浸式竖屏详情页
// contentID: '863556812'
// } as Params,
// };
// WDRouterRule.jumpWithAction(taskAction)
})
}
}
\ No newline at end of file
... ...
import router from '@ohos.router'
import { FrontLinkObject, MorningEveningPaperDTO } from 'wdBean'
// import { Logger } from 'wdKit';
// import PageViewModel from '../viewmodel/PageViewModel';
// import { PageComponent } from './page/PageComponent';
const TAG = 'MorningEveningPaperComponent';
@Entry
@Component
export struct MorningEveningPaperComponent {
@State currentTopNavSelectedIndex: number = 0;
paperPageId: string = '21549'
@State groupId: string = ''
@State message: string = 'Hello World'
@State morningEveningPaperDTO: MorningEveningPaperDTO = {
name: "新闻夜读",
topicInfo: {
frontLinkObject: {
coverSize: "599*798",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/9a91a96077174087852cf93c5e26acce.jpeg",
newsId: "30002086032",
newsRelId: 500000256225,
summary: "欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计划达成一致。欧尔班多次明确反对欧盟此举。2023年底,匈牙利否决了欧盟对乌克兰的500亿欧元援助计划,认为欧盟不应向乌克兰提供更多资金,而应尽快结束俄乌冲突。因此,欧盟领导人在去年12月欧盟峰会上未能就该计",
title: "匈牙利总理欧尔班妥协,阻碍欧盟向乌克兰援助的最后一个障碍被解"
},
title: "新闻夜读",
topicDate: "2024-01-16",
topicId: "10000002068",
}
} as MorningEveningPaperDTO
// @State morningEveningPaperDTO: MorningEveningPaperDTO = {} as MorningEveningPaperDTO
async aboutToAppear() {
console.info(TAG, `aboutToAppear`);
// let paperDTO = await PageViewModel.getMorningEveningPaperData(this.paperPageId)
// if (paperDTO) {
// this.morningEveningPaperDTO = paperDTO;
// if (paperDTO.groups && paperDTO.groups.length > 0) {
// this.groupId = paperDTO.groups[0].id + ''
// }
// Logger.info(TAG, `aboutToAppear, paperDTO is not empty`);
// }
}
build() {
Column() {
RelativeContainer() {
Image($r('app.media.icon_read_paper'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('img_logo1')
Row() {
Text(this.morningEveningPaperDTO?.topicInfo?.title ?? "")
.fontSize(20)
.fontColor($r('app.color.white'))
.maxLines(1)
Text(this.morningEveningPaperDTO?.topicInfo?.topicDate ?? '')// Text('2024年\n1月16日')
.width(50)
.fontSize(12)
.fontColor($r('app.color.white'))
.maxLines(2)
Image($r('app.media.bg_event_status_end'))
.height($r('app.float.top_arrow_size'))
.width(100)
}
.alignItems(VerticalAlign.Bottom)
.alignRules({
left: { anchor: "img_logo1", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.id('row_paper_date')
Image($r('app.media.icon_close'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.id('img_close')
.onClick((event: ClickEvent) => {
console.info(TAG, "img_close")
router.back()
})
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "img_close", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.id('img_share')
}
.margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
.height($r('app.float.top_bar_height'))
.backgroundColor(Color.Black)
List() {
ListItem() {
this.buildTopicInfoView(this.morningEveningPaperDTO?.topicInfo?.frontLinkObject)
}
ListItem() {
Row() {
Stack({ alignContent: Alignment.Start }) {
Image($r('app.media.listen_left_bg'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Contain)
Image($r('app.media.icon_listen'))
.width(24)
.height(24)
.margin({ left: 10 })
.alignSelf(ItemAlign.Start)
Text('晚上好, 请收听今日新闻播报')
.fontSize(14)
.margin({ left: 50 })
.fontColor(Color.Black)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.layoutWeight(1)
.height('100%')
Stack({ alignContent: Alignment.Center }) {
Image($r('app.media.listen_right_bg'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Contain)
Image($r('app.media.ic_red_triangle'))
.width(24)
.height(24)
.margin({ left: 10 })// .alignSelf(ItemAlign.Center)
.objectFit(ImageFit.Contain)
}
// .aspectRatio(7 / 4)
.height('100%')
// .justifyContent(FlexAlign.Center)
// .width(94)
// .width(140)
.width('20%')
// .height(56)
.onClick(() => {
console.info(TAG, `onClick listen_right_bg`);
})
}
// .width('100%')
.height(56)
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
// .backgroundColor(Color.Red)
}
ListItem() {
// PageComponent({
// currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
// navIndex: 0,
// pageId: '31320', //this.groupId,
// channelId: ''
// })
}.height(500)
}
// .backgroundColor('#FFF1F3F5')
// .backgroundColor(Color.Blue)
.margin({ left: 14, right: 14 })
// .alignListItem(ListItemAlign.Center)
}.width('100%')
// Row() {
// Column() {
// Text(this.message)
// .fontSize(50)
// .fontWeight(FontWeight.Bold)
// }
// .width('100%')
// }
// .height('100%')
}
/**
* 布局描述
*
* @param FrontLinkObject item 组件项
* @param index
*/
@Builder
buildTopicInfoView(item: FrontLinkObject) {
RelativeContainer() {
Image(item?.coverUrl)
.width("100%")
.height("100%")
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top },
left: { anchor: '__container__', align: HorizontalAlign.Start }
})
.id('img_cover')
Row() {
Text("查看详情")
.fontSize(20)
.fontColor($r('app.color.white'))
.maxLines(1)
Image($r('app.media.more'))
.height($r('app.float.top_arrow_size'))
.width(20)
}
.margin({ top: 10 })
// .backgroundColor(Color.Red)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
})
.id('row_detail')
Text(item?.summary ?? "")
.margin({ top: 10 })
.fontSize(14)
.fontColor($r('app.color.white'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "row_detail", align: VerticalAlign.Top }
})
.id('txt_summary')
Text(item?.title ?? "")
.fontSize(24)
.fontColor($r('app.color.white'))
.maxLines(2)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "txt_summary", align: VerticalAlign.Top }
})
.id('txt_title')
}
.width("100%")
.aspectRatio(3 / 4)
// .aspectRatio(1)
// .backgroundColor(Color.Orange)
// .hoverEffect(HoverEffect.Scale)
.onClick((event: ClickEvent) => {
console.info(TAG, `buildTopicInfoView onClick event`);
// let taskAction: Action = {
// type: 'JUMP_H5_BY_WEB_VIEW',
// params: {
// url: ConfigConstants.DETAIL_URL
// } as Params,
// };
// WDRouterRule.jumpWithAction(taskAction)
// let taskAction: Action = {
// type: 'JUMP_DETAIL_PAGE',
// params: {
// detailPageType: 7, // 沉浸式竖屏详情页
// contentID: '863556812'
// } as Params,
// };
// WDRouterRule.jumpWithAction(taskAction)
})
}
}
\ No newline at end of file
... ... @@ -383,4 +383,65 @@ export struct MasonryLayout01CardView {
WDRouterRule.jumpWithAction(taskAction)
})
}
}
/**
* 早晚报数据卡片
*/
@Component
export struct PaperSingleColumn999CardView {
private item: ContentDTO = {} as ContentDTO;
private index: number = -1;
build() {
Column() {
Text(this.item?.newsTitle)
.fontSize(16)
.fontWeight(FontWeight.Bold)
.alignSelf(ItemAlign.Start)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
if (this.item?.coverUrl) {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.item?.coverUrl)
.borderRadius(5)
.aspectRatio(16 / 9)
.padding({ top: 10 })
if (this.item?.videoInfo) {
Stack() {
Text(this.item?.videoInfo.videoDuration)
.backgroundColor(Color.Black)
.opacity(0.6)
.width(CommonConstants.FULL_PARENT)
.padding({ left: 40 })
Image($r('app.media.iv_card_play_yellow_flag'))
.fitOriginalSize(true)
}.width(CommonConstants.FULL_PARENT)
}
}
}
if (this.item?.newsSummary) {
Text(this.item?.newsSummary)
.fontSize(14)
.padding({ top: 10 })
.alignSelf(ItemAlign.Start)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
}
if (this.item?.visitorComment) {
Row() {
Text(this.item?.visitorComment + "评")
.fontSize(12)
.fontColor(Color.Gray)
Image($r('app.media.icon_share'))
.width(16)
.height(16)
.margin(10)
.backgroundColor(Color.Brown)
}.width(CommonConstants.FULL_PARENT)
.justifyContent(FlexAlign.SpaceBetween)
}
}
.margin({ bottom: 5 })
}
}
\ No newline at end of file
... ...
{
"src": [
"components/MorningEveningPaperComponent"
"components/MorningEveningPaper/MorningEveningPaperComponent"
]
}
... ...