wangliang_wd

feat:优化评论界面,人民号号主页显示

... ... @@ -2,7 +2,8 @@ import router from '@ohos.router'
import { PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { ToastUtils } from 'wdKit';
import { SPHelper, ToastUtils } from 'wdKit';
import { SpConstants } from 'wdConstant'
@Component
export struct PeopleShipHomePageNavComponent {
... ... @@ -10,10 +11,16 @@ export struct PeopleShipHomePageNavComponent {
@Consume isAttention: string
@Consume isLoadingAttention: boolean
@Prop attentionOpacity: boolean
@State userId:string = ''
// 页面详情数据
@Prop detailModel: PeopleShipUserDetailData = {} as PeopleShipUserDetailData
aboutToAppear(): void {
this.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string
}
build() {
RelativeContainer() {
Row() {
... ... @@ -67,52 +74,36 @@ export struct PeopleShipHomePageNavComponent {
})
.visibility((this.topOpacity > 0.5 ? Visibility.Visible : Visibility.Hidden))
if (this.isAttention == '0') {
// 关注
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row(){
Image($r('app.media.people_ship_top_add'))
.objectFit(ImageFit.Auto)
.width('13vp')
.height('13pv')
.margin({
right: '3vp'
})
Text('关注')
.fontSize($r('app.float.vp_12'))
.fontColor(Color.White)
.height('100%')
if (this.userId != this.detailModel.userId){
if (this.isAttention == '0') {
// 关注
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row(){
Image($r('app.media.people_ship_top_add'))
.objectFit(ImageFit.Auto)
.width('13vp')
.height('13pv')
.margin({
right: '3vp'
})
Text('关注')
.fontSize($r('app.float.vp_12'))
.fontColor(Color.White)
.height('100%')
}
.alignSelf(ItemAlign.Center)
.justifyContent(FlexAlign.Center)
.width('100%')
.height('100%')
}
.alignSelf(ItemAlign.Center)
.justifyContent(FlexAlign.Center)
.width('100%')
.height('100%')
}
.id("Button_Head")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "user_Head", align: HorizontalAlign.End }
})
.borderRadius(4)
.backgroundColor($r('app.color.color_ED2800'))
.width('54vp')
.height('24vp')
.onClick(() => {
if (this.isLoadingAttention){
return
}
this.isLoadingAttention = true
})
.margin({
left: '12vp',
})
.padding(0)
.visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden))
} else {
Button('已关注', { type: ButtonType.Normal, stateEffect: true })
.id("Button_Head")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "user_Head", align: HorizontalAlign.End }
})
.borderRadius(4)
.backgroundColor($r('app.color.color_F5F5F5'))
.backgroundColor($r('app.color.color_ED2800'))
.width('54vp')
.height('24vp')
.onClick(() => {
... ... @@ -124,15 +115,33 @@ export struct PeopleShipHomePageNavComponent {
.margin({
left: '12vp',
})
.id("Button_Head")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "user_Head", align: HorizontalAlign.End }
})
.padding(0)
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden))
} else {
Button('已关注', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(4)
.backgroundColor($r('app.color.color_F5F5F5'))
.width('54vp')
.height('24vp')
.onClick(() => {
if (this.isLoadingAttention){
return
}
this.isLoadingAttention = true
})
.margin({
left: '12vp',
})
.id("Button_Head")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "user_Head", align: HorizontalAlign.End }
})
.padding(0)
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden))
}
}
}
.height('100%')
... ...
import measure from '@ohos.measure'
import { DisplayUtils, NumberFormatterUtils } from 'wdKit'
import { DisplayUtils, NumberFormatterUtils, SPHelper } from 'wdKit'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
import { PeopleShipHomePageAttestationComponent } from './PeopleShipHomePageAttestationComponent'
import { Logger } from 'wdKit'
... ... @@ -8,6 +8,7 @@ import { InfluenceData, PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent'
import { HWLocationUtils } from 'wdHwAbility'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { SpConstants } from 'wdConstant'
@Component
... ... @@ -32,6 +33,7 @@ export struct PeopleShipHomePageTopComponent {
@State lineInNum: number = 1
@Link topHeight: number
@State provinceName: string = ''
@State userId:string = ''
build() {
Column() {
... ... @@ -242,13 +244,15 @@ export struct PeopleShipHomePageTopComponent {
top: '16vp'
})
// 分享-关注
PeopleShipHomeAttentionComponent()
.width(`calc(100% - ${32 + 'vp'})`)
.margin({
top: '10vp',
bottom: '16vp'
})
if (this.userId != this.detailModel.userId) {
// 分享-关注
PeopleShipHomeAttentionComponent()
.width(`calc(100% - ${32 + 'vp'})`)
.margin({
top: '10vp',
bottom: '16vp'
})
}
Row()
.backgroundColor($r('app.color.color_F5F5F5'))
.width('100%')
... ... @@ -277,6 +281,7 @@ export struct PeopleShipHomePageTopComponent {
this.onIntroductionUpdated()
}
this.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string
}
// 不听减去2个字-一直到时3行
... ...