123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { useState } from "react"
  2. import { Textarea, View } from "@tarojs/components"
  3. import CustomNav from "@/components/CustomNav"
  4. import ButtontWX from "@/components/ButtontWX"
  5. import { feedback } from "@/services/mine"
  6. import Taro from "@tarojs/taro"
  7. import './style.less'
  8. export default (props) => {
  9. const [textAreaValue, setTextAreaValue] = useState('')
  10. const [loading, setLoading] = useState(false)
  11. const onSubmitClick = () => {
  12. setLoading(true)
  13. console.log('textAreaValue', textAreaValue);
  14. if (textAreaValue == '') {
  15. Taro.showToast({
  16. title: '请填写内容哦',
  17. icon: 'none',
  18. duration: 2000
  19. })
  20. } else {
  21. feedback({ content: textAreaValue }).then(() => {
  22. Taro.showToast({
  23. title: '反馈已收到!',
  24. icon: 'success',
  25. duration: 2000
  26. }).then(() => {
  27. setTimeout(() => {
  28. setLoading(true)
  29. Taro.navigateBack({
  30. delta: 1
  31. }
  32. )
  33. }, 1000)
  34. })
  35. })
  36. }
  37. }
  38. return (
  39. <View className='page-index'>
  40. <View className='index-navbar'>
  41. <CustomNav title='意见反馈' />
  42. </View>
  43. <View>
  44. <View className='components-page'>
  45. <Textarea placeholder='请留下您宝贵的意见和建议!' className='components-page-TextareaCentent' autoHeight onInput={(e) => { setTextAreaValue(e.detail.value) }} />
  46. </View>
  47. <View className='buton-bottom-Feedback'>
  48. <ButtontWX disabled={loading} onClick={onSubmitClick} butText='提交' butWidth={350} butHeight={49} butFontSize={16} butBorderRadius={49} />
  49. </View>
  50. </View>
  51. </View>
  52. )
  53. }