王士厅

电子报优化骨架屏逻辑,折叠屏bug修改

... ... @@ -64,13 +64,12 @@ export struct ENewspaperItemComponent {
.zIndex(15)
}
}
// this.itemPicWidth this.itemPicHeight 外层计算已减去,注掉解决骨架屏压缩变形
/*.padding({
.padding({
top: 14,
right: 10,
bottom: 14,
left: 10
})*/
})
.backgroundColor(Color.White)
.width('100%')
.onTouch((event: TouchEvent) => {
... ...
... ... @@ -145,7 +145,6 @@ export struct ENewspaperPageComponent {
let ratio = this.ratio == '100%' ? 1 : 0.5
this.picWidth = this.picWidth * ratio
this.picHeight = this.picHeight
// 默认日期
const date = new Date()
const month = date.getMonth() + 1
... ... @@ -174,14 +173,17 @@ export struct ENewspaperPageComponent {
resizeWindow() {
this.windowClass?.on('windowSizeChange', () => {
this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width
// 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
this.ratio = this.screenWidth > 2000 ? '50%' : '100%'
let ratio = this.ratio == '100%' ? 1 : 0.5
this.picWidth = this.screenWidth - vp2px(20)
this.picWidth = this.picWidth * ratio
this.resize()
});
}
resize() {
this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width
// 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
this.ratio = this.screenWidth > 2000 ? '50%' : '100%'
let ratio = this.ratio == '100%' ? 1 : 0.5
this.picWidth = this.screenWidth - vp2px(20)
this.picWidth = this.picWidth * ratio
}
build() {
Stack() {
... ... @@ -257,10 +259,10 @@ export struct ENewspaperPageComponent {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.id('news_skeleton_id')
.width('100%')
.height(px2vp(this.picHeight) + 32)
.width(px2vp(this.picWidth))
.height(px2vp(this.picHeight))
.margin({ top: 59, left: 10, right: 10 })
.padding({ right: 10, left: 10 })
// .padding({ right: 10, left: 10 })
}
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
... ... @@ -448,8 +450,7 @@ export struct ENewspaperPageComponent {
private async getNewspaperList() {
// ENewspaperItemComponent .padding({ top:14, right: 10, bottom: 14, left: 10 })
// 计算图片的内容宽高
let ratio = this.ratio == '100%' ? 1 : 0.5
this.itemPicWidth = this.picWidth * ratio - vp2px(20)
this.itemPicWidth = this.picWidth - vp2px(20)
this.itemPicHeight = this.picHeight - vp2px(28)
try {
if (NetworkUtil.isNetConnected()) {
... ...
... ... @@ -15,35 +15,39 @@ export struct newsSkeleton {
Row() {
Column() {
Image($r('app.media.peopleSeleton'))
.width(120.89)
.height(46.98)// 后缀名不能省略
.width('100%')
.height(47)// 后缀名不能省略
.interpolation(ImageInterpolation.High)
.margin({
bottom: 6
})
textArea('100%', 8)
}
.margin({
right: 5
right: '2%'
})
.width(120.89)
.width(`76%`)
.alignItems(HorizontalAlign.Start)
Column() {
Row()
.width(`16.5%`)
.width(`100%`)
.height(25)
.backgroundColor('#FFF5F5F5')
Row()
.width(`16.5%`)
.width(`100%`)
.height(4)
.backgroundColor('#FFF5F5F5')
.margin({ top: 3, bottom: 3 })
Row()
.width(`16.5%`)
.width(`100%`)
.height(20)
.backgroundColor('#FFF5F5F5')
// textArea(27, 25)
// textArea(27, 4)
// textArea(27, 20)
}
.width(`22%`)
.border({ width: 1 })
.borderColor('#FFF5F5F5')
.padding({
... ... @@ -119,6 +123,7 @@ export struct newsSkeleton {
.width('100%')
}
.height('100%')
.width('100%')
}
}
... ...