yanlu

fix:17009 UI还原问题--人民号号主信息页简介为空的时候鸿蒙版未能隐藏简介

@@ -35,7 +35,7 @@ struct PeopleShipHomePage { @@ -35,7 +35,7 @@ struct PeopleShipHomePage {
35 @Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false 35 @Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false
36 //关注显示 36 //关注显示
37 @Prop attentionOpacity: boolean = false 37 @Prop attentionOpacity: boolean = false
38 - @Provide topHeight: number = 400 38 + @Provide @Watch('handleChangeTopHeight') topHeight: number = 400
39 39
40 build() { 40 build() {
41 41
@@ -62,7 +62,6 @@ struct PeopleShipHomePage { @@ -62,7 +62,6 @@ struct PeopleShipHomePage {
62 }) 62 })
63 .width("100%") 63 .width("100%")
64 .height(this.topHeight) 64 .height(this.topHeight)
65 - .backgroundColor(Color.White)  
66 65
67 // 列表 66 // 列表
68 PeopleShipHomeListComponent({ 67 PeopleShipHomeListComponent({
@@ -81,7 +80,7 @@ struct PeopleShipHomePage { @@ -81,7 +80,7 @@ struct PeopleShipHomePage {
81 .scrollBar(BarState.Off) 80 .scrollBar(BarState.Off)
82 .width('100%') 81 .width('100%')
83 .height('100%') 82 .height('100%')
84 - .onScroll(() => { 83 + .onDidScroll(() => {
85 // this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2) 84 // this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2)
86 this.topOpacity = this.scroller.currentOffset().yOffset / 100 85 this.topOpacity = this.scroller.currentOffset().yOffset / 100
87 if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) { 86 if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) {
@@ -89,8 +88,7 @@ struct PeopleShipHomePage { @@ -89,8 +88,7 @@ struct PeopleShipHomePage {
89 } else { 88 } else {
90 this.attentionOpacity = false 89 this.attentionOpacity = false
91 } 90 }
92 - console.log(`全局请求失败拦截,message:${this.topOpacity}`)  
93 - // System.out.println("输出高度:"+ AttrHelper.vp2px(height,this)); 91 + Logger.debug('PeopleShipHomePage',`透明度:${this.topOpacity}`)
94 92
95 }) 93 })
96 } 94 }
@@ -108,13 +106,13 @@ struct PeopleShipHomePage { @@ -108,13 +106,13 @@ struct PeopleShipHomePage {
108 try { 106 try {
109 // 获取页面信息 107 // 获取页面信息
110 this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '') 108 this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '')
111 - Logger.debug('PeopleShipHomePage', '获取页面信息', `${JSON.stringify(this.detailModel)}`) 109 + Logger.debug('PeopleShipHomePage', '获取页面信息' + `${JSON.stringify(this.detailModel)}`)
112 110
113 // 获取关注 111 // 获取关注
114 // 登录后获取,是否关注 112 // 登录后获取,是否关注
115 if (HttpUtils.getUserId()) { 113 if (HttpUtils.getUserId()) {
116 let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId) 114 let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId)
117 - Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`) 115 + Logger.debug('PeopleShipHomePage', '获取关注信息' + `${JSON.stringify(followList)}`)
118 this.findFollowStata(followList) 116 this.findFollowStata(followList)
119 } 117 }
120 118
@@ -126,7 +124,7 @@ struct PeopleShipHomePage { @@ -126,7 +124,7 @@ struct PeopleShipHomePage {
126 findFollowStata(followList: QueryListIsFollowedItem[]) { 124 findFollowStata(followList: QueryListIsFollowedItem[]) {
127 if (followList.length > 0) { 125 if (followList.length > 0) {
128 let item: QueryListIsFollowedItem = followList[0] 126 let item: QueryListIsFollowedItem = followList[0]
129 - Logger.debug('PeopleShipHomePage', '关注', `${JSON.stringify(item.status)}`) 127 + Logger.debug('PeopleShipHomePage', '关注' + `${JSON.stringify(item.status)}`)
130 this.isAttention = item.status 128 this.isAttention = item.status
131 } 129 }
132 } 130 }
@@ -169,5 +167,9 @@ struct PeopleShipHomePage { @@ -169,5 +167,9 @@ struct PeopleShipHomePage {
169 this.isLoadingAttention = false 167 this.isLoadingAttention = false
170 }) 168 })
171 } 169 }
  170 + handleChangeTopHeight() {
  171 + Logger.debug('PeopleShipHomePage', 'topHeight' + this.topHeight)
  172 +
  173 + }
172 } 174 }
173 175
@@ -155,8 +155,13 @@ export struct TopNavigationComponent { @@ -155,8 +155,13 @@ export struct TopNavigationComponent {
155 this.channelIds = _channelIds 155 this.channelIds = _channelIds
156 this.myChannelList = _myChannelList 156 this.myChannelList = _myChannelList
157 157
158 - this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[0].name : this.topNavList[0].name  
159 - 158 + // 崩溃
  159 + // this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[0].name : this.topNavList[0].name
  160 + if (this._currentNavIndex === 0 && this.myChannelList && this.myChannelList.length > 0 && this.myChannelList[0].name) {
  161 + this.currentTopNavName = this.myChannelList[0].name
  162 + }else if(this._currentNavIndex != 0 && this.topNavList && this.topNavList.length > 0 && this.topNavList[0].name){
  163 + this.currentTopNavName = this.topNavList[0].name
  164 + }
160 165
161 //缓存首页频道 166 //缓存首页频道
162 let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId) 167 let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId)
@@ -114,62 +114,64 @@ export struct PeopleShipHomePageTopComponent { @@ -114,62 +114,64 @@ export struct PeopleShipHomePageTopComponent {
114 } 114 }
115 115
116 // 简介 116 // 简介
117 - if (this.lineInNum > 3) {  
118 - Row() {  
119 - Text() {  
120 - Span(this.content)  
121 - .fontColor($r('app.color.color_222222')) 117 + if (this.detailModel.introduction && this.detailModel.introduction.length > 0 ) {
  118 + if (this.lineInNum > 3) {
  119 + Row() {
  120 + Text() {
  121 + Span(this.content)
  122 + .fontColor($r('app.color.color_222222'))
122 123
123 - Span(this.collapseTxt)  
124 - .onClick(() => {  
125 - if (this.isCollapse) {  
126 - this.maxLines = Infinity;  
127 - this.content = `简介:${this.detailModel.introduction}`  
128 - this.isCollapse = false;  
129 - this.collapseTxt = '收起';  
130 - this.topHeight = this.topFixedHeight + 21 * this.lineInNum  
131 -  
132 - } else {  
133 - this.isCollapse = true;  
134 - this.collapseTxt = '…展开';  
135 - this.content = this.subTxt;  
136 - this.topHeight = this.topFixedHeight + 21 * 3  
137 - }  
138 - })  
139 - .fontColor($r('app.color.color_B0B0B0')) 124 + Span(this.collapseTxt)
  125 + .onClick(() => {
  126 + if (this.isCollapse) {
  127 + this.maxLines = Infinity;
  128 + this.content = `简介:${this.detailModel.introduction}`
  129 + this.isCollapse = false;
  130 + this.collapseTxt = '收起';
  131 + this.topHeight = this.topFixedHeight + 21 * this.lineInNum
140 132
141 - }  
142 - .backgroundColor(Color.Transparent)  
143 - .lineHeight('21vp')  
144 - .width('100%')  
145 - .maxLines(this.maxLines)  
146 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
147 - .fontSize($r('app.float.vp_14'))  
148 - .padding({  
149 - left: '16vp',  
150 - right: '16vp',  
151 - })  
152 - }.width('100%')  
153 - .backgroundColor(Color.Transparent)  
154 - .alignItems(VerticalAlign.Top)  
155 - } else {  
156 - Row() {  
157 - Text(`简介:${this.detailModel.introduction}`)  
158 - .fontSize($r('app.float.vp_14'))  
159 - .fontColor($r('app.color.color_222222')) 133 + } else {
  134 + this.isCollapse = true;
  135 + this.collapseTxt = '…展开';
  136 + this.content = this.subTxt;
  137 + this.topHeight = this.topFixedHeight + 21 * 3
  138 + }
  139 + })
  140 + .fontColor($r('app.color.color_B0B0B0'))
  141 +
  142 + }
  143 + .backgroundColor(Color.Transparent)
160 .lineHeight('21vp') 144 .lineHeight('21vp')
161 .width('100%') 145 .width('100%')
162 - .maxLines(3) 146 + .maxLines(this.maxLines)
163 .textOverflow({ overflow: TextOverflow.Ellipsis }) 147 .textOverflow({ overflow: TextOverflow.Ellipsis })
  148 + .fontSize($r('app.float.vp_14'))
164 .padding({ 149 .padding({
165 left: '16vp', 150 left: '16vp',
166 right: '16vp', 151 right: '16vp',
167 }) 152 })
168 - .backgroundColor(Color.Transparent) 153 + }.width('100%')
  154 + .backgroundColor(Color.Transparent)
  155 + .alignItems(VerticalAlign.Top)
  156 + } else {
  157 + Row() {
  158 + Text(`简介:${this.detailModel.introduction}`)
  159 + .fontSize($r('app.float.vp_14'))
  160 + .fontColor($r('app.color.color_222222'))
  161 + .lineHeight('21vp')
  162 + .width('100%')
  163 + .maxLines(3)
  164 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  165 + .padding({
  166 + left: '16vp',
  167 + right: '16vp',
  168 + })
  169 + .backgroundColor(Color.Transparent)
169 170
170 - }.width('100%')  
171 - .backgroundColor(Color.Transparent)  
172 - .alignItems(VerticalAlign.Top) 171 + }.width('100%')
  172 + .backgroundColor(Color.Transparent)
  173 + .alignItems(VerticalAlign.Top)
  174 + }
173 } 175 }
174 176
175 // IP归属地 177 // IP归属地
@@ -261,8 +263,8 @@ export struct PeopleShipHomePageTopComponent { @@ -261,8 +263,8 @@ export struct PeopleShipHomePageTopComponent {
261 .height('6vp') 263 .height('6vp')
262 } 264 }
263 .width('100%') 265 .width('100%')
  266 + .backgroundColor(Color.White)
264 267
265 - // .height('100%')  
266 } 268 }
267 269
268 async aboutToAppear() { 270 async aboutToAppear() {
@@ -312,7 +314,7 @@ export struct PeopleShipHomePageTopComponent { @@ -312,7 +314,7 @@ export struct PeopleShipHomePageTopComponent {
312 314
313 async onIntroductionUpdated() { 315 async onIntroductionUpdated() {
314 316
315 - if (this.content.length == 0 && this.detailModel.introduction) { 317 + if (this.content.length == 0 && this.detailModel.introduction && this.detailModel.introduction.length > 0) {
316 this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) 318 this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
317 if (this.lineInNum > 3) { 319 if (this.lineInNum > 3) {
318 this.compIntroductionTextHeights() 320 this.compIntroductionTextHeights()
@@ -344,18 +346,24 @@ export struct PeopleShipHomePageTopComponent { @@ -344,18 +346,24 @@ export struct PeopleShipHomePageTopComponent {
344 this.topFixedHeight += 12 346 this.topFixedHeight += 12
345 } 347 }
346 } 348 }
347 - this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))  
348 - if (this.lineInNum <= 3) {  
349 - this.topHeight = this.topFixedHeight + (21 * this.lineInNum)  
350 - } else {  
351 - this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}` + '收起', DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))  
352 - this.topHeight = this.topFixedHeight + (this.isCollapse ? 21 * 3 : 21 * this.lineInNum)  
353 - } 349 +
354 // IP归属地 350 // IP归属地
355 if (this.provinceName && this.provinceName.length > 0) { 351 if (this.provinceName && this.provinceName.length > 0) {
356 this.topFixedHeight += 28 352 this.topFixedHeight += 28
357 - this.topHeight += 28 353 + this.topHeight = this.topFixedHeight
  354 + }
  355 +
  356 + // 简介
  357 + if (this.detailModel.introduction && this.detailModel.introduction.length > 0 ) {
  358 + this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
  359 + if (this.lineInNum <= 3) {
  360 + this.topHeight = this.topFixedHeight + (21 * this.lineInNum)
  361 + } else {
  362 + this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}` + '收起', DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
  363 + this.topHeight = this.topFixedHeight + (this.isCollapse ? 21 * 3 : 21 * this.lineInNum)
  364 + }
358 } 365 }
  366 +
359 } 367 }
360 } 368 }
361 369