| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- import { BasicType, copyText, IBestToast, UserInfo, YTAvoid, YTLog, YTRouter } from 'basic'
- import { common, Want } from '@kit.AbilityKit'
- import { BusinessError } from '@kit.BasicServicesKit'
- import { BUNDLE_NAME } from 'BuildProfile'
- @Component
- export struct Mine {
- @StorageProp(YTAvoid.SAFE_TOP_KEY) safeTop: number = 0
- @StorageProp(UserInfo.KEY) userInfo: UserInfo = UserInfo.getInstance()
- setArr: Array<BasicType<undefined>> = [
- {
- text: '意见反馈',
- click: () => {
- if (this.userInfo.checkLogin()) {
- YTRouter.router2SuggestionPage()
- } else {
- YTRouter.router2LoginPage()
- }
- },
- src: $r('app.media.right_arrow')
- },
- {
- text: '给个好评',
- click: () => {
- const want: Want = {
- uri: "store://appgallery.huawei.com/app/detail?id=" + BUNDLE_NAME
- };
- const context = this.getUIContext().getHostContext() as common.UIAbilityContext;
- context.startAbility(want).then(() => {
- //拉起成功
- YTLog.info('跳转成功')
- }).catch((err: BusinessError) => {
- // 拉起失败
- YTLog.error(err)
- IBestToast.show('出现未知错误,请稍后再试')
- });
- },
- src: $r('app.media.right_arrow')
- },
- {
- text: '关于我们',
- click: () => {
- YTRouter.router2AboutUS()
- },
- src: $r('app.media.right_arrow')
- }
- ]
- aboutToAppear(): void {
- }
- build() {
- Column() {
- Row() {
- Row() {
- Image(this.userInfo.getHeadImg() ?? $r('app.media.app_icon'))
- .aspectRatio(1)
- .height(40)
- .borderRadius(20)
- .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('Color.Black')
- 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()
- Column() {
- List() {
- ForEach(this.setArr, (item: BasicType<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 })
- .width('100%')
- .height('100%')
- }
- .layoutWeight(1)
- .width('100%')
- }
- .padding({ top: this.safeTop + 22, left: 16, right: 16 })
- .height('100%')
- }
- }
|