陈剑华

Merge remote-tracking branch 'origin/main'

... ... @@ -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
}
}
... ...
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
}
... ...
... ... @@ -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%')
}
// 单独的页签
... ...
... ... @@ -12,6 +12,7 @@ import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
import { HttpUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import { LazyDataSource } from 'wdKit/Index';
import LoadMoreLayout from '../page/LoadMoreLayout'
const TAG: string = 'ReserveMorePage';
... ... @@ -95,7 +96,9 @@ struct ReserveMorePage {
)
// 加载更多
ListItem() {
if (!this.hasMore && !this.isLoading) {
if (this.hasMore) {
LoadMoreLayout({ isVisible: this.hasMore })
} else if (!this.hasMore && !this.isLoading) {
PeopleShipNoMoreData()
}
}
... ... @@ -201,7 +204,7 @@ struct ReserveMorePage {
.color(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC'))
.visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.Visible : Visibility.None)
Text(!this.isReserved(item) ? '关注' : '已关注')
Text(!this.isReserved(item) ? '预约' : '已预约')
.fontSize($r('app.float.vp_12'))
.fontWeight(500)
.fontColor(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC'))
... ...