wangliang_wd

feat:优化早晚报标题背景

@@ -65,7 +65,7 @@ export struct MorningEveningPaperComponent { @@ -65,7 +65,7 @@ export struct MorningEveningPaperComponent {
65 @Provide currentTime: string = "00:00"; 65 @Provide currentTime: string = "00:00";
66 @Provide totalTime: string = "00:00"; 66 @Provide totalTime: string = "00:00";
67 @Provide progressVal: number = 0; 67 @Provide progressVal: number = 0;
68 - @State mixedBgColor: string = '' 68 + @Provide mixedBgColor: string = ''
69 // 顶部安全高度赋值 69 // 顶部安全高度赋值
70 @State topSafeHeight: number = px2vp(AppStorage.get<number>('topSafeHeight') || 0) 70 @State topSafeHeight: number = px2vp(AppStorage.get<number>('topSafeHeight') || 0)
71 @State bottomSafeHeight: number = px2vp(AppStorage.get<number>('bottomSafeHeight') || 0) 71 @State bottomSafeHeight: number = px2vp(AppStorage.get<number>('bottomSafeHeight') || 0)
@@ -269,7 +269,7 @@ export struct MorningEveningPaperComponent { @@ -269,7 +269,7 @@ export struct MorningEveningPaperComponent {
269 if (this.pageInfoBean?.topicInfo?.frontLinkObject) { 269 if (this.pageInfoBean?.topicInfo?.frontLinkObject) {
270 270
271 ListItem() { 271 ListItem() {
272 - topicInfoView({ frontLinkObject: this.pageInfoBean?.topicInfo?.frontLinkObject }) 272 + topicInfoView({ frontLinkObject: this.pageInfoBean?.topicInfo?.frontLinkObject})
273 } 273 }
274 274
275 } 275 }
@@ -20,19 +20,38 @@ export struct topicInfoView { @@ -20,19 +20,38 @@ export struct topicInfoView {
20 20
21 frontLinkObject: FrontLinkObject = {} as FrontLinkObject 21 frontLinkObject: FrontLinkObject = {} as FrontLinkObject
22 @State isExpansion:boolean = false 22 @State isExpansion:boolean = false
  23 + @Consume mixedBgColor: string
  24 +
23 aboutToAppear() { 25 aboutToAppear() {
24 } 26 }
25 27
26 build() { 28 build() {
27 RelativeContainer() { 29 RelativeContainer() {
28 - Image(this.frontLinkObject?.coverUrl) 30 + Stack(){
  31 + Image(this.frontLinkObject?.coverUrl)
  32 + .width("100%")
  33 + .height("100%")
  34 + Stack(){
  35 + Image('')
  36 + .width("100%")
  37 + .height("40%")
  38 + .linearGradient({
  39 + direction: GradientDirection.Bottom, // 渐变方向
  40 + repeating: false, // 渐变颜色是否重复
  41 + colors: [[Color.Transparent, 0.0],[this.mixedBgColor,1]] // 数组末尾元素占比小于1时满足重复着色效果
  42 + })
  43 + }
  44 + .align(Alignment.Bottom)
29 .width("100%") 45 .width("100%")
30 .height("100%") 46 .height("100%")
31 - .alignRules({  
32 - top: { anchor: '__container__', align: VerticalAlign.Top },  
33 - left: { anchor: '__container__', align: HorizontalAlign.Start }  
34 - })  
35 - .id('img_cover') 47 + }
  48 + .width("100%")
  49 + .height("100%")
  50 + .alignRules({
  51 + top: { anchor: '__container__', align: VerticalAlign.Top },
  52 + left: { anchor: '__container__', align: HorizontalAlign.Start }
  53 + })
  54 + .id('img_cover')
36 55
37 if (this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0) { 56 if (this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0) {
38 Row() { 57 Row() {
@@ -71,25 +90,7 @@ export struct topicInfoView { @@ -71,25 +90,7 @@ export struct topicInfoView {
71 90
72 91
73 Row(){ 92 Row(){
74 -  
75 CommentText({longMessage:this.frontLinkObject?.summary ?? "",fontSize:14,fontColor:'#CCFFFFFF',isMorningEveningPaper:true}) 93 CommentText({longMessage:this.frontLinkObject?.summary ?? "",fontSize:14,fontColor:'#CCFFFFFF',isMorningEveningPaper:true})
76 - // Text(this.frontLinkObject?.summary ?? "")  
77 - // .fontSize(14)  
78 - // .fontColor('#CCFFFFFF')  
79 - // .maxLines(this.isExpansion?999:3)  
80 - // .textOverflow({ overflow: TextOverflow.Ellipsis })  
81 - // .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {  
82 - // Logger.debug('TAG', `当前屏幕可见区域大小: currentRatio:' +${currentRatio}`)  
83 - // if (!isVisible && currentRatio <= 0.0) {  
84 - //  
85 - // }  
86 - // })  
87 - //  
88 - // Text(this.isExpansion?'收起':'展开').onClick(()=>{  
89 - // this.isExpansion = !this.isExpansion  
90 - // })  
91 - // .fontSize(14)  
92 - // .fontColor($r('app.color.white'))  
93 }.alignItems(VerticalAlign.Bottom) 94 }.alignItems(VerticalAlign.Bottom)
94 .alignRules({ 95 .alignRules({
95 left: { anchor: "__container__", align: HorizontalAlign.Start }, 96 left: { anchor: "__container__", align: HorizontalAlign.Start },
@@ -99,7 +100,7 @@ export struct topicInfoView { @@ -99,7 +100,7 @@ export struct topicInfoView {
99 .id('txt_summary') 100 .id('txt_summary')
100 101
101 Text(this.frontLinkObject?.title ?? "") 102 Text(this.frontLinkObject?.title ?? "")
102 - .fontSize(24) 103 + .fontSize(20)
103 .fontColor($r('app.color.white')) 104 .fontColor($r('app.color.white'))
104 .maxLines(2) 105 .maxLines(2)
105 .alignRules({ 106 .alignRules({