index.jsx 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import Taro from "@tarojs/taro"
  2. import { Icon, View } from "@tarojs/components"
  3. import { useEffect, useState } from "react"
  4. import CustomNav from '@/components/CustomNav'
  5. import withLayout from '@/layouts'
  6. import './style.less'
  7. export default (props) => {
  8. const { ico, textNext, onSelected, nextQuestio } = props
  9. const YES = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/YES.png'
  10. const No = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/RandomIIcon/No.png'
  11. const [imageOne, setImageOne] = useState(false)
  12. const [imageTow, setImageTow] = useState(false)
  13. const handleYES = () => {
  14. setImageOne(true)
  15. setImageTow(false)
  16. onSelected()
  17. setTimeout(() => {
  18. nextQuestio()
  19. }, 500);
  20. }
  21. const handleNo = () => {
  22. setImageOne(false)
  23. setImageTow(true)
  24. onSelected()//未选择不给到下一题
  25. setTimeout(() => {
  26. nextQuestio()
  27. }, 500);
  28. }
  29. return (
  30. <View >
  31. <View style='font-size: 20px;font-weight: bold;color: #140F0F;marginLeft:10px;;'>
  32. 2<text style='font-size: 13px;font-weight: bold;color: #140F0F;'> / 5 </text>你是单身吗?
  33. </View>
  34. <view className='Girl-Conste-box' onClick={handleYES} >
  35. <View className='Girl-box-imageContent'>
  36. <image className={`Girl-box-image imageTwo ${imageOne && 'Girl-imageLess'} `} src={YES} />
  37. </View>
  38. <view className='Girl-box-content' >
  39. <View className='Girl-box-C-title' >
  40. YES
  41. </View>
  42. <View className='Girl-box-C-moon' >
  43. </View>
  44. </view>
  45. </view>
  46. <view className='Girl-Conste-box' onClick={handleNo} >
  47. <View className='Girl-box-imageContent'>
  48. <image className={`Girl-box-image ${imageTow && 'Girl-imageLess'} `} src={No} />
  49. </View>
  50. <view className='Girl-box-content' >
  51. <View className='Girl-box-C-title' >
  52. No
  53. </View>
  54. <View className='Girl-box-C-moon' >
  55. </View>
  56. </view>
  57. </view>
  58. </View>
  59. )
  60. }