update
This commit is contained in:
parent
3062208332
commit
feac093bda
@ -13,6 +13,8 @@ const getDayTime = ()=>{
|
||||
class WristbandPathInfo extends React.Component{
|
||||
state = {
|
||||
list: [],
|
||||
page: 1,
|
||||
maxPage: 1,
|
||||
stime: (getDayTime()),
|
||||
etime: (Date.now())
|
||||
}
|
||||
@ -24,6 +26,8 @@ class WristbandPathInfo extends React.Component{
|
||||
closeView = () => {
|
||||
this.setState({
|
||||
list: [],
|
||||
page: 1,
|
||||
maxPage: 1,
|
||||
stime: (getDayTime()),
|
||||
etime: (Date.now())
|
||||
}, ()=>{
|
||||
@ -41,14 +45,34 @@ class WristbandPathInfo extends React.Component{
|
||||
.then(response=>response.json())
|
||||
.then(json => {
|
||||
if(json.status != 1) return showDialog(json.message);
|
||||
let l = json.data.record || [];
|
||||
this.setState({
|
||||
list: json.data.record || []
|
||||
list: l,
|
||||
page: 1,
|
||||
maxPage: Math.ceil(l.length / 20)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
nextPage = () => {
|
||||
let {page, maxPage} = this.state;
|
||||
this.setState({
|
||||
page: page >= maxPage ? maxPage : page+1
|
||||
})
|
||||
}
|
||||
|
||||
prevPage = () => {
|
||||
let {page} = this.state;
|
||||
this.setState({
|
||||
page: page <= 1 ? 1 : page-1
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
let {closeModal, open} = this.props;
|
||||
|
||||
let tmpList = this.state.list.slice((this.state.page - 1) * 20, ((this.state.page - 1) * 20 + 20))
|
||||
|
||||
return (
|
||||
<Modal open={open} onClose={()=>{this.closeView()}}>
|
||||
<Modal.Header>
|
||||
@ -94,7 +118,7 @@ class WristbandPathInfo extends React.Component{
|
||||
</Table.Header>
|
||||
<Table.Body>
|
||||
{
|
||||
this.state.list.map((t,idx) => {
|
||||
tmpList.map((t,idx) => {
|
||||
return (
|
||||
<Table.Row key={idx}>
|
||||
<Table.Cell>{parseInt(t.wphyloghr, 16)}</Table.Cell>
|
||||
|
Loading…
Reference in New Issue
Block a user