Showing
5 changed files
with
51 additions
and
18 deletions
| @@ -42,10 +42,12 @@ export struct ENewspaperPageComponent { | @@ -42,10 +42,12 @@ export struct ENewspaperPageComponent { | ||
| 42 | console.log("onDateChange-日历选择弹框", "date:", JSON.stringify(date)) | 42 | console.log("onDateChange-日历选择弹框", "date:", JSON.stringify(date)) |
| 43 | if (date.fullYear && date.month && date.date) { | 43 | if (date.fullYear && date.month && date.date) { |
| 44 | let month: number = date.month + 1 | 44 | let month: number = date.month + 1 |
| 45 | - this.calendarDate = `${date.fullYear}-${month > 9 ? month : '0' + month}-${date.date > 9 ? date.date : '0' + date.date}` | 45 | + this.calendarDate = |
| 46 | + `${date.fullYear}-${month > 9 ? month : '0' + month}-${date.date > 9 ? date.date : '0' + date.date}` | ||
| 46 | this.getNewspaperTime() | 47 | this.getNewspaperTime() |
| 47 | this.getNewspaperList() | 48 | this.getNewspaperList() |
| 48 | - this.selectDate = new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0) | 49 | + this.selectDate = |
| 50 | + new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0) | ||
| 49 | } | 51 | } |
| 50 | } | 52 | } |
| 51 | }), | 53 | }), |
| @@ -148,6 +150,7 @@ export struct ENewspaperPageComponent { | @@ -148,6 +150,7 @@ export struct ENewspaperPageComponent { | ||
| 148 | center: { anchor: "__container__", align: VerticalAlign.Center } | 150 | center: { anchor: "__container__", align: VerticalAlign.Center } |
| 149 | }) | 151 | }) |
| 150 | .id('e_newspaper_share') | 152 | .id('e_newspaper_share') |
| 153 | + .visibility(Visibility.Hidden) | ||
| 151 | } | 154 | } |
| 152 | .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) | 155 | .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) |
| 153 | .height($r('app.float.top_bar_height')) | 156 | .height($r('app.float.top_bar_height')) |
| @@ -208,13 +211,15 @@ export struct ENewspaperPageComponent { | @@ -208,13 +211,15 @@ export struct ENewspaperPageComponent { | ||
| 208 | .id('e_newspaper_shadow') | 211 | .id('e_newspaper_shadow') |
| 209 | 212 | ||
| 210 | Row() { | 213 | Row() { |
| 211 | - Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' : '滑动查看下一版') | 214 | + Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' : |
| 215 | + '滑动查看下一版') | ||
| 212 | .fontColor(Color.White) | 216 | .fontColor(Color.White) |
| 213 | .fontSize($r('app.float.font_size_14')) | 217 | .fontSize($r('app.float.font_size_14')) |
| 214 | Image($r('app.media.icon_next_page')) | 218 | Image($r('app.media.icon_next_page')) |
| 215 | .width($r('app.float.vp_16')) | 219 | .width($r('app.float.vp_16')) |
| 216 | .height($r('app.float.vp_16')) | 220 | .height($r('app.float.vp_16')) |
| 217 | - .visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None : Visibility.Visible) | 221 | + .visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None : |
| 222 | + Visibility.Visible) | ||
| 218 | } | 223 | } |
| 219 | .justifyContent(FlexAlign.Center) | 224 | .justifyContent(FlexAlign.Center) |
| 220 | .margin({ top: $r('app.float.margin_16') }) | 225 | .margin({ top: $r('app.float.margin_16') }) |
| @@ -110,7 +110,7 @@ export struct RMCalendar { | @@ -110,7 +110,7 @@ export struct RMCalendar { | ||
| 110 | if (this.onDateChange) { | 110 | if (this.onDateChange) { |
| 111 | this.onDateChange(item) | 111 | this.onDateChange(item) |
| 112 | if (item.fullYear && item.month) { | 112 | if (item.fullYear && item.month) { |
| 113 | - this.title = `${item.fullYear}年${item.month + 1}月` | 113 | + this.title = `${item.fullYear}年${this.getMonthStr(item.month + 1)}月` |
| 114 | } | 114 | } |
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| @@ -191,18 +191,20 @@ export struct RMCalendar { | @@ -191,18 +191,20 @@ export struct RMCalendar { | ||
| 191 | */ | 191 | */ |
| 192 | private calcData() { | 192 | private calcData() { |
| 193 | 193 | ||
| 194 | - this.title = `${this.selectDay.getFullYear()}年${this.selectDay.getMonth() + 1}月` | 194 | + this.title = `${this.selectDay.getFullYear()}年${this.getMonthStr(this.selectDay.getMonth() + 1)}月` |
| 195 | this.selectDay.setDate(1) | 195 | this.selectDay.setDate(1) |
| 196 | 196 | ||
| 197 | if (this.selectDay.getFullYear() < this.startDate.getFullYear() | 197 | if (this.selectDay.getFullYear() < this.startDate.getFullYear() |
| 198 | - || (this.selectDay.getFullYear() == this.startDate.getFullYear() && this.selectDay.getMonth() <= this.startDate.getMonth())) { | 198 | + || (this.selectDay.getFullYear() == this.startDate.getFullYear() && |
| 199 | + this.selectDay.getMonth() <= this.startDate.getMonth())) { | ||
| 199 | this.hasPre = false | 200 | this.hasPre = false |
| 200 | } else { | 201 | } else { |
| 201 | this.hasPre = true | 202 | this.hasPre = true |
| 202 | } | 203 | } |
| 203 | 204 | ||
| 204 | if (this.selectDay.getFullYear() > this.endDate.getFullYear() | 205 | if (this.selectDay.getFullYear() > this.endDate.getFullYear() |
| 205 | - || (this.selectDay.getFullYear() == this.endDate.getFullYear() && this.selectDay.getMonth() >= this.endDate.getMonth())) { | 206 | + || (this.selectDay.getFullYear() == this.endDate.getFullYear() && |
| 207 | + this.selectDay.getMonth() >= this.endDate.getMonth())) { | ||
| 206 | this.hasNext = false | 208 | this.hasNext = false |
| 207 | } else { | 209 | } else { |
| 208 | this.hasNext = true | 210 | this.hasNext = true |
| @@ -274,7 +276,8 @@ export struct RMCalendar { | @@ -274,7 +276,8 @@ export struct RMCalendar { | ||
| 274 | Text(this.title) | 276 | Text(this.title) |
| 275 | .fontSize(this.titleFontSize) | 277 | .fontSize(this.titleFontSize) |
| 276 | .fontColor(this.titleFontColor) | 278 | .fontColor(this.titleFontColor) |
| 277 | - .fontWeight(this.titleFontWeight) | 279 | + .fontWeight(600) |
| 280 | + .fontFamily('PingFang SC-Semibold') | ||
| 278 | } | 281 | } |
| 279 | 282 | ||
| 280 | Blank() | 283 | Blank() |
| @@ -318,7 +321,22 @@ export struct RMCalendar { | @@ -318,7 +321,22 @@ export struct RMCalendar { | ||
| 318 | left: 35, | 321 | left: 35, |
| 319 | right: 35 | 322 | right: 35 |
| 320 | }) | 323 | }) |
| 324 | + .padding( | ||
| 325 | + { bottom: 20 }) | ||
| 321 | .border({ radius: 4 }) | 326 | .border({ radius: 4 }) |
| 322 | } | 327 | } |
| 323 | } | 328 | } |
| 329 | + | ||
| 330 | + getMonthStr(month?: number): string { | ||
| 331 | + if (!month) { | ||
| 332 | + return '' | ||
| 333 | + } | ||
| 334 | + if (month <= 0) { | ||
| 335 | + return '' | ||
| 336 | + } | ||
| 337 | + if (month <= 9) { | ||
| 338 | + return '0' + month | ||
| 339 | + } | ||
| 340 | + return month + '' | ||
| 341 | + } | ||
| 324 | } | 342 | } |
| @@ -13,7 +13,8 @@ export struct ENewspaperListDialog { | @@ -13,7 +13,8 @@ export struct ENewspaperListDialog { | ||
| 13 | @State pageDialogShow: boolean = false | 13 | @State pageDialogShow: boolean = false |
| 14 | @State scrollIndex: number = 0 | 14 | @State scrollIndex: number = 0 |
| 15 | @Prop @Watch('updateRecordsData') newspaperListBean: NewspaperListBean = {} as NewspaperListBean | 15 | @Prop @Watch('updateRecordsData') newspaperListBean: NewspaperListBean = {} as NewspaperListBean |
| 16 | - private listScroller: Scroller = new Scroller(); | 16 | + private listScroller: Scroller = new Scroller() |
| 17 | + @State scrollOffset: number = 0 | ||
| 17 | //文字版选择弹框 | 18 | //文字版选择弹框 |
| 18 | pageListDialogController: CustomDialogController = new CustomDialogController({ | 19 | pageListDialogController: CustomDialogController = new CustomDialogController({ |
| 19 | builder: ENewspaperPageDialog({ | 20 | builder: ENewspaperPageDialog({ |
| @@ -229,18 +230,24 @@ export struct ENewspaperListDialog { | @@ -229,18 +230,24 @@ export struct ENewspaperListDialog { | ||
| 229 | .scrollBar(BarState.Off) | 230 | .scrollBar(BarState.Off) |
| 230 | 231 | ||
| 231 | .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => { | 232 | .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => { |
| 232 | - console.info('ENewspaperListDialog::first' + firstIndex) | ||
| 233 | - console.info('ENewspaperListDialog::last' + lastIndex) | ||
| 234 | - console.info('ENewspaperListDialog::center' + centerIndex) | 233 | + // console.info('ENewspaperListDialog::first' + firstIndex) |
| 234 | + // console.info('ENewspaperListDialog::last' + lastIndex) | ||
| 235 | + // console.info('ENewspaperListDialog::center' + centerIndex) | ||
| 235 | // this.updateCurrentPageNum(firstIndex) | 236 | // this.updateCurrentPageNum(firstIndex) |
| 236 | // const tempIndex = this.findClassIndex(firstIndex) | 237 | // const tempIndex = this.findClassIndex(firstIndex) |
| 237 | if (firstIndex !== centerIndex) { | 238 | if (firstIndex !== centerIndex) { |
| 238 | return | 239 | return |
| 239 | } | 240 | } |
| 241 | + // console.info(`this.scrollOffset:` + this.scrollOffset) | ||
| 242 | + // if (this.scrollOffset == 0) { | ||
| 240 | this.currentPageNum = `${centerIndex < 9 ? '0' + (centerIndex + 1) : centerIndex + 1}` | 243 | this.currentPageNum = `${centerIndex < 9 ? '0' + (centerIndex + 1) : centerIndex + 1}` |
| 244 | + // } | ||
| 241 | }) | 245 | }) |
| 242 | .onScroll((scrollOffset: number, scrollState: ScrollState) => { | 246 | .onScroll((scrollOffset: number, scrollState: ScrollState) => { |
| 243 | - console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset) | 247 | + // console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset) |
| 248 | + // if (this.scrollOffset == 0) { | ||
| 249 | + // this.scrollOffset = 0 | ||
| 250 | + // } | ||
| 244 | }) | 251 | }) |
| 245 | } | 252 | } |
| 246 | .margin({ top: 124 }) | 253 | .margin({ top: 124 }) |
| @@ -31,10 +31,10 @@ struct ENewspaper { | @@ -31,10 +31,10 @@ struct ENewspaper { | ||
| 31 | 31 | ||
| 32 | pageTransition() { | 32 | pageTransition() { |
| 33 | // 定义页面进入时的效果,从底侧滑入 | 33 | // 定义页面进入时的效果,从底侧滑入 |
| 34 | - PageTransitionEnter({ type: RouteType.None, duration: 300 }) | 34 | + PageTransitionEnter({ type: RouteType.Push, duration: 400 }) |
| 35 | .slide(SlideEffect.Bottom) | 35 | .slide(SlideEffect.Bottom) |
| 36 | // 定义页面退出时的效果,向底侧滑出 | 36 | // 定义页面退出时的效果,向底侧滑出 |
| 37 | - PageTransitionExit({ type: RouteType.None, duration: 300 }) | 37 | + PageTransitionExit({ type: RouteType.Pop, duration: 400 }) |
| 38 | .slide(SlideEffect.Bottom) | 38 | .slide(SlideEffect.Bottom) |
| 39 | } | 39 | } |
| 40 | 40 |
| @@ -2,8 +2,6 @@ import { BottomNavigationComponent, LogoutViewModel, PermissionDesComponent } fr | @@ -2,8 +2,6 @@ import { BottomNavigationComponent, LogoutViewModel, PermissionDesComponent } fr | ||
| 2 | import { BreakpointConstants } from 'wdConstant'; | 2 | import { BreakpointConstants } from 'wdConstant'; |
| 3 | 3 | ||
| 4 | import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger } from 'wdKit'; | 4 | import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger } from 'wdKit'; |
| 5 | -import router from '@ohos.router'; | ||
| 6 | -import { promptAction } from '@kit.ArkUI'; | ||
| 7 | import { HWLocationUtils, WDPushNotificationManager } from 'wdHwAbility/Index'; | 5 | import { HWLocationUtils, WDPushNotificationManager } from 'wdHwAbility/Index'; |
| 8 | import { common } from '@kit.AbilityKit'; | 6 | import { common } from '@kit.AbilityKit'; |
| 9 | 7 | ||
| @@ -44,6 +42,11 @@ struct MainPage { | @@ -44,6 +42,11 @@ struct MainPage { | ||
| 44 | }) | 42 | }) |
| 45 | } | 43 | } |
| 46 | 44 | ||
| 45 | + pageTransition() { | ||
| 46 | + PageTransitionEnter({ type: RouteType.None, duration: 0 }) | ||
| 47 | + PageTransitionExit({ type: RouteType.None, duration: 0 }) | ||
| 48 | + } | ||
| 49 | + | ||
| 47 | aboutToDisappear() { | 50 | aboutToDisappear() { |
| 48 | this.breakpointSystem.unregister() | 51 | this.breakpointSystem.unregister() |
| 49 | Logger.info(TAG, 'aboutToDisappear'); | 52 | Logger.info(TAG, 'aboutToDisappear'); |
-
Please register or login to post a comment