Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
10 changed files
with
273 additions
and
169 deletions
| @@ -15,6 +15,7 @@ export struct WdWebComponent { | @@ -15,6 +15,7 @@ export struct WdWebComponent { | ||
| 15 | onWebPrepared: () => void = () => { | 15 | onWebPrepared: () => void = () => { |
| 16 | } | 16 | } |
| 17 | @Prop webUrl: string = '' | 17 | @Prop webUrl: string = '' |
| 18 | + @Prop @Watch('onReloadStateChanged') reload: number = 0 | ||
| 18 | @Link isPageEnd: boolean | 19 | @Link isPageEnd: boolean |
| 19 | 20 | ||
| 20 | build() { | 21 | build() { |
| @@ -87,5 +88,11 @@ export struct WdWebComponent { | @@ -87,5 +88,11 @@ export struct WdWebComponent { | ||
| 87 | Logger.debug(TAG, 'onLoadIntercept return false'); | 88 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 88 | return false | 89 | return false |
| 89 | } | 90 | } |
| 91 | + onReloadStateChanged() { | ||
| 92 | + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | ||
| 93 | + if (this.reload > 0) { | ||
| 94 | + this.webviewControl.refresh() | ||
| 95 | + } | ||
| 96 | + } | ||
| 90 | } | 97 | } |
| 91 | 98 |
| @@ -15,6 +15,7 @@ export struct WdWebLocalComponent { | @@ -15,6 +15,7 @@ export struct WdWebLocalComponent { | ||
| 15 | } | 15 | } |
| 16 | @Prop backVisibility: boolean = false | 16 | @Prop backVisibility: boolean = false |
| 17 | @Prop webResource: Resource = {} as Resource | 17 | @Prop webResource: Resource = {} as Resource |
| 18 | + @Prop @Watch('onReloadStateChanged') reload: number = 0 | ||
| 18 | @State webHeight: string | number = '100%' | 19 | @State webHeight: string | number = '100%' |
| 19 | @Link isPageEnd: boolean | 20 | @Link isPageEnd: boolean |
| 20 | @State videoUrl: string = '' | 21 | @State videoUrl: string = '' |
| @@ -240,5 +241,11 @@ export struct WdWebLocalComponent { | @@ -240,5 +241,11 @@ export struct WdWebLocalComponent { | ||
| 240 | Logger.debug(TAG, 'onLoadIntercept return false'); | 241 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 241 | return false | 242 | return false |
| 242 | } | 243 | } |
| 244 | + onReloadStateChanged() { | ||
| 245 | + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | ||
| 246 | + if (this.reload > 0) { | ||
| 247 | + this.webviewControl.refresh() | ||
| 248 | + } | ||
| 249 | + } | ||
| 243 | } | 250 | } |
| 244 | 251 |
| @@ -95,6 +95,7 @@ export struct ImageAndTextWebComponent { | @@ -95,6 +95,7 @@ export struct ImageAndTextWebComponent { | ||
| 95 | Column() { | 95 | Column() { |
| 96 | WdWebLocalComponent({ | 96 | WdWebLocalComponent({ |
| 97 | webviewControl: this.webviewControl, | 97 | webviewControl: this.webviewControl, |
| 98 | + reload:this.reload, | ||
| 98 | webResource: $rawfile('apph5/index.html'), | 99 | webResource: $rawfile('apph5/index.html'), |
| 99 | backVisibility: false, | 100 | backVisibility: false, |
| 100 | onWebPrepared: this.onWebPrepared.bind(this), | 101 | onWebPrepared: this.onWebPrepared.bind(this), |
| @@ -20,6 +20,7 @@ export struct SpacialTopicPageComponent { | @@ -20,6 +20,7 @@ export struct SpacialTopicPageComponent { | ||
| 20 | action: Action = {} as Action | 20 | action: Action = {} as Action |
| 21 | @State webUrl: string = ''; | 21 | @State webUrl: string = ''; |
| 22 | @State isPageEnd: boolean = false | 22 | @State isPageEnd: boolean = false |
| 23 | + @State reload: number = 0; | ||
| 23 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 24 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 24 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 25 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 25 | private webPrepared = false; | 26 | private webPrepared = false; |
| @@ -101,6 +102,7 @@ export struct SpacialTopicPageComponent { | @@ -101,6 +102,7 @@ export struct SpacialTopicPageComponent { | ||
| 101 | WdWebComponent({ | 102 | WdWebComponent({ |
| 102 | webviewControl: this.webviewControl, | 103 | webviewControl: this.webviewControl, |
| 103 | webUrl: this.webUrl, | 104 | webUrl: this.webUrl, |
| 105 | + reload: this.reload, | ||
| 104 | onWebPrepared: this.onWebPrepared.bind(this), | 106 | onWebPrepared: this.onWebPrepared.bind(this), |
| 105 | isPageEnd: $isPageEnd, | 107 | isPageEnd: $isPageEnd, |
| 106 | }) | 108 | }) |
| @@ -136,6 +138,7 @@ export struct SpacialTopicPageComponent { | @@ -136,6 +138,7 @@ export struct SpacialTopicPageComponent { | ||
| 136 | if (!this.action?.params?.backVisibility) { | 138 | if (!this.action?.params?.backVisibility) { |
| 137 | WindowModel.shared.setWindowLayoutFullScreen(true) | 139 | WindowModel.shared.setWindowLayoutFullScreen(true) |
| 138 | } | 140 | } |
| 141 | + this.reload++ | ||
| 139 | } | 142 | } |
| 140 | 143 | ||
| 141 | aboutToAppear() { | 144 | aboutToAppear() { |
| @@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent'; | @@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent'; | ||
| 7 | import { ChildCommentComponent } from './ChildCommentComponent'; | 7 | import { ChildCommentComponent } from './ChildCommentComponent'; |
| 8 | import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; | 8 | import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; |
| 9 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; | 9 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; |
| 10 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 10 | 11 | ||
| 11 | const TAG = "HomePageBottomCommentComponent" | 12 | const TAG = "HomePageBottomCommentComponent" |
| 12 | 13 | ||
| @@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent { | @@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent { | ||
| 22 | @State count: number = 0; | 23 | @State count: number = 0; |
| 23 | @Link commentNum: number | 24 | @Link commentNum: number |
| 24 | @State isGetRequest: boolean = false | 25 | @State isGetRequest: boolean = false |
| 26 | + private scroller: Scroller = new Scroller(); | ||
| 25 | 27 | ||
| 26 | aboutToAppear() { | 28 | aboutToAppear() { |
| 27 | this.getNewPageData() | 29 | this.getNewPageData() |
| @@ -42,39 +44,31 @@ export struct HomePageBottomCommentComponent { | @@ -42,39 +44,31 @@ export struct HomePageBottomCommentComponent { | ||
| 42 | .offset({ y: "-200lpx" }) | 44 | .offset({ y: "-200lpx" }) |
| 43 | } | 45 | } |
| 44 | } else { | 46 | } else { |
| 45 | - List({ space: 3 }) { | ||
| 46 | - LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 47 | - ListItem() { | ||
| 48 | - ChildCommentComponent({ | ||
| 49 | - data: item, | ||
| 50 | - levelHead: UserDataLocal.getUserLevelHeaderUrl(), | ||
| 51 | - isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 52 | - }) | 47 | + CustomPullToRefresh({ |
| 48 | + alldata:this.data_comment, | ||
| 49 | + scroller:this.scroller, | ||
| 50 | + customList:()=>{ | ||
| 51 | + this.ListLayout() | ||
| 52 | + }, | ||
| 53 | + onRefresh:(resolve)=>{ | ||
| 54 | + this.curPageNum = 1; | ||
| 55 | + this.hasMore = true | ||
| 56 | + this.isGetRequest = false | ||
| 57 | + this.data_comment.clear() | ||
| 58 | + | ||
| 59 | + if (!this.isLoading){ | ||
| 60 | + this.getNewPageData() | ||
| 61 | + if(resolve) resolve('刷新成功') | ||
| 53 | } | 62 | } |
| 54 | - }, (item: CommentListItem, index: number) => index.toString()) | ||
| 55 | - | ||
| 56 | - //没有更多数据 显示提示 | ||
| 57 | - if (!this.hasMore) { | ||
| 58 | - ListItem() { | ||
| 59 | - ListHasNoMoreDataUI() | 63 | + }, |
| 64 | + onLoadMore:(resolve)=> { | ||
| 65 | + console.log(TAG, "触底了"); | ||
| 66 | + if (!this.isLoading) { | ||
| 67 | + this.isLoading = true | ||
| 68 | + //加载分页数据 | ||
| 69 | + this.getNewPageData() | ||
| 60 | } | 70 | } |
| 61 | } | 71 | } |
| 62 | - } | ||
| 63 | - .cachedCount(15) | ||
| 64 | - .layoutWeight(1) | ||
| 65 | - .scrollBar(BarState.Off) | ||
| 66 | - .edgeEffect(EdgeEffect.None) | ||
| 67 | - .nestedScroll({ | ||
| 68 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 69 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 70 | - }) | ||
| 71 | - .onReachEnd(() => { | ||
| 72 | - console.log(TAG, "触底了"); | ||
| 73 | - if (!this.isLoading) { | ||
| 74 | - this.isLoading = true | ||
| 75 | - //加载分页数据 | ||
| 76 | - this.getNewPageData() | ||
| 77 | - } | ||
| 78 | }) | 72 | }) |
| 79 | } | 73 | } |
| 80 | }.layoutWeight(1) | 74 | }.layoutWeight(1) |
| @@ -82,6 +76,35 @@ export struct HomePageBottomCommentComponent { | @@ -82,6 +76,35 @@ export struct HomePageBottomCommentComponent { | ||
| 82 | .width('100%') | 76 | .width('100%') |
| 83 | } | 77 | } |
| 84 | 78 | ||
| 79 | + @Builder ListLayout(){ | ||
| 80 | + List({ space: 3,scroller: this.scroller }) { | ||
| 81 | + LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 82 | + ListItem() { | ||
| 83 | + ChildCommentComponent({ | ||
| 84 | + data: item, | ||
| 85 | + levelHead: UserDataLocal.getUserLevelHeaderUrl(), | ||
| 86 | + isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 87 | + }) | ||
| 88 | + } | ||
| 89 | + }, (item: CommentListItem, index: number) => index.toString()) | ||
| 90 | + | ||
| 91 | + //没有更多数据 显示提示 | ||
| 92 | + if (!this.hasMore) { | ||
| 93 | + ListItem() { | ||
| 94 | + ListHasNoMoreDataUI() | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + .cachedCount(15) | ||
| 99 | + .layoutWeight(1) | ||
| 100 | + .scrollBar(BarState.Off) | ||
| 101 | + .edgeEffect(EdgeEffect.None) | ||
| 102 | + .nestedScroll({ | ||
| 103 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 104 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 105 | + }) | ||
| 106 | + } | ||
| 107 | + | ||
| 85 | getNewPageData() { | 108 | getNewPageData() { |
| 86 | this.isLoading = true | 109 | this.isLoading = true |
| 87 | if (this.hasMore) { | 110 | if (this.hasMore) { |
| @@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | @@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | ||
| 7 | import { FollowChildComponent } from '../follow/FollowChildComponent'; | 7 | import { FollowChildComponent } from '../follow/FollowChildComponent'; |
| 8 | import dataPreferences from '@ohos.data.preferences'; | 8 | import dataPreferences from '@ohos.data.preferences'; |
| 9 | import { EmptyComponent } from '../../view/EmptyComponent'; | 9 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 10 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 10 | 11 | ||
| 11 | const TAG = "HomePageBottomFollowComponent" | 12 | const TAG = "HomePageBottomFollowComponent" |
| 12 | /** | 13 | /** |
| @@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent" | @@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent" | ||
| 14 | */ | 15 | */ |
| 15 | @Component | 16 | @Component |
| 16 | export struct HomePageBottomFollowComponent { | 17 | export struct HomePageBottomFollowComponent { |
| 18 | + private scroller: Scroller = new Scroller(); | ||
| 17 | @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); | 19 | @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); |
| 18 | @State isLoading: boolean = false | 20 | @State isLoading: boolean = false |
| 19 | @State hasMore: boolean = true | 21 | @State hasMore: boolean = true |
| @@ -104,61 +106,30 @@ export struct HomePageBottomFollowComponent { | @@ -104,61 +106,30 @@ export struct HomePageBottomFollowComponent { | ||
| 104 | }) | 106 | }) |
| 105 | }.layoutWeight(1) | 107 | }.layoutWeight(1) |
| 106 | } else { | 108 | } else { |
| 107 | - List({ space: 3 }) { | 109 | + CustomPullToRefresh({ |
| 110 | + alldata:this.data_follow, | ||
| 111 | + scroller:this.scroller, | ||
| 112 | + customList:()=>{ | ||
| 113 | + this.ListLayout() | ||
| 114 | + }, | ||
| 115 | + onRefresh:(resolve)=>{ | ||
| 116 | + this.curPageNum = 1; | ||
| 117 | + this.hasMore = true | ||
| 118 | + this.isGetRequest = false | ||
| 119 | + this.data_follow.clear() | ||
| 108 | 120 | ||
| 109 | - ListItem() { | ||
| 110 | - Row() { | ||
| 111 | - Text("关注更多人民号") | ||
| 112 | - .fontWeight('400lpx') | ||
| 113 | - .fontColor($r('app.color.color_222222')) | ||
| 114 | - .lineHeight('38lpx') | ||
| 115 | - .fontSize('27lpx') | ||
| 116 | - .textAlign(TextAlign.Center) | ||
| 117 | - .margin({ right: '4lpx' }) | ||
| 118 | - Image($r('app.media.arrow_icon_right')) | ||
| 119 | - .objectFit(ImageFit.Auto) | ||
| 120 | - .width('27lpx') | ||
| 121 | - .height('27lpx') | 121 | + if (!this.isLoading){ |
| 122 | + this.getNewPageData() | ||
| 123 | + if(resolve) resolve('刷新成功') | ||
| 122 | } | 124 | } |
| 123 | - .height('69lpx') | ||
| 124 | - .width('659lpx') | ||
| 125 | - .alignItems(VerticalAlign.Center) | ||
| 126 | - .justifyContent(FlexAlign.Center) | ||
| 127 | - .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 128 | - .margin({ top: '31lpx', bottom: '4lpx' }) | ||
| 129 | - }.onClick(() => { | ||
| 130 | - let params = { 'index': "1" } as Record<string, string> | ||
| 131 | - WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 132 | - }) | ||
| 133 | - | ||
| 134 | - LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 135 | - ListItem() { | ||
| 136 | - FollowChildComponent({ data: item, type: 2 }) | 125 | + }, |
| 126 | + onLoadMore:(resolve)=> { | ||
| 127 | + console.log(TAG, "触底了"); | ||
| 128 | + if (!this.isLoading) { | ||
| 129 | + this.isLoading = true | ||
| 130 | + //加载分页数据 | ||
| 131 | + this.getNewPageData() | ||
| 137 | } | 132 | } |
| 138 | - }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 139 | - | ||
| 140 | - //没有更多数据 显示提示 | ||
| 141 | - if (!this.hasMore) { | ||
| 142 | - ListItem() { | ||
| 143 | - ListHasNoMoreDataUI() | ||
| 144 | - } | ||
| 145 | - } | ||
| 146 | - } | ||
| 147 | - .cachedCount(15) | ||
| 148 | - .padding({ left: '31lpx', right: '31lpx' }) | ||
| 149 | - .layoutWeight(1) | ||
| 150 | - .scrollBar(BarState.Off) | ||
| 151 | - .edgeEffect(EdgeEffect.None) | ||
| 152 | - .nestedScroll({ | ||
| 153 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 154 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 155 | - }) | ||
| 156 | - .onReachEnd(() => { | ||
| 157 | - console.log(TAG, "触底了"); | ||
| 158 | - if (!this.isLoading) { | ||
| 159 | - this.isLoading = true | ||
| 160 | - //加载分页数据 | ||
| 161 | - this.getNewPageData() | ||
| 162 | } | 133 | } |
| 163 | }) | 134 | }) |
| 164 | } | 135 | } |
| @@ -167,6 +138,56 @@ export struct HomePageBottomFollowComponent { | @@ -167,6 +138,56 @@ export struct HomePageBottomFollowComponent { | ||
| 167 | .width('100%') | 138 | .width('100%') |
| 168 | } | 139 | } |
| 169 | 140 | ||
| 141 | + @Builder ListLayout(){ | ||
| 142 | + List({ space: 3 ,scroller:this.scroller}) { | ||
| 143 | + ListItem() { | ||
| 144 | + Row() { | ||
| 145 | + Text("关注更多人民号") | ||
| 146 | + .fontWeight('400lpx') | ||
| 147 | + .fontColor($r('app.color.color_222222')) | ||
| 148 | + .lineHeight('38lpx') | ||
| 149 | + .fontSize('27lpx') | ||
| 150 | + .textAlign(TextAlign.Center) | ||
| 151 | + .margin({ right: '4lpx' }) | ||
| 152 | + Image($r('app.media.arrow_icon_right')) | ||
| 153 | + .objectFit(ImageFit.Auto) | ||
| 154 | + .width('27lpx') | ||
| 155 | + .height('27lpx') | ||
| 156 | + } | ||
| 157 | + .height('69lpx') | ||
| 158 | + .width('659lpx') | ||
| 159 | + .alignItems(VerticalAlign.Center) | ||
| 160 | + .justifyContent(FlexAlign.Center) | ||
| 161 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 162 | + .margin({ top: '31lpx', bottom: '4lpx' }) | ||
| 163 | + }.onClick(() => { | ||
| 164 | + let params = { 'index': "1" } as Record<string, string> | ||
| 165 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 166 | + }) | ||
| 167 | + | ||
| 168 | + LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 169 | + ListItem() { | ||
| 170 | + FollowChildComponent({ data: item, type: 2 }) | ||
| 171 | + } | ||
| 172 | + }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 173 | + //没有更多数据 显示提示 | ||
| 174 | + if (!this.hasMore) { | ||
| 175 | + ListItem() { | ||
| 176 | + ListHasNoMoreDataUI() | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + .cachedCount(15) | ||
| 181 | + .padding({ left: '31lpx', right: '31lpx' }) | ||
| 182 | + .layoutWeight(1) | ||
| 183 | + .scrollBar(BarState.Off) | ||
| 184 | + .edgeEffect(EdgeEffect.None) | ||
| 185 | + .nestedScroll({ | ||
| 186 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 187 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 188 | + }) | ||
| 189 | + } | ||
| 190 | + | ||
| 170 | @Styles | 191 | @Styles |
| 171 | listStyle() { | 192 | listStyle() { |
| 172 | .backgroundColor(Color.White) | 193 | .backgroundColor(Color.White) |
| @@ -7,6 +7,7 @@ import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDet | @@ -7,6 +7,7 @@ import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDet | ||
| 7 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; | 7 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; |
| 8 | import { ChildCommentComponent } from './ChildCommentComponent'; | 8 | import { ChildCommentComponent } from './ChildCommentComponent'; |
| 9 | import { EmptyComponent } from '../../view/EmptyComponent'; | 9 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 10 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 10 | 11 | ||
| 11 | const TAG = "HomePageBottomComponent" | 12 | const TAG = "HomePageBottomComponent" |
| 12 | /** | 13 | /** |
| @@ -23,6 +24,8 @@ export struct OtherHomePageBottomCommentComponent { | @@ -23,6 +24,8 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 23 | @Prop levelHead: string | 24 | @Prop levelHead: string |
| 24 | @Link commentNum: number | 25 | @Link commentNum: number |
| 25 | @State isGetRequest: boolean = false | 26 | @State isGetRequest: boolean = false |
| 27 | + private scroller: Scroller = new Scroller(); | ||
| 28 | + | ||
| 26 | 29 | ||
| 27 | aboutToAppear() { | 30 | aboutToAppear() { |
| 28 | this.getNewPageData() | 31 | this.getNewPageData() |
| @@ -41,41 +44,31 @@ export struct OtherHomePageBottomCommentComponent { | @@ -41,41 +44,31 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 41 | .layoutWeight(1) | 44 | .layoutWeight(1) |
| 42 | } | 45 | } |
| 43 | } else { | 46 | } else { |
| 44 | - List({ space: 3 }) { | ||
| 45 | - LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 46 | - ListItem() { | ||
| 47 | - ChildCommentComponent({ | ||
| 48 | - data: item, | ||
| 49 | - levelHead: this.levelHead, | ||
| 50 | - isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 51 | - }) | 47 | + CustomPullToRefresh({ |
| 48 | + alldata:this.data_comment, | ||
| 49 | + scroller:this.scroller, | ||
| 50 | + customList:()=>{ | ||
| 51 | + this.ListLayout() | ||
| 52 | + }, | ||
| 53 | + onRefresh:(resolve)=>{ | ||
| 54 | + this.curPageNum = 1; | ||
| 55 | + this.hasMore = true | ||
| 56 | + this.isGetRequest = false | ||
| 57 | + this.data_comment.clear() | ||
| 58 | + | ||
| 59 | + if (!this.isLoading){ | ||
| 60 | + this.getNewPageData() | ||
| 61 | + if(resolve) resolve('刷新成功') | ||
| 52 | } | 62 | } |
| 53 | - .onClick(() => { | ||
| 54 | - }) | ||
| 55 | - }, (item: CommentListItem, index: number) => index.toString()) | ||
| 56 | - | ||
| 57 | - //没有更多数据 显示提示 | ||
| 58 | - if (!this.hasMore) { | ||
| 59 | - ListItem() { | ||
| 60 | - ListHasNoMoreDataUI() | 63 | + }, |
| 64 | + onLoadMore:(resolve)=> { | ||
| 65 | + console.log(TAG, "触底了"); | ||
| 66 | + if (!this.isLoading) { | ||
| 67 | + this.isLoading = true | ||
| 68 | + //加载分页数据 | ||
| 69 | + this.getNewPageData() | ||
| 61 | } | 70 | } |
| 62 | } | 71 | } |
| 63 | - } | ||
| 64 | - .cachedCount(15) | ||
| 65 | - .layoutWeight(1) | ||
| 66 | - .scrollBar(BarState.Off) | ||
| 67 | - .edgeEffect(EdgeEffect.None) | ||
| 68 | - .nestedScroll({ | ||
| 69 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 70 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 71 | - }) | ||
| 72 | - .onReachEnd(() => { | ||
| 73 | - console.log(TAG, "触底了"); | ||
| 74 | - if (!this.isLoading) { | ||
| 75 | - this.isLoading = true | ||
| 76 | - //加载分页数据 | ||
| 77 | - this.getNewPageData() | ||
| 78 | - } | ||
| 79 | }) | 72 | }) |
| 80 | } | 73 | } |
| 81 | } | 74 | } |
| @@ -84,6 +77,35 @@ export struct OtherHomePageBottomCommentComponent { | @@ -84,6 +77,35 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 84 | .justifyContent(FlexAlign.Start) | 77 | .justifyContent(FlexAlign.Start) |
| 85 | } | 78 | } |
| 86 | 79 | ||
| 80 | + @Builder ListLayout(){ | ||
| 81 | + List({ space: 3 ,scroller: this.scroller}) { | ||
| 82 | + LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 83 | + ListItem() { | ||
| 84 | + ChildCommentComponent({ | ||
| 85 | + data: item, | ||
| 86 | + levelHead: this.levelHead, | ||
| 87 | + isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | + }, (item: CommentListItem, index: number) => index.toString()) | ||
| 91 | + | ||
| 92 | + //没有更多数据 显示提示 | ||
| 93 | + if (!this.hasMore) { | ||
| 94 | + ListItem() { | ||
| 95 | + ListHasNoMoreDataUI() | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + .cachedCount(15) | ||
| 100 | + .layoutWeight(1) | ||
| 101 | + .scrollBar(BarState.Off) | ||
| 102 | + .edgeEffect(EdgeEffect.None) | ||
| 103 | + .nestedScroll({ | ||
| 104 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 105 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 106 | + }) | ||
| 107 | + } | ||
| 108 | + | ||
| 87 | @Styles | 109 | @Styles |
| 88 | listStyle() { | 110 | listStyle() { |
| 89 | .backgroundColor(Color.White) | 111 | .backgroundColor(Color.White) |
| @@ -4,6 +4,7 @@ import { WDRouterRule, WDRouterPage } from 'wdRouter'; | @@ -4,6 +4,7 @@ import { WDRouterRule, WDRouterPage } from 'wdRouter'; | ||
| 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 5 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; | 5 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; |
| 6 | import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem'; | 6 | import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem'; |
| 7 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 7 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 8 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| 8 | import { EmptyComponent } from '../../view/EmptyComponent'; | 9 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 9 | import { FollowChildComponent } from '../follow/FollowChildComponent'; | 10 | import { FollowChildComponent } from '../follow/FollowChildComponent'; |
| @@ -22,7 +23,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -22,7 +23,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 22 | @State count:number = 0; | 23 | @State count:number = 0; |
| 23 | @Prop curUserId: string | 24 | @Prop curUserId: string |
| 24 | @State isGetRequest:boolean = false | 25 | @State isGetRequest:boolean = false |
| 25 | - | 26 | + private scroller: Scroller = new Scroller(); |
| 26 | 27 | ||
| 27 | aboutToAppear(){ | 28 | aboutToAppear(){ |
| 28 | this.getNewPageData() | 29 | this.getNewPageData() |
| @@ -66,68 +67,87 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -66,68 +67,87 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 66 | }.layoutWeight(1) | 67 | }.layoutWeight(1) |
| 67 | .justifyContent(FlexAlign.Start) | 68 | .justifyContent(FlexAlign.Start) |
| 68 | }else{ | 69 | }else{ |
| 69 | - List({ space: 3 }) { | ||
| 70 | - | ||
| 71 | - ListItem() { | ||
| 72 | - Row(){ | ||
| 73 | - Text("关注更多人民号") | ||
| 74 | - .fontWeight('400lpx') | ||
| 75 | - .fontColor($r('app.color.color_222222')) | ||
| 76 | - .lineHeight('38lpx') | ||
| 77 | - .fontSize('27lpx') | ||
| 78 | - .textAlign(TextAlign.Center) | ||
| 79 | - .margin({right:'4lpx'}) | ||
| 80 | - Image($r('app.media.arrow_icon_right')) | ||
| 81 | - .objectFit(ImageFit.Auto) | ||
| 82 | - .width('27lpx') | ||
| 83 | - .height('27lpx') | ||
| 84 | - }.height('69lpx') | ||
| 85 | - .width('659lpx') | ||
| 86 | - .alignItems(VerticalAlign.Center) | ||
| 87 | - .justifyContent(FlexAlign.Center) | ||
| 88 | - .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 89 | - .margin({top:'31lpx',bottom:'4lpx'}) | ||
| 90 | - }.onClick(()=>{ | ||
| 91 | - let params = {'index': "1"} as Record<string, string>; | ||
| 92 | - WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | ||
| 93 | - }) | 70 | + CustomPullToRefresh({ |
| 71 | + alldata:this.data_follow, | ||
| 72 | + scroller:this.scroller, | ||
| 73 | + customList:()=>{ | ||
| 74 | + this.ListLayout() | ||
| 75 | + }, | ||
| 76 | + onRefresh:(resolve)=>{ | ||
| 77 | + this.curPageNum = 1; | ||
| 78 | + this.hasMore = true | ||
| 79 | + this.isGetRequest = false | ||
| 80 | + this.data_follow.clear() | ||
| 94 | 81 | ||
| 95 | - LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 96 | - ListItem() { | ||
| 97 | - FollowChildComponent({data: item,type:2}) | 82 | + if (!this.isLoading){ |
| 83 | + this.getNewPageData() | ||
| 84 | + if(resolve) resolve('刷新成功') | ||
| 98 | } | 85 | } |
| 99 | - .onClick(() => { | ||
| 100 | - }) | ||
| 101 | - }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 102 | - | ||
| 103 | - //没有更多数据 显示提示 | ||
| 104 | - if(!this.hasMore){ | ||
| 105 | - ListItem(){ | ||
| 106 | - ListHasNoMoreDataUI() | 86 | + }, |
| 87 | + onLoadMore:(resolve)=> { | ||
| 88 | + console.log(TAG, "触底了"); | ||
| 89 | + if (!this.isLoading) { | ||
| 90 | + this.isLoading = true | ||
| 91 | + //加载分页数据 | ||
| 92 | + this.getNewPageData() | ||
| 107 | } | 93 | } |
| 108 | } | 94 | } |
| 109 | - }.cachedCount(15) | ||
| 110 | - .padding({left:'31lpx',right:'31lpx'}) | ||
| 111 | - .layoutWeight(1) | ||
| 112 | - .scrollBar(BarState.Off) | ||
| 113 | - .edgeEffect(EdgeEffect.None) | ||
| 114 | - .nestedScroll({ | ||
| 115 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 116 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 117 | - }) | ||
| 118 | - .onReachEnd(()=>{ | ||
| 119 | - console.log(TAG,"触底了"); | ||
| 120 | - if(!this.isLoading){ | ||
| 121 | - this.isLoading = true | ||
| 122 | - //加载分页数据 | ||
| 123 | - this.getNewPageData() | ||
| 124 | - } | ||
| 125 | }) | 95 | }) |
| 126 | } | 96 | } |
| 127 | } | 97 | } |
| 128 | .width('100%') | 98 | .width('100%') |
| 129 | } | 99 | } |
| 130 | 100 | ||
| 101 | + @Builder ListLayout(){ | ||
| 102 | + List({ space: 3 ,scroller:this.scroller}) { | ||
| 103 | + ListItem() { | ||
| 104 | + Row(){ | ||
| 105 | + Text("关注更多人民号") | ||
| 106 | + .fontWeight('400lpx') | ||
| 107 | + .fontColor($r('app.color.color_222222')) | ||
| 108 | + .lineHeight('38lpx') | ||
| 109 | + .fontSize('27lpx') | ||
| 110 | + .textAlign(TextAlign.Center) | ||
| 111 | + .margin({right:'4lpx'}) | ||
| 112 | + Image($r('app.media.arrow_icon_right')) | ||
| 113 | + .objectFit(ImageFit.Auto) | ||
| 114 | + .width('27lpx') | ||
| 115 | + .height('27lpx') | ||
| 116 | + }.height('69lpx') | ||
| 117 | + .width('659lpx') | ||
| 118 | + .alignItems(VerticalAlign.Center) | ||
| 119 | + .justifyContent(FlexAlign.Center) | ||
| 120 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 121 | + .margin({top:'31lpx',bottom:'4lpx'}) | ||
| 122 | + }.onClick(()=>{ | ||
| 123 | + let params = {'index': "1"} as Record<string, string>; | ||
| 124 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | ||
| 125 | + }) | ||
| 126 | + | ||
| 127 | + LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 128 | + ListItem() { | ||
| 129 | + FollowChildComponent({data: item,type:2}) | ||
| 130 | + } | ||
| 131 | + .onClick(() => { | ||
| 132 | + }) | ||
| 133 | + }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 134 | + | ||
| 135 | + //没有更多数据 显示提示 | ||
| 136 | + if(!this.hasMore){ | ||
| 137 | + ListItem(){ | ||
| 138 | + ListHasNoMoreDataUI() | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + }.cachedCount(15) | ||
| 142 | + .padding({left:'31lpx',right:'31lpx'}) | ||
| 143 | + .layoutWeight(1) | ||
| 144 | + .scrollBar(BarState.Off) | ||
| 145 | + .edgeEffect(EdgeEffect.None) | ||
| 146 | + .nestedScroll({ | ||
| 147 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 148 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 149 | + }) | ||
| 150 | + } | ||
| 131 | 151 | ||
| 132 | @Styles | 152 | @Styles |
| 133 | listStyle() { | 153 | listStyle() { |
| @@ -46,7 +46,7 @@ struct MyCollectionListPage { | @@ -46,7 +46,7 @@ struct MyCollectionListPage { | ||
| 46 | 46 | ||
| 47 | build() { | 47 | build() { |
| 48 | Column(){ | 48 | Column(){ |
| 49 | - CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:true,editCallback:()=>{ | 49 | + CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:this.browSingModel.viewType == ViewType.ERROR || this.browSingModel.viewType == ViewType.EMPTY?false:true,editCallback:()=>{ |
| 50 | this.allSelectDatas(false) | 50 | this.allSelectDatas(false) |
| 51 | this.isAllSelect = false | 51 | this.isAllSelect = false |
| 52 | this.selectDatas = [] | 52 | this.selectDatas = [] |
| @@ -19,7 +19,7 @@ export struct BigPicCardComponent { | @@ -19,7 +19,7 @@ export struct BigPicCardComponent { | ||
| 19 | 19 | ||
| 20 | aboutToAppear() { | 20 | aboutToAppear() { |
| 21 | // 取第一个数据 | 21 | // 取第一个数据 |
| 22 | - if (this.compDTO.operDataList) { | 22 | + if (this.compDTO.operDataList.length > 0) { |
| 23 | this.contentDTO = this.compDTO.operDataList[0]; | 23 | this.contentDTO = this.compDTO.operDataList[0]; |
| 24 | this.contentDTO.appStyle = "2"; | 24 | this.contentDTO.appStyle = "2"; |
| 25 | } | 25 | } |
-
Please register or login to post a comment