分页逻辑

master
pan 5 years ago
parent 80b54263b8
commit 8ec775a21a
  1. 8
      src/my/MyFriend.tsx
  2. 2
      src/my/MyHelp.tsx
  3. 2
      src/my/MyLeaveWord.tsx
  4. 2
      src/my/SeekHelp.tsx
  5. 2
      src/public.tsx
  6. 7
      src/sub/IndexMenu.tsx
  7. 5
      src/sub/Volunteer.tsx

@ -109,7 +109,7 @@ export class MyFriend extends React.Component<
/**
*
*/
queryUser(name:string){
queryUser(name:string,page:number){
if(!name){
this.setState({
@ -122,7 +122,9 @@ export class MyFriend extends React.Component<
switch (res.customResult) {
case PageDataMessage.ok:
that.setState({
userList: res.dataList
userList: page===1?res.dataList||[]:(that.state.userList||[]).concat(res.dataList||[]),
page: res.page,
scrollTip: page > 1 ? '成功加载第' + page + '页数据' : null,
})
break
}
@ -187,7 +189,7 @@ export class MyFriend extends React.Component<
this.setState({
queryUser:e.target.value
})
this.queryUser(e.target.value)
this.queryUser(e.target.value,1)
}}/>
</ListGroup.Item>

@ -137,7 +137,7 @@ export class MyHelp extends React.Component<{
switch (res.customResult) {
case PageDataMessage.ok:
that.setState({
data: (that.state.data||[]).concat(res.dataList||[]),
data: page===1?res.dataList||[]:(that.state.data||[]).concat(res.dataList||[]),
page: res.page,
scrollTip: page > 1 ? '成功加载第' + page + '页数据' : null,
})

@ -64,7 +64,7 @@ export class MyLeaveWord extends React.Component<
switch (res.customResult) {
case PageDataMessage.ok:
that.setState({
data: (that.state.data||[]).concat(res.dataList||[]),
data: page===1?res.dataList||[]:(that.state.data||[]).concat(res.dataList||[]),
page: res.page,
scrollTip: page > 1 ? '成功加载第' + page + '页数据' : null,
})

@ -75,7 +75,7 @@ export class SeekHelp extends React.Component<{ user:string },
switch (res.customResult) {
case PageDataMessage.ok:
that.setState({
data: (that.state.data||[]).concat(res.dataList||[]),
data: page===1?res.dataList||[]:(that.state.data||[]).concat(res.dataList||[]),
page: res.page,
scrollTip: page > 1 ? '成功加载第' + page + '页数据' : null,
})

@ -89,7 +89,7 @@ export function loadMyFriend(name:string,that:React.Component<any,any>,page:numb
switch (res.customResult) {
case PageDataMessage.ok:
that.setState({
friendList: (that.state.friendList||[]).concat(res.dataList||[]),
friendList: page===1?res.dataList||[]:(that.state.friendList||[]).concat(res.dataList||[]),
page: res.page,
scrollTip: page > 1 ? '成功加载第' + page + '页数据' : null,
})

@ -68,9 +68,10 @@ export class IndexMenu extends React.Component<{ cookies:Cookies },
});break;
case PageDataMessage.ok:
that.setState({
activityList:res.dataList,
page:res.page
});break
activityList: page===1?res.dataList||[]:(that.state.activityList||[]).concat(res.dataList||[]),
page: res.page,
})
break
case PageDataMessage.empty:
that.setState({
activityList:[],

@ -54,9 +54,10 @@ export class Volunteer extends React.Component<{ undefined?:undefined },
},new FindUserTransform(),function(res:FindUserRes){
switch (res.customResult) {
case PageDataMessage.ok:
that.setState({
volunteerList:res.dataList,
page:res.page,
volunteerList: page===1?res.dataList||[]:(that.state.volunteerList||[]).concat(res.dataList||[]),
page: res.page,
form:{
keyword:that.state.form.keyword,
serviceAddress:that.state.form.serviceAddress

Loading…
Cancel
Save