import React, {Component} from 'react'; import {Card, Col, PageHeader, Radio, Row, Statistic} from "antd"; import {DesktopOutlined, IdcardOutlined, LinkOutlined, UserOutlined} from '@ant-design/icons'; import {itemRender} from '../../utils/utils' import request from "../../common/request"; import './Dashboard.css' import {Link} from "react-router-dom"; import {Area} from '@ant-design/charts'; import Logout from "../user/Logout"; const routes = [ { path: '', breadcrumbName: '首页', }, { path: 'dashboard', breadcrumbName: '仪表盘', } ]; class Dashboard extends Component { state = { counter: {}, d: 'w', session: [], } componentDidMount() { this.getCounter(); this.getD(); } componentWillUnmount() { } getCounter = async () => { let result = await request.get('/overview/counter'); if (result['code'] === 1) { this.setState({ counter: result['data'] }) } } getD = async () => { let result = await request.get('/overview/sessions?d=' + this.state.d); if (result['code'] === 1) { this.setState({ session: result['data'] }) console.log('set session', this.state.session) } } handleChangeD = (e) => { let d = e.target.value; this.setState({ d: d }, () => this.getD()) } render() { const config = { data: this.state.session, xField: 'day', yField: 'count', seriesField: 'protocol', }; const buttonRadio = 按周 按月 return ( <> ]} >
}/> }/> }/> }/>
); } } export default Dashboard;