王士厅

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

... ... @@ -34,11 +34,10 @@ export struct ENewspaperItemComponent {
.visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
Image(this.newspaperListItemBean.pagePic)
.width('100%')
.aspectRatio(378 / 566)
.objectFit(ImageFit.Fill)
.onComplete(() => {
this.isShowSkeleton = false
})
.objectFit(ImageFit.Contain)
.visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible)
Canvas(this.context)
... ... @@ -49,7 +48,7 @@ export struct ENewspaperItemComponent {
})
}
.padding({ top: 16, right: 16, bottom: 16, left: 16 })
.padding({ top:14, right: 10, bottom: 14, left: 10 })
.margin({ left: 10, right: 10 })
.backgroundColor(Color.White)
.width('100%')
... ...
... ... @@ -28,6 +28,8 @@ export struct ENewspaperPageComponent {
@State swiperIndex: number = 0;
//当前选择的日期标记
@State selectDate: Date = new Date()
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -102,7 +104,10 @@ export struct ENewspaperPageComponent {
//获取宽高尺寸
this.screenWidth = this.displayTool.width
this.picWidth = this.screenWidth - vp2px(52)
this.picHeight = this.picWidth * 566 / 378
let screenHeight = this.displayTool.height;
// bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度
let height = screenHeight -this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60)
this.picHeight = height
// 默认日期
const date = new Date()
const month = date.getMonth() + 1
... ... @@ -213,10 +218,11 @@ export struct ENewspaperPageComponent {
}
.index(this.swiperIndex)
.width('100%')
.height(px2vp(this.picHeight) + 32)
// newspaper_shadow 44 高度 e_newspaper_content 35 margin top
.height(px2vp(this.picHeight) - 44 - 35)
.vertical(true)
.autoPlay(false)
.cachedCount(3)
.cachedCount(1)
.indicator(false)
.loop(false)
.displayCount(1)
... ... @@ -234,6 +240,7 @@ export struct ENewspaperPageComponent {
Image($r('app.media.newspaper_shadow'))
.height($r('app.float.vp_12'))
.width('100%')
.margin({ left: 10, right: 10, top: -1 })
.objectFit(ImageFit.Contain)
.alignRules({
... ...