fanmingyou3_wd

早晚报布局

1 import router from '@ohos.router' 1 import router from '@ohos.router'
2 import { FrontLinkObject, MorningEveningPaperDTO } from 'wdBean' 2 import { FrontLinkObject, MorningEveningPaperDTO } from 'wdBean'
3 -import { Logger } from 'wdKit';  
4 -import PageViewModel from '../viewmodel/PageViewModel';  
5 -import { PageComponent } from './page/PageComponent'; 3 +
  4 +// import { Logger } from 'wdKit';
  5 +// import PageViewModel from '../viewmodel/PageViewModel';
  6 +// import { PageComponent } from './page/PageComponent';
6 7
7 const TAG = 'MorningEveningPaperComponent'; 8 const TAG = 'MorningEveningPaperComponent';
8 9
@@ -34,14 +35,14 @@ export struct MorningEveningPaperComponent { @@ -34,14 +35,14 @@ export struct MorningEveningPaperComponent {
34 35
35 async aboutToAppear() { 36 async aboutToAppear() {
36 console.info(TAG, `aboutToAppear`); 37 console.info(TAG, `aboutToAppear`);
37 - let paperDTO = await PageViewModel.getMorningEveningPaperData(this.paperPageId)  
38 - if (paperDTO) {  
39 - this.morningEveningPaperDTO = paperDTO;  
40 - if (paperDTO.groups && paperDTO.groups.length > 0) {  
41 - this.groupId = paperDTO.groups[0].id + ''  
42 - }  
43 - Logger.info(TAG, `aboutToAppear, paperDTO is not empty`);  
44 - } 38 + // let paperDTO = await PageViewModel.getMorningEveningPaperData(this.paperPageId)
  39 + // if (paperDTO) {
  40 + // this.morningEveningPaperDTO = paperDTO;
  41 + // if (paperDTO.groups && paperDTO.groups.length > 0) {
  42 + // this.groupId = paperDTO.groups[0].id + ''
  43 + // }
  44 + // Logger.info(TAG, `aboutToAppear, paperDTO is not empty`);
  45 + // }
45 } 46 }
46 47
47 build() { 48 build() {
@@ -110,51 +111,65 @@ export struct MorningEveningPaperComponent { @@ -110,51 +111,65 @@ export struct MorningEveningPaperComponent {
110 111
111 ListItem() { 112 ListItem() {
112 Row() { 113 Row() {
113 - Row() { 114 + Stack({ alignContent: Alignment.Start }) {
  115 + Image($r('app.media.listen_left_bg'))
  116 + .width('100%')
  117 + .height('100%')
  118 + .objectFit(ImageFit.Contain)
114 Image($r('app.media.icon_listen')) 119 Image($r('app.media.icon_listen'))
115 .width(24) 120 .width(24)
116 .height(24) 121 .height(24)
117 .margin({ left: 10 }) 122 .margin({ left: 10 })
  123 + .alignSelf(ItemAlign.Start)
  124 +
118 Text('晚上好, 请收听今日新闻播报') 125 Text('晚上好, 请收听今日新闻播报')
119 .fontSize(14) 126 .fontSize(14)
120 - .margin({ left: 10 }) 127 + .margin({ left: 50 })
121 .fontColor(Color.Black) 128 .fontColor(Color.Black)
122 .maxLines(1) 129 .maxLines(1)
123 .textOverflow({ overflow: TextOverflow.Ellipsis }) 130 .textOverflow({ overflow: TextOverflow.Ellipsis })
124 } 131 }
125 - .width('72%')  
126 - .height(56)  
127 - .backgroundImage($r('app.media.listen_left_bg')) 132 + .layoutWeight(1)
  133 + .height('100%')
  134 +
  135 + Stack({ alignContent: Alignment.Center }) {
  136 + Image($r('app.media.listen_right_bg'))
  137 + .width('100%')
  138 + .height('100%')
  139 + .objectFit(ImageFit.Contain)
128 140
129 - Row() {  
130 Image($r('app.media.ic_red_triangle')) 141 Image($r('app.media.ic_red_triangle'))
131 - .width(30)  
132 - .height(30)  
133 - .margin({ left: 15 }) 142 + .width(24)
  143 + .height(24)
  144 + .margin({ left: 10 })// .alignSelf(ItemAlign.Center)
134 .objectFit(ImageFit.Contain) 145 .objectFit(ImageFit.Contain)
135 } 146 }
136 - .justifyContent(FlexAlign.Center)  
137 - // .width(94)  
138 - .width('28%')  
139 // .aspectRatio(7 / 4) 147 // .aspectRatio(7 / 4)
140 - .height(56)  
141 - .backgroundImage($r('app.media.listen_right_bg')) 148 + .height('100%')
  149 + // .justifyContent(FlexAlign.Center)
  150 + // .width(94)
  151 + // .width(140)
  152 + .width('20%')
  153 + // .height(56)
  154 + .onClick(() => {
  155 + console.info(TAG, `onClick listen_right_bg`);
  156 + })
142 } 157 }
143 - .width('100%') 158 + // .width('100%')
144 .height(56) 159 .height(56)
  160 + .alignItems(VerticalAlign.Center)
145 .justifyContent(FlexAlign.SpaceBetween) 161 .justifyContent(FlexAlign.SpaceBetween)
146 -  
147 // .backgroundColor(Color.Red) 162 // .backgroundColor(Color.Red)
148 } 163 }
149 164
150 ListItem() { 165 ListItem() {
151 - PageComponent({  
152 - currentTopNavSelectedIndex: $currentTopNavSelectedIndex,  
153 - navIndex: 0,  
154 - pageId: '31320', //this.groupId,  
155 - channelId: ''  
156 - })  
157 - } 166 + // PageComponent({
  167 + // currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
  168 + // navIndex: 0,
  169 + // pageId: '31320', //this.groupId,
  170 + // channelId: ''
  171 + // })
  172 + }.height(500)
158 } 173 }
159 // .backgroundColor('#FFF1F3F5') 174 // .backgroundColor('#FFF1F3F5')
160 // .backgroundColor(Color.Blue) 175 // .backgroundColor(Color.Blue)
@@ -212,7 +227,7 @@ export struct MorningEveningPaperComponent { @@ -212,7 +227,7 @@ export struct MorningEveningPaperComponent {
212 227
213 Text(item?.summary ?? "") 228 Text(item?.summary ?? "")
214 .margin({ top: 10 }) 229 .margin({ top: 10 })
215 - .fontSize(13) 230 + .fontSize(14)
216 .fontColor($r('app.color.white')) 231 .fontColor($r('app.color.white'))
217 .maxLines(3) 232 .maxLines(3)
218 .textOverflow({ overflow: TextOverflow.Ellipsis }) 233 .textOverflow({ overflow: TextOverflow.Ellipsis })
@@ -223,7 +238,7 @@ export struct MorningEveningPaperComponent { @@ -223,7 +238,7 @@ export struct MorningEveningPaperComponent {
223 .id('txt_summary') 238 .id('txt_summary')
224 239
225 Text(item?.title ?? "") 240 Text(item?.title ?? "")
226 - .fontSize(23) 241 + .fontSize(24)
227 .fontColor($r('app.color.white')) 242 .fontColor($r('app.color.white'))
228 .maxLines(2) 243 .maxLines(2)
229 .alignRules({ 244 .alignRules({