index.jsx 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { useState } from 'react'
  2. import Taro from '@tarojs/taro'
  3. import withLayout from '@/layout'
  4. import { ScrollView, Input } from '@tarojs/components'
  5. import { fetch } from '@/utils/request'
  6. import { API_TOBE_MANAGER } from '@/constants/api'
  7. import './index.scss'
  8. export default withLayout(() => {
  9. const [Code, setCode] = useState('')
  10. const ToSubmit = () => {
  11. if (Code !== '') {
  12. fetch({ url: API_TOBE_MANAGER, method: 'post', payload: { marketingCode: Code } }).then((res) => {
  13. Taro.showToast({
  14. title: '绑定成功',
  15. icon: 'none'
  16. })
  17. })
  18. } else {
  19. Taro.showToast({
  20. title: '请输入楼盘码',
  21. icon: 'none'
  22. })
  23. }
  24. }
  25. const CodeChange = (e) => {
  26. setCode(e.detail.value)
  27. }
  28. return (
  29. <view className='Page toBeManager'>
  30. <ScrollView scroll-y>
  31. <view className='PageContent'>
  32. <view className='Input'>
  33. <Input placeholder='请输入楼盘码' onInput={CodeChange}></Input>
  34. </view>
  35. <view className='Btn'>
  36. <text onClick={ToSubmit}>提交</text>
  37. </view>
  38. </view>
  39. </ScrollView>
  40. </view>
  41. )
  42. })