wangyong_wd

style:本地精选卡样式优化

import { CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { BannerComponent } from './view/BannerComponent';
import { LabelComponent } from './view/LabelComponent';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import {
... ...
... ... @@ -71,6 +71,7 @@ export struct AttentionListComponent {
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.height(74)
}
.padding({
... ...
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { ProcessUtils } from '../../utils/ProcessUtils';
import { CommonConstants } from 'wdConstant/Index';
const TAG = 'Card19Component';
/**
... ... @@ -83,9 +85,16 @@ export struct Card19Component {
.fontColor($r('app.color.color_222222'))
.textOverflowStyle(2)
.margin({ bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
// 图片-从无图到9图展示
createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls })
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ... @@ -94,9 +103,6 @@ export struct Card19Component {
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}
... ...
... ... @@ -12,12 +12,10 @@ import { ProcessUtils } from '../../utils/ProcessUtils';
export struct ZhSingleRow04 {
@State compDTO: CompDTO = {} as CompDTO
aboutToAppear() {}
build() {
Column(){
Column() {
//顶部
Row(){
Row() {
Row() {
Image($r("app.media.local_selection"))
.width(24)
... ... @@ -28,6 +26,7 @@ export struct ZhSingleRow04 {
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
}
Row() {
Text("更多")
.fontSize($r("app.float.font_size_14"))
... ... @@ -41,64 +40,93 @@ export struct ZhSingleRow04 {
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8, bottom: 8 })
.width('100%')
// 列表内容
List({ space: 12 }) {
ForEach(this.compDTO.operDataList, (item: ContentDTO) => {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
ListItem() {
Row(){
if(item.coverUrl) {
Image(item.coverUrl)
.width(84)
.height(56)
.borderRadius(3)
.objectFit(ImageFit.Cover)
.padding({right: 6})
}
Column(){
Text(item.newsTitle)
.fontSize($r("app.float.font_size_16"))
.fontColor($r("app.color.color_212228"))
.fontWeight(400)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.margin({ top: 8 })
Row(){
Text(item.source)
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_B0B0B0'))
.textOverflow({overflow: TextOverflow.Ellipsis})
.maxLines(1)
.width(item.source.length > 10 ? '60%' : '')
Image($r("app.media.point"))
.width(16)
.height(16)
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
localCard(
{
operDataListItem: item
}
.width('100%')
}
.width(200)
}
// .margin({right: 18})
.onClick(() =>{
)
.margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0})
.onClick(() => {
ProcessUtils.processPage(item)
})
}
})
}
.listDirection(Axis.Horizontal)
.width('100%')
.scrollBar(BarState.Off)
.width(CommonConstants.FULL_PARENT)
}
.width(CommonConstants.FULL_WIDTH)
.padding({
top: 14,
left: 16,
right: 16,
bottom: 14
left: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
}
}
@Component
struct localCard {
@Prop operDataListItem: ContentDTO
build() {
Flex({ direction: FlexDirection.Column }) {
Text(this.operDataListItem.source)
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_B0B0B0'))
.width('100%')
.margin({ bottom: 6 })
.flexShrink(0)
Text(this.operDataListItem.newsTitle)
.width(CommonConstants.FULL_PARENT)
.height(CommonConstants.FULL_PARENT)
.fontSize($r('app.float.font_size_16'))
.fontColor('#000000')
.align(Alignment.TopStart)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Row() {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.operDataListItem.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.margin({ right: 5 })
// 这里需要外部查询评论接口后,写入字段
if(this.operDataListItem.interactData?.commentNum) {
Text(`${this.operDataListItem.interactData?.commentNum}评`)
.fontSize(12)
}
Blank()
Image($r('app.media.local_content_icon'))
.width(20)
.height(20)
.margin({
right: -4
})
}
.width('100%')
.padding({
top: 17
})
.flexShrink(0)
}
.width(182)
.height(146)
.padding(12)
.border({
radius: 2,
})
.shadow({ radius: 5, color: '#1A000000', offsetX: 0, offsetY: 2 })
.margin({
right: 10
})
}
}
\ No newline at end of file
... ...