zoukankan      html  css  js  c++  java
  • React后台管理系统-首页Home组件

    React后台管理系统-首页Home组件

    1.Home组件要显示用户总数、商品总数和订单总数,数据请求后端的 /manage/statistic/base_count.do接口,返回的是

    1. this.state = {
    2.            userCount : '-',
    3.            productCount : '-',
    4.            orderCount : '-'
    5.        }
    6.  //页面挂载之后请求数据
    7. componentDidMount(){
    8.        this.loadCount();
    9.    }
    10.    loadCount(){
    11.        //请求后端的接口
    12.        _statistic.getHomeCount().then(res => {
    13.            this.setState(res);
    14.        }, errMsg => {
    15.            _mm.errorTips(errMsg);
    16.        });
    17.    }

    2.把数据渲染到页面上

    1. <div id="page-wrapper">
    2.                <PageTitle title="首页" />
    3.                <div className="row">
    4.                    <div className="col-md-4">
    5.                        <Link to="/user" className="color-box brown">
    6.                            <p className="count">{this.state.userCount}</p>
    7.                            <p className="desc">
    8.                                <i className="fa fa-user-o"></i>
    9.                                <span>用户总数</span>
    10.                            </p>
    11.                        </Link>
    12.                    </div>
    13.                    <div className="col-md-4">
    14.                        <Link to="/product" className="color-box green">
    15.                            <p className="count">{this.state.productCount}</p>
    16.                            <p className="desc">
    17.                                <i className="fa fa-list"></i>
    18.                                <span>商品总数</span>
    19.                            </p>
    20.                        </Link>
    21.                    </div>
    22.                    <div className="col-md-4">
    23.                        <Link to="/order" className="color-box blue">
    24.                            <p className="count">{this.state.orderCount}</p>
    25.                            <p className="desc">
    26.                                <i className="fa fa-check-square-o"></i>
    27.                                <span>订单总数</span>
    28.                            </p>
    29.                        </Link>
    30.                    </div>
    31.                </div>
    32.            </div>

  • 相关阅读:
    今天开始用 VSU 2010
    Visual Studio 2010 模型设计工具 基本应用
    Asp.Net访问Oracle 数据库 执行SQL语句和调用存储过程
    Enterprise Library 4.1 Security Block 快速使用图文笔记
    解决“System.Data.OracleClient 需要 Oracle 客户端软件 8.1.7 或更高版本。”(图)
    一个Oracle存储过程示例
    Enterprise Library 4.1 Application Settings 快速使用图文笔记
    Oracle 10g for Windows 简体中文版的安装过程
    Oracle 11g for Windows 简体中文版的安装过程
    Oracle 9i 数据库 创建数据库 Net 配置 创建表 SQL查询 创建存储过程 (图)
  • 原文地址:https://www.cnblogs.com/six-hc/p/12715241.html
Copyright © 2011-2022 走看看