FragranceSettingView.ets 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. import { webview } from '@kit.ArkWeb'
  2. import { AppStorageKeyFishCollect, avPlayerManager, IBestToast, YTHeader } from 'basic'
  3. import { TextInputCom } from '../component/TextInputCom'
  4. @Builder
  5. function FragranceSettingBuilder() {
  6. NavDestination() {
  7. FragranceSettingView()
  8. }.title("设置")
  9. .hideTitleBar(true)
  10. }
  11. @Component
  12. struct FragranceSettingView {
  13. @StorageLink(AppStorageKeyFishCollect.TEXTARR)
  14. textArr:string[]=[]
  15. @State
  16. currSelectNumber:number=1
  17. @State
  18. currSelectTimeNumber:number=1
  19. build() {
  20. Column() {
  21. YTHeader({title:'设置'})
  22. //悬浮文字
  23. Column({space:20}){
  24. Row() {
  25. Text('悬浮文字').fontColor(Color.White)
  26. }.width('100%')
  27. .justifyContent(FlexAlign.Start)
  28. List({space:20}){
  29. ForEach(this.textArr,(item:string,index:number)=>{
  30. ListItem() {
  31. TextInputCom({
  32. text: item,
  33. changeText: (value: string) => {
  34. this.textArr[index] = value
  35. }
  36. })
  37. }
  38. })
  39. }.layoutWeight(1).scrollBar(BarState.Off)
  40. //取消
  41. Column(){
  42. Text('+').fontColor(Color.White)
  43. // Image($r('app.media.muyu')).width(20)
  44. }.width(73)
  45. .height(40)
  46. .borderRadius(8)
  47. .justifyContent(FlexAlign.Center)
  48. .backgroundColor('#646561')
  49. .onClick(()=>{
  50. if(this.textArr.length>6){
  51. IBestToast.show({
  52. message:'最多支持五行文本'
  53. })
  54. return
  55. }
  56. this.textArr.push('')
  57. })
  58. }.width('100%')
  59. .layoutWeight(1)
  60. .backgroundColor('#3f3f3f')
  61. .padding({left:10,right:10,top:20,bottom:20})
  62. .borderRadius(15)
  63. .margin({bottom:20})
  64. //上香数量
  65. Column({space:20}){
  66. Row() {
  67. Text('上香数量').fontColor(Color.White)
  68. }.width('100%')
  69. .justifyContent(FlexAlign.Start)
  70. Row(){
  71. Text('数量').fontColor(Color.White)
  72. Row(){
  73. Text('一支')
  74. .layoutWeight(1)
  75. .height('100%')
  76. .textAlign(TextAlign.Center)
  77. .borderRadius(8)
  78. .backgroundColor(this.currSelectNumber==1?'#FADE71':Color.Transparent)
  79. .onClick(()=>{
  80. this.currSelectNumber=1
  81. })
  82. Text('三支')
  83. .layoutWeight(1)
  84. .textAlign(TextAlign.Center)
  85. .height('100%')
  86. .borderRadius(8)
  87. .backgroundColor(this.currSelectNumber==3?'#FADE71':Color.Transparent)
  88. .onClick(()=>{
  89. this.currSelectNumber=3
  90. })
  91. }.width(106)
  92. .height(38)
  93. .backgroundColor('#646561')
  94. .borderRadius(8)
  95. }.width('100%')
  96. .justifyContent(FlexAlign.SpaceBetween)
  97. }.width('100%')
  98. .backgroundColor('#3f3f3f')
  99. .margin({bottom:20})
  100. .padding({left:10,right:10,top:20,bottom:20})
  101. .borderRadius(15)
  102. .height(150)
  103. //燃尽时间
  104. Column({space:20}){
  105. Row() {
  106. Text('燃尽时间').fontColor(Color.White)
  107. }.width('100%')
  108. .justifyContent(FlexAlign.Start)
  109. Row(){
  110. Text('10分钟')
  111. .width(62)
  112. .height(30)
  113. .fontSize(14)
  114. .textAlign(TextAlign.Center)
  115. .borderRadius(8)
  116. .margin({right:20})
  117. .fontColor(this.currSelectTimeNumber==1?Color.Black:'rgba(255, 255, 255, 0.4)')
  118. .backgroundColor(this.currSelectTimeNumber==1?'#FADE71':Color.Transparent)
  119. .onClick(()=>{
  120. this.currSelectTimeNumber=1
  121. })
  122. Text('30分钟')
  123. .width(62)
  124. .height(30)
  125. .fontSize(14)
  126. .textAlign(TextAlign.Center)
  127. .margin({right:20})
  128. .borderRadius(8)
  129. .fontColor(this.currSelectTimeNumber==2?Color.Black:'rgba(255, 255, 255, 0.4)')
  130. .backgroundColor(this.currSelectTimeNumber==2?'#FADE71':Color.Transparent)
  131. .onClick(()=>{
  132. this.currSelectTimeNumber=2
  133. })
  134. Text('不限时')
  135. .width(62)
  136. .height(30)
  137. .fontSize(14)
  138. .height('100%')
  139. .margin({right:20})
  140. .textAlign(TextAlign.Center)
  141. .borderRadius(8)
  142. .fontColor(this.currSelectTimeNumber==3?Color.Black:'rgba(255, 255, 255, 0.4)')
  143. .backgroundColor(this.currSelectTimeNumber==3?'#FADE71':Color.Transparent)
  144. .onClick(()=>{
  145. this.currSelectTimeNumber=3
  146. })
  147. }.width('100%')
  148. .height(30)
  149. .justifyContent(FlexAlign.Start)
  150. }.width('100%')
  151. .backgroundColor('#3f3f3f')
  152. .padding({left:10,right:10,top:20,bottom:20})
  153. .borderRadius(15)
  154. .height(150)
  155. .margin({bottom:20})
  156. }.width('100%')
  157. .height('100%')
  158. .backgroundColor(Color.Black)
  159. .padding({left:20,right:20})
  160. }
  161. }