FishSettingView.ets 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import { webview } from '@kit.ArkWeb'
  2. import { AppStorageKeyFishCollect, avPlayerManager, IBestToast, Params, YTHeader, YTUserRequest } from 'basic'
  3. @Builder
  4. function FishSettingViewBuilder() {
  5. NavDestination() {
  6. FishSettingView()
  7. }.title("设置")
  8. .hideTitleBar(true)
  9. }
  10. @Component
  11. struct FishSettingView {
  12. @State selectMusic:number=1
  13. @StorageLink(AppStorageKeyFishCollect.FISHTEXT)
  14. textValue:string=""
  15. aboutToDisappear(): void {
  16. YTUserRequest.updateSuspensionCharacters({suspensionCharacters:this.textValue} as Params)
  17. }
  18. build() {
  19. Column() {
  20. YTHeader({title:'设置'})
  21. Column({space:20}){
  22. Row() {
  23. Text('悬浮文字').fontColor(Color.White)
  24. }.width('100%')
  25. .justifyContent(FlexAlign.Start)
  26. Stack({alignContent:Alignment.End}){
  27. TextInput({text:$$this.textValue})
  28. .fontColor($r('[basic].color.login_main_yellow'))
  29. .borderRadius(15).width('100%')
  30. .backgroundColor('#787878')
  31. .onChange((value)=>{
  32. if(value.length>7){
  33. IBestToast.show({
  34. message:'最多7个字'
  35. })
  36. this.textValue=this.textValue.slice(0,7)
  37. return
  38. }
  39. })
  40. Image($r('app.media.muyu')).width(24).margin({right:10}).onClick(()=>{this.textValue=""})
  41. }
  42. }.width('100%')
  43. .backgroundColor('#3f3f3f')
  44. .padding({left:10,right:10,top:20,bottom:20})
  45. .borderRadius(15)
  46. .height(150)
  47. .margin({bottom:20})
  48. Column({space:20}){
  49. Row() {
  50. Text('木鱼音色').fontColor(Color.White)
  51. }.width('100%')
  52. .justifyContent(FlexAlign.Start)
  53. Row({space:30}) {
  54. ForEach([1, 2, 3], (item: number) => {
  55. Column({space:5}) {
  56. Text(item.toString()).fontColor($r('[basic].color.login_main_yellow'))
  57. Image($r('app.media.muyu')).width(30)
  58. }.width(60)
  59. .height(60)
  60. .justifyContent(FlexAlign.Center)
  61. .borderRadius(15)
  62. .backgroundColor(this.selectMusic==item?'#3dbbd1':'#000000')
  63. .onClick(()=>{
  64. this.selectMusic=item
  65. avPlayerManager.playByRawSrc(`music${item}.mp3`)
  66. })
  67. })
  68. }.width('100%').justifyContent(FlexAlign.Start)
  69. }.width('100%')
  70. .backgroundColor('#3f3f3f')
  71. .padding({left:10,right:10,top:20,bottom:20})
  72. .borderRadius(15)
  73. .height(150)
  74. }.width('100%')
  75. .height('100%')
  76. .backgroundColor(Color.Black)
  77. .padding({left:20,right:20})
  78. }
  79. }