import { BasicType, copyText, ShowBannerAd, UserInfo, userInfo, YtAvoid, yTRouter } from 'basic' @Component export struct Mine { @StorageProp(YtAvoid.safeTopKey) safeTop: number = 0 @StorageProp(userInfo.KEY) userInfo: UserInfo = new UserInfo() setArr: Array> = [ { text: '意见反馈', click: () => { yTRouter.router2SuggestionPage() if (this.userInfo.checkLogin()) { } else { //TODO 去登录页 } }, src: $r('app.media.right_arrow') }, { text: '给个好评', click: () => { }, src: $r('app.media.right_arrow') }, { text: '关于我们', click: () => { yTRouter.router2AboutUS() }, src: $r('app.media.right_arrow') } ] aboutToAppear(): void { } build() { Column() { Row() { Row() { if (this.userInfo.getHeadImg()) { Image(this.userInfo.getHeadImg()) .aspectRatio(1) .height(40) .borderRadius(20) .margin({ right: 9 }) } else { Image($r('app.media.app_icon')) .width(50) .height(40) .margin({ right: 9 }) } Column({ space: 7 }) { Text(this.userInfo.getName() ?? this.userInfo.getPhoneNumber() ?? this.userInfo.getId()?.toString() ?? '未登录') .fontSize($r('[basic].float.page_text_font_size_16')) .fontColor('#FF000000') Text() { Span('ID:' + (this.userInfo.getId()?.toString().padStart(8, '0') ?? '00000000')) ImageSpan($r('app.media.copy')) .width(7) .height(8) .margin({ left: 4 }) .onClick(() => { copyText((this.userInfo.getId()?.toString().padStart(8, '0') ?? '00000000')) }) .offset({ bottom: 4 }) } .fontColor('#80000000') .fontSize($r('[basic].float.page_text_font_size_10')) } .alignItems(HorizontalAlign.Start) } .onClick(() => { if (this.userInfo.checkLogin()) { yTRouter.router2SettingPage() return } yTRouter.router2LoginPage() }) } .width('100%') .margin({ bottom: 30 }) ShowBannerAd() List() { ForEach(this.setArr, (item: BasicType, index) => { ListItem() { Row() { Text(item.text) .fontColor('#80000000') .fontSize(12) if (!index) { Row() { Text(this.userInfo.getAiNum()?.toString() ?? '') .fontWeight(600) .fontSize($r('[basic].float.page_text_font_size_14')) Image($r('app.media.right_arrow')) .width(24) .aspectRatio(1) } } else { Image($r('app.media.right_arrow')) .width(24) .aspectRatio(1) } } .width('100%') .height(36) .justifyContent(FlexAlign.SpaceBetween) .onClick(() => { item.click?.() }) } }) } .padding({ left: 12, right: 4 }) .divider({ strokeWidth: 1, color: '#0A000000', endMargin: 8 }) .margin({ top: 30 }) } .padding({ top: this.safeTop + 22, left: 16, right: 16 }) .height('100%') } }