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.

134 lines
3.7 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. import { useState, useEffect } from "react";
  2. import './home.css'
  3. import videoRef from "./img/bj1.mp4"
  4. import headImg from "./img/head.png"
  5. import { Carousel, message } from 'antd';
  6. import moment from 'moment';
  7. import icon1 from "./img/1.png"
  8. import icon2 from "./img/2.png"
  9. import icon3 from "./img/3.png"
  10. import icon4 from "./img/4.png"
  11. import icon5 from "./img/5.png"
  12. import icon6 from "./img/6.png"
  13. import icon7 from "./img/7.png"
  14. import icon8 from "./img/8.png"
  15. export default function Home() {
  16. const [data, setData] = useState(false);
  17. const weeks = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
  18. const [renderKey, setRenderKey] = useState(1);
  19. // 链接类型:1-路由 2-链接 3-建设中 4-点击事件
  20. const list = [
  21. {
  22. type: 1,
  23. url: '/Main',
  24. name: 'AI问政',
  25. icon: icon3,
  26. },
  27. {
  28. type: 1,
  29. url: '/home/DataAnalysis',
  30. name: '数据分析',
  31. icon: icon1,
  32. },
  33. {
  34. type: 1,
  35. url: '/home/Tendency',
  36. name: '趋势洞察',
  37. icon: icon4,
  38. },
  39. {
  40. type: 1,
  41. url: '/home/ReportGeneration',
  42. name: '报告生成',
  43. icon: icon2,
  44. },
  45. {
  46. type: 2,
  47. url: '',
  48. name: '文件上传',
  49. icon: icon6,
  50. },
  51. {
  52. type: 1,
  53. url: '/home/PolicyLibrary',
  54. name: '政策库',
  55. icon: icon5,
  56. },
  57. {
  58. type: 2,
  59. url: '',
  60. name: '应用管理',
  61. icon: icon7,
  62. },
  63. {
  64. type: 1,
  65. url: '/settings/appearance',
  66. name: '系统管理',
  67. icon: icon8,
  68. },
  69. ]
  70. // 点击事件
  71. const bindUrl = (e) => {
  72. console.log(1234, e);
  73. if (e.type == 1) {
  74. window.location = e.url
  75. } else {
  76. message.info({
  77. content: e.name + '开发中...'
  78. })
  79. }
  80. }
  81. //方法
  82. useEffect(() => {
  83. const timer = setInterval(() => {
  84. setRenderKey(Math.random());
  85. }, 1000);
  86. // 组件卸载清除定时器
  87. return () => clearInterval(timer);
  88. }, []);
  89. return (
  90. <div className='box'>
  91. {/* 背景视频 */}
  92. <video autoPlay loop muted>
  93. <source src={videoRef} type="video/mp4"></source>
  94. </video>
  95. <div className="cen_box">
  96. <div className="head">
  97. <div className="head1_1">阿拉善盟AI行政数据分析与决策参考系统</div>
  98. <img src={headImg} alt="" />
  99. <div className="head2">
  100. <div>{moment().format('HH:mm:ss')}</div>
  101. <div>{moment().format('YYYY年MM月DD日')} </div>
  102. <div>{weeks[moment().day()]}</div>
  103. </div>
  104. </div>
  105. <div className="content">
  106. <Carousel draggable>
  107. <div className="lunType">
  108. <div className="lunType1_1">
  109. {list.map((item, index) => (
  110. <div key={index} className="lunType2" onClick={() => bindUrl(item)}>
  111. <div>{item.name}</div>
  112. <img src={item.icon} alt="" />
  113. </div>
  114. ))}
  115. </div>
  116. </div>
  117. </Carousel>
  118. </div>
  119. </div>
  120. </div>
  121. )
  122. }