AboutPage.ets 5.2 KB

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