王士厅

电子报一多优化

... ... @@ -174,6 +174,8 @@ export struct ENewspaperPageComponent {
resizeWindow() {
this.windowClass?.on('windowSizeChange', () => {
this.resize()
this.getNewspaperList()
this.swiperController.changeIndex(this.swiperIndex)
});
}
resize() {
... ...
import { RMCalendarBean } from './RMCalendarBean'
import { RMCalenderCell } from './RMCalendarCell'
import { ToastUtils, NetworkUtil } from 'wdKit/Index';
import { ToastUtils, NetworkUtil, WindowModel } from 'wdKit/Index';
import { window } from '@kit.ArkUI';
@Component
export struct RMCalendar {
private windowClass?: window.Window;
@State selectItem: RMCalendarBean = new RMCalendarBean()
//选中的日期
private selectDay: Date = new Date()
... ... @@ -70,6 +72,7 @@ export struct RMCalendar {
onMonthChange?: (after: Date, befor: Date) => void
// 不可选中项的点击事件
disableCellClick?: (item: RMCalendarBean) => void
@State isZD: boolean = false // 存储是否折叠屏
@Builder
createWeekTitle(item: string) {
... ... @@ -165,6 +168,24 @@ export struct RMCalendar {
temp.time = this.selectDay.getTime()
this.selectItem = temp
this.calcData()
this.windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口
let screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width
// 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
this.isZD = screenWidth > 2000 ? true : false
this.resizeWindow()
}
aboutToDisappear() {
this.windowClass?.off('windowSizeChange');
}
resizeWindow() {
this.windowClass?.on('windowSizeChange', () => {
this.windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口
let screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width
// 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
this.isZD = screenWidth > 2000 ? true : false
});
}
/**
... ... @@ -343,6 +364,7 @@ export struct RMCalendar {
{ bottom: 20 })
.border({ radius: 4 })
}
.width(this.isZD ? "50%" : "100%")
}
getMonthStr(month?: number): string {
... ...
... ... @@ -118,8 +118,13 @@ export struct newsSkeleton {
left: 15
})
if (this.showBottom) {
Column().backgroundColor('#CBCBCB').height(5).width(339)
Column().backgroundColor('#909090').height(5).width(326)
// Column().backgroundColor('#CBCBCB').height(5).width(339)
// Column().backgroundColor('#909090').height(5).width(336)
Image($r('app.media.newspaper_shadow'))
.height($r('app.float.vp_12'))
.width("97%")
.objectFit(ImageFit.Contain)
.margin({ top: -1 })
}
}
.width('100%')
... ...
... ... @@ -136,8 +136,12 @@ export struct ENewspaperListDialog {
Image($r('app.media.line'))
.width('100%')
.height(6)
.margin({ top: 20, left: 16, right: 16 })
.objectFit(ImageFit.Contain)
.margin({ top: 20 })
.padding({
left: 16,
right: 16
})
.objectFit(ImageFit.Fill)
}
.width('100%')
.gesture(
... ...