You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.8 KiB

2 years ago
  1. import { useState } from 'react';
  2. import '~/styles/layout.scss'
  3. import { useRouter } from '~/hooks/useRouter';
  4. import Notify from './Notify';
  5. import Router from './router';
  6. import { tabbarData } from './routes';
  7. const LayoutRouter = () => {
  8. const { location, push } = useRouter()
  9. const [visible, setVisible] = useState(false)
  10. return (
  11. <div className='layout'>
  12. <div className={`header plr-3 ${location.pathname === '/personal' && 'header-bg-color'}`}>
  13. <div className='fz-wb-550'>9527</div>
  14. <div className='row' onClick={() => setVisible(true)}>
  15. <div className='notify-circle'></div>
  16. <i className='iconfont icon-messages fz-24 fz-wb-1000' />
  17. </div>
  18. </div>
  19. <div className='pages'>
  20. <Router />
  21. {
  22. tabbarData.includes(location.pathname) && <div className='tabbar-block'></div>
  23. }
  24. </div>
  25. {
  26. tabbarData.includes(location.pathname) && (
  27. <div className='tabbar'>
  28. {
  29. tabbarData.map((item, index) => (
  30. <div key={index} onClick={() => push(item)}>
  31. <img
  32. src={require(`~/assets/tabbar/tabbar-${index + 1}${item === location.pathname ? '-o' : ''}.png`)}
  33. alt=""
  34. className='img'
  35. />
  36. {
  37. item === location.pathname &&
  38. <div className='row-center'>
  39. <div className='circle'></div>
  40. </div>
  41. }
  42. </div>
  43. ))
  44. }
  45. </div>
  46. )
  47. }
  48. <Notify visible={visible} setVisible={setVisible} />
  49. </div>
  50. );
  51. }
  52. export default LayoutRouter