Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangliang_wd
2024-10-22 11:24:55 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
68d38605f57a81beaf375e8633bf0db85c8bfa6f
68d38605
1 parent
6881aa77
feat:优化人民号搜索结果上拉更多逻辑处理
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
25 deletions
sight_harmony/features/wdComponent/src/main/ets/pages/SearchCreatorPage.ets
sight_harmony/features/wdComponent/src/main/ets/pages/SearchCreatorPage.ets
View file @
68d3860
...
...
@@ -11,6 +11,7 @@ import MinePageDatasModel from '../model/MinePageDatasModel';
import { ListHasNoMoreDataUI } from '../components/reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../components/mine/follow/FollowChildComponent';
import { SpConstants } from 'wdConstant/Index';
import { CustomPullToRefresh } from '../../../../Index';
const TAG = "SearchCreatorPage"
...
...
@@ -28,6 +29,7 @@ struct SearchCreatorPage {
curPageNum: number = 1;
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
private scroller: Scroller = new Scroller();
onPageShow() {
this.keyword = this.params?.pageID;
...
...
@@ -35,7 +37,7 @@ struct SearchCreatorPage {
this.getNewPageData()
}
getNewPageData() {
getNewPageData(
resolve?: (value: string | PromiseLike<string>) => void
) {
this.isLoading = true
if (this.hasMore) {
SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keyword,getContext(this)).then((result)=>{
...
...
@@ -78,6 +80,7 @@ struct SearchCreatorPage {
}
})
})
if(resolve) resolve('刷新成功')
this.getFollowListStatus(result.totalCount)
}
}).catch((err:Error)=>{
...
...
@@ -170,32 +173,20 @@ struct SearchCreatorPage {
ListHasNoMoreDataUI({style:2})
.height('100%')
}else{
List({ space: 3 }) {
LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({data: item,type:1})
}
.onClick(() => {
})
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
ListHasNoMoreDataUI()
CustomPullToRefresh({
alldata:this.data,
scroller:this.scroller,
hasMore:this.hasMore,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
},
onLoadMore:(resolve)=> {
if (this.hasMore) {
this.getNewPageData(resolve)
}
}
}.cachedCount(5)
.padding({left:'31lpx',right:'31lpx'})
.layoutWeight(1)
.scrollBar(BarState.Off)
.onReachEnd(()=>{
Logger.debug(TAG,"触底了");
if(!this.isLoading){
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}.layoutWeight(1)
...
...
@@ -209,4 +200,27 @@ struct SearchCreatorPage {
.padding({top:px2vp(this.topSafeHeight)})
}
@Builder ListLayout() {
List({ space: 3,scroller: this.scroller }) {
LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({data: item,type:1})
}
.onClick(() => {
})
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
ListHasNoMoreDataUI().height(64)
}
}
}.cachedCount(5)
.padding({left:'31lpx',right:'31lpx'})
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment