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
yanlu
2024-05-13 16:02:25 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4528f61c943e0c734119ffdb76baf8daee697d3b
4528f61c
1 parent
d3282e4a
fix: 17212 人民号作品列表在作品数量较少时上滑无反应
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
66 deletions
sight_harmony/features/wdComponent/src/main/ets/components/page/PeopleShipHomePage.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeArticleListComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeListComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/PeopleShipHomePage.ets
View file @
4528f61
...
...
@@ -13,6 +13,7 @@ import {
PeopleShipUserDetailData,
ArticleCountData
} from 'wdBean'
import { EmptyComponent } from '../view/EmptyComponent'
@Entry
@Component
...
...
@@ -35,11 +36,20 @@ struct PeopleShipHomePage {
@Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false
//关注显示
@State attentionOpacity: boolean = false
@Provide topHeight: number = 400
@Provide topHeight: number = 286
@State isLoading: boolean = true
build() {
Stack({ alignContent: Alignment.TopStart }) {
// 顶部图片
Image($r('app.media.home_page_bg'))
.width('100%')
.height('120vp')
.objectFit(ImageFit.Fill)
.backgroundColor(Color.White)
.visibility(this.isLoading ? Visibility.None : Visibility.Visible)
Column(){
// 头部返回
PeopleShipHomePageNavComponent({
attentionOpacity: this.attentionOpacity,
...
...
@@ -47,9 +57,7 @@ struct PeopleShipHomePage {
detailModel: this.detailModel
})
.height($r('app.float.top_bar_height'))
.zIndex(100)
.backgroundColor(Color.Transparent)
if (this.detailModel && this.detailModel.userName) {
Scroll(this.scroller) {
Column() {
...
...
@@ -62,24 +70,32 @@ struct PeopleShipHomePage {
})
.width("100%")
.height(this.topHeight)
// 列表
Column(){
PeopleShipHomeListComponent({
publishCount: this.publishCount,
creatorId: this.creatorId
})
}.height('100%')
}
.width("100%")
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
// .height('100%')
// .height(this.publishCount == 0 ? '100%' : '')
}
.scrollable(ScrollDirection.Vertical)
// .alignSelf(ItemAlign.Start)
// .align(Alignment.Start)
.edgeEffect(EdgeEffect.None)
.friction(0.6
)
.friction(0.7
)
.backgroundColor(Color.White)
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
.height('calc(100% - 44vp)')
// .layoutWeight(1)
.onDidScroll(() => {
// this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2)
this.topOpacity = this.scroller.currentOffset().yOffset / 100
...
...
@@ -94,6 +110,13 @@ struct PeopleShipHomePage {
}
}
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Start)
.width('100%')
// .height('100%')
}
// .height('100%')
.width('100%')
}
...
...
@@ -104,9 +127,11 @@ struct PeopleShipHomePage {
private async getData() {
try {
this.isLoading = true
// 获取页面信息
this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '')
Logger.debug('PeopleShipHomePage', '获取页面信息' + `${JSON.stringify(this.detailModel)}`)
this.isLoading = false
// 获取关注
// 登录后获取,是否关注
...
...
@@ -117,7 +142,7 @@ struct PeopleShipHomePage {
}
} catch (exception) {
this.isLoading = false
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeArticleListComponent.ets
View file @
4528f61
import { Logger
, DisplayUtils
} from 'wdKit'
import { Logger} from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import {
ContentDTO,
...
...
@@ -16,11 +16,11 @@ import {
} from 'wdBean'
import { CardParser } from '../CardParser'
import { PageRepository } from '../../repository/PageRepository'
import { RefreshLayoutBean } from '../page/RefreshLayoutBean'
import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout'
import { ErrorComponent } from '../view/ErrorComponent'
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'
import LoadMoreLayout from '../page/LoadMoreLayout'
const TAG = 'PeopleShipHomeArticleListComponent';
...
...
@@ -47,45 +47,29 @@ export struct PeopleShipHomeArticleListComponent {
} else if (this.viewType == 2) {
ErrorComponent()
} else {
CustomPullToRefresh({
alldata:this.arr,
scroller:this.scroller,
hasMore: this.hasMore,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.currentPage = 1
this.getPeopleShipPageArticleList(resolve)
},
onLoadMore:(resolve)=> {
if (this.hasMore === false) {
if(resolve) {
resolve('')
}
return
}
if(!this.isLoading && this.hasMore){
//加载分页数据
this.currentPage++;
this.getPeopleShipPageArticleList(resolve)
}else {
if(resolve) {
resolve('')
}
}
},
})
// CustomPullToRefresh({
// alldata:this.arr,
// scroller:this.scroller,
// hasMore: false,
// customList:()=>{
// this.ListLayout()
// },
// onRefresh:(resolve)=>{
// this.currentPage = 1
// this.getPeopleShipPageArticleList(resolve)
// },
// })
}
}
@Builder
LoadingLayout() {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20)
}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
// CustomRefreshLoadLayout({
// refreshBean: new RefreshLayoutBean(true,
// $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20)
// }).height(DisplayUtils.getDeviceHeight() - this.topHeight)
}
@Builder
...
...
@@ -93,7 +77,6 @@ export struct PeopleShipHomeArticleListComponent {
List({scroller: this.scroller}) {
// 下拉刷新
ForEach(this.arr, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
...
...
@@ -103,11 +86,14 @@ export struct PeopleShipHomeArticleListComponent {
// 加载更多
ListItem() {
if (!this.hasMore && !this.isLoading) {
if (this.hasMore) {
LoadMoreLayout({ isVisible: this.hasMore })
} else if (!this.hasMore && !this.isLoading) {
PeopleShipNoMoreData()
}
}
}
.backgroundColor(Color.Transparent)
.width("100%")
.height("100%")
.edgeEffect(EdgeEffect.None)
...
...
@@ -115,13 +101,13 @@ export struct PeopleShipHomeArticleListComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
// .onReachEnd(() => {
// if(!this.isLoading && this.hasMore){
// //加载分页数据
// this.getPeopleShipPageArticleList()
// }
// })
.onReachEnd(() => {
if(!this.isLoading && this.hasMore){
//加载分页数据
this.currentPage++;
this.getPeopleShipPageArticleList()
}
})
}
aboutToAppear() {
...
...
@@ -313,7 +299,6 @@ export struct PeopleShipHomeArticleListComponent {
}
}
// this.arr = listData.list
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeListComponent.ets
View file @
4528f61
...
...
@@ -24,10 +24,10 @@ export struct PeopleShipHomeListComponent {
// 列表
else if (this.publishCount == 0) {
// 无数据展示
EmptyComponent({emptyType: 12}).height(
DisplayUtils.getDeviceHeight() - this.topHeight
)
EmptyComponent({emptyType: 12}).height(
'100%'
)
} else {
Column() {
Column()
{
Stack({ alignContent: Alignment.Top })
{
// 页签
Row() {
Scroll() {
...
...
@@ -44,13 +44,10 @@ export struct PeopleShipHomeListComponent {
.scrollBar(BarState.Off)
.width('100%')
}
.zIndex(10)
.backgroundColor(Color.White)
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.justifyContent(FlexAlign.Start)
.height('44vp')
.alignItems(HorizontalAlign.Start
)
.alignItems(VerticalAlign.Bottom
)
.width('100%')
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
...
...
@@ -63,15 +60,15 @@ export struct PeopleShipHomeListComponent {
currentIndex: index
})
}
// }.tabBar(this.tabBuilder
(index, item.name ?? ''))
// .tabBar(this.Tab
(index, item.name ?? ''))
})
}
.backgroundColor(Color.White)
.barWidth('100%')
.barHeight(0)
.vertical(false)
.height(DisplayUtils.getDeviceHeight() - 144)
.barHeight('44vp')
.height('100% ')
.animationDuration(0)
.divider({
strokeWidth: '0.5vp',
...
...
@@ -82,16 +79,19 @@ export struct PeopleShipHomeListComponent {
.onChange((index: number) => {
this.currentIndex = index
})
}
}
}
}
@Builder
LoadingLayout() {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight)
}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
// CustomRefreshLoadLayout({
// refreshBean: new RefreshLayoutBean(true,
// $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight)
// }).height('100%')
}
// 单独的页签
...
...
Please
register
or
login
to post a comment