| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- import { BarType, 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<BarType<undefined>> = [
- // {
- // text: 'AI次数兑换',
- // click: () => {
- // yTRouter.router2AIExchangePage()
- // if (this.userInfo.checkLogin()) {
- //
- // } else {
- // //TODO 去登录页
- // }
- //
- // },
- // src: $r('app.media.right_arrow')
- // },
- // {
- // 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.router2AgreementPage('关于我们')
- // },
- // src: $r('app.media.right_arrow')
- // },
- // {
- // text: '隐私政策',
- // click: () => {
- // yTRouter.router2AgreementPage('隐私政策')
- // },
- // 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: BarType<undefined>, 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%')
- }
- }
|