Showing
2 changed files
with
22 additions
and
7 deletions
| @@ -60,10 +60,11 @@ export struct ENewspaperPageComponent { | @@ -60,10 +60,11 @@ export struct ENewspaperPageComponent { | ||
| 60 | //watch监听报纸页码回调 | 60 | //watch监听报纸页码回调 |
| 61 | onCurrentPageNumUpdated(): void { | 61 | onCurrentPageNumUpdated(): void { |
| 62 | console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) | 62 | console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) |
| 63 | - let _swiperIndex = Number.parseInt(this.currentPageNum) | ||
| 64 | - console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "_swiperIndex:", _swiperIndex) | ||
| 65 | - this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex | 63 | + // let _swiperIndex = Number.parseInt(this.currentPageNum) |
| 64 | + // console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "_swiperIndex:", _swiperIndex) | ||
| 65 | + // this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex | ||
| 66 | 66 | ||
| 67 | + this.swiperIndex = this.newspaperListBean?.list.findIndex(_item => _item?.pageNum === this.currentPageNum) | ||
| 67 | //电子报--版面序号选择点击 | 68 | //电子报--版面序号选择点击 |
| 68 | TrackingContent.clickWithEvent('panel_number_selection_click', TrackConstants.PageName.NewsPaperPage, | 69 | TrackingContent.clickWithEvent('panel_number_selection_click', TrackConstants.PageName.NewsPaperPage, |
| 69 | TrackConstants.PageName.NewsPaperPage | 70 | TrackConstants.PageName.NewsPaperPage |
| @@ -140,7 +141,8 @@ export struct ENewspaperPageComponent { | @@ -140,7 +141,8 @@ export struct ENewspaperPageComponent { | ||
| 140 | let screenHeight = this.displayTool.height; | 141 | let screenHeight = this.displayTool.height; |
| 141 | // bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度 | 142 | // bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度 |
| 142 | // newspaper_shadow 49 高度 e_newspaper_content 59 margin top | 143 | // newspaper_shadow 49 高度 e_newspaper_content 59 margin top |
| 143 | - let height = screenHeight - this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60) - vp2px(49) -vp2px(59) | 144 | + let height = |
| 145 | + screenHeight - this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60) - vp2px(49) - vp2px(59) | ||
| 144 | this.picHeight = height | 146 | this.picHeight = height |
| 145 | 147 | ||
| 146 | let ratio = this.ratio == '100%' ? 1 : 0.5 | 148 | let ratio = this.ratio == '100%' ? 1 : 0.5 |
| @@ -176,6 +178,7 @@ export struct ENewspaperPageComponent { | @@ -176,6 +178,7 @@ export struct ENewspaperPageComponent { | ||
| 176 | this.resize() | 178 | this.resize() |
| 177 | }); | 179 | }); |
| 178 | } | 180 | } |
| 181 | + | ||
| 179 | resize() { | 182 | resize() { |
| 180 | this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width | 183 | this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width |
| 181 | // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件 | 184 | // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件 |
| @@ -48,6 +48,9 @@ export struct ENewspaperListDialog { | @@ -48,6 +48,9 @@ export struct ENewspaperListDialog { | ||
| 48 | @State topHeight: number = 124 | 48 | @State topHeight: number = 124 |
| 49 | private deviceHeight: number = 0 | 49 | private deviceHeight: number = 0 |
| 50 | 50 | ||
| 51 | + | ||
| 52 | + selectPageNum : boolean = true | ||
| 53 | + | ||
| 51 | //watch监听报纸页码回调 | 54 | //watch监听报纸页码回调 |
| 52 | onCurrentPageNumUpdated(): void { | 55 | onCurrentPageNumUpdated(): void { |
| 53 | // console.log(TAG, "onCurrentPageNumUpdated currentPageNum:", this.currentPageNum) | 56 | // console.log(TAG, "onCurrentPageNumUpdated currentPageNum:", this.currentPageNum) |
| @@ -56,6 +59,8 @@ export struct ENewspaperListDialog { | @@ -56,6 +59,8 @@ export struct ENewspaperListDialog { | ||
| 56 | // let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex | 59 | // let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex |
| 57 | 60 | ||
| 58 | if (this.newspaperListBean != undefined) { | 61 | if (this.newspaperListBean != undefined) { |
| 62 | + | ||
| 63 | + this.selectPageNum = false | ||
| 59 | // 从业务数据中找到编号 | 64 | // 从业务数据中找到编号 |
| 60 | let scrollIndexEnd = this.newspaperListBean?.list.findIndex(_item => _item?.pageNum === this.currentPageNum) | 65 | let scrollIndexEnd = this.newspaperListBean?.list.findIndex(_item => _item?.pageNum === this.currentPageNum) |
| 61 | 66 | ||
| @@ -82,10 +87,12 @@ export struct ENewspaperListDialog { | @@ -82,10 +87,12 @@ export struct ENewspaperListDialog { | ||
| 82 | 87 | ||
| 83 | this.isCurrentViewOpen = true | 88 | this.isCurrentViewOpen = true |
| 84 | console.log(TAG, "aboutToAppear currentPageNum:", this.currentPageNum) | 89 | console.log(TAG, "aboutToAppear currentPageNum:", this.currentPageNum) |
| 85 | - let _scrollIndex = Number.parseInt(this.currentPageNum) | ||
| 86 | - console.log(TAG, "aboutToAppear _scrollIndex:", _scrollIndex) | ||
| 87 | - this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex | 90 | + // let _scrollIndex = Number.parseInt(this.currentPageNum) |
| 91 | + // console.log(TAG, "aboutToAppear _scrollIndex:", _scrollIndex) | ||
| 92 | + // this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex | ||
| 88 | // this.listScroller.scrollToIndex(this.scrollIndex) | 93 | // this.listScroller.scrollToIndex(this.scrollIndex) |
| 94 | + | ||
| 95 | + this.scrollIndex = this.newspaperListBean?.list.findIndex(_item => _item?.pageNum === this.currentPageNum) | ||
| 89 | } | 96 | } |
| 90 | 97 | ||
| 91 | aboutToDisappear() { | 98 | aboutToDisappear() { |
| @@ -292,9 +299,14 @@ export struct ENewspaperListDialog { | @@ -292,9 +299,14 @@ export struct ENewspaperListDialog { | ||
| 292 | 299 | ||
| 293 | // this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}` | 300 | // this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}` |
| 294 | 301 | ||
| 302 | + if(this.selectPageNum){ | ||
| 295 | if (this.newspaperListBean != undefined) { | 303 | if (this.newspaperListBean != undefined) { |
| 296 | this.currentPageNum = this.newspaperListBean?.list[lastIndex].pageNum | 304 | this.currentPageNum = this.newspaperListBean?.list[lastIndex].pageNum |
| 297 | } | 305 | } |
| 306 | + }else { | ||
| 307 | + this.selectPageNum = true | ||
| 308 | + } | ||
| 309 | + | ||
| 298 | 310 | ||
| 299 | }) | 311 | }) |
| 300 | } | 312 | } |
-
Please register or login to post a comment