topicInfoView.ets 3.39 KB
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)
    })
  }
}