MinePageUserSimpleInfoUI.ets 3.09 KB
import RouteManager from '../../../utils/RouteManager'

@Component
export default struct MinePageUserSimpleInfoUI {
  @Prop isLogin:boolean
  @Prop userName:string

  build(){
    Row(){
      //头像
      Stack(){
        Button({type:ButtonType.Circle})
          .backgroundColor($r('app.color.main_red'))
          .width('110lpx')
          .height('110lpx')
        Image($r('app.media.default_head'))
          .width('108lpx')
          .height('108lpx')
          .objectFit(ImageFit.Cover)
          .borderRadius(50)
      }.width('110lpx')
      .height('110lpx')
      .alignContent(Alignment.Center)
      .onClick(()=>{
        if(!this.isLogin){
          // RouteManager.jumpNewPage("pages/SettingAboutPage")
        }else {
          RouteManager.jumpNewPage("pages/MyHomePage")
        }
      })

      if(this.isLogin){
        //昵称信息
        Column(){
          Row(){
            Text(this.userName)
              .fontColor($r('app.color.color_222222'))
              .maxLines(1)
              .textOverflow({ overflow: TextOverflow.Ellipsis })
              .fontSize('33lpx')

            Image($r('app.media.mine_user_edit'))
              .width('27lpx')
              .height('27lpx')
              .margin({left:'15lpx'})
              .objectFit(ImageFit.Cover)
            Blank()
          }.width('100%')

          Stack(){
            Image($r('app.media.mine_grade_bg'))
              .width('84lpx')
              .height('29lpx')
              .objectFit(ImageFit.Auto)
            Text("等级8")
              .textAlign(TextAlign.Center)
              .fontColor($r('app.color.white'))
              .fontSize('19lpx')
              .width('50lpx')
              .height('29lpx')
          }.margin({top:'15lpx'})
        }.alignItems(HorizontalAlign.Start)
        .margin({top:'12lpx',left:'17lpx'})
        .width('352lpx')
      }else{
        Row(){
          Text("登录注册")
            .fontColor($r('app.color.color_222222'))
            .textOverflow({ overflow: TextOverflow.Ellipsis })
            .fontSize('33lpx')

          Image($r('app.media.mine_user_edit'))
            .width('11lpx')
            .height('20lpx')
            .margin({left:'15lpx'})
            .objectFit(ImageFit.Cover)
          Blank()
        }
        .margin({top:'11lpx',left:'17lpx'})
        .width('352lpx')
      }

      Blank()

      Stack({alignContent:Alignment.Start}){
        Text("签到")
          .textAlign(TextAlign.Start)
          .width('108lpx')
          .height('46lpx')
          .fontColor($r('app.color.color_AD6000'))
          .backgroundColor($r('app.color.color_FFC460'))
          .fontWeight(500)
          .position({x:'23lpx'})
          .padding({left:'35lpx'})
        Image($r("app.media.mine_sign_icon"))
          .width('50lpx')
          .height('50lpx')
      }.width('131lpx')
    }.backgroundColor($r('app.color.white'))
    .setFullWidth()
    .padding({top:'31lpx',left:'46lpx'})
  }

  @Styles setFullWidthAndHeight(){
    .width('100%')
    .height('100%')
  }

  @Styles setFullWidth(){
    .width('100%')
  }

  @Styles setFullHeight(){
    .height('100%')
  }
}