AboutPage.ets 5.6 KB

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