陈剑华

Merge remote-tracking branch 'origin/main'

@@ -13,6 +13,7 @@ import { @@ -13,6 +13,7 @@ import {
13 PeopleShipUserDetailData, 13 PeopleShipUserDetailData,
14 ArticleCountData 14 ArticleCountData
15 } from 'wdBean' 15 } from 'wdBean'
  16 +import { EmptyComponent } from '../view/EmptyComponent'
16 17
17 @Entry 18 @Entry
18 @Component 19 @Component
@@ -35,65 +36,87 @@ struct PeopleShipHomePage { @@ -35,65 +36,87 @@ struct PeopleShipHomePage {
35 @Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false 36 @Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false
36 //关注显示 37 //关注显示
37 @State attentionOpacity: boolean = false 38 @State attentionOpacity: boolean = false
38 - @Provide topHeight: number = 400 39 + @Provide topHeight: number = 286
  40 + @State isLoading: boolean = true
39 41
40 build() { 42 build() {
41 -  
42 - Stack({ alignContent: Alignment.TopStart }) {  
43 - // 头部返回  
44 - PeopleShipHomePageNavComponent({  
45 - attentionOpacity: this.attentionOpacity,  
46 - topOpacity: this.topOpacity,  
47 - detailModel: this.detailModel  
48 - })  
49 - .height($r('app.float.top_bar_height'))  
50 - .zIndex(100)  
51 - .backgroundColor(Color.Transparent)  
52 -  
53 - if (this.detailModel && this.detailModel.userName) {  
54 - Scroll(this.scroller) {  
55 - Column() {  
56 - // 顶部相关  
57 - PeopleShipHomePageTopComponent({  
58 - creatorId: this.creatorId,  
59 - detailModel: this.detailModel,  
60 - publishCount: this.publishCount,  
61 - topHeight: this.topHeight  
62 - }) 43 + Stack({ alignContent: Alignment.TopStart }) {
  44 + // 顶部图片
  45 + Image($r('app.media.home_page_bg'))
  46 + .width('100%')
  47 + .height('120vp')
  48 + .objectFit(ImageFit.Fill)
  49 + .backgroundColor(Color.White)
  50 + .visibility(this.isLoading ? Visibility.None : Visibility.Visible)
  51 +
  52 + Column(){
  53 + // 头部返回
  54 + PeopleShipHomePageNavComponent({
  55 + attentionOpacity: this.attentionOpacity,
  56 + topOpacity: this.topOpacity,
  57 + detailModel: this.detailModel
  58 + })
  59 + .height($r('app.float.top_bar_height'))
  60 + .backgroundColor(Color.Transparent)
  61 + if (this.detailModel && this.detailModel.userName) {
  62 + Scroll(this.scroller) {
  63 + Column() {
  64 + // 顶部相关
  65 + PeopleShipHomePageTopComponent({
  66 + creatorId: this.creatorId,
  67 + detailModel: this.detailModel,
  68 + publishCount: this.publishCount,
  69 + topHeight: this.topHeight
  70 + })
  71 + .width("100%")
  72 + .height(this.topHeight)
  73 + // 列表
  74 + Column(){
  75 + PeopleShipHomeListComponent({
  76 + publishCount: this.publishCount,
  77 + creatorId: this.creatorId
  78 + })
  79 + }.height('100%')
  80 +
  81 +
  82 + }
63 .width("100%") 83 .width("100%")
64 - .height(this.topHeight) 84 + .justifyContent(FlexAlign.Start)
  85 + .alignItems(HorizontalAlign.Start)
  86 + // .height('100%')
  87 + // .height(this.publishCount == 0 ? '100%' : '')
  88 + }
  89 + .scrollable(ScrollDirection.Vertical)
  90 + // .alignSelf(ItemAlign.Start)
  91 + // .align(Alignment.Start)
  92 + .edgeEffect(EdgeEffect.None)
  93 + .friction(0.7)
  94 + .backgroundColor(Color.White)
  95 + .scrollBar(BarState.Off)
  96 + .width('100%')
  97 + .height('calc(100% - 44vp)')
  98 + // .layoutWeight(1)
  99 + .onDidScroll(() => {
  100 + // this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2)
  101 + this.topOpacity = this.scroller.currentOffset().yOffset / 100
  102 + if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) {
  103 + this.attentionOpacity = true
  104 + } else {
  105 + this.attentionOpacity = false
  106 + }
  107 + Logger.debug('PeopleShipHomePage',`透明度:${this.topOpacity}`)
65 108
66 - // 列表  
67 - PeopleShipHomeListComponent({  
68 - publishCount: this.publishCount,  
69 - creatorId: this.creatorId  
70 }) 109 })
71 -  
72 } 110 }
73 - .width("100%")  
74 - .justifyContent(FlexAlign.Start)  
75 - // .height(this.publishCount == 0 ? '100%' : '') 111 +
76 } 112 }
77 - .edgeEffect(EdgeEffect.None)  
78 - .friction(0.6)  
79 - .backgroundColor(Color.White)  
80 - .scrollBar(BarState.Off) 113 + .alignItems(HorizontalAlign.Start)
  114 + .justifyContent(FlexAlign.Start)
81 .width('100%') 115 .width('100%')
82 - .height('100%')  
83 - .onDidScroll(() => {  
84 - // this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2)  
85 - this.topOpacity = this.scroller.currentOffset().yOffset / 100  
86 - if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) {  
87 - this.attentionOpacity = true  
88 - } else {  
89 - this.attentionOpacity = false  
90 - }  
91 - Logger.debug('PeopleShipHomePage',`透明度:${this.topOpacity}`)  
92 -  
93 - }) 116 + // .height('100%')
94 } 117 }
95 -  
96 - } 118 + // .height('100%')
  119 + .width('100%')
97 120
98 } 121 }
99 122
@@ -104,9 +127,11 @@ struct PeopleShipHomePage { @@ -104,9 +127,11 @@ struct PeopleShipHomePage {
104 127
105 private async getData() { 128 private async getData() {
106 try { 129 try {
  130 + this.isLoading = true
107 // 获取页面信息 131 // 获取页面信息
108 this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '') 132 this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '')
109 Logger.debug('PeopleShipHomePage', '获取页面信息' + `${JSON.stringify(this.detailModel)}`) 133 Logger.debug('PeopleShipHomePage', '获取页面信息' + `${JSON.stringify(this.detailModel)}`)
  134 + this.isLoading = false
110 135
111 // 获取关注 136 // 获取关注
112 // 登录后获取,是否关注 137 // 登录后获取,是否关注
@@ -117,7 +142,7 @@ struct PeopleShipHomePage { @@ -117,7 +142,7 @@ struct PeopleShipHomePage {
117 } 142 }
118 143
119 } catch (exception) { 144 } catch (exception) {
120 - 145 + this.isLoading = false
121 } 146 }
122 } 147 }
123 148
1 -import { Logger, DisplayUtils} from 'wdKit' 1 +import { Logger} from 'wdKit'
2 import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' 2 import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
3 import { 3 import {
4 ContentDTO, 4 ContentDTO,
@@ -16,11 +16,11 @@ import { @@ -16,11 +16,11 @@ import {
16 } from 'wdBean' 16 } from 'wdBean'
17 import { CardParser } from '../CardParser' 17 import { CardParser } from '../CardParser'
18 import { PageRepository } from '../../repository/PageRepository' 18 import { PageRepository } from '../../repository/PageRepository'
19 -import { RefreshLayoutBean } from '../page/RefreshLayoutBean'  
20 import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' 19 import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout'
21 import { ErrorComponent } from '../view/ErrorComponent' 20 import { ErrorComponent } from '../view/ErrorComponent'
22 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh' 21 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'
23 import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData' 22 import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'
  23 +import LoadMoreLayout from '../page/LoadMoreLayout'
24 24
25 const TAG = 'PeopleShipHomeArticleListComponent'; 25 const TAG = 'PeopleShipHomeArticleListComponent';
26 26
@@ -47,45 +47,29 @@ export struct PeopleShipHomeArticleListComponent { @@ -47,45 +47,29 @@ export struct PeopleShipHomeArticleListComponent {
47 } else if (this.viewType == 2) { 47 } else if (this.viewType == 2) {
48 ErrorComponent() 48 ErrorComponent()
49 } else { 49 } else {
50 - CustomPullToRefresh({  
51 - alldata:this.arr,  
52 - scroller:this.scroller,  
53 - hasMore: this.hasMore,  
54 - customList:()=>{  
55 - this.ListLayout()  
56 - },  
57 - onRefresh:(resolve)=>{  
58 - this.currentPage = 1  
59 - this.getPeopleShipPageArticleList(resolve)  
60 - },  
61 - onLoadMore:(resolve)=> {  
62 - if (this.hasMore === false) {  
63 - if(resolve) {  
64 - resolve('')  
65 - }  
66 - return  
67 - }  
68 - if(!this.isLoading && this.hasMore){  
69 - //加载分页数据  
70 - this.currentPage++;  
71 - this.getPeopleShipPageArticleList(resolve)  
72 - }else {  
73 - if(resolve) {  
74 - resolve('')  
75 - }  
76 - }  
77 - },  
78 - }) 50 + this.ListLayout()
  51 + // CustomPullToRefresh({
  52 + // alldata:this.arr,
  53 + // scroller:this.scroller,
  54 + // hasMore: false,
  55 + // customList:()=>{
  56 + // this.ListLayout()
  57 + // },
  58 + // onRefresh:(resolve)=>{
  59 + // this.currentPage = 1
  60 + // this.getPeopleShipPageArticleList(resolve)
  61 + // },
  62 + // })
79 } 63 }
80 64
81 } 65 }
82 66
83 @Builder 67 @Builder
84 LoadingLayout() { 68 LoadingLayout() {
85 - CustomRefreshLoadLayout({  
86 - refreshBean: new RefreshLayoutBean(true,  
87 - $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20)  
88 - }).height(DisplayUtils.getDeviceHeight() - this.topHeight) 69 + // CustomRefreshLoadLayout({
  70 + // refreshBean: new RefreshLayoutBean(true,
  71 + // $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20)
  72 + // }).height(DisplayUtils.getDeviceHeight() - this.topHeight)
89 } 73 }
90 74
91 @Builder 75 @Builder
@@ -93,7 +77,6 @@ export struct PeopleShipHomeArticleListComponent { @@ -93,7 +77,6 @@ export struct PeopleShipHomeArticleListComponent {
93 77
94 List({scroller: this.scroller}) { 78 List({scroller: this.scroller}) {
95 // 下拉刷新 79 // 下拉刷新
96 -  
97 ForEach(this.arr, (item: ContentDTO) => { 80 ForEach(this.arr, (item: ContentDTO) => {
98 ListItem() { 81 ListItem() {
99 CardParser({ contentDTO: item }) 82 CardParser({ contentDTO: item })
@@ -103,11 +86,14 @@ export struct PeopleShipHomeArticleListComponent { @@ -103,11 +86,14 @@ export struct PeopleShipHomeArticleListComponent {
103 86
104 // 加载更多 87 // 加载更多
105 ListItem() { 88 ListItem() {
106 - if (!this.hasMore && !this.isLoading) { 89 + if (this.hasMore) {
  90 + LoadMoreLayout({ isVisible: this.hasMore })
  91 + } else if (!this.hasMore && !this.isLoading) {
107 PeopleShipNoMoreData() 92 PeopleShipNoMoreData()
108 } 93 }
109 } 94 }
110 } 95 }
  96 + .backgroundColor(Color.Transparent)
111 .width("100%") 97 .width("100%")
112 .height("100%") 98 .height("100%")
113 .edgeEffect(EdgeEffect.None) 99 .edgeEffect(EdgeEffect.None)
@@ -115,13 +101,13 @@ export struct PeopleShipHomeArticleListComponent { @@ -115,13 +101,13 @@ export struct PeopleShipHomeArticleListComponent {
115 scrollForward: NestedScrollMode.PARENT_FIRST, 101 scrollForward: NestedScrollMode.PARENT_FIRST,
116 scrollBackward: NestedScrollMode.SELF_FIRST 102 scrollBackward: NestedScrollMode.SELF_FIRST
117 }) 103 })
118 -  
119 - // .onReachEnd(() => {  
120 - // if(!this.isLoading && this.hasMore){  
121 - // //加载分页数据  
122 - // this.getPeopleShipPageArticleList()  
123 - // }  
124 - // }) 104 + .onReachEnd(() => {
  105 + if(!this.isLoading && this.hasMore){
  106 + //加载分页数据
  107 + this.currentPage++;
  108 + this.getPeopleShipPageArticleList()
  109 + }
  110 + })
125 } 111 }
126 112
127 aboutToAppear() { 113 aboutToAppear() {
@@ -313,7 +299,6 @@ export struct PeopleShipHomeArticleListComponent { @@ -313,7 +299,6 @@ export struct PeopleShipHomeArticleListComponent {
313 } 299 }
314 300
315 } 301 }
316 -  
317 // this.arr = listData.list 302 // this.arr = listData.list
318 } 303 }
319 304
@@ -24,10 +24,10 @@ export struct PeopleShipHomeListComponent { @@ -24,10 +24,10 @@ export struct PeopleShipHomeListComponent {
24 // 列表 24 // 列表
25 else if (this.publishCount == 0) { 25 else if (this.publishCount == 0) {
26 // 无数据展示 26 // 无数据展示
27 - EmptyComponent({emptyType: 12}).height(DisplayUtils.getDeviceHeight() - this.topHeight) 27 + EmptyComponent({emptyType: 12}).height('100%')
28 } else { 28 } else {
29 Column() { 29 Column() {
30 - Column() { 30 + Stack({ alignContent: Alignment.Top }){
31 // 页签 31 // 页签
32 Row() { 32 Row() {
33 Scroll() { 33 Scroll() {
@@ -44,54 +44,54 @@ export struct PeopleShipHomeListComponent { @@ -44,54 +44,54 @@ export struct PeopleShipHomeListComponent {
44 .scrollBar(BarState.Off) 44 .scrollBar(BarState.Off)
45 .width('100%') 45 .width('100%')
46 } 46 }
  47 + .zIndex(10)
47 .backgroundColor(Color.White) 48 .backgroundColor(Color.White)
  49 + .height('44vp')
48 .alignItems(VerticalAlign.Bottom) 50 .alignItems(VerticalAlign.Bottom)
49 .width('100%') 51 .width('100%')
50 - }  
51 - .justifyContent(FlexAlign.Start)  
52 - .height('44vp')  
53 - .alignItems(HorizontalAlign.Start)  
54 - .width('100%')  
55 52
56 - Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {  
57 - ForEach(this.tabArr, (item: ArticleTypeData, index: number) => {  
58 - TabContent() {  
59 - PeopleShipHomeArticleListComponent({  
60 - typeModel: item,  
61 - creatorId: this.creatorId,  
62 - currentTopSelectedIndex: this.currentIndex,  
63 - currentIndex: index  
64 - })  
65 - }  
66 - // }.tabBar(this.tabBuilder(index, item.name ?? '')) 53 + Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
  54 + ForEach(this.tabArr, (item: ArticleTypeData, index: number) => {
  55 + TabContent() {
  56 + PeopleShipHomeArticleListComponent({
  57 + typeModel: item,
  58 + creatorId: this.creatorId,
  59 + currentTopSelectedIndex: this.currentIndex,
  60 + currentIndex: index
  61 + })
  62 + }
  63 + // .tabBar(this.Tab(index, item.name ?? ''))
  64 + })
  65 +
  66 + }
  67 + .backgroundColor(Color.White)
  68 + .barWidth('100%')
  69 + .vertical(false)
  70 + .barHeight('44vp')
  71 + .height('100% ')
  72 + .animationDuration(0)
  73 + .divider({
  74 + strokeWidth: '0.5vp',
  75 + color: $r('app.color.color_F5F5F5'),
  76 + startMargin: 0,
  77 + endMargin: 0
  78 + })
  79 + .onChange((index: number) => {
  80 + this.currentIndex = index
67 }) 81 })
68 82
69 } 83 }
70 - .backgroundColor(Color.White)  
71 - .barWidth('100%')  
72 - .barHeight(0)  
73 - .vertical(false)  
74 - .height(DisplayUtils.getDeviceHeight() - 144)  
75 - .animationDuration(0)  
76 - .divider({  
77 - strokeWidth: '0.5vp',  
78 - color: $r('app.color.color_F5F5F5'),  
79 - startMargin: 0,  
80 - endMargin: 0  
81 - })  
82 - .onChange((index: number) => {  
83 - this.currentIndex = index  
84 - }) 84 +
85 } 85 }
86 } 86 }
87 } 87 }
88 88
89 @Builder 89 @Builder
90 LoadingLayout() { 90 LoadingLayout() {
91 - CustomRefreshLoadLayout({  
92 - refreshBean: new RefreshLayoutBean(true,  
93 - $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight)  
94 - }).height(DisplayUtils.getDeviceHeight() - this.topHeight) 91 + // CustomRefreshLoadLayout({
  92 + // refreshBean: new RefreshLayoutBean(true,
  93 + // $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight)
  94 + // }).height('100%')
95 } 95 }
96 96
97 // 单独的页签 97 // 单独的页签
@@ -12,6 +12,7 @@ import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; @@ -12,6 +12,7 @@ import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
12 import { HttpUtils } from 'wdNetwork/Index'; 12 import { HttpUtils } from 'wdNetwork/Index';
13 import { WDRouterPage, WDRouterRule } from 'wdRouter' 13 import { WDRouterPage, WDRouterRule } from 'wdRouter'
14 import { LazyDataSource } from 'wdKit/Index'; 14 import { LazyDataSource } from 'wdKit/Index';
  15 +import LoadMoreLayout from '../page/LoadMoreLayout'
15 16
16 const TAG: string = 'ReserveMorePage'; 17 const TAG: string = 'ReserveMorePage';
17 18
@@ -95,7 +96,9 @@ struct ReserveMorePage { @@ -95,7 +96,9 @@ struct ReserveMorePage {
95 ) 96 )
96 // 加载更多 97 // 加载更多
97 ListItem() { 98 ListItem() {
98 - if (!this.hasMore && !this.isLoading) { 99 + if (this.hasMore) {
  100 + LoadMoreLayout({ isVisible: this.hasMore })
  101 + } else if (!this.hasMore && !this.isLoading) {
99 PeopleShipNoMoreData() 102 PeopleShipNoMoreData()
100 } 103 }
101 } 104 }
@@ -201,7 +204,7 @@ struct ReserveMorePage { @@ -201,7 +204,7 @@ struct ReserveMorePage {
201 .color(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC')) 204 .color(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC'))
202 .visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.Visible : Visibility.None) 205 .visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.Visible : Visibility.None)
203 206
204 - Text(!this.isReserved(item) ? '关注' : '已关注') 207 + Text(!this.isReserved(item) ? '预约' : '已预约')
205 .fontSize($r('app.float.vp_12')) 208 .fontSize($r('app.float.vp_12'))
206 .fontWeight(500) 209 .fontWeight(500)
207 .fontColor(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC')) 210 .fontColor(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC'))