Footer.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import React, { useEffect, useState } from 'react';
  2. import { Container, Segment } from 'semantic-ui-react';
  3. import { getFooterHTML, getSystemName } from '../helpers';
  4. import {Layout} from "@douyinfe/semi-ui";
  5. const Footer = () => {
  6. const systemName = getSystemName();
  7. const [footer, setFooter] = useState(getFooterHTML());
  8. let remainCheckTimes = 5;
  9. const loadFooter = () => {
  10. let footer_html = localStorage.getItem('footer_html');
  11. if (footer_html) {
  12. setFooter(footer_html);
  13. }
  14. };
  15. useEffect(() => {
  16. const timer = setInterval(() => {
  17. if (remainCheckTimes <= 0) {
  18. clearInterval(timer);
  19. return;
  20. }
  21. remainCheckTimes--;
  22. loadFooter();
  23. }, 200);
  24. return () => clearTimeout(timer);
  25. }, []);
  26. return (
  27. <Layout>
  28. <Layout.Content style={{textAlign: 'center'}}>
  29. {footer ? (
  30. <div
  31. className='custom-footer'
  32. dangerouslySetInnerHTML={{ __html: footer }}
  33. ></div>
  34. ) : (
  35. <div className='custom-footer'>
  36. <a
  37. href='https://github.com/Calcium-Ion/new-api'
  38. target='_blank'
  39. >
  40. New API {process.env.REACT_APP_VERSION}{' '}
  41. </a>
  42. 由{' '}
  43. <a href='https://github.com/Calcium-Ion' target='_blank'>
  44. Calcium-Ion
  45. </a>{' '}
  46. 开发,基于{' '}
  47. <a href='https://github.com/songquanpeng/one-api' target='_blank'>
  48. One API v0.5.4
  49. </a>{' '}
  50. ,本项目根据{' '}
  51. <a href='https://opensource.org/licenses/mit-license.php'>
  52. MIT 许可证
  53. </a>{' '}
  54. 授权
  55. </div>
  56. )}
  57. </Layout.Content>
  58. </Layout>
  59. );
  60. };
  61. export default Footer;