王士厅

电子报直板、折叠屏、pad适配

@@ -34,11 +34,10 @@ export struct ENewspaperItemComponent { @@ -34,11 +34,10 @@ export struct ENewspaperItemComponent {
34 .visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None) 34 .visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
35 Image(this.newspaperListItemBean.pagePic) 35 Image(this.newspaperListItemBean.pagePic)
36 .width('100%') 36 .width('100%')
37 - .aspectRatio(378 / 566)  
38 - .objectFit(ImageFit.Fill)  
39 .onComplete(() => { 37 .onComplete(() => {
40 this.isShowSkeleton = false 38 this.isShowSkeleton = false
41 }) 39 })
  40 + .objectFit(ImageFit.Contain)
42 .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible) 41 .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible)
43 42
44 Canvas(this.context) 43 Canvas(this.context)
@@ -49,7 +48,7 @@ export struct ENewspaperItemComponent { @@ -49,7 +48,7 @@ export struct ENewspaperItemComponent {
49 48
50 }) 49 })
51 } 50 }
52 - .padding({ top: 16, right: 16, bottom: 16, left: 16 }) 51 + .padding({ top:14, right: 10, bottom: 14, left: 10 })
53 .margin({ left: 10, right: 10 }) 52 .margin({ left: 10, right: 10 })
54 .backgroundColor(Color.White) 53 .backgroundColor(Color.White)
55 .width('100%') 54 .width('100%')
@@ -28,6 +28,8 @@ export struct ENewspaperPageComponent { @@ -28,6 +28,8 @@ export struct ENewspaperPageComponent {
28 @State swiperIndex: number = 0; 28 @State swiperIndex: number = 0;
29 //当前选择的日期标记 29 //当前选择的日期标记
30 @State selectDate: Date = new Date() 30 @State selectDate: Date = new Date()
  31 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
  32 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
31 33
32 //watch监听报纸页码回调 34 //watch监听报纸页码回调
33 onCurrentPageNumUpdated(): void { 35 onCurrentPageNumUpdated(): void {
@@ -102,7 +104,10 @@ export struct ENewspaperPageComponent { @@ -102,7 +104,10 @@ export struct ENewspaperPageComponent {
102 //获取宽高尺寸 104 //获取宽高尺寸
103 this.screenWidth = this.displayTool.width 105 this.screenWidth = this.displayTool.width
104 this.picWidth = this.screenWidth - vp2px(52) 106 this.picWidth = this.screenWidth - vp2px(52)
105 - this.picHeight = this.picWidth * 566 / 378 107 + let screenHeight = this.displayTool.height;
  108 + // bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度
  109 + let height = screenHeight -this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60)
  110 + this.picHeight = height
106 // 默认日期 111 // 默认日期
107 const date = new Date() 112 const date = new Date()
108 const month = date.getMonth() + 1 113 const month = date.getMonth() + 1
@@ -213,10 +218,11 @@ export struct ENewspaperPageComponent { @@ -213,10 +218,11 @@ export struct ENewspaperPageComponent {
213 } 218 }
214 .index(this.swiperIndex) 219 .index(this.swiperIndex)
215 .width('100%') 220 .width('100%')
216 - .height(px2vp(this.picHeight) + 32) 221 + // newspaper_shadow 44 高度 e_newspaper_content 35 margin top
  222 + .height(px2vp(this.picHeight) - 44 - 35)
217 .vertical(true) 223 .vertical(true)
218 .autoPlay(false) 224 .autoPlay(false)
219 - .cachedCount(3) 225 + .cachedCount(1)
220 .indicator(false) 226 .indicator(false)
221 .loop(false) 227 .loop(false)
222 .displayCount(1) 228 .displayCount(1)
@@ -234,6 +240,7 @@ export struct ENewspaperPageComponent { @@ -234,6 +240,7 @@ export struct ENewspaperPageComponent {
234 240
235 Image($r('app.media.newspaper_shadow')) 241 Image($r('app.media.newspaper_shadow'))
236 .height($r('app.float.vp_12')) 242 .height($r('app.float.vp_12'))
  243 + .width('100%')
237 .margin({ left: 10, right: 10, top: -1 }) 244 .margin({ left: 10, right: 10, top: -1 })
238 .objectFit(ImageFit.Contain) 245 .objectFit(ImageFit.Contain)
239 .alignRules({ 246 .alignRules({