liyubing

fix:1)电子报-电子报最后一版进入读报纸列表后_未展示该版内容

... ... @@ -122,7 +122,6 @@ export default struct TemplatePageComponent {
LazyForEach(this.templatePage.compList, (compDTO: CompDTO, index: number) => {
ListItem() {
Column() {
CompParser({
compDTO: compDTO,
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'
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'
import { Logger } from 'wdKit';
import { font, window } from '@kit.ArkUI';
const TAG: string = 'ENewspaperListDialog';
/**
* 读报纸半屏弹窗
* 弹窗嵌套参考资料(https://developer.harmonyos.com/cn/docs/documentation/doc-references-V2/ts-methods-custom-dialog-box-0000001580345722-V2)
... ... @@ -19,12 +19,16 @@ export struct ENewspaperListDialog {
@State scrollOffset: number = 0
@State isCurrentViewOpen: boolean = false
@Consume bottomSafeHeight:number
firstFlag : boolean = true
//文字版选择弹框
pageListDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperPageDialog({
dialogType: 1,
newspaperListBean: this.newspaperListBean,
dialogVisibility: (visibility: boolean) => {
console.log(TAG, "ENewspaperPageDialog visibility:", visibility)
this.isCurrentViewOpen = !visibility
}
}),
... ... @@ -47,10 +51,15 @@ export struct ENewspaperListDialog {
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
this.firstFlag = false
console.log(TAG, "onCurrentPageNumUpdated currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_scrollIndex:", _scrollIndex)
console.log(TAG, "onCurrentPageNumUpdated _scrollIndex:", _scrollIndex)
let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
console.log(TAG, "onCurrentPageNumUpdated scrollIndexEnd:", scrollIndexEnd)
console.log(TAG, "onCurrentPageNumUpdated (!this.isCurrentViewOpen):", ""+!this.isCurrentViewOpen)
if (!this.isCurrentViewOpen) {
this.listScroller.scrollToIndex(scrollIndexEnd)
}
... ... @@ -69,9 +78,9 @@ export struct ENewspaperListDialog {
this.deviceHeight = px2vp(windowClass.getWindowProperties().windowRect.height) - changeHeight
this.isCurrentViewOpen = true
console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum)
console.log(TAG, "aboutToAppear currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperListDialog-aboutToAppear", "_scrollIndex:", _scrollIndex)
console.log(TAG, "aboutToAppear _scrollIndex:", _scrollIndex)
this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
// this.listScroller.scrollToIndex(this.scrollIndex)
}
... ... @@ -285,7 +294,12 @@ export struct ENewspaperListDialog {
// }
// console.info(`this.scrollOffset:` + this.scrollOffset)
// if (this.scrollOffset == 0) {
this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}`
if(this.firstFlag){
this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}`
}else {
this.firstFlag = true
}
// }
})
}
... ...
... ... @@ -12,7 +12,7 @@ export struct ENewspaperPageDialog {
public dialogVisibility?: (visibility: boolean) => void
onCurrentPageNumUpdated(): void {
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
console.log('ENewspaperListDialog',"ENewspaperPageDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
}
aboutToAppear(): void {
... ...