Showing
4 changed files
with
25 additions
and
12 deletions
| @@ -296,13 +296,13 @@ export struct ENewspaperPageComponent { | @@ -296,13 +296,13 @@ export struct ENewspaperPageComponent { | ||
| 296 | Row() { | 296 | Row() { |
| 297 | Image($r('app.media.newspaper_shadow')) | 297 | Image($r('app.media.newspaper_shadow')) |
| 298 | .height($r('app.float.vp_12')) | 298 | .height($r('app.float.vp_12')) |
| 299 | - .width('100%') | 299 | + .width(px2vp(this.picWidth)) |
| 300 | .objectFit(ImageFit.Contain) | 300 | .objectFit(ImageFit.Contain) |
| 301 | 301 | ||
| 302 | - }.margin({ top: -1,left: 10, right: 10 }).alignRules({ | 302 | + }.margin({ top: -1 }).alignRules({ |
| 303 | top: { anchor: "e_newspaper_content", align: VerticalAlign.Bottom }, | 303 | top: { anchor: "e_newspaper_content", align: VerticalAlign.Bottom }, |
| 304 | - // left: { anchor: 'e_newspaper_content', align: HorizontalAlign.Start }, | ||
| 305 | - // right: { anchor: 'e_newspaper_content', align: HorizontalAlign.End } | 304 | + left: { anchor: 'e_newspaper_content', align: HorizontalAlign.Start }, |
| 305 | + right: { anchor: 'e_newspaper_content', align: HorizontalAlign.End } | ||
| 306 | }) | 306 | }) |
| 307 | .id('e_newspaper_shadow') | 307 | .id('e_newspaper_shadow') |
| 308 | 308 |
| @@ -122,7 +122,6 @@ export default struct TemplatePageComponent { | @@ -122,7 +122,6 @@ export default struct TemplatePageComponent { | ||
| 122 | LazyForEach(this.templatePage.compList, (compDTO: CompDTO, index: number) => { | 122 | LazyForEach(this.templatePage.compList, (compDTO: CompDTO, index: number) => { |
| 123 | ListItem() { | 123 | ListItem() { |
| 124 | Column() { | 124 | Column() { |
| 125 | - | ||
| 126 | CompParser({ | 125 | CompParser({ |
| 127 | compDTO: compDTO, | 126 | compDTO: compDTO, |
| 128 | nextCompDTO: index === this.templatePage.compList.getDataArray().length - 1 ? new CompDTO() : this.templatePage.compList.get(index + 1) as CompDTO, | 127 | nextCompDTO: index === this.templatePage.compList.getDataArray().length - 1 ? new CompDTO() : this.templatePage.compList.get(index + 1) as CompDTO, |
| @@ -4,7 +4,7 @@ import { WDRouterRule } from 'wdRouter/Index' | @@ -4,7 +4,7 @@ import { WDRouterRule } from 'wdRouter/Index' | ||
| 4 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog' | 4 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog' |
| 5 | import { Logger } from 'wdKit'; | 5 | import { Logger } from 'wdKit'; |
| 6 | import { font, window } from '@kit.ArkUI'; | 6 | import { font, window } from '@kit.ArkUI'; |
| 7 | - | 7 | +const TAG: string = 'ENewspaperListDialog'; |
| 8 | /** | 8 | /** |
| 9 | * 读报纸半屏弹窗 | 9 | * 读报纸半屏弹窗 |
| 10 | * 弹窗嵌套参考资料(https://developer.harmonyos.com/cn/docs/documentation/doc-references-V2/ts-methods-custom-dialog-box-0000001580345722-V2) | 10 | * 弹窗嵌套参考资料(https://developer.harmonyos.com/cn/docs/documentation/doc-references-V2/ts-methods-custom-dialog-box-0000001580345722-V2) |
| @@ -19,12 +19,16 @@ export struct ENewspaperListDialog { | @@ -19,12 +19,16 @@ export struct ENewspaperListDialog { | ||
| 19 | @State scrollOffset: number = 0 | 19 | @State scrollOffset: number = 0 |
| 20 | @State isCurrentViewOpen: boolean = false | 20 | @State isCurrentViewOpen: boolean = false |
| 21 | @Consume bottomSafeHeight:number | 21 | @Consume bottomSafeHeight:number |
| 22 | + | ||
| 23 | + firstFlag : boolean = true | ||
| 22 | //文字版选择弹框 | 24 | //文字版选择弹框 |
| 23 | pageListDialogController: CustomDialogController = new CustomDialogController({ | 25 | pageListDialogController: CustomDialogController = new CustomDialogController({ |
| 24 | builder: ENewspaperPageDialog({ | 26 | builder: ENewspaperPageDialog({ |
| 25 | dialogType: 1, | 27 | dialogType: 1, |
| 26 | newspaperListBean: this.newspaperListBean, | 28 | newspaperListBean: this.newspaperListBean, |
| 27 | dialogVisibility: (visibility: boolean) => { | 29 | dialogVisibility: (visibility: boolean) => { |
| 30 | + | ||
| 31 | + console.log(TAG, "ENewspaperPageDialog visibility:", visibility) | ||
| 28 | this.isCurrentViewOpen = !visibility | 32 | this.isCurrentViewOpen = !visibility |
| 29 | } | 33 | } |
| 30 | }), | 34 | }), |
| @@ -47,10 +51,15 @@ export struct ENewspaperListDialog { | @@ -47,10 +51,15 @@ export struct ENewspaperListDialog { | ||
| 47 | 51 | ||
| 48 | //watch监听报纸页码回调 | 52 | //watch监听报纸页码回调 |
| 49 | onCurrentPageNumUpdated(): void { | 53 | onCurrentPageNumUpdated(): void { |
| 50 | - console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) | 54 | + this.firstFlag = false |
| 55 | + console.log(TAG, "onCurrentPageNumUpdated currentPageNum:", this.currentPageNum) | ||
| 51 | let _scrollIndex = Number.parseInt(this.currentPageNum) | 56 | let _scrollIndex = Number.parseInt(this.currentPageNum) |
| 52 | - console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_scrollIndex:", _scrollIndex) | 57 | + console.log(TAG, "onCurrentPageNumUpdated _scrollIndex:", _scrollIndex) |
| 53 | let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex | 58 | let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex |
| 59 | + | ||
| 60 | + console.log(TAG, "onCurrentPageNumUpdated scrollIndexEnd:", scrollIndexEnd) | ||
| 61 | + | ||
| 62 | + console.log(TAG, "onCurrentPageNumUpdated (!this.isCurrentViewOpen):", ""+!this.isCurrentViewOpen) | ||
| 54 | if (!this.isCurrentViewOpen) { | 63 | if (!this.isCurrentViewOpen) { |
| 55 | this.listScroller.scrollToIndex(scrollIndexEnd) | 64 | this.listScroller.scrollToIndex(scrollIndexEnd) |
| 56 | } | 65 | } |
| @@ -69,9 +78,9 @@ export struct ENewspaperListDialog { | @@ -69,9 +78,9 @@ export struct ENewspaperListDialog { | ||
| 69 | this.deviceHeight = px2vp(windowClass.getWindowProperties().windowRect.height) - changeHeight | 78 | this.deviceHeight = px2vp(windowClass.getWindowProperties().windowRect.height) - changeHeight |
| 70 | 79 | ||
| 71 | this.isCurrentViewOpen = true | 80 | this.isCurrentViewOpen = true |
| 72 | - console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum) | 81 | + console.log(TAG, "aboutToAppear currentPageNum:", this.currentPageNum) |
| 73 | let _scrollIndex = Number.parseInt(this.currentPageNum) | 82 | let _scrollIndex = Number.parseInt(this.currentPageNum) |
| 74 | - console.log("ENewspaperListDialog-aboutToAppear", "_scrollIndex:", _scrollIndex) | 83 | + console.log(TAG, "aboutToAppear _scrollIndex:", _scrollIndex) |
| 75 | this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex | 84 | this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex |
| 76 | // this.listScroller.scrollToIndex(this.scrollIndex) | 85 | // this.listScroller.scrollToIndex(this.scrollIndex) |
| 77 | } | 86 | } |
| @@ -285,7 +294,12 @@ export struct ENewspaperListDialog { | @@ -285,7 +294,12 @@ export struct ENewspaperListDialog { | ||
| 285 | // } | 294 | // } |
| 286 | // console.info(`this.scrollOffset:` + this.scrollOffset) | 295 | // console.info(`this.scrollOffset:` + this.scrollOffset) |
| 287 | // if (this.scrollOffset == 0) { | 296 | // if (this.scrollOffset == 0) { |
| 288 | - this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}` | 297 | + if(this.firstFlag){ |
| 298 | + this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}` | ||
| 299 | + }else { | ||
| 300 | + this.firstFlag = true | ||
| 301 | + } | ||
| 302 | + | ||
| 289 | // } | 303 | // } |
| 290 | }) | 304 | }) |
| 291 | } | 305 | } |
| @@ -12,7 +12,7 @@ export struct ENewspaperPageDialog { | @@ -12,7 +12,7 @@ export struct ENewspaperPageDialog { | ||
| 12 | public dialogVisibility?: (visibility: boolean) => void | 12 | public dialogVisibility?: (visibility: boolean) => void |
| 13 | 13 | ||
| 14 | onCurrentPageNumUpdated(): void { | 14 | onCurrentPageNumUpdated(): void { |
| 15 | - console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) | 15 | + console.log('ENewspaperListDialog',"ENewspaperPageDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | aboutToAppear(): void { | 18 | aboutToAppear(): void { |
-
Please register or login to post a comment