AboutPage.ets 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import TitleBar from '../view/TitleBar'
  2. import { router } from '@kit.ArkUI'
  3. import { CommonConstants } from '../common/constants/CommonConstants'
  4. import { AppUtil, ToastUtil } from '@pura/harmony-utils'
  5. import { Utility } from '../common/util/Utility'
  6. import { ConfigurationConstant } from '@kit.AbilityKit'
  7. @Preview
  8. @Entry
  9. @Component
  10. export struct AboutPage{
  11. @State isDarkMode: boolean = false
  12. @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
  13. ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
  14. onColorModeChange() {
  15. this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
  16. this.titleBarModel.setTitleFontColor($r('app.color.title_text'))
  17. .setTitleBarBackground($r('app.color.title_bar_bg'))
  18. .setLeftTitleBackground($r('app.color.title_bar_bg'))
  19. }
  20. @State titleBarModel: TitleBar.Model = new TitleBar.Model()
  21. .setTitleTextStyle(FontStyle.Normal)
  22. .setTitleBarStyle(TitleBar.BarStyle.TRANSPARENT)
  23. .setLeftIcon($r('app.media.left_back_white'))
  24. .setTitleName('关于我们')
  25. .setTitleFontColor(Color.White)
  26. .setTitleBarBackground($r('app.color.title_bar_bg'))
  27. .setLeftTitleBackground($r('app.color.title_bar_bg'))
  28. .setTitleBarBottomLineColor($r('app.color.title_bar_bg'))
  29. .setOnLeftClickListener(() => {
  30. router.back()
  31. })
  32. @State verName:string = ''
  33. @State appName:string = ''
  34. // 组件生命周期
  35. aboutToAppear() {
  36. this.verName = AppUtil.getVersionName()
  37. Utility.getAppName(getContext(this)).then((appName:string)=>{
  38. this.appName = appName
  39. })
  40. this.onColorModeChange()
  41. console.info('LifeCycleComponent aboutToAppear');
  42. }
  43. // 组件生命周期
  44. aboutToDisappear() {
  45. console.info('LifeCycleComponent aboutToDisappear');
  46. }
  47. build() {
  48. Column(){
  49. TitleBar({model:$titleBarModel})
  50. Scroll(){
  51. Column(){
  52. Image($r('app.media.icon'))
  53. .width(150)
  54. .height(150)
  55. .borderRadius('100%')
  56. .clip(true)
  57. .margin({top:55})
  58. Text(this.appName+'V:'+this.verName)
  59. .fontColor(this.isDarkMode ? Color.White : Color.Black)
  60. .fontWeight(480)
  61. .fontSize(17)
  62. .margin({top:20,bottom:20})
  63. Text(CommonConstants.ICP_NO)
  64. .fontColor(this.isDarkMode ? Color.White : Color.Black)
  65. .fontWeight(480)
  66. .decoration({ type: TextDecorationType.Underline, color: this.isDarkMode ? Color.White : Color.Black })
  67. .fontSize(18)
  68. .margin({top:20,bottom:20})
  69. .onClick(()=>{
  70. router.pushUrl({url:'pages/WebIndex',
  71. params:{ titleName:'ICP备案',webUrl:CommonConstants.ICP_URL}
  72. });
  73. })
  74. Button('加入Q群:685109858', { type: ButtonType.Capsule, stateEffect: false })
  75. .width('60%')
  76. .height(55)
  77. .margin({top:50,bottom:20})
  78. // .visibility(Visibility.None)
  79. .stateEffect(true)
  80. .backgroundColor(this.isDarkMode ? '#1E90FF' : '#FF4081')
  81. .stateStyles({
  82. pressed: { opacity: 0.6 }
  83. })
  84. .onClick(()=>{
  85. ToastUtil.showToast('复制群号成功!')
  86. Utility.copyText('685109858')
  87. })
  88. Button('用户反馈', { type: ButtonType.Capsule, stateEffect: false })
  89. .width('60%')
  90. .height(55)
  91. .stateEffect(true)
  92. .margin({bottom:20})
  93. .backgroundColor(this.isDarkMode ? '#1E90FF' : '#FF4081')
  94. .stateStyles({
  95. pressed: { opacity: 0.6 }
  96. })
  97. .onClick(()=>{
  98. AlertDialog.show({
  99. title:'发送邮件',
  100. message:'感谢你的支持,如果有什么不支持的格式不能播放请反馈给我们修复,谢谢!有建议和反馈的请邮件联系我们:'+CommonConstants.CONTACT_MAIL,
  101. autoCancel:true,
  102. alignment:DialogAlignment.Center,
  103. offset:{dx:0,dy:-20},
  104. confirm:{
  105. value:'确定',
  106. fontColor:Color.White,
  107. backgroundColor:$r('app.color.title_bar_bg'),
  108. action:()=>{
  109. ToastUtil.showToast('复制邮件地址成功!')
  110. Utility.copyText(CommonConstants.CONTACT_MAIL)
  111. }
  112. }
  113. })
  114. })
  115. }
  116. .height('95%')
  117. .width('100%')
  118. }
  119. .height('100%')
  120. .backgroundColor(this.isDarkMode ? '#1A1A1A' : undefined)
  121. .linearGradient(!this.isDarkMode ? {colors:[['#FF4081', 0.0], ['#FF8C00', 0.6]]} : undefined)
  122. }
  123. }
  124. }