Showing
3 changed files
with
31 additions
and
16 deletions
| @@ -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,6 +114,7 @@ export struct PeopleShipHomePageTopComponent { | @@ -114,6 +114,7 @@ export struct PeopleShipHomePageTopComponent { | ||
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | // 简介 | 116 | // 简介 |
| 117 | + if (this.detailModel.introduction && this.detailModel.introduction.length > 0 ) { | ||
| 117 | if (this.lineInNum > 3) { | 118 | if (this.lineInNum > 3) { |
| 118 | Row() { | 119 | Row() { |
| 119 | Text() { | 120 | Text() { |
| @@ -171,6 +172,7 @@ export struct PeopleShipHomePageTopComponent { | @@ -171,6 +172,7 @@ export struct PeopleShipHomePageTopComponent { | ||
| 171 | .backgroundColor(Color.Transparent) | 172 | .backgroundColor(Color.Transparent) |
| 172 | .alignItems(VerticalAlign.Top) | 173 | .alignItems(VerticalAlign.Top) |
| 173 | } | 174 | } |
| 175 | + } | ||
| 174 | 176 | ||
| 175 | // IP归属地 | 177 | // IP归属地 |
| 176 | if (this.provinceName && this.provinceName.length > 0) { | 178 | if (this.provinceName && this.provinceName.length > 0) { |
| @@ -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,6 +346,15 @@ export struct PeopleShipHomePageTopComponent { | @@ -344,6 +346,15 @@ export struct PeopleShipHomePageTopComponent { | ||
| 344 | this.topFixedHeight += 12 | 346 | this.topFixedHeight += 12 |
| 345 | } | 347 | } |
| 346 | } | 348 | } |
| 349 | + | ||
| 350 | + // IP归属地 | ||
| 351 | + if (this.provinceName && this.provinceName.length > 0) { | ||
| 352 | + this.topFixedHeight += 28 | ||
| 353 | + this.topHeight = this.topFixedHeight | ||
| 354 | + } | ||
| 355 | + | ||
| 356 | + // 简介 | ||
| 357 | + if (this.detailModel.introduction && this.detailModel.introduction.length > 0 ) { | ||
| 347 | this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | 358 | this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) |
| 348 | if (this.lineInNum <= 3) { | 359 | if (this.lineInNum <= 3) { |
| 349 | this.topHeight = this.topFixedHeight + (21 * this.lineInNum) | 360 | this.topHeight = this.topFixedHeight + (21 * this.lineInNum) |
| @@ -351,11 +362,8 @@ export struct PeopleShipHomePageTopComponent { | @@ -351,11 +362,8 @@ export struct PeopleShipHomePageTopComponent { | ||
| 351 | this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}` + '收起', DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | 362 | 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) | 363 | this.topHeight = this.topFixedHeight + (this.isCollapse ? 21 * 3 : 21 * this.lineInNum) |
| 353 | } | 364 | } |
| 354 | - // IP归属地 | ||
| 355 | - if (this.provinceName && this.provinceName.length > 0) { | ||
| 356 | - this.topFixedHeight += 28 | ||
| 357 | - this.topHeight += 28 | ||
| 358 | } | 365 | } |
| 366 | + | ||
| 359 | } | 367 | } |
| 360 | } | 368 | } |
| 361 | 369 |
-
Please register or login to post a comment