知与行后台管理端

Welcome.jsx 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import React, { useEffect, useState } from 'react';
  2. import { Card, Typography, Alert, Row, Col } from 'antd';
  3. import { FormattedMessage } from 'umi-plugin-react/locale';
  4. import EchartsTest from '../components/EchartsTest';
  5. import IndexEcharts from './indexEcharts/index';
  6. import router from 'umi/router';
  7. import apis from '../services/apis';
  8. import request from '../utils/request'
  9. const Welcome = (props) => {
  10. const option = {
  11. xAxis: {
  12. type: 'category',
  13. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  14. },
  15. yAxis: {
  16. type: 'value'
  17. },
  18. series: [{
  19. data: [820, 932, 901, 934, 1290, 1330, 1320],
  20. type: 'line'
  21. }]
  22. };
  23. useEffect(() => {
  24. echratsInfo();
  25. }, [])
  26. const [data, setData] = useState({ records: [] })
  27. function echratsInfo(params) {
  28. request({
  29. ...apis.indexEcharts.list,
  30. params,
  31. }).then((data) => {
  32. setData(data)
  33. console.log(data, "666666666666666666666666666666")
  34. })
  35. }
  36. return (
  37. <>
  38. <div style={{ display: 'flex', marginBottom: '28px' }}>
  39. <div style={{
  40. textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(144deg,rgba(241,43,62,1) 0%,rgba(254,144,155,1) 100%)', height: '100px',
  41. boxShadow: '0px 0.11rem 14px -15px rgba(241,43,62,1)',
  42. borderRadius: '12px', width: '32%', marginRight: '2%'
  43. }}>
  44. <span style={{ fontSize: '24px', color: '#fff' }}>总用户 </span>
  45. <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>{data.selectUserCount || '0'}</span>
  46. </div>
  47. <div style={{
  48. textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(144deg,rgba(255,126,74,1) 0%,rgba(255,196,168,1) 100%)', height: '100px',
  49. boxShadow: '0px 0.11rem 14px -15px rgba(255,126,74,1)',
  50. borderRadius: '12px', width: '32%', marginRight: '2%'
  51. }}>
  52. <span style={{ fontSize: '24px', color: '#fff' }}>总注册用户 </span>
  53. <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>{data.selectRegisteredCount || '0'}</span>
  54. </div>
  55. <div onClick={() => router.push('/indexEcharts/newUsers')} style={{
  56. textAlign: 'center', display: 'flex', justifyContent: 'center', background: 'linear-gradient(137deg,rgba(107,130,230,1) 0%,rgba(152,175,251,1) 100%)', height: '100px',
  57. boxShadow: '0px 0.11rem 14px -15px rgba(107,130,230,1)',
  58. borderRadius: '12px', width: '32%',
  59. }}>
  60. <span style={{ fontSize: '24px', color: '#fff', borderBottom: '1px solid #fff', margin: '30px 0' }}>最近7天新增 </span>
  61. <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy', lineHeight: '100px' }}>{data.selectRecentlyCount || '0'}</span>
  62. </div>
  63. </div>
  64. <IndexEcharts style={{ width: '100%' }}></IndexEcharts>
  65. {/* <EchartsTest style={{ width: 500, height: 500 }}></EchartsTest> */}
  66. </>
  67. )
  68. }
  69. export default Welcome;