diff --git a/src/components/AdminPage/Wristband/WristbandInfo/WristbandPathInfo.js b/src/components/AdminPage/Wristband/WristbandInfo/WristbandPathInfo.js index 90a1639..0213782 100644 --- a/src/components/AdminPage/Wristband/WristbandInfo/WristbandPathInfo.js +++ b/src/components/AdminPage/Wristband/WristbandInfo/WristbandPathInfo.js @@ -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 ( {this.closeView()}}> @@ -80,9 +104,16 @@ class WristbandPathInfo extends React.Component{ + +
+
+ { - this.state.list.map((t,idx) => { + tmpList.map((t,idx) => { return ( {