Showing
6 changed files
with
59 additions
and
32 deletions
| @@ -13,6 +13,7 @@ export struct WdWebComponent { | @@ -13,6 +13,7 @@ export struct WdWebComponent { | ||
| 13 | @Prop backVisibility: boolean = false | 13 | @Prop backVisibility: boolean = false |
| 14 | @Prop webUrl: string = '' | 14 | @Prop webUrl: string = '' |
| 15 | @Prop @Watch('onReloadStateChanged') reload: number = 0 | 15 | @Prop @Watch('onReloadStateChanged') reload: number = 0 |
| 16 | + @Link isPageEnd: boolean | ||
| 16 | 17 | ||
| 17 | build() { | 18 | build() { |
| 18 | Column() { | 19 | Column() { |
| @@ -37,7 +38,6 @@ export struct WdWebComponent { | @@ -37,7 +38,6 @@ export struct WdWebComponent { | ||
| 37 | .horizontalScrollBarAccess(false) | 38 | .horizontalScrollBarAccess(false) |
| 38 | .verticalScrollBarAccess(false) | 39 | .verticalScrollBarAccess(false) |
| 39 | .onPageBegin((event) => { | 40 | .onPageBegin((event) => { |
| 40 | - console.log(this.webUrl,"yzl") | ||
| 41 | this.onPageBegin(event?.url); | 41 | this.onPageBegin(event?.url); |
| 42 | }) | 42 | }) |
| 43 | .onPageEnd((event) => { | 43 | .onPageEnd((event) => { |
| @@ -86,18 +86,19 @@ export struct WdWebComponent { | @@ -86,18 +86,19 @@ export struct WdWebComponent { | ||
| 86 | BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | 86 | BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) |
| 87 | } | 87 | } |
| 88 | onPageEnd: (url?: string) => void = () => { | 88 | onPageEnd: (url?: string) => void = () => { |
| 89 | + this.isPageEnd = true | ||
| 89 | Logger.debug(TAG, 'onPageEnd'); | 90 | Logger.debug(TAG, 'onPageEnd'); |
| 90 | } | 91 | } |
| 91 | onLoadIntercept: (url?: string) => boolean = () => { | 92 | onLoadIntercept: (url?: string) => boolean = () => { |
| 92 | Logger.debug(TAG, 'onLoadIntercept return false'); | 93 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 93 | return false | 94 | return false |
| 94 | } | 95 | } |
| 96 | + | ||
| 95 | onReloadStateChanged() { | 97 | onReloadStateChanged() { |
| 96 | Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | 98 | Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); |
| 97 | if (this.reload > 0) { | 99 | if (this.reload > 0) { |
| 98 | this.webviewControl.refresh() | 100 | this.webviewControl.refresh() |
| 99 | } | 101 | } |
| 100 | } | 102 | } |
| 101 | - | ||
| 102 | } | 103 | } |
| 103 | 104 |
| @@ -17,6 +17,7 @@ export struct WdWebLocalComponent { | @@ -17,6 +17,7 @@ export struct WdWebLocalComponent { | ||
| 17 | @Prop backVisibility: boolean = false | 17 | @Prop backVisibility: boolean = false |
| 18 | @Prop webResource: Resource = {} as Resource | 18 | @Prop webResource: Resource = {} as Resource |
| 19 | @State webHeight: string | number = '100%' | 19 | @State webHeight: string | number = '100%' |
| 20 | + @Link isPageEnd: boolean | ||
| 20 | 21 | ||
| 21 | build() { | 22 | build() { |
| 22 | Column() { | 23 | Column() { |
| @@ -109,6 +110,7 @@ export struct WdWebLocalComponent { | @@ -109,6 +110,7 @@ export struct WdWebLocalComponent { | ||
| 109 | onPageEnd: (url?: string) => void = () => { | 110 | onPageEnd: (url?: string) => void = () => { |
| 110 | Logger.debug(TAG, 'onPageEnd'); | 111 | Logger.debug(TAG, 'onPageEnd'); |
| 111 | this.onWebPrepared() | 112 | this.onWebPrepared() |
| 113 | + this.isPageEnd = true | ||
| 112 | } | 114 | } |
| 113 | onLoadIntercept: (url?: string) => boolean = () => { | 115 | onLoadIntercept: (url?: string) => boolean = () => { |
| 114 | Logger.debug(TAG, 'onLoadIntercept return false'); | 116 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| @@ -19,6 +19,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | @@ -19,6 +19,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 19 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 19 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 20 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 20 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 21 | import { PageRepository } from '../repository/PageRepository'; | 21 | import { PageRepository } from '../repository/PageRepository'; |
| 22 | +import { detailedSkeleton } from './skeleton/detailSkeleton' | ||
| 22 | 23 | ||
| 23 | const TAG = 'ImageAndTextPageComponent' | 24 | const TAG = 'ImageAndTextPageComponent' |
| 24 | 25 | ||
| @@ -30,41 +31,49 @@ export struct ImageAndTextPageComponent { | @@ -30,41 +31,49 @@ export struct ImageAndTextPageComponent { | ||
| 30 | @State recommendList: ContentDTO[] = [] | 31 | @State recommendList: ContentDTO[] = [] |
| 31 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 32 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 32 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 33 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 34 | + @State isPageEnd: boolean = false | ||
| 35 | + | ||
| 33 | build() { | 36 | build() { |
| 34 | Column() { | 37 | Column() { |
| 35 | - // 发布时间 | ||
| 36 | - Row() { | ||
| 37 | - Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 38 | - .width(70) | ||
| 39 | - .height(28) | ||
| 40 | - Text(this.contentDetailData[0]?.publishTime) | ||
| 41 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 42 | - .fontSize($r('app.float.font_size_13')) | ||
| 43 | - .height('100%') | ||
| 44 | - .align(Alignment.End) | ||
| 45 | - } | ||
| 46 | - .width(CommonConstants.FULL_WIDTH) | ||
| 47 | - .height(32) | ||
| 48 | - .padding({ left: 15, right: 15, }) | ||
| 49 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 50 | - .backgroundColor(Color.White) | 38 | + if (!this.isPageEnd) { |
| 39 | + detailedSkeleton() | ||
| 40 | + } else { | ||
| 41 | + // 发布时间 | ||
| 42 | + Row() { | ||
| 43 | + Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 44 | + .width(70) | ||
| 45 | + .height(28) | ||
| 46 | + Text(this.contentDetailData[0]?.publishTime) | ||
| 47 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 48 | + .fontSize($r('app.float.font_size_13')) | ||
| 49 | + .height('100%') | ||
| 50 | + .align(Alignment.End) | ||
| 51 | + } | ||
| 52 | + .width(CommonConstants.FULL_WIDTH) | ||
| 53 | + .height(32) | ||
| 54 | + .padding({ left: 15, right: 15, }) | ||
| 55 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 56 | + .backgroundColor(Color.White) | ||
| 51 | 57 | ||
| 52 | - Row() { | ||
| 53 | - Image($r('app.media.line')) | ||
| 54 | - .width('100%') | ||
| 55 | - .height(6) | ||
| 56 | - .objectFit(ImageFit.Cover) | ||
| 57 | - .margin({ top: 10 }) | 58 | + Row() { |
| 59 | + Image($r('app.media.line')) | ||
| 60 | + .width('100%') | ||
| 61 | + .height(6) | ||
| 62 | + .objectFit(ImageFit.Cover) | ||
| 63 | + .margin({ top: 10 }) | ||
| 64 | + } | ||
| 65 | + .padding({ left: 15, right: 15 }) | ||
| 66 | + .backgroundColor(Color.White) | ||
| 58 | } | 67 | } |
| 59 | - .padding({ left: 15, right: 15 }) | ||
| 60 | - .backgroundColor(Color.White) | 68 | + |
| 61 | 69 | ||
| 62 | Stack({ alignContent: Alignment.Bottom }) { | 70 | Stack({ alignContent: Alignment.Bottom }) { |
| 63 | Scroll(this.scroller) { | 71 | Scroll(this.scroller) { |
| 64 | Column() { | 72 | Column() { |
| 65 | ImageAndTextWebComponent({ | 73 | ImageAndTextWebComponent({ |
| 66 | contentDetailData: this.contentDetailData, | 74 | contentDetailData: this.contentDetailData, |
| 67 | - action: this.action | 75 | + action: this.action, |
| 76 | + isPageEnd: $isPageEnd | ||
| 68 | }) | 77 | }) |
| 69 | Column() { | 78 | Column() { |
| 70 | if (this.recommendList.length > 0) { | 79 | if (this.recommendList.length > 0) { |
| @@ -77,6 +86,7 @@ export struct ImageAndTextPageComponent { | @@ -77,6 +86,7 @@ export struct ImageAndTextPageComponent { | ||
| 77 | .width(CommonConstants.FULL_WIDTH) | 86 | .width(CommonConstants.FULL_WIDTH) |
| 78 | .height(CommonConstants.FULL_HEIGHT) | 87 | .height(CommonConstants.FULL_HEIGHT) |
| 79 | .padding({ bottom: 76 }) | 88 | .padding({ bottom: 76 }) |
| 89 | + | ||
| 80 | // .scrollBar(BarState.Off) | 90 | // .scrollBar(BarState.Off) |
| 81 | 91 | ||
| 82 | //底部交互区 | 92 | //底部交互区 |
| @@ -15,6 +15,7 @@ import { BridgeWebViewControl } from 'wdJsBridge/Index'; | @@ -15,6 +15,7 @@ import { BridgeWebViewControl } from 'wdJsBridge/Index'; | ||
| 15 | export struct ImageAndTextWebComponent { | 15 | export struct ImageAndTextWebComponent { |
| 16 | action: Action = {} as Action | 16 | action: Action = {} as Action |
| 17 | @State reload: number = 0; | 17 | @State reload: number = 0; |
| 18 | + @Link isPageEnd: boolean | ||
| 18 | @Prop @Watch('onDetailDataUpdated') contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] | 19 | @Prop @Watch('onDetailDataUpdated') contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] |
| 19 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 20 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 20 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 21 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| @@ -84,7 +85,9 @@ export struct ImageAndTextWebComponent { | @@ -84,7 +85,9 @@ export struct ImageAndTextWebComponent { | ||
| 84 | webviewControl: this.webviewControl, | 85 | webviewControl: this.webviewControl, |
| 85 | webResource: $rawfile('apph5/index.html'), | 86 | webResource: $rawfile('apph5/index.html'), |
| 86 | backVisibility: false, | 87 | backVisibility: false, |
| 87 | - onWebPrepared: this.onWebPrepared.bind(this) | 88 | + onWebPrepared: this.onWebPrepared.bind(this), |
| 89 | + isPageEnd:$isPageEnd | ||
| 90 | + | ||
| 88 | }) | 91 | }) |
| 89 | } | 92 | } |
| 90 | } | 93 | } |
| @@ -4,6 +4,7 @@ import { WdWebComponent } from 'wdWebComponent'; | @@ -4,6 +4,7 @@ import { WdWebComponent } from 'wdWebComponent'; | ||
| 4 | import router from '@ohos.router'; | 4 | import router from '@ohos.router'; |
| 5 | import { CommonConstants } from 'wdConstant' | 5 | import { CommonConstants } from 'wdConstant' |
| 6 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; | 6 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; |
| 7 | +import { detailedSkeleton } from './skeleton/detailSkeleton' | ||
| 7 | 8 | ||
| 8 | const TAG = 'SpacialTopicPageComponent' | 9 | const TAG = 'SpacialTopicPageComponent' |
| 9 | 10 | ||
| @@ -13,14 +14,20 @@ export struct SpacialTopicPageComponent { | @@ -13,14 +14,20 @@ export struct SpacialTopicPageComponent { | ||
| 13 | scroller: Scroller = new Scroller(); | 14 | scroller: Scroller = new Scroller(); |
| 14 | action: Action = {} as Action | 15 | action: Action = {} as Action |
| 15 | @State webUrl: string = ''; | 16 | @State webUrl: string = ''; |
| 17 | + @State isPageEnd: boolean = false | ||
| 18 | + | ||
| 16 | build() { | 19 | build() { |
| 17 | Column() { | 20 | Column() { |
| 21 | + if (!this.isPageEnd) { | ||
| 22 | + detailedSkeleton() | ||
| 23 | + } | ||
| 18 | Stack({ alignContent: Alignment.Bottom }) { | 24 | Stack({ alignContent: Alignment.Bottom }) { |
| 19 | Column() { | 25 | Column() { |
| 20 | WdWebComponent({ | 26 | WdWebComponent({ |
| 21 | webviewControl: this.webviewControl, | 27 | webviewControl: this.webviewControl, |
| 22 | webUrl: this.webUrl, | 28 | webUrl: this.webUrl, |
| 23 | backVisibility: false, | 29 | backVisibility: false, |
| 30 | + isPageEnd:$isPageEnd | ||
| 24 | }) | 31 | }) |
| 25 | } | 32 | } |
| 26 | .padding({ bottom: 56 }) | 33 | .padding({ bottom: 56 }) |
| @@ -64,6 +71,8 @@ export struct SpacialTopicPageComponent { | @@ -64,6 +71,8 @@ export struct SpacialTopicPageComponent { | ||
| 64 | .padding({ left: 15, right: 15, bottom: 20, top: 20 }) | 71 | .padding({ left: 15, right: 15, bottom: 20, top: 20 }) |
| 65 | .justifyContent(FlexAlign.SpaceBetween) | 72 | .justifyContent(FlexAlign.SpaceBetween) |
| 66 | .backgroundColor(Color.White) | 73 | .backgroundColor(Color.White) |
| 74 | + | ||
| 75 | + | ||
| 67 | } | 76 | } |
| 68 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 77 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 69 | .backgroundColor(Color.White) | 78 | .backgroundColor(Color.White) |
| @@ -13,6 +13,7 @@ import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | @@ -13,6 +13,7 @@ import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | ||
| 13 | import { CompParser } from '../CompParser'; | 13 | import { CompParser } from '../CompParser'; |
| 14 | import { CompDTO } from 'wdBean'; | 14 | import { CompDTO } from 'wdBean'; |
| 15 | import PageHelper from '../../viewmodel/PageHelper'; | 15 | import PageHelper from '../../viewmodel/PageHelper'; |
| 16 | +import { channelSkeleton } from '../skeleton/channelSkeleton' | ||
| 16 | 17 | ||
| 17 | const TAG = 'PageComponent'; | 18 | const TAG = 'PageComponent'; |
| 18 | 19 | ||
| @@ -97,10 +98,11 @@ export struct PageComponent { | @@ -97,10 +98,11 @@ export struct PageComponent { | ||
| 97 | 98 | ||
| 98 | @Builder | 99 | @Builder |
| 99 | LoadingLayout() { | 100 | LoadingLayout() { |
| 100 | - CustomRefreshLoadLayout({ | ||
| 101 | - refreshBean: new RefreshLayoutBean(true, | ||
| 102 | - $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight) | ||
| 103 | - }) | 101 | + channelSkeleton() |
| 102 | + // CustomRefreshLoadLayout({ | ||
| 103 | + // refreshBean: new RefreshLayoutBean(true, | ||
| 104 | + // $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight) | ||
| 105 | + // }) | ||
| 104 | } | 106 | } |
| 105 | 107 | ||
| 106 | async aboutToAppear() { | 108 | async aboutToAppear() { |
-
Please register or login to post a comment