Commit f9d145ea by 姜雷

Merge branch 'test'

parents 8e0a4aad 9db8d416
...@@ -101,10 +101,15 @@ Component({ ...@@ -101,10 +101,15 @@ Component({
}); });
}, },
refreshList() { refreshList() {
wx.showLoading({
title: '加载中',
mask: true,
});
this.fetchList({ this.fetchList({
pageNum: 1, pageNum: 1,
}) })
.then(res => { .then(res => {
wx.hideLoading();
const { list } = res.data; const { list } = res.data;
this.setData({ this.setData({
pageNum: 1, pageNum: 1,
...@@ -112,14 +117,20 @@ Component({ ...@@ -112,14 +117,20 @@ Component({
}); });
}) })
.catch(err => { .catch(err => {
wx.hideLoading();
console.log(err); console.log(err);
}); });
}, },
getMoreListItem() { getMoreListItem() {
wx.showLoading({
title: '加载中',
mask: true,
});
this.fetchList({ this.fetchList({
pageNum: this.data.pageNum + 1, pageNum: this.data.pageNum + 1,
}) })
.then(res => { .then(res => {
wx.hideLoading();
const { list } = res.data; const { list } = res.data;
if (list && list.length) { if (list && list.length) {
this.setData!({ this.setData!({
...@@ -129,6 +140,7 @@ Component({ ...@@ -129,6 +140,7 @@ Component({
} }
}) })
.catch(err => { .catch(err => {
wx.hideLoading();
console.log(err); console.log(err);
}); });
}, },
......
...@@ -109,6 +109,7 @@ Component({ ...@@ -109,6 +109,7 @@ Component({
refreshList() { refreshList() {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
mask: true,
}); });
this.fetchList() this.fetchList()
.then(res => { .then(res => {
...@@ -118,6 +119,10 @@ Component({ ...@@ -118,6 +119,10 @@ Component({
this.setData({ this.setData({
['dataList.' + this.data.status]: res.data, ['dataList.' + this.data.status]: res.data,
}); });
} else {
this.setData({
['dataList.' + this.data.status]: [],
});
} }
}) })
.catch(err => { .catch(err => {
...@@ -128,6 +133,7 @@ Component({ ...@@ -128,6 +133,7 @@ Component({
getMoreListItem() { getMoreListItem() {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
mask: true,
}); });
let nextPage = this.data.pagination[this.data.status].pageNum + 1; let nextPage = this.data.pagination[this.data.status].pageNum + 1;
this.fetchList({ this.fetchList({
......
...@@ -98,6 +98,7 @@ Component({ ...@@ -98,6 +98,7 @@ Component({
refreshList() { refreshList() {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
mask: true,
}); });
this.fetchList({}) this.fetchList({})
.then(res => { .then(res => {
...@@ -108,6 +109,10 @@ Component({ ...@@ -108,6 +109,10 @@ Component({
this.setData({ this.setData({
dataList: list, dataList: list,
}); });
} else {
this.setData({
dataList: [],
});
} }
}) })
.catch(err => { .catch(err => {
...@@ -118,6 +123,7 @@ Component({ ...@@ -118,6 +123,7 @@ Component({
getMoreListItem() { getMoreListItem() {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
mask: true,
}); });
let nextPage = this.data.pageNum + 1; let nextPage = this.data.pageNum + 1;
this.fetchList({ this.fetchList({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment