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>

React后台管理系统-首页Home组件的更多相关文章

  1. React后台管理系统-添加商品组件

    引入了CategorySelector 二级联动组件.FileUploader图片上传组件和RichEditor富文本编辑组件 import React from 'react'; import MU ...

  2. React后台管理系统- rc-pagination分页组件封装

    1.用户列表页面使用的rc-pagination分页组件 Github地址: https://github.com/react-component/pagination 2.安装 cnpm insta ...

  3. 《React后台管理系统实战 :一》:目录结构、引入antd、引入路由、写login页面、使用antd的form登录组件、form前台验证、高阶函数/组件

    实战 上接,笔记:https://blog.csdn.net/u010132177/article/details/104150177 https://gitee.com/pasaulis/react ...

  4. 【共享单车】—— React后台管理系统开发手记:主页面架构设计

    前言:以下内容基于React全家桶+AntD实战课程的学习实践过程记录.最终成果github地址:https://github.com/66Web/react-antd-manager,欢迎star. ...

  5. react后台管理系统路由方案及react-router原理解析

        最近做了一个后台管理系统主体框架是基于React进行开发的,因此系统的路由管理,选用了react-router(4.3.1)插件进行路由页面的管理配置. 实现原理剖析 1.hash的方式   ...

  6. 《React后台管理系统实战 :三》header组件:页面排版、天气请求接口及页面调用、时间格式化及使用定时器、退出函数

    一.布局及排版 1.布局src/pages/admin/header/index.jsx import React,{Component} from 'react' import './header. ...

  7. 《React后台管理系统实战 :二》antd左导航:cmd批量创建子/目录、用antd进行页面布局、分离左导航为单独组件、子路由、动态写左导航、css样式相对陷阱

    一.admin页面布局及路由创建 0)cmd批量创建目录及子目录 //创建各个目录,及charts和子目录bar md home category product role user charts\b ...

  8. 【共享单车】—— React后台管理系统开发手记:UI菜单各个组件使用(Andt UI组件)

    前言:以下内容基于React全家桶+AntD实战课程的学习实践过程记录.最终成果github地址:https://github.com/66Web/react-antd-manager,欢迎star. ...

  9. 【共享单车】—— React后台管理系统开发手记:AntD Form基础组件

    前言:以下内容基于React全家桶+AntD实战课程的学习实践过程记录.最终成果github地址:https://github.com/66Web/react-antd-manager,欢迎star. ...

随机推荐

  1. Kipmi0 占用CPU 100%

    查看当前正在运行的进程发现kipmi0进程占用率达到100% kipmi -% of the CPUs, %/% comes when the machine is idle? A second is ...

  2. poj2186-Popular Cows(强连通分支)

    有N(N<=10000)头牛,每头牛都想成为most poluler的牛,给出M(M<=50000)个关系,如(1,2)代表1欢迎2,关系可以传递,但是不可以相互,即1欢迎2不代表2欢迎1 ...

  3. CF E .Tree with Small Distances(树上的贪心)

    题意: 这是一颗有n-1条边的无向树 , 在树上加最少的边使树的1节点到其他节点的距离最多为 2 : 分析:很容易考虑的贪心的做法,但是该如何的贪心呢 ? 我一开始是打算贪心节点的儿子最多那一个 , ...

  4. @GeneratorValue与@GenericGenerator注解使用心得

    参考博主们的 http://blog.csdn.net/tianxiezuomaikong/article/details/64930151

  5. 《nginx 一》dns解析 nginx安装

    DNS域名解析 整个过程大体描述如下,其中前两个步骤是在本机完成的,后8个步骤涉及到真正的域名解析服务器:1.浏览器会检查缓存中有没有这个域名对应的解析过的IP地址,如果缓存中有,这个解析过程就结束. ...

  6. MVC学习6 学习使用Code First Migrations功能 把Model的更新同步到DB中

     参考:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-new-field-to-th ...

  7. 在sublime text3下,用快捷键把文件打开到浏览器中

    使用背景 在编辑html或者js文件的时候,是否想在浏览器中预览一下, 你的步骤可能是这样的: 找到编辑文件的位置, 右键使用某一浏览器打开.如果是这样,你就out了, 因为在sublime中有更加简 ...

  8. Android Asynchronous Http Client

    Features Make asynchronous HTTP requests, handle responses in anonymous callbacks HTTP requests happ ...

  9. Linux系统 Centos7/Centos6.8 yum命令在线安装 MySQL5.6

    Linux系统 Centos7 yum命令在线安装 MySQL5.6 标签: centosmysqlyum 2015-11-18 17:21 707人阅读 评论(0) 收藏 举报  分类: Linux ...

  10. BZOJ4355: Play with sequence(吉司机线段树)

    题意 题目链接 Sol 传说中的吉司机线段树??感觉和BZOJ冒险那题差不多,就是强行剪枝... 这题最坑的地方在于对于操作1,$C >= 0$, 操作2中需要对0取max,$a[i] > ...