@@ -115,11 +115,7 @@ export default {
} else if (list.length < 6) {
list.push(id);
} else {
- wx.showToast({
- icon: 'none',
- title: '最多选择六张',
- mask: true
- });
+ this.toast('最多选择六张');
}
this.nowChoose = list;
},
@@ -72,6 +72,22 @@ export default {
return num;
+ },
+ toast(title, icon = 'none', duration = 1500) {
+ wx.showToast({
+ icon: icon,
+ title: title,
+ mask: true,
+ duration: duration
+ });
+ showLoading() {
+ wx.showLoading({
+ title: '加载中...'
+ hideLoading() {
+ wx.hideLoading();
};
@@ -71,16 +71,25 @@ export default {
this.getData();
getData() {
+ this.showLoading();
+ this.list = [];
this.empty = false;
this.$http
.get('/cardCase/showCasesMA', {
caseStatus: this.getStatus(this.active)
})
.then(res => {
+ this.hideLoading();
this.list = res;
if (res.length === 0) {
this.empty = true;
+ })
+ .catch(e => {
+ if (e.error) {
+ this.toast(e.rror);
+ }
});