Showing
10 changed files
with
234 additions
and
117 deletions
| @@ -324,6 +324,27 @@ export struct HomePageBottomComponent{ | @@ -324,6 +324,27 @@ export struct HomePageBottomComponent{ | ||
| 324 | data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName)) | 324 | data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName)) |
| 325 | }) | 325 | }) |
| 326 | 326 | ||
| 327 | + if(status.commentIdList.length === 0){ | ||
| 328 | + data.forEach((item)=>{ | ||
| 329 | + let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | ||
| 330 | + this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,publishTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName)) | ||
| 331 | + }) | ||
| 332 | + | ||
| 333 | + this.data_comment.notifyDataReload() | ||
| 334 | + | ||
| 335 | + this.count = this.data_comment.totalCount() | ||
| 336 | + this.commentNum = value.totalCount | ||
| 337 | + if (this.data_comment.totalCount() < value.totalCount) { | ||
| 338 | + this.curPageNum++ | ||
| 339 | + }else { | ||
| 340 | + this.hasMore = false | ||
| 341 | + } | ||
| 342 | + | ||
| 343 | + this.isLoading = false | ||
| 344 | + this.isGetRequest = true | ||
| 345 | + return | ||
| 346 | + } | ||
| 347 | + | ||
| 327 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ | 348 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ |
| 328 | newValue.forEach((item)=>{ | 349 | newValue.forEach((item)=>{ |
| 329 | data.forEach((list)=>{ | 350 | data.forEach((list)=>{ |
| @@ -139,6 +139,27 @@ export struct OtherHomePageBottomCommentComponent { | @@ -139,6 +139,27 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 139 | data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, parentCommentUserName)) | 139 | data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, parentCommentUserName)) |
| 140 | }) | 140 | }) |
| 141 | 141 | ||
| 142 | + if(status.commentIdList.length === 0){ | ||
| 143 | + data.forEach((item) => { | ||
| 144 | + this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, item.parentCommentContent, item.parentCommentUserName)) | ||
| 145 | + }) | ||
| 146 | + | ||
| 147 | + this.data_comment.notifyDataReload() | ||
| 148 | + | ||
| 149 | + this.count = this.data_comment.totalCount() | ||
| 150 | + this.commentNum = value.totalCount | ||
| 151 | + if (this.data_comment.totalCount() < value.totalCount) { | ||
| 152 | + this.curPageNum++ | ||
| 153 | + } else { | ||
| 154 | + this.hasMore = false | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + this.isLoading = false | ||
| 158 | + this.isGetRequest = true | ||
| 159 | + return | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + | ||
| 142 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => { | 163 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => { |
| 143 | newValue.forEach((item) => { | 164 | newValue.forEach((item) => { |
| 144 | data.forEach((list) => { | 165 | data.forEach((list) => { |
| @@ -3,31 +3,29 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | @@ -3,31 +3,29 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | ||
| 3 | 3 | ||
| 4 | @Component | 4 | @Component |
| 5 | export struct PeopleShipAttentionContentListHeadComponent { | 5 | export struct PeopleShipAttentionContentListHeadComponent { |
| 6 | - | ||
| 7 | - @State index: number = 0 | ||
| 8 | @ObjectLink item: FollowListDetailItem | 6 | @ObjectLink item: FollowListDetailItem |
| 7 | + | ||
| 9 | build() { | 8 | build() { |
| 10 | - Column(){ | 9 | + Column() { |
| 11 | // 头像 | 10 | // 头像 |
| 12 | PeopleShipHomePageHeadComponent({ | 11 | PeopleShipHomePageHeadComponent({ |
| 13 | diameter: 48, | 12 | diameter: 48, |
| 14 | iconDiameter: 16, | 13 | iconDiameter: 16, |
| 15 | - headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') : | ||
| 16 | - ((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ? | ||
| 17 | - this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')), | ||
| 18 | - authIcon: this.index == 0 ? '' : this.item.authIcon | 14 | + headPhotoUrl: (this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ? |
| 15 | + this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'), | ||
| 16 | + authIcon: this.item.authIcon | ||
| 19 | }).margin({ | 17 | }).margin({ |
| 20 | bottom: '8vp' | 18 | bottom: '8vp' |
| 21 | }) | 19 | }) |
| 22 | 20 | ||
| 23 | - Text(this.index == 0 ? '我的关注' : this.item.attentionUserName) | 21 | + Text(this.item.attentionUserName) |
| 24 | .fontColor($r('app.color.color_666666')) | 22 | .fontColor($r('app.color.color_666666')) |
| 25 | .fontSize($r('app.float.vp_13')) | 23 | .fontSize($r('app.float.vp_13')) |
| 26 | .fontWeight(400) | 24 | .fontWeight(400) |
| 27 | .height('18vp') | 25 | .height('18vp') |
| 28 | .lineHeight('18vp') | 26 | .lineHeight('18vp') |
| 29 | .maxLines(1) | 27 | .maxLines(1) |
| 30 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | 28 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 31 | .padding({ | 29 | .padding({ |
| 32 | left: '2vp', | 30 | left: '2vp', |
| 33 | right: '2vp' | 31 | right: '2vp' |
| @@ -36,7 +34,7 @@ export struct PeopleShipAttentionContentListHeadComponent { | @@ -36,7 +34,7 @@ export struct PeopleShipAttentionContentListHeadComponent { | ||
| 36 | .alignItems(HorizontalAlign.Center) | 34 | .alignItems(HorizontalAlign.Center) |
| 37 | .width('78vp') | 35 | .width('78vp') |
| 38 | .margin({ | 36 | .margin({ |
| 39 | - left: this.index == 0 ? '8vp' : '4vp', | 37 | + left: '4vp', |
| 40 | top: '14vp', | 38 | top: '14vp', |
| 41 | bottom: '14vp' | 39 | bottom: '14vp' |
| 42 | }) | 40 | }) |
| @@ -6,37 +6,72 @@ import { PeopleShipAttentionContentListHeadComponent } from './PeopleShipAttenti | @@ -6,37 +6,72 @@ import { PeopleShipAttentionContentListHeadComponent } from './PeopleShipAttenti | ||
| 6 | @Component | 6 | @Component |
| 7 | export struct PeopleShipAttentionContentListTopComponent { | 7 | export struct PeopleShipAttentionContentListTopComponent { |
| 8 | @Prop followList: FollowListDetailItem[] | 8 | @Prop followList: FollowListDetailItem[] |
| 9 | + | ||
| 9 | build() { | 10 | build() { |
| 10 | Column() { | 11 | Column() { |
| 11 | - List(){ | 12 | + List() { |
| 12 | ListItem() { | 13 | ListItem() { |
| 13 | - PeopleShipAttentionContentListHeadComponent({ | ||
| 14 | - index: 0, | ||
| 15 | - item: this.followList[0] | ||
| 16 | - }) | 14 | + this.PeopleShipFollowTop() |
| 17 | }.onClick(() => { | 15 | }.onClick(() => { |
| 18 | // 跳转到关注列表-我的 | 16 | // 跳转到关注列表-我的 |
| 19 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage) | 17 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage) |
| 20 | }) | 18 | }) |
| 21 | 19 | ||
| 22 | 20 | ||
| 23 | - ForEach(this.followList, (item: FollowListDetailItem, index: number) => { | 21 | + ForEach(this.followList, (item: FollowListDetailItem) => { |
| 24 | ListItem() { | 22 | ListItem() { |
| 25 | PeopleShipAttentionContentListHeadComponent({ | 23 | PeopleShipAttentionContentListHeadComponent({ |
| 26 | - index: index + 1, | ||
| 27 | item: item | 24 | item: item |
| 28 | }) | 25 | }) |
| 29 | }.onClick(() => { | 26 | }.onClick(() => { |
| 30 | let creatorId = item.attentionCreatorId || '' | 27 | let creatorId = item.attentionCreatorId || '' |
| 31 | ProcessUtils.gotoPeopleShipHomePage(creatorId) | 28 | ProcessUtils.gotoPeopleShipHomePage(creatorId) |
| 32 | }) | 29 | }) |
| 33 | - }, (item: FollowListDetailItem) => item.attentionCreatorId) | 30 | + }, (item: FollowListDetailItem, index: number) => item.attentionCreatorId + index) |
| 34 | } | 31 | } |
| 35 | .listDirection(Axis.Horizontal) | 32 | .listDirection(Axis.Horizontal) |
| 36 | .scrollBar(BarState.Off) | 33 | .scrollBar(BarState.Off) |
| 37 | .width('100%') | 34 | .width('100%') |
| 38 | .height('102vp') | 35 | .height('102vp') |
| 36 | + | ||
| 39 | Divider().strokeWidth(1).color($r('app.color.color_F5F5F5')) | 37 | Divider().strokeWidth(1).color($r('app.color.color_F5F5F5')) |
| 40 | } | 38 | } |
| 41 | } | 39 | } |
| 40 | + | ||
| 41 | + @Builder | ||
| 42 | + PeopleShipFollowTop() { | ||
| 43 | + Column() { | ||
| 44 | + // 头像 | ||
| 45 | + Image($r('app.media.attention_mine')) | ||
| 46 | + .alt($r('app.media.attention_mine')) | ||
| 47 | + .width(48) | ||
| 48 | + .height(48) | ||
| 49 | + .borderRadius(24) | ||
| 50 | + .objectFit(ImageFit.ScaleDown) | ||
| 51 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 52 | + .margin({ | ||
| 53 | + bottom: '8vp' | ||
| 54 | + }) | ||
| 55 | + | ||
| 56 | + Text('我的关注') | ||
| 57 | + .fontColor($r('app.color.color_666666')) | ||
| 58 | + .fontSize($r('app.float.vp_13')) | ||
| 59 | + .fontWeight(400) | ||
| 60 | + .height('18vp') | ||
| 61 | + .lineHeight('18vp') | ||
| 62 | + .maxLines(1) | ||
| 63 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 64 | + .padding({ | ||
| 65 | + left: '2vp', | ||
| 66 | + right: '2vp' | ||
| 67 | + }) | ||
| 68 | + } | ||
| 69 | + .alignItems(HorizontalAlign.Center) | ||
| 70 | + .width('78vp') | ||
| 71 | + .margin({ | ||
| 72 | + left: '8vp', | ||
| 73 | + top: '14vp', | ||
| 74 | + bottom: '14vp' | ||
| 75 | + }) | ||
| 76 | + } | ||
| 42 | } | 77 | } |
| @@ -18,7 +18,14 @@ export struct PeopleShipHomeAttentionComponent { | @@ -18,7 +18,14 @@ export struct PeopleShipHomeAttentionComponent { | ||
| 18 | .height(20) | 18 | .height(20) |
| 19 | .color($r('app.color.color_fff')) | 19 | .color($r('app.color.color_fff')) |
| 20 | }else { | 20 | }else { |
| 21 | - Text('+ 关注') | 21 | + Image($r('app.media.people_ship_top_add')) |
| 22 | + .objectFit(ImageFit.Auto) | ||
| 23 | + .width('16vp') | ||
| 24 | + .height('16pv') | ||
| 25 | + .margin({ | ||
| 26 | + right: '4vp' | ||
| 27 | + }) | ||
| 28 | + Text('关注') | ||
| 22 | .fontColor(Color.White) | 29 | .fontColor(Color.White) |
| 23 | .fontSize($r('app.float.vp_14')) | 30 | .fontSize($r('app.float.vp_14')) |
| 24 | .fontWeight(500) | 31 | .fontWeight(500) |
| @@ -38,14 +38,17 @@ export struct PeopleShipHomeListComponent { | @@ -38,14 +38,17 @@ export struct PeopleShipHomeListComponent { | ||
| 38 | } | 38 | } |
| 39 | .justifyContent(FlexAlign.Start) | 39 | .justifyContent(FlexAlign.Start) |
| 40 | } | 40 | } |
| 41 | + .backgroundColor(Color.White) | ||
| 41 | .align(Alignment.Start) | 42 | .align(Alignment.Start) |
| 42 | .scrollable(ScrollDirection.Horizontal) | 43 | .scrollable(ScrollDirection.Horizontal) |
| 43 | .scrollBar(BarState.Off) | 44 | .scrollBar(BarState.Off) |
| 44 | .width('100%') | 45 | .width('100%') |
| 45 | } | 46 | } |
| 47 | + .backgroundColor(Color.White) | ||
| 46 | .alignItems(VerticalAlign.Bottom) | 48 | .alignItems(VerticalAlign.Bottom) |
| 47 | .width('100%') | 49 | .width('100%') |
| 48 | } | 50 | } |
| 51 | + .justifyContent(FlexAlign.Start) | ||
| 49 | .height('44vp') | 52 | .height('44vp') |
| 50 | .alignItems(HorizontalAlign.Start) | 53 | .alignItems(HorizontalAlign.Start) |
| 51 | .width('100%') | 54 | .width('100%') |
| @@ -62,7 +62,25 @@ export struct PeopleShipHomePageNavComponent { | @@ -62,7 +62,25 @@ export struct PeopleShipHomePageNavComponent { | ||
| 62 | 62 | ||
| 63 | if (this.isAttention == '0') { | 63 | if (this.isAttention == '0') { |
| 64 | // 关注 | 64 | // 关注 |
| 65 | - Button('+ 关注', { type: ButtonType.Normal, stateEffect: true }) | 65 | + Button({ type: ButtonType.Normal, stateEffect: true }) { |
| 66 | + Row(){ | ||
| 67 | + Image($r('app.media.people_ship_top_add')) | ||
| 68 | + .objectFit(ImageFit.Auto) | ||
| 69 | + .width('12vp') | ||
| 70 | + .height('12pv') | ||
| 71 | + .margin({ | ||
| 72 | + right: '2vp' | ||
| 73 | + }) | ||
| 74 | + Text('关注') | ||
| 75 | + .fontSize($r('app.float.vp_12')) | ||
| 76 | + .fontColor(Color.White) | ||
| 77 | + } | ||
| 78 | + .alignSelf(ItemAlign.Center) | ||
| 79 | + .justifyContent(FlexAlign.Center) | ||
| 80 | + .width('100%') | ||
| 81 | + .height('100%') | ||
| 82 | + } | ||
| 83 | + | ||
| 66 | .borderRadius(4) | 84 | .borderRadius(4) |
| 67 | .backgroundColor($r('app.color.color_ED2800')) | 85 | .backgroundColor($r('app.color.color_ED2800')) |
| 68 | .width('54vp') | 86 | .width('54vp') |
| @@ -77,8 +95,6 @@ export struct PeopleShipHomePageNavComponent { | @@ -77,8 +95,6 @@ export struct PeopleShipHomePageNavComponent { | ||
| 77 | left: '12vp', | 95 | left: '12vp', |
| 78 | }) | 96 | }) |
| 79 | .padding(0) | 97 | .padding(0) |
| 80 | - .fontSize($r('app.float.vp_12')) | ||
| 81 | - .fontColor(Color.White) | ||
| 82 | .visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden)) | 98 | .visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden)) |
| 83 | } else { | 99 | } else { |
| 84 | Button('已关注', { type: ButtonType.Normal, stateEffect: true }) | 100 | Button('已关注', { type: ButtonType.Normal, stateEffect: true }) |
| @@ -5,7 +5,7 @@ export struct PeopleShipHomePageAttestationComponent { | @@ -5,7 +5,7 @@ export struct PeopleShipHomePageAttestationComponent { | ||
| 5 | build() { | 5 | build() { |
| 6 | Row() { | 6 | Row() { |
| 7 | Text(this.name) | 7 | Text(this.name) |
| 8 | - .lineHeight('16vp') | 8 | + .lineHeight('18vp') |
| 9 | .fontColor($r('app.color.color_ED2800')) | 9 | .fontColor($r('app.color.color_ED2800')) |
| 10 | .fontSize($r('app.float.vp_11')) | 10 | .fontSize($r('app.float.vp_11')) |
| 11 | .backgroundColor($r('app.color.color_1AED2800')) | 11 | .backgroundColor($r('app.color.color_1AED2800')) |
| @@ -16,21 +16,27 @@ export struct PeopleShipHomePageAttestationComponent { | @@ -16,21 +16,27 @@ export struct PeopleShipHomePageAttestationComponent { | ||
| 16 | left: '16vp', | 16 | left: '16vp', |
| 17 | }) | 17 | }) |
| 18 | .padding({ | 18 | .padding({ |
| 19 | - top: '3vp', | ||
| 20 | - bottom: '3vp', | ||
| 21 | - right: '6vp', | ||
| 22 | - left: '6vp' | 19 | + top: '1vp', |
| 20 | + bottom: '1vp', | ||
| 21 | + right: '4vp', | ||
| 22 | + left: '4vp' | ||
| 23 | }) | 23 | }) |
| 24 | 24 | ||
| 25 | Text(this.content) | 25 | Text(this.content) |
| 26 | - .lineHeight('22vp') | 26 | + .lineHeight('18vp') |
| 27 | .fontSize($r('app.float.vp_12')) | 27 | .fontSize($r('app.float.vp_12')) |
| 28 | .layoutWeight(1) | 28 | .layoutWeight(1) |
| 29 | .fontColor($r('app.color.color_222222')) | 29 | .fontColor($r('app.color.color_222222')) |
| 30 | .textAlign(TextAlign.Start) | 30 | .textAlign(TextAlign.Start) |
| 31 | + .align(Alignment.Center) | ||
| 32 | + .padding(0) | ||
| 31 | .margin({ | 33 | .margin({ |
| 32 | right: '16vp' | 34 | right: '16vp' |
| 33 | }) | 35 | }) |
| 36 | + .padding({ | ||
| 37 | + top: '1vp', | ||
| 38 | + bottom: '1vp', | ||
| 39 | + }) | ||
| 34 | } | 40 | } |
| 35 | .width('100%') | 41 | .width('100%') |
| 36 | .alignItems(VerticalAlign.Top) | 42 | .alignItems(VerticalAlign.Top) |
| @@ -2,7 +2,7 @@ import measure from '@ohos.measure' | @@ -2,7 +2,7 @@ import measure from '@ohos.measure' | ||
| 2 | import { DisplayUtils } from 'wdKit' | 2 | import { DisplayUtils } from 'wdKit' |
| 3 | import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent' | 3 | import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent' |
| 4 | import { PeopleShipHomePageAttestationComponent } from './PeopleShipHomePageAttestationComponent' | 4 | import { PeopleShipHomePageAttestationComponent } from './PeopleShipHomePageAttestationComponent' |
| 5 | -import { Logger } from 'wdKit' | 5 | +import { Logger } from 'wdKit' |
| 6 | import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' | 6 | import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' |
| 7 | import { InfluenceData, PeopleShipUserDetailData } from 'wdBean' | 7 | import { InfluenceData, PeopleShipUserDetailData } from 'wdBean' |
| 8 | import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent' | 8 | import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent' |
| @@ -28,36 +28,37 @@ export struct PeopleShipHomePageTopComponent { | @@ -28,36 +28,37 @@ export struct PeopleShipHomePageTopComponent { | ||
| 28 | @State collapseTxt: string = '…展开'; | 28 | @State collapseTxt: string = '…展开'; |
| 29 | private subTxt: string = ''; | 29 | private subTxt: string = ''; |
| 30 | @State content: string = '' | 30 | @State content: string = '' |
| 31 | - @State topFixedHeight: number = 320 | 31 | + @State topFixedHeight: number = 286 |
| 32 | @State lineInNum: number = 1 | 32 | @State lineInNum: number = 1 |
| 33 | @Link topHeight: number | 33 | @Link topHeight: number |
| 34 | @State provinceName: string = '' | 34 | @State provinceName: string = '' |
| 35 | + | ||
| 35 | build() { | 36 | build() { |
| 36 | Column() { | 37 | Column() { |
| 37 | - Stack({ alignContent: Alignment.TopStart}) { | 38 | + Stack({ alignContent: Alignment.TopStart }) { |
| 38 | // 顶部图片 | 39 | // 顶部图片 |
| 39 | Image($r('app.media.home_page_bg')) | 40 | Image($r('app.media.home_page_bg')) |
| 40 | .width('100%') | 41 | .width('100%') |
| 41 | .height('120vp') | 42 | .height('120vp') |
| 42 | .objectFit(ImageFit.Fill) | 43 | .objectFit(ImageFit.Fill) |
| 43 | - .backgroundColor(Color.Black) | 44 | + .backgroundColor(Color.White) |
| 44 | // 头像和名称 | 45 | // 头像和名称 |
| 45 | Row() { | 46 | Row() { |
| 46 | // 头像 | 47 | // 头像 |
| 47 | PeopleShipHomePageHeadComponent({ | 48 | PeopleShipHomePageHeadComponent({ |
| 48 | diameter: 80, | 49 | diameter: 80, |
| 49 | iconDiameter: 20, | 50 | iconDiameter: 20, |
| 50 | - headPhotoUrl:(this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon') , | 51 | + headPhotoUrl: (this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'), |
| 51 | authIcon: this.detailModel.authIcon | 52 | authIcon: this.detailModel.authIcon |
| 52 | }).margin({ | 53 | }).margin({ |
| 53 | left: '10vp', | 54 | left: '10vp', |
| 54 | bottom: '20vp' | 55 | bottom: '20vp' |
| 55 | - }).onClick(()=>{ | 56 | + }).onClick(() => { |
| 56 | let params = { | 57 | let params = { |
| 57 | 'headPhotoUrl': this.detailModel.headPhotoUrl, | 58 | 'headPhotoUrl': this.detailModel.headPhotoUrl, |
| 58 | 'headType': '1' | 59 | 'headType': '1' |
| 59 | } as Record<string, string>; | 60 | } as Record<string, string>; |
| 60 | - WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params) | 61 | + WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage, params) |
| 61 | }) | 62 | }) |
| 62 | 63 | ||
| 63 | 64 | ||
| @@ -68,7 +69,7 @@ export struct PeopleShipHomePageTopComponent { | @@ -68,7 +69,7 @@ export struct PeopleShipHomePageTopComponent { | ||
| 68 | .fontColor($r('app.color.color_222222')) | 69 | .fontColor($r('app.color.color_222222')) |
| 69 | .fontWeight(500) | 70 | .fontWeight(500) |
| 70 | .textAlign(TextAlign.Start) | 71 | .textAlign(TextAlign.Start) |
| 71 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | 72 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 72 | .maxLines(2) | 73 | .maxLines(2) |
| 73 | .layoutWeight(1) | 74 | .layoutWeight(1) |
| 74 | .margin({ | 75 | .margin({ |
| @@ -85,82 +86,89 @@ export struct PeopleShipHomePageTopComponent { | @@ -85,82 +86,89 @@ export struct PeopleShipHomePageTopComponent { | ||
| 85 | .width('100%') | 86 | .width('100%') |
| 86 | .height('180vp') | 87 | .height('180vp') |
| 87 | .backgroundColor(Color.Transparent) | 88 | .backgroundColor(Color.Transparent) |
| 89 | + | ||
| 88 | // 认证id:1蓝2黄,蓝v 只有官方认证,黄v有领域和身份认证 | 90 | // 认证id:1蓝2黄,蓝v 只有官方认证,黄v有领域和身份认证 |
| 89 | // 官方认证 | 91 | // 官方认证 |
| 90 | - if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) { | ||
| 91 | - PeopleShipHomePageAttestationComponent({name: '官方认证', content: this.detailModel.categoryAuth}) | 92 | + if (this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) { |
| 93 | + PeopleShipHomePageAttestationComponent({ name: '官方认证', content: this.detailModel.categoryAuth}) | ||
| 92 | .margin({ | 94 | .margin({ |
| 93 | - top: '10vp', | 95 | + top: '0vp', |
| 94 | bottom: '10vp' | 96 | bottom: '10vp' |
| 95 | }) | 97 | }) |
| 96 | } | 98 | } |
| 97 | - if(this.detailModel.authId == 2) { | ||
| 98 | - if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){ | ||
| 99 | - PeopleShipHomePageAttestationComponent({name: '领域认证', content: this.detailModel.authTitle}) | ||
| 100 | - .margin({ | ||
| 101 | - top: '10vp', | ||
| 102 | - bottom: '10vp' | ||
| 103 | - }) | ||
| 104 | - } | ||
| 105 | - if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){ | ||
| 106 | - PeopleShipHomePageAttestationComponent({name: '身份认证', content: this.detailModel.authPersonal}) | 99 | + if (this.detailModel.authId == 2) { |
| 100 | + if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0) { | ||
| 101 | + PeopleShipHomePageAttestationComponent({ name: '领域认证', content: this.detailModel.authTitle }) | ||
| 107 | .margin({ | 102 | .margin({ |
| 108 | - top: '10vp', | 103 | + top: '0vp', |
| 104 | + bottom: (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) ? '6vp' : '10vp' | ||
| 105 | + }) | ||
| 106 | + } | ||
| 107 | + if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) { | ||
| 108 | + PeopleShipHomePageAttestationComponent({ name: '身份认证', content: this.detailModel.authPersonal }) | ||
| 109 | + .margin({ | ||
| 110 | + top: '0vp', | ||
| 109 | bottom: '10vp' | 111 | bottom: '10vp' |
| 110 | }) | 112 | }) |
| 111 | } | 113 | } |
| 112 | } | 114 | } |
| 113 | 115 | ||
| 114 | // 简介 | 116 | // 简介 |
| 115 | - if(this.lineInNum > 3) { | 117 | + if (this.lineInNum > 3) { |
| 116 | Row() { | 118 | Row() { |
| 117 | Text() { | 119 | Text() { |
| 118 | Span(this.content) | 120 | Span(this.content) |
| 119 | .fontColor($r('app.color.color_222222')) | 121 | .fontColor($r('app.color.color_222222')) |
| 120 | 122 | ||
| 121 | Span(this.collapseTxt) | 123 | Span(this.collapseTxt) |
| 122 | - .onClick(()=>{ | ||
| 123 | - if(this.isCollapse){ | 124 | + .onClick(() => { |
| 125 | + if (this.isCollapse) { | ||
| 124 | this.maxLines = Infinity; | 126 | this.maxLines = Infinity; |
| 125 | this.content = `简介:${this.detailModel.introduction}` | 127 | this.content = `简介:${this.detailModel.introduction}` |
| 126 | this.isCollapse = false; | 128 | this.isCollapse = false; |
| 127 | this.collapseTxt = '收起'; | 129 | this.collapseTxt = '收起'; |
| 128 | this.topHeight = this.topFixedHeight + 21 * this.lineInNum | 130 | this.topHeight = this.topFixedHeight + 21 * this.lineInNum |
| 129 | 131 | ||
| 130 | - }else{ | 132 | + } else { |
| 131 | this.isCollapse = true; | 133 | this.isCollapse = true; |
| 132 | this.collapseTxt = '…展开'; | 134 | this.collapseTxt = '…展开'; |
| 133 | this.content = this.subTxt; | 135 | this.content = this.subTxt; |
| 134 | - this.topHeight = this.topFixedHeight + 21 * 3 | 136 | + this.topHeight = this.topFixedHeight + 21 * 3 |
| 135 | } | 137 | } |
| 136 | }) | 138 | }) |
| 137 | .fontColor($r('app.color.color_B0B0B0')) | 139 | .fontColor($r('app.color.color_B0B0B0')) |
| 138 | 140 | ||
| 139 | } | 141 | } |
| 142 | + .backgroundColor(Color.Transparent) | ||
| 140 | .lineHeight('21vp') | 143 | .lineHeight('21vp') |
| 144 | + .width('100%') | ||
| 141 | .maxLines(this.maxLines) | 145 | .maxLines(this.maxLines) |
| 142 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | 146 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 143 | .fontSize($r('app.float.vp_14')) | 147 | .fontSize($r('app.float.vp_14')) |
| 144 | - .key('home_page_introduction') | ||
| 145 | - .margin({ | 148 | + .padding({ |
| 146 | left: '16vp', | 149 | left: '16vp', |
| 147 | right: '16vp', | 150 | right: '16vp', |
| 148 | }) | 151 | }) |
| 149 | }.width('100%') | 152 | }.width('100%') |
| 153 | + .backgroundColor(Color.Transparent) | ||
| 150 | .alignItems(VerticalAlign.Top) | 154 | .alignItems(VerticalAlign.Top) |
| 151 | - }else { | 155 | + } else { |
| 152 | Row() { | 156 | Row() { |
| 153 | Text(`简介:${this.detailModel.introduction}`) | 157 | Text(`简介:${this.detailModel.introduction}`) |
| 154 | - .fontSize($r('app.float.vp_14')) | ||
| 155 | - .fontColor($r('app.color.color_222222')) | ||
| 156 | - .lineHeight('21vp') | ||
| 157 | - .maxLines(3) | ||
| 158 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 159 | - .margin({ | ||
| 160 | - left: '16vp', | ||
| 161 | - right: '16vp', | ||
| 162 | - }) | 158 | + .fontSize($r('app.float.vp_14')) |
| 159 | + .fontColor($r('app.color.color_222222')) | ||
| 160 | + .lineHeight('21vp') | ||
| 161 | + .width('100%') | ||
| 162 | + .maxLines(3) | ||
| 163 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 164 | + .padding({ | ||
| 165 | + left: '16vp', | ||
| 166 | + right: '16vp', | ||
| 167 | + }) | ||
| 168 | + .backgroundColor(Color.Transparent) | ||
| 169 | + | ||
| 163 | }.width('100%') | 170 | }.width('100%') |
| 171 | + .backgroundColor(Color.Transparent) | ||
| 164 | .alignItems(VerticalAlign.Top) | 172 | .alignItems(VerticalAlign.Top) |
| 165 | } | 173 | } |
| 166 | 174 | ||
| @@ -171,7 +179,6 @@ export struct PeopleShipHomePageTopComponent { | @@ -171,7 +179,6 @@ export struct PeopleShipHomePageTopComponent { | ||
| 171 | .fontSize($r('app.float.vp_12')) | 179 | .fontSize($r('app.float.vp_12')) |
| 172 | .fontColor($r('app.color.color_999999')) | 180 | .fontColor($r('app.color.color_999999')) |
| 173 | .textAlign(TextAlign.Start) | 181 | .textAlign(TextAlign.Start) |
| 174 | - .width('100%') | ||
| 175 | .alignSelf(ItemAlign.Start) | 182 | .alignSelf(ItemAlign.Start) |
| 176 | .margin({ | 183 | .margin({ |
| 177 | right: '16vp', | 184 | right: '16vp', |
| @@ -254,7 +261,8 @@ export struct PeopleShipHomePageTopComponent { | @@ -254,7 +261,8 @@ export struct PeopleShipHomePageTopComponent { | ||
| 254 | .height('6vp') | 261 | .height('6vp') |
| 255 | } | 262 | } |
| 256 | .width('100%') | 263 | .width('100%') |
| 257 | - .height('100%') | 264 | + |
| 265 | + // .height('100%') | ||
| 258 | } | 266 | } |
| 259 | 267 | ||
| 260 | async aboutToAppear() { | 268 | async aboutToAppear() { |
| @@ -272,17 +280,15 @@ export struct PeopleShipHomePageTopComponent { | @@ -272,17 +280,15 @@ export struct PeopleShipHomePageTopComponent { | ||
| 272 | 280 | ||
| 273 | } | 281 | } |
| 274 | 282 | ||
| 275 | - | ||
| 276 | - | ||
| 277 | // 不听减去2个字-一直到时3行 | 283 | // 不听减去2个字-一直到时3行 |
| 278 | private compIntroductionTextHeights() { | 284 | private compIntroductionTextHeights() { |
| 279 | let introduction = `简介:${this.detailModel.introduction}` | 285 | let introduction = `简介:${this.detailModel.introduction}` |
| 280 | - let lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 281 | - while (lineInNum1 > 3 ) { | 286 | + let lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) |
| 287 | + while (lineInNum1 > 3) { | ||
| 282 | introduction = introduction.substring(0, introduction.length - 2); | 288 | introduction = introduction.substring(0, introduction.length - 2); |
| 283 | - lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | 289 | + lineInNum1 = this.getTextLineNum(introduction + this.collapseTxt, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) |
| 284 | } | 290 | } |
| 285 | - introduction = introduction.substring(0, introduction.length - 3); | 291 | + // introduction = introduction.substring(0, introduction.length - 3); |
| 286 | Logger.debug('PeopleShipHomePageTopComponent', '3行简介:', `${introduction}`) | 292 | Logger.debug('PeopleShipHomePageTopComponent', '3行简介:', `${introduction}`) |
| 287 | 293 | ||
| 288 | this.subTxt = introduction; | 294 | this.subTxt = introduction; |
| @@ -292,7 +298,7 @@ export struct PeopleShipHomePageTopComponent { | @@ -292,7 +298,7 @@ export struct PeopleShipHomePageTopComponent { | ||
| 292 | private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) { | 298 | private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) { |
| 293 | let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize) | 299 | let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize) |
| 294 | let height: number = Number(size.height) | 300 | let height: number = Number(size.height) |
| 295 | - return Math.ceil(px2vp(height)/lineHeight) | 301 | + return Math.ceil(px2vp(height) / lineHeight) |
| 296 | } | 302 | } |
| 297 | 303 | ||
| 298 | private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) { | 304 | private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) { |
| @@ -306,51 +312,56 @@ export struct PeopleShipHomePageTopComponent { | @@ -306,51 +312,56 @@ export struct PeopleShipHomePageTopComponent { | ||
| 306 | 312 | ||
| 307 | async onIntroductionUpdated() { | 313 | async onIntroductionUpdated() { |
| 308 | 314 | ||
| 309 | - if (this.content.length == 0 && this.detailModel.introduction ) { | ||
| 310 | - this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | 315 | + if (this.content.length == 0 && this.detailModel.introduction) { |
| 316 | + this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 311 | if (this.lineInNum > 3) { | 317 | if (this.lineInNum > 3) { |
| 312 | this.compIntroductionTextHeights() | 318 | this.compIntroductionTextHeights() |
| 313 | this.content = this.subTxt | 319 | this.content = this.subTxt |
| 314 | } | 320 | } |
| 315 | } | 321 | } |
| 316 | - if (this.detailModel) { | ||
| 317 | - this.topFixedHeight = 308 | ||
| 318 | - if (this.detailModel.region && this.detailModel.region.length > 0) { | ||
| 319 | - this.provinceName = this.detailModel.region | ||
| 320 | - }else { | ||
| 321 | - this.provinceName = await this.computeIPRegion(this.detailModel.province) | ||
| 322 | - } | ||
| 323 | - if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) { | ||
| 324 | - this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22 | ||
| 325 | - } | ||
| 326 | - else if(this.detailModel.authId == 2) { | ||
| 327 | - if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){ | ||
| 328 | - this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22 | ||
| 329 | - } | ||
| 330 | - if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){ | ||
| 331 | - if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){ | ||
| 332 | - this.topFixedHeight += 10 | ||
| 333 | - } | ||
| 334 | - this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22 | ||
| 335 | - } | ||
| 336 | - } | ||
| 337 | - this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 338 | - if (this.lineInNum <= 3) { | ||
| 339 | - this.topFixedHeight += (21 * this.lineInNum) | ||
| 340 | - this.topHeight = this.topFixedHeight | ||
| 341 | - }else { | ||
| 342 | - this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum ) | ||
| 343 | - } | ||
| 344 | - // IP归属地 | ||
| 345 | - if (this.provinceName && this.provinceName.length > 0) { | ||
| 346 | - this.topHeight += 28 | ||
| 347 | - } | ||
| 348 | - } | 322 | + if (this.detailModel) { |
| 323 | + this.topFixedHeight = 286 | ||
| 324 | + if (this.detailModel.region && this.detailModel.region.length > 0) { | ||
| 325 | + this.provinceName = this.detailModel.region | ||
| 326 | + } else { | ||
| 327 | + this.provinceName = await this.computeIPRegion(this.detailModel.province) | ||
| 328 | + } | ||
| 329 | + if (this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) { | ||
| 330 | + this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18 | ||
| 331 | + this.topFixedHeight += 12 | ||
| 332 | + } | ||
| 333 | + else if (this.detailModel.authId == 2) { | ||
| 334 | + if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0) { | ||
| 335 | + this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18 | ||
| 336 | + if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0){ | ||
| 337 | + this.topFixedHeight += 8 | ||
| 338 | + }else{ | ||
| 339 | + this.topFixedHeight += 12 | ||
| 340 | + } | ||
| 341 | + } | ||
| 342 | + if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) { | ||
| 343 | + this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18 | ||
| 344 | + this.topFixedHeight += 12 | ||
| 345 | + } | ||
| 346 | + } | ||
| 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 | + } | ||
| 354 | + // IP归属地 | ||
| 355 | + if (this.provinceName && this.provinceName.length > 0) { | ||
| 356 | + this.topFixedHeight += 28 | ||
| 357 | + this.topHeight += 28 | ||
| 358 | + } | ||
| 359 | + } | ||
| 349 | } | 360 | } |
| 350 | 361 | ||
| 351 | - private computeShowNum(count: number) { | ||
| 352 | - if(count >= 10000) { | ||
| 353 | - return `${(count/10000).toFixed(1)}万` | 362 | + private computeShowNum(count: number) { |
| 363 | + if (count >= 10000) { | ||
| 364 | + return `${(count / 10000).toFixed(1)}万` | ||
| 354 | } | 365 | } |
| 355 | return `${count}` | 366 | return `${count}` |
| 356 | } | 367 | } |
| @@ -359,7 +370,7 @@ export struct PeopleShipHomePageTopComponent { | @@ -359,7 +370,7 @@ export struct PeopleShipHomePageTopComponent { | ||
| 359 | private async computeIPRegion(province: string) { | 370 | private async computeIPRegion(province: string) { |
| 360 | if (province && province.length) { | 371 | if (province && province.length) { |
| 361 | try { | 372 | try { |
| 362 | - let provinceName = await HWLocationUtils.getProvinceName(province) ; | 373 | + let provinceName = await HWLocationUtils.getProvinceName(province); |
| 363 | return provinceName | 374 | return provinceName |
| 364 | } catch (e) { | 375 | } catch (e) { |
| 365 | return '' | 376 | return '' |
| @@ -367,5 +378,4 @@ export struct PeopleShipHomePageTopComponent { | @@ -367,5 +378,4 @@ export struct PeopleShipHomePageTopComponent { | ||
| 367 | } | 378 | } |
| 368 | return '' | 379 | return '' |
| 369 | } | 380 | } |
| 370 | - | ||
| 371 | } | 381 | } |
-
Please register or login to post a comment