index.tsx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. "use client";
  2. import { usePathname, useRouter} from "@/i18n";
  3. import { FC, PropsWithChildren, ReactNode } from "react";
  4. import clsx from "clsx";
  5. import "./style.scss";
  6. /**
  7. * @description 底部Tab组件
  8. * @param children 插槽内容
  9. *
  10. */
  11. export interface FooterProps {
  12. children?: () => ReactNode;
  13. }
  14. const Footer: FC<PropsWithChildren<FooterProps>> = () => {
  15. const tabList = [
  16. {
  17. iconSpanName: 'icon-home',
  18. label: 'Início',
  19. path: '/'
  20. },
  21. {
  22. iconSpanName: 'icon-qianbao1',
  23. label: 'Depósito',
  24. path: '/deposit'
  25. },
  26. {
  27. iconSpanName: 'icon-afiliado',
  28. label: 'Afiliado',
  29. path: '/affiliate/summary'
  30. },
  31. {
  32. iconSpanName: 'icon-tiyu',
  33. label: 'Esportes',
  34. path: '/'
  35. },
  36. {
  37. iconSpanName: 'icon-yonghu',
  38. label: 'Perfil',
  39. path: '/profile'
  40. },
  41. ]
  42. const pathname = usePathname()
  43. const router = useRouter();
  44. const goPage = (path = '/') => {
  45. router.push(path)
  46. }
  47. return (
  48. <div className="footer-box">
  49. <ul>
  50. {
  51. tabList.map((item, index) => {
  52. return (
  53. <li className={clsx(item.path == pathname && 'active')} onClick={() => goPage(item.path)} key={index}>
  54. <div className="icon-box">
  55. {
  56. index == 2 ? (
  57. <><i className="icon-afiliado"></i><i className="icon-rs"></i></>
  58. ) : <span className={clsx('iconfont',item.iconSpanName)}></span>
  59. }
  60. { index == 3 && <b className="icon-hot"></b> }
  61. </div>
  62. <label>{item.label}</label>
  63. </li>
  64. )
  65. })
  66. }
  67. </ul>
  68. </div>
  69. );
  70. };
  71. export default Footer;