AboutUS.ets 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. import { YtAvoid, YTHeader, yTRouter } from 'basic';
  2. import { bundleManager } from '@kit.AbilityKit';
  3. @Builder
  4. function AboutUSBuilder() {
  5. NavDestination() {
  6. AboutUS()
  7. }.title("关于我们")
  8. .hideTitleBar(true)
  9. }
  10. @Component
  11. export struct AboutUS {
  12. @State content: string = '';
  13. @State isAgree: boolean = false
  14. @StorageProp(YtAvoid.safeBottomKey) safeBottom: number = 0
  15. ICPRecordNumber: string = '19019164号-5A'
  16. listData: string[] = ['用户协议', '隐私政策']
  17. @State versionName: string = ''
  18. async aboutToAppear() {
  19. const res = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
  20. this.versionName = res.versionName
  21. }
  22. build() {
  23. Column() {
  24. YTHeader({ title: "关于我们" })
  25. Column() {
  26. Image($r('[basic].media.app_icon'))
  27. .width(100)
  28. .margin({ bottom: 16 })
  29. Text('版本号:' + this.versionName)
  30. .margin({ bottom: 8 })
  31. Text('ICP备案号:' + this.ICPRecordNumber)
  32. .margin({ bottom: 20 })
  33. .fontSize(12)
  34. .fontColor(Color.Gray)
  35. List({ space: 25 }) {
  36. ForEach(this.listData, (item: string, index) => {
  37. ListItem() {
  38. Row() {
  39. Text(item).fontSize(13)
  40. .fontColor(Color.Gray)
  41. Blank()
  42. Image($r('app.media.MRight')).width('24').height('24').margin({ right: 10 })
  43. }.width('100%')
  44. .onClick(() => {
  45. switch (index) {
  46. case 0:
  47. yTRouter.router2userAgreement()
  48. break;
  49. case 1:
  50. yTRouter.router2Privacy()
  51. break;
  52. }
  53. })
  54. }
  55. }, (item: string) => item)
  56. ListItem() {
  57. Row() {
  58. Text('个性化推荐').fontSize(13)
  59. .fontColor(Color.Gray)
  60. Blank()
  61. Row() {
  62. Text()
  63. .height('100%')
  64. .aspectRatio(1)
  65. .backgroundColor(Color.White)
  66. .borderRadius(20)
  67. }
  68. .padding(1)
  69. .alignSelf(ItemAlign.End)
  70. .width(39)
  71. .aspectRatio(2)
  72. .borderRadius(20)
  73. .justifyContent(this.isAgree ? FlexAlign.End : FlexAlign.Start)
  74. .backgroundColor(this.isAgree ? $r('[basic].color.main_ac_color_dark') : '#D9D9D9')
  75. .onClick(() => {
  76. animateTo({ duration: 200 }, () => {
  77. this.isAgree = !this.isAgree
  78. })
  79. })
  80. }
  81. .width('100%')
  82. .alignItems(VerticalAlign.Center)
  83. .padding({ right: 16 })
  84. }
  85. }
  86. .divider({
  87. strokeWidth: 1,
  88. color: '#DFDFDF',
  89. startMargin: 20,
  90. endMargin: 10
  91. })
  92. .width('100%')
  93. .padding({ top: 10 })
  94. }
  95. .width('100%')
  96. .margin({ top: 20 })
  97. .padding({ left: 20, right: 20 })
  98. // Web({
  99. // src: "https://hm-static.ytpm.net/friend/doc/%E7%94%A8%E6%88%B7%E5%8D%8F%E8%AE%AE.html",
  100. // controller: this.webviewController,
  101. // renderMode: RenderMode.ASYNC_RENDER // 设置渲染模式
  102. // }).padding(40).width('100%').height('100%')
  103. }
  104. .padding({ bottom: this.safeBottom })
  105. }
  106. }