-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
265c06b
commit fc28d53
Showing
14 changed files
with
312 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,6 @@ h4 { | |
p { | ||
font-size: 16px; | ||
line-height: 25px; | ||
padding-top: 20px; | ||
} | ||
|
||
.panel { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from "react"; | ||
|
||
import {Link} from 'react-router-dom'; | ||
|
||
import PageTitle from 'component/page-title/index.jsx'; | ||
|
||
class Error extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
|
||
render() { | ||
return ( | ||
<div id="page-wrapper"> | ||
<PageTitle title="出错了!"></PageTitle> | ||
<div className="row"> | ||
<div className="col-md-12"> | ||
找不到该路径, | ||
<Link to="/">点击返回首页</Link> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
|
||
export default Error; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.color-box { | ||
display: block; | ||
height: 160px; | ||
text-align: center; | ||
padding: 20px 0; | ||
opacity: .9;/* 透明度: 1为完全不透明 */ | ||
transition: all .3s;/* 所有动画效果0.3秒 */ | ||
&:hover { | ||
text-decoration: none; | ||
color: #555; | ||
opacity: 1; | ||
transform: scale(1.08);/* 放大1.08倍 */ | ||
} | ||
&:focus { | ||
text-decoration: none; | ||
} | ||
.count { | ||
font-size: 50px; | ||
height: 80px; | ||
line-height: 80px; | ||
} | ||
.desc { | ||
font-size: 18px; | ||
.fa { | ||
margin-right: 5px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import React from "react"; | ||
import PageTitle from 'component/page-title/index.jsx'; | ||
import Pagination from 'util/pagination/index.jsx'; | ||
import CommerceUtil from 'util/commerce.jsx'; | ||
import UserService from "service/user-service.jsx"; | ||
|
||
const _commerce = new CommerceUtil(); | ||
const _userService = new UserService(); | ||
|
||
class UserList extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
list: [], /* list必须初始化, 否则是undefined, 没法map */ | ||
pageNum: 1, | ||
firstLoading: true/* 优化用户体验, 首次加载前, 显示正在加载, 加载成功后显示列表数据或错误提示数据 */ | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
this.loadUserList(); | ||
} | ||
|
||
loadUserList() { | ||
_userService.listUsers(this.state.pageNum).then(res => { | ||
this.setState(res, | ||
// 将firstLoading置为false | ||
() => { | ||
this.setState({ | ||
firstLoading: false | ||
}) | ||
}); | ||
}, errMsg => { | ||
this.setState({ | ||
list: [] | ||
}); | ||
_commerce.errorTips(errMsg); | ||
}); | ||
} | ||
|
||
// 当页数变化时 | ||
onPageNumChange(pageNum) { | ||
// 设置完页号后, 再load一次userList | ||
// setState是一个异步方法, 第二个参数是成功后的回调 | ||
this.setState({ | ||
pageNum: pageNum | ||
}, () => { | ||
this.loadUserList(); | ||
}); | ||
} | ||
|
||
render() { | ||
let listBody = this.state.list.map((user, index) => { | ||
return (<tr key={index}> | ||
<td>{user.id}</td> | ||
<td>{user.username}</td> | ||
<td>{user.email}</td> | ||
<td>{user.phone}</td> | ||
<td>{new Date(user.createTime).toLocaleString()}</td> | ||
</tr>); | ||
}); | ||
let listError = ( | ||
<tr> | ||
<td colSpan="5" className="text-center"> | ||
{this.state.firstLoading ? "正在加载数据..." : "没有查询到数据"} | ||
</td> | ||
</tr> | ||
); | ||
|
||
let tableBody = this.state.list.length > 0 ? listBody : listError; | ||
|
||
return ( | ||
<div id="page-wrapper"> | ||
<PageTitle title="用户列表"></PageTitle> | ||
<div className="row"> | ||
<div className="col-md-12"> | ||
<table className="table table-striped table-bordered"> | ||
<thead> | ||
<tr> | ||
<th>ID</th> | ||
<th>用户名</th> | ||
<th>邮箱</th> | ||
<th>电话</th> | ||
<th>注册时间</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{tableBody} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<Pagination | ||
current={this.state.pageNum} | ||
total={this.state.total} | ||
onChange={(pageNum) => { | ||
this.onPageNumChange(pageNum); | ||
}}/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
|
||
export default UserList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import CommerceUtil from 'util/commerce.jsx'; | ||
|
||
const _commerce = new CommerceUtil(); | ||
|
||
class StatisticService { | ||
// 获取首页统计数据 | ||
getHomeCount(loginInfo) { | ||
// 直接返回Promise对象, 使调用者可以链式调用 | ||
return _commerce.request({ | ||
type: "post", | ||
url: '/manage/statistic/base_count.do', | ||
}); | ||
} | ||
|
||
} | ||
|
||
export default StatisticService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.