王士厅

电子报一多优化

@@ -174,6 +174,8 @@ export struct ENewspaperPageComponent { @@ -174,6 +174,8 @@ export struct ENewspaperPageComponent {
174 resizeWindow() { 174 resizeWindow() {
175 this.windowClass?.on('windowSizeChange', () => { 175 this.windowClass?.on('windowSizeChange', () => {
176 this.resize() 176 this.resize()
  177 + this.getNewspaperList()
  178 + this.swiperController.changeIndex(this.swiperIndex)
177 }); 179 });
178 } 180 }
179 resize() { 181 resize() {
1 import { RMCalendarBean } from './RMCalendarBean' 1 import { RMCalendarBean } from './RMCalendarBean'
2 import { RMCalenderCell } from './RMCalendarCell' 2 import { RMCalenderCell } from './RMCalendarCell'
3 -import { ToastUtils, NetworkUtil } from 'wdKit/Index'; 3 +import { ToastUtils, NetworkUtil, WindowModel } from 'wdKit/Index';
  4 +import { window } from '@kit.ArkUI';
4 5
5 @Component 6 @Component
6 export struct RMCalendar { 7 export struct RMCalendar {
  8 + private windowClass?: window.Window;
7 @State selectItem: RMCalendarBean = new RMCalendarBean() 9 @State selectItem: RMCalendarBean = new RMCalendarBean()
8 //选中的日期 10 //选中的日期
9 private selectDay: Date = new Date() 11 private selectDay: Date = new Date()
@@ -70,6 +72,7 @@ export struct RMCalendar { @@ -70,6 +72,7 @@ export struct RMCalendar {
70 onMonthChange?: (after: Date, befor: Date) => void 72 onMonthChange?: (after: Date, befor: Date) => void
71 // 不可选中项的点击事件 73 // 不可选中项的点击事件
72 disableCellClick?: (item: RMCalendarBean) => void 74 disableCellClick?: (item: RMCalendarBean) => void
  75 + @State isZD: boolean = false // 存储是否折叠屏
73 76
74 @Builder 77 @Builder
75 createWeekTitle(item: string) { 78 createWeekTitle(item: string) {
@@ -165,6 +168,24 @@ export struct RMCalendar { @@ -165,6 +168,24 @@ export struct RMCalendar {
165 temp.time = this.selectDay.getTime() 168 temp.time = this.selectDay.getTime()
166 this.selectItem = temp 169 this.selectItem = temp
167 this.calcData() 170 this.calcData()
  171 + this.windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口
  172 + let screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width
  173 + // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
  174 + this.isZD = screenWidth > 2000 ? true : false
  175 + this.resizeWindow()
  176 + }
  177 +
  178 + aboutToDisappear() {
  179 + this.windowClass?.off('windowSizeChange');
  180 + }
  181 +
  182 + resizeWindow() {
  183 + this.windowClass?.on('windowSizeChange', () => {
  184 + this.windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口
  185 + let screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width
  186 + // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
  187 + this.isZD = screenWidth > 2000 ? true : false
  188 + });
168 } 189 }
169 190
170 /** 191 /**
@@ -343,6 +364,7 @@ export struct RMCalendar { @@ -343,6 +364,7 @@ export struct RMCalendar {
343 { bottom: 20 }) 364 { bottom: 20 })
344 .border({ radius: 4 }) 365 .border({ radius: 4 })
345 } 366 }
  367 + .width(this.isZD ? "50%" : "100%")
346 } 368 }
347 369
348 getMonthStr(month?: number): string { 370 getMonthStr(month?: number): string {
@@ -118,8 +118,13 @@ export struct newsSkeleton { @@ -118,8 +118,13 @@ export struct newsSkeleton {
118 left: 15 118 left: 15
119 }) 119 })
120 if (this.showBottom) { 120 if (this.showBottom) {
121 - Column().backgroundColor('#CBCBCB').height(5).width(339)  
122 - Column().backgroundColor('#909090').height(5).width(326) 121 + // Column().backgroundColor('#CBCBCB').height(5).width(339)
  122 + // Column().backgroundColor('#909090').height(5).width(336)
  123 + Image($r('app.media.newspaper_shadow'))
  124 + .height($r('app.float.vp_12'))
  125 + .width("97%")
  126 + .objectFit(ImageFit.Contain)
  127 + .margin({ top: -1 })
123 } 128 }
124 } 129 }
125 .width('100%') 130 .width('100%')
@@ -136,8 +136,12 @@ export struct ENewspaperListDialog { @@ -136,8 +136,12 @@ export struct ENewspaperListDialog {
136 Image($r('app.media.line')) 136 Image($r('app.media.line'))
137 .width('100%') 137 .width('100%')
138 .height(6) 138 .height(6)
139 - .margin({ top: 20, left: 16, right: 16 })  
140 - .objectFit(ImageFit.Contain) 139 + .margin({ top: 20 })
  140 + .padding({
  141 + left: 16,
  142 + right: 16
  143 + })
  144 + .objectFit(ImageFit.Fill)
141 } 145 }
142 .width('100%') 146 .width('100%')
143 .gesture( 147 .gesture(