wangliang_wd

feat:优化早晚报标题背景

... ... @@ -65,7 +65,7 @@ export struct MorningEveningPaperComponent {
@Provide currentTime: string = "00:00";
@Provide totalTime: string = "00:00";
@Provide progressVal: number = 0;
@State mixedBgColor: string = ''
@Provide mixedBgColor: string = ''
// 顶部安全高度赋值
@State topSafeHeight: number = px2vp(AppStorage.get<number>('topSafeHeight') || 0)
@State bottomSafeHeight: number = px2vp(AppStorage.get<number>('bottomSafeHeight') || 0)
... ... @@ -269,7 +269,7 @@ export struct MorningEveningPaperComponent {
if (this.pageInfoBean?.topicInfo?.frontLinkObject) {
ListItem() {
topicInfoView({ frontLinkObject: this.pageInfoBean?.topicInfo?.frontLinkObject })
topicInfoView({ frontLinkObject: this.pageInfoBean?.topicInfo?.frontLinkObject})
}
}
... ...
... ... @@ -20,19 +20,38 @@ export struct topicInfoView {
frontLinkObject: FrontLinkObject = {} as FrontLinkObject
@State isExpansion:boolean = false
@Consume mixedBgColor: string
aboutToAppear() {
}
build() {
RelativeContainer() {
Image(this.frontLinkObject?.coverUrl)
Stack(){
Image(this.frontLinkObject?.coverUrl)
.width("100%")
.height("100%")
Stack(){
Image('')
.width("100%")
.height("40%")
.linearGradient({
direction: GradientDirection.Bottom, // 渐变方向
repeating: false, // 渐变颜色是否重复
colors: [[Color.Transparent, 0.0],[this.mixedBgColor,1]] // 数组末尾元素占比小于1时满足重复着色效果
})
}
.align(Alignment.Bottom)
.width("100%")
.height("100%")
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top },
left: { anchor: '__container__', align: HorizontalAlign.Start }
})
.id('img_cover')
}
.width("100%")
.height("100%")
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top },
left: { anchor: '__container__', align: HorizontalAlign.Start }
})
.id('img_cover')
if (this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0) {
Row() {
... ... @@ -71,25 +90,7 @@ export struct topicInfoView {
Row(){
CommentText({longMessage:this.frontLinkObject?.summary ?? "",fontSize:14,fontColor:'#CCFFFFFF',isMorningEveningPaper:true})
// Text(this.frontLinkObject?.summary ?? "")
// .fontSize(14)
// .fontColor('#CCFFFFFF')
// .maxLines(this.isExpansion?999:3)
// .textOverflow({ overflow: TextOverflow.Ellipsis })
// .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
// Logger.debug('TAG', `当前屏幕可见区域大小: currentRatio:' +${currentRatio}`)
// if (!isVisible && currentRatio <= 0.0) {
//
// }
// })
//
// Text(this.isExpansion?'收起':'展开').onClick(()=>{
// this.isExpansion = !this.isExpansion
// })
// .fontSize(14)
// .fontColor($r('app.color.white'))
}.alignItems(VerticalAlign.Bottom)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
... ... @@ -99,7 +100,7 @@ export struct topicInfoView {
.id('txt_summary')
Text(this.frontLinkObject?.title ?? "")
.fontSize(24)
.fontSize(20)
.fontColor($r('app.color.white'))
.maxLines(2)
.alignRules({
... ...