邓洁: 完善搜索功能
This commit is contained in:
@@ -50,12 +50,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
console.log('this.listId', this.listId);
|
|
||||||
this.refresh = true
|
this.refresh = true
|
||||||
if (this.listId !== 4) {
|
if (this.listId !== 4) {
|
||||||
this.getMyPublished(this.listId + 1, this.pageSize, this.pageNum)
|
this.getMyPublished(this.listId + 1, this.pageSize, 1)
|
||||||
} else {
|
} else {
|
||||||
this.getMatch()
|
this.getMatch(this.matchPageSize, 1)
|
||||||
}
|
}
|
||||||
this.keyword = ''
|
this.keyword = ''
|
||||||
},
|
},
|
||||||
@@ -63,21 +62,24 @@
|
|||||||
if (this.listId !== 4 && !this.refresh && this.searchListLength !== 0) {
|
if (this.listId !== 4 && !this.refresh && this.searchListLength !== 0) {
|
||||||
this.pageNum++
|
this.pageNum++
|
||||||
this.getMyPublished(this.listId + 1, this.pageSize, this.pageNum)
|
this.getMyPublished(this.listId + 1, this.pageSize, this.pageNum)
|
||||||
} else if (this.listId == 4 && this.matchListLength !== 0) {
|
} else if (this.listId == 4 && !this.refresh &&this.matchListLength !== 0) {
|
||||||
this.matchPageNum++
|
this.matchPageNum++
|
||||||
this.getMatch()
|
this.getMatch(this.matchPageSize, this.matchPageNum)
|
||||||
} else if (this.searchListLength == 0) {
|
} else if (this.searchListLength == 0) {
|
||||||
this.pageNum = 1
|
this.pageNum = 1
|
||||||
|
} else if (this.matchListLength == 0) {
|
||||||
|
this.matchPageNum = 1
|
||||||
}
|
}
|
||||||
this.keyword = ''
|
this.keyword = ''
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getInput(val) {
|
getInput(val) {
|
||||||
console.log('搜索值', val);
|
console.log('搜索值', val);
|
||||||
if (this.pageNum !== 1) {
|
|
||||||
this.pageNum = 1
|
|
||||||
}
|
|
||||||
if (this.listId !== 4) {
|
if (this.listId !== 4) {
|
||||||
|
if (this.pageNum !== 1) {
|
||||||
|
this.pageNum = 1
|
||||||
|
}
|
||||||
this.$api.getMyPublished({
|
this.$api.getMyPublished({
|
||||||
type: this.listId + 1,
|
type: this.listId + 1,
|
||||||
pageSize: this.pageSize,
|
pageSize: this.pageSize,
|
||||||
@@ -98,6 +100,9 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
if (this.matchPageNum !== 1) {
|
||||||
|
this.matchPageNum = 1
|
||||||
|
}
|
||||||
this.$api.getMyMatch({
|
this.$api.getMyMatch({
|
||||||
pageSize: this.matchPageSize,
|
pageSize: this.matchPageSize,
|
||||||
pageNum: this.matchPageNum,
|
pageNum: this.matchPageNum,
|
||||||
@@ -171,14 +176,24 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
getMatch() {
|
getMatch(pageSize,pageNum) {
|
||||||
this.$api.getMyMatch({
|
this.$api.getMyMatch({
|
||||||
pageSize: this.matchPageSize,
|
pageSize: pageSize,
|
||||||
pageNum: this.matchPageNum
|
pageNum: pageNum
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.data.code == 1) {
|
if (res.data.code == 1) {
|
||||||
this.matchListLength = res.data.data.length
|
this.matchListLength = res.data.data.length
|
||||||
this.matchList = [...this.matchList, ...res.data.data[0]]
|
if(this.refresh){
|
||||||
|
this.refresh = false
|
||||||
|
if (res.data.data.length == 0) {
|
||||||
|
this.showNull = true
|
||||||
|
} else {
|
||||||
|
this.showNull = false
|
||||||
|
}
|
||||||
|
this.matchList = res.data.data[0]
|
||||||
|
}else{
|
||||||
|
this.matchList = [...this.matchList, ...res.data.data[0]]
|
||||||
|
}
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
} else {
|
} else {
|
||||||
uni.$u.toast(res.data.msg)
|
uni.$u.toast(res.data.msg)
|
||||||
@@ -194,7 +209,7 @@
|
|||||||
console.log('发布信息l', res, res.data.data.length);
|
console.log('发布信息l', res, res.data.data.length);
|
||||||
if (res.data.code == 1) {
|
if (res.data.code == 1) {
|
||||||
this.searchListLength = res.data.data.length
|
this.searchListLength = res.data.data.length
|
||||||
if (isDelete == 1) {
|
if (isDelete == 1|| this.refresh) {
|
||||||
this.searchInfoList = res.data.data
|
this.searchInfoList = res.data.data
|
||||||
this.refresh = false
|
this.refresh = false
|
||||||
if (res.data.data.length == 0) {
|
if (res.data.data.length == 0) {
|
||||||
@@ -238,9 +253,8 @@
|
|||||||
|
|
||||||
if (this.titletext == '我的匹配') {
|
if (this.titletext == '我的匹配') {
|
||||||
this.listId = 4
|
this.listId = 4
|
||||||
this.getMatch()
|
this.getMatch(this.matchPageSize, this.matchPageNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user