陈剑华

Merge remote-tracking branch 'origin/main'

@@ -13,7 +13,7 @@ import { @@ -13,7 +13,7 @@ import {
13 PeopleShipUserDetailData, 13 PeopleShipUserDetailData,
14 ArticleCountData 14 ArticleCountData
15 } from 'wdBean' 15 } from 'wdBean'
16 -import { EmptyComponent } from '../view/EmptyComponent' 16 +import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
17 import { CustomTitleUI } from '../reusable/CustomTitleUI' 17 import { CustomTitleUI } from '../reusable/CustomTitleUI'
18 18
19 @Entry 19 @Entry
@@ -41,6 +41,7 @@ struct PeopleShipHomePage { @@ -41,6 +41,7 @@ struct PeopleShipHomePage {
41 @State isLoading: boolean = true 41 @State isLoading: boolean = true
42 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 42 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
43 @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() 43 @State isConnectNetwork : boolean = NetworkUtil.isNetConnected()
  44 + @State isHasHomePage: boolean = true
44 45
45 onPageShow(): void { 46 onPageShow(): void {
46 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'}) 47 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'})
@@ -60,91 +61,100 @@ struct PeopleShipHomePage { @@ -60,91 +61,100 @@ struct PeopleShipHomePage {
60 61
61 build() { 62 build() {
62 if(this.isConnectNetwork){ 63 if(this.isConnectNetwork){
63 - Stack({ alignContent: Alignment.TopStart }) {  
64 - Stack({ alignContent: Alignment.Top }){  
65 - // 顶部图片  
66 - Image($r('app.media.home_page_bg'))  
67 - .width('100%')  
68 - .height('120vp')  
69 - .objectFit(ImageFit.Auto)  
70 - .objectRepeat(ImageRepeat.NoRepeat)  
71 - .backgroundColor(Color.White)  
72 - .visibility(this.isLoading ? Visibility.None : Visibility.Visible)  
73 -  
74 - Row()  
75 - .height(px2vp(this.topSafeHeight))  
76 - .width("100%")  
77 - .backgroundColor($r('app.color.white'))  
78 - .visibility(this.topOpacity > 0 ? Visibility.Visible : Visibility.None)  
79 - .opacity(this.topOpacity )  
80 - } 64 + if (this.isHasHomePage){
  65 + Stack({ alignContent: Alignment.TopStart }) {
  66 + Stack({ alignContent: Alignment.Top }){
  67 + // 顶部图片
  68 + Image($r('app.media.home_page_bg'))
  69 + .width('100%')
  70 + .height('120vp')
  71 + .objectFit(ImageFit.Auto)
  72 + .objectRepeat(ImageRepeat.NoRepeat)
  73 + .backgroundColor(Color.White)
  74 + .visibility(this.isLoading ? Visibility.None : Visibility.Visible)
  75 +
  76 + Row()
  77 + .height(px2vp(this.topSafeHeight))
  78 + .width("100%")
  79 + .backgroundColor($r('app.color.white'))
  80 + .visibility(this.topOpacity > 0 ? Visibility.Visible : Visibility.None)
  81 + .opacity(this.topOpacity )
  82 + }
81 83
82 - Column(){  
83 - // 头部返回  
84 - PeopleShipHomePageNavComponent({  
85 - attentionOpacity: this.attentionOpacity,  
86 - topOpacity: this.topOpacity,  
87 - detailModel: this.detailModel  
88 - })  
89 - .height($r('app.float.top_bar_height'))  
90 - .backgroundColor(Color.Transparent)  
91 - if (this.detailModel && this.detailModel.userName) {  
92 - Scroll(this.scroller) {  
93 - Column() {  
94 - // 顶部相关  
95 - PeopleShipHomePageTopComponent({  
96 - creatorId: this.creatorId,  
97 - detailModel: this.detailModel,  
98 - publishCount: this.publishCount,  
99 - topHeight: this.topHeight  
100 - })  
101 - .width("100%")  
102 - .height(this.topHeight)  
103 - // 列表  
104 - Column(){  
105 - PeopleShipHomeListComponent({ 84 + Column(){
  85 + // 头部返回
  86 + PeopleShipHomePageNavComponent({
  87 + attentionOpacity: this.attentionOpacity,
  88 + topOpacity: this.topOpacity,
  89 + detailModel: this.detailModel
  90 + })
  91 + .height($r('app.float.top_bar_height'))
  92 + .backgroundColor(Color.Transparent)
  93 + if (this.detailModel && this.detailModel.userName) {
  94 + Scroll(this.scroller) {
  95 + Column() {
  96 + // 顶部相关
  97 + PeopleShipHomePageTopComponent({
  98 + creatorId: this.creatorId,
  99 + detailModel: this.detailModel,
106 publishCount: this.publishCount, 100 publishCount: this.publishCount,
107 - creatorId: this.creatorId 101 + topHeight: this.topHeight
108 }) 102 })
109 - }.height('100%')  
110 -  
111 - 103 + .width("100%")
  104 + .height(this.topHeight)
  105 + // 列表
  106 + Column(){
  107 + PeopleShipHomeListComponent({
  108 + publishCount: this.publishCount,
  109 + creatorId: this.creatorId
  110 + })
  111 + }.height('100%')
  112 +
  113 +
  114 + }
  115 + .width("100%")
  116 + .justifyContent(FlexAlign.Start)
  117 + .alignItems(HorizontalAlign.Start)
  118 + // .height('100%')
  119 + // .height(this.publishCount == 0 ? '100%' : '')
112 } 120 }
113 - .width("100%")  
114 - .justifyContent(FlexAlign.Start)  
115 - .alignItems(HorizontalAlign.Start)  
116 - // .height('100%')  
117 - // .height(this.publishCount == 0 ? '100%' : '') 121 + .scrollable(ScrollDirection.Vertical)
  122 + // .alignSelf(ItemAlign.Start)
  123 + // .align(Alignment.Start)
  124 + .edgeEffect(EdgeEffect.None)
  125 + .friction(0.7)
  126 + .backgroundColor(Color.White)
  127 + .scrollBar(BarState.Off)
  128 + .width('100%')
  129 + .height('calc(100% - 44vp)')
  130 + // .layoutWeight(1)
  131 + .onDidScroll(() => {
  132 + // this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2)
  133 + this.topOpacity = this.scroller.currentOffset().yOffset / 100
  134 + if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) {
  135 + this.attentionOpacity = true
  136 + } else {
  137 + this.attentionOpacity = false
  138 + }
  139 + Logger.debug('PeopleShipHomePage',`透明度:${this.topOpacity}`)
  140 +
  141 + })
118 } 142 }
119 - .scrollable(ScrollDirection.Vertical)  
120 - // .alignSelf(ItemAlign.Start)  
121 - // .align(Alignment.Start)  
122 - .edgeEffect(EdgeEffect.None)  
123 - .friction(0.7)  
124 - .backgroundColor(Color.White)  
125 - .scrollBar(BarState.Off)  
126 - .width('100%')  
127 - .height('calc(100% - 44vp)')  
128 - // .layoutWeight(1)  
129 - .onDidScroll(() => {  
130 - // this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2)  
131 - this.topOpacity = this.scroller.currentOffset().yOffset / 100  
132 - if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) {  
133 - this.attentionOpacity = true  
134 - } else {  
135 - this.attentionOpacity = false  
136 - }  
137 - Logger.debug('PeopleShipHomePage',`透明度:${this.topOpacity}`)  
138 -  
139 - })  
140 } 143 }
  144 + .alignItems(HorizontalAlign.Start)
  145 + .justifyContent(FlexAlign.Start)
  146 + .width('100%')
  147 + .margin({top:px2vp(this.topSafeHeight)})
141 } 148 }
142 - .alignItems(HorizontalAlign.Start)  
143 - .justifyContent(FlexAlign.Start)  
144 .width('100%') 149 .width('100%')
145 - .margin({top:px2vp(this.topSafeHeight)}) 150 + }else {
  151 + Column(){
  152 + CustomTitleUI({ titleName: "" })
  153 + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoUserHomepage}).height('70%')
  154 + }.width("100%")
  155 + .height("100%")
  156 + .padding({top:px2vp(this.topSafeHeight)})
146 } 157 }
147 - .width('100%')  
148 }else{ 158 }else{
149 Column(){ 159 Column(){
150 CustomTitleUI({ titleName: "" }) 160 CustomTitleUI({ titleName: "" })
@@ -184,6 +194,7 @@ struct PeopleShipHomePage { @@ -184,6 +194,7 @@ struct PeopleShipHomePage {
184 194
185 } catch (exception) { 195 } catch (exception) {
186 this.isLoading = false 196 this.isLoading = false
  197 + this.isHasHomePage = false
187 } 198 }
188 } 199 }
189 200
@@ -44,7 +44,9 @@ export const enum WDViewDefaultType { @@ -44,7 +44,9 @@ export const enum WDViewDefaultType {
44 // 17. 暂无评论快来抢沙发 44 // 17. 暂无评论快来抢沙发
45 WDViewDefaultType_NoComment1, 45 WDViewDefaultType_NoComment1,
46 // 18. 内容找不到了 46 // 18. 内容找不到了
47 - WDViewDefaultType_NoContent2 47 + WDViewDefaultType_NoContent2,
  48 + // 19. 暂时无法查看该创作者主页
  49 + WDViewDefaultType_NoUserHomepage
48 } 50 }
49 51
50 /** 52 /**
@@ -214,6 +216,8 @@ export struct EmptyComponent { @@ -214,6 +216,8 @@ export struct EmptyComponent {
214 contentString = '暂无评论,快来抢沙发' 216 contentString = '暂无评论,快来抢沙发'
215 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent2) { 217 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent2) {
216 contentString = '内容找不到了' 218 contentString = '内容找不到了'
  219 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoUserHomepage){
  220 + contentString = '暂时无法查看该创作者主页'
217 } 221 }
218 222
219 return contentString 223 return contentString
@@ -250,6 +254,8 @@ export struct EmptyComponent { @@ -250,6 +254,8 @@ export struct EmptyComponent {
250 this.emptyType === WDViewDefaultType.WDViewDefaultType_NoFollow || 254 this.emptyType === WDViewDefaultType.WDViewDefaultType_NoFollow ||
251 this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent2) { 255 this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent2) {
252 imageString = $r('app.media.icon_no_appointmentMade1') 256 imageString = $r('app.media.icon_no_appointmentMade1')
  257 + }else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoUserHomepage){
  258 + imageString = $r('app.media.icon_no_master1')
253 } 259 }
254 return imageString 260 return imageString
255 } 261 }