SuggestionPage.ets 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. import { IBestToast, YtAvoid, YtButton, YTHeader, yTRequest } from 'basic'
  2. @Builder
  3. function suggestionBuilder() {
  4. NavDestination() {
  5. SuggestionPage()
  6. }
  7. .hideTitleBar(true)
  8. }
  9. @Component
  10. struct SuggestionPage {
  11. @StorageProp(YtAvoid.safeTopKey) safeTop: number = 0
  12. @StorageProp(YtAvoid.safeBottomKey) safeBottom: number = 0
  13. @State description: string = ''
  14. @State contact: string = ''
  15. build() {
  16. Column() {
  17. YTHeader({ title: '意见反馈' })
  18. Row() {
  19. Row() {
  20. Text()
  21. .width(3)
  22. .height(10)
  23. .backgroundColor('#FF95BFBF')
  24. .margin({ right: 3 })
  25. Text() {
  26. Span('问题描述 ')
  27. .fontColor('#CC000000')
  28. Span('(必填)')
  29. .fontColor('#FFFD4437')
  30. }
  31. .fontSize($r('[basic].float.page_text_font_size_12'))
  32. .fontWeight(500)
  33. }
  34. }
  35. .width('100%')
  36. .alignItems(VerticalAlign.Bottom)
  37. .margin({ bottom: 4, top: 26 })
  38. .justifyContent(FlexAlign.SpaceBetween)
  39. .padding({ left: 16, right: 20 })
  40. Text('请尽量将问题描述详细')
  41. .fontSize($r('[basic].float.page_text_font_size_10'))
  42. .fontColor('#4D000000')
  43. .margin({ bottom: 8 })
  44. .width('100%')
  45. .textAlign(TextAlign.Start)
  46. .padding({ left: 22 })
  47. Column() {
  48. TextArea({ text: $$this.description })
  49. .width('100%')
  50. .padding(5)
  51. .fontSize($r('[basic].float.page_text_font_size_12'))
  52. .fontColor('#CC000000')
  53. .borderRadius(4)
  54. .border({ width: 1, color: '#14000000' })
  55. .height(155)
  56. .backgroundColor(Color.White)
  57. }
  58. .padding({ left: 22, right: 22 })
  59. .margin({ bottom: 23 })
  60. Row() {
  61. Row() {
  62. Text()
  63. .width(3)
  64. .height(10)
  65. .backgroundColor('#FF95BFBF')
  66. .margin({ right: 3 })
  67. Text() {
  68. Span('联系方式 ')
  69. .fontColor('#CC000000')
  70. Span('(选填)')
  71. .fontColor('#CC000000')
  72. }
  73. .fontSize($r('[basic].float.page_text_font_size_12'))
  74. .fontWeight(500)
  75. }
  76. }
  77. .width('100%')
  78. .alignItems(VerticalAlign.Bottom)
  79. .margin({ bottom: 4, top: 26 })
  80. .justifyContent(FlexAlign.SpaceBetween)
  81. .padding({ left: 16, right: 20 })
  82. Text('请输入手机号或QQ号')
  83. .fontSize($r('[basic].float.page_text_font_size_10'))
  84. .fontColor('#4D000000')
  85. .margin({ bottom: 8 })
  86. .width('100%')
  87. .textAlign(TextAlign.Start)
  88. .padding({ left: 22 })
  89. Column() {
  90. TextArea({ text: $$this.contact })
  91. .width('100%')
  92. .borderRadius(4)
  93. .padding(5)
  94. .fontSize($r('[basic].float.page_text_font_size_12'))
  95. .fontColor('#CC000000')
  96. .border({ width: 1, color: '#14000000' })
  97. .height(87)
  98. .backgroundColor(Color.White)
  99. }
  100. .padding({ left: 22, right: 22 })
  101. .margin({ bottom: 160 })
  102. Column() {
  103. YtButton({
  104. btContent: '提交反馈',
  105. click: () => {
  106. if (!this.description) {
  107. IBestToast.show({
  108. type: 'warning',
  109. message: '请输入问题描述'
  110. })
  111. return
  112. }
  113. yTRequest.questionBack(this.description, this.contact)
  114. // //TODO 发请求提交反馈
  115. // YTLog.info(this.description + this.contact + '反馈提交了')
  116. }
  117. })
  118. }
  119. .padding({ left: 18, right: 18 })
  120. }
  121. .padding({ top: this.safeTop, bottom: this.safeBottom })
  122. }
  123. }