|
@@ -162,24 +162,43 @@ var vNode = {
|
|
|
success:function(res) {
|
|
|
console.log(res)
|
|
|
if (res.error_code == 0){
|
|
|
- if(res.data && res.data.list && $.isArray(res.data.list) && res.data.list.length != 0){
|
|
|
+ if(res.data && res.data.list && $.isArray(res.data.list)){
|
|
|
_this.foShow = false
|
|
|
- for (let i = 0; i < res.data.list.length; i++) {
|
|
|
- res.data.list[i].budget = _this.moneyUnit(res.data.list[i].budget)
|
|
|
- var highlight = ''
|
|
|
- if(res.data.list[i].matchkeys && $.isArray(res.data.list[i].matchkeys) && res.data.list[i].matchkeys.length != 0){
|
|
|
- highlight = utils.replaceKeyword(res.data.list[i].title,res.data.list[i].matchkeys, _this.highlightTag)
|
|
|
- res.data.list[i].title = highlight
|
|
|
+ // 当数组为空时,且不为第一页,底部显示没有更多数据
|
|
|
+ if(res.data.list.length == 0 && _this.setParam.pagenum != 1){
|
|
|
+ _this.list = _this.list.concat(res.data.list)
|
|
|
+ _this.loading = false
|
|
|
+ if(!res.data.hasnextpage){
|
|
|
+ _this.loading = true
|
|
|
+ _this.finished = true;
|
|
|
+ }else{
|
|
|
+ _this.loading = false
|
|
|
+ _this.setParam.pagenum++
|
|
|
}
|
|
|
- }
|
|
|
- _this.list = _this.list.concat(res.data.list)
|
|
|
- _this.loading = false
|
|
|
- if(!res.data.hasnextpage){
|
|
|
+ }else if(res.data.list.length == 0 && _this.setParam.pagenum == 1){
|
|
|
+ // 当数组为空时,且为第一页,页面为暂无数据页面
|
|
|
_this.loading = true
|
|
|
_this.finished = true;
|
|
|
- }else{
|
|
|
+ _this.foShow = true
|
|
|
+ } else {
|
|
|
+ // 数据正常加载更多
|
|
|
+ for (let i = 0; i < res.data.list.length; i++) {
|
|
|
+ res.data.list[i].budget = _this.moneyUnit(res.data.list[i].budget)
|
|
|
+ var highlight = ''
|
|
|
+ if(res.data.list[i].matchkeys && $.isArray(res.data.list[i].matchkeys) && res.data.list[i].matchkeys.length != 0){
|
|
|
+ highlight = utils.replaceKeyword(res.data.list[i].title,res.data.list[i].matchkeys, _this.highlightTag)
|
|
|
+ res.data.list[i].title = highlight
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.list = _this.list.concat(res.data.list)
|
|
|
_this.loading = false
|
|
|
- _this.setParam.pagenum++
|
|
|
+ if(!res.data.hasnextpage){
|
|
|
+ _this.loading = true
|
|
|
+ _this.finished = true;
|
|
|
+ }else{
|
|
|
+ _this.loading = false
|
|
|
+ _this.setParam.pagenum++
|
|
|
+ }
|
|
|
}
|
|
|
}else{
|
|
|
_this.loading = true
|
|
@@ -390,25 +409,44 @@ var vNode = {
|
|
|
success:function(res) {
|
|
|
console.log(res)
|
|
|
if (res.error_code == 0){
|
|
|
- // res.data.list=[]
|
|
|
- if(res.data && res.data.list && $.isArray(res.data.list) && res.data.list.length!=0){
|
|
|
+ if(res.data && res.data.list && $.isArray(res.data.list)){
|
|
|
_this.foShow = false
|
|
|
- for (let i = 0; i < res.data.list.length; i++) {
|
|
|
- res.data.list[i].budget = _this.moneyUnit(res.data.list[i].budget)
|
|
|
- var highlight = ''
|
|
|
- if(res.data.list[i].matchkeys && $.isArray(res.data.list[i].matchkeys) && res.data.list[i].matchkeys.length != 0){
|
|
|
- highlight = utils.replaceKeyword(res.data.list[i].title,res.data.list[i].matchkeys, _this.highlightTag)
|
|
|
- res.data.list[i].title = highlight
|
|
|
+ // 当数组为空时,且不为第一页,底部显示没有更多数据
|
|
|
+ if(res.data.list.length == 0 && _this.setParam.pagenum != 1){
|
|
|
+ areaList = areaList.concat(res.data.list)
|
|
|
+ _this.loading = false
|
|
|
+ if(!res.data.hasnextpage){
|
|
|
+ _this.loading = true
|
|
|
+ _this.finished = true;
|
|
|
+ }else{
|
|
|
+ _this.loading = false
|
|
|
+ _this.setParam.pagenum++
|
|
|
}
|
|
|
- }
|
|
|
- areaList = areaList.concat(res.data.list)
|
|
|
- _this.list= areaList
|
|
|
- if(!res.data.hasnextpage){
|
|
|
+ }else if(res.data.list.length == 0 && _this.setParam.pagenum == 1){
|
|
|
+ // 当数组为空时,且为第一页,页面为暂无数据页面
|
|
|
_this.loading = true
|
|
|
_this.finished = true;
|
|
|
- }else{
|
|
|
- _this.loading = false
|
|
|
- _this.setParam.pagenum++
|
|
|
+ _this.foShow = true
|
|
|
+ } else {
|
|
|
+ // 数据正常加载更多
|
|
|
+ for (let i = 0; i < res.data.list.length; i++) {
|
|
|
+ res.data.list[i].budget = _this.moneyUnit(res.data.list[i].budget)
|
|
|
+ var highlight = ''
|
|
|
+ if(res.data.list[i].matchkeys && $.isArray(res.data.list[i].matchkeys) && res.data.list[i].matchkeys.length != 0){
|
|
|
+ highlight = utils.replaceKeyword(res.data.list[i].title,res.data.list[i].matchkeys, _this.highlightTag)
|
|
|
+ res.data.list[i].title = highlight
|
|
|
+ }
|
|
|
+ }
|
|
|
+ areaList = areaList.concat(res.data.list)
|
|
|
+ _this.list= areaList
|
|
|
+ if(!res.data.hasnextpage){
|
|
|
+ _this.loading = true
|
|
|
+ _this.finished = true;
|
|
|
+ }else{
|
|
|
+ _this.loading = false
|
|
|
+ _this.finished = false
|
|
|
+ _this.setParam.pagenum++
|
|
|
+ }
|
|
|
}
|
|
|
}else{
|
|
|
_this.loading = true
|