index.jsx 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import React, { useState, useEffect } from 'react'
  2. import './index.scss'
  3. import Taro from '@tarojs/taro'
  4. import { ScrollView, Image } from '@tarojs/components'
  5. export default function UserDetailActivityInfo (props) {
  6. const { Data = {} } = props
  7. const [PageList, setPageList] = useState([
  8. { content: '参加了5D沉浸式 剧场', time: '2019年7月12日 12:30:00' },
  9. { content: '参加了5D沉浸式 剧场', time: '2019年7月12日 12:30:00' },
  10. { content: '参加了5D沉浸式 剧场', time: '2019年7月12日 12:30:00' },
  11. { content: '参加了5D沉浸式 剧场', time: '2019年7月12日 12:30:00' },
  12. { content: '参加了5D沉浸式 剧场', time: '2019年7月12日 12:30:00' },
  13. { content: '参加了5D沉浸式 剧场', time: '2019年7月12日 12:30:00' }
  14. ])
  15. const [IsPull, setPull] = useState(false)
  16. const [PullTimer, setPullTimer] = useState(null)
  17. const PageRefresh = () => { // 页面下拉刷新回调
  18. setPull(true)
  19. }
  20. useEffect(() => { // 下拉刷新触发
  21. if (IsPull) {
  22. clearTimeout(PullTimer)
  23. setPullTimer(setTimeout(() => {
  24. setPull(false)
  25. }, 2000))
  26. }
  27. }, [IsPull])
  28. return (
  29. <view className='components UserDetailActivityInfo'>
  30. <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
  31. <view className='PageContent'>
  32. <view className='Content'>
  33. {
  34. PageList.map((item, index) => (
  35. <view className='flex-h' key={`Item-${index}`}>
  36. <view className='flex-item'>
  37. <text>{item.time}</text>
  38. </view>
  39. <view className='Line'>
  40. <view></view>
  41. </view>
  42. <view className='flex-item'>
  43. <text className='active'>{item.content}</text>
  44. </view>
  45. </view>
  46. ))
  47. }
  48. </view>
  49. <view className='Btn'>
  50. <text className='active'>添加跟进</text>
  51. </view>
  52. </view>
  53. </ScrollView>
  54. </view>
  55. )
  56. }