过滤数据慢,添加loading效果

This commit is contained in:
shijingjing
2023-02-28 14:58:47 +08:00
parent e9574cf236
commit 282dc52148
2 changed files with 20 additions and 3 deletions

View File

@@ -55,12 +55,17 @@ export default {
},
methods: {
getAllGrids() {
uni.showLoading({title: '加载中'})
this.$http.post('/app/appgirdinfo/listByInfo').then((res) => {
if (res?.data) {
let parents = res.data.map(e => e.parentGirdId)
this.allData = res.data.map(e => ({...e, hasChildren: parents.includes(e.id)}))
this.gridInit()
}
}).then(()=> {
uni.hideLoading()
}).finally(()=> {
uni.hideLoading()
})
},
gridInit() {

View File

@@ -55,30 +55,37 @@ export default {
uni.setStorageSync('sendScope', this.sendScope)
},
submit() {
this.$loading()
if(this.sendType == 'ResidentsGroup') {
this.getWxGroups()
} else if(this.sendType == 'Residents' || this.sendType == 'CircleOfFriends') {
this.getSendScope()
}
uni.setStorageSync('sendScope', this.sendScope)
setTimeout(() => {
uni.navigateBack()
}, 600)
},
// 群发居民群
getWxGroups() {
uni.showLoading({title: '加载中'})
this.$http.post(`/app/appmasssendingtask/queryWxGroups?sendScope=${this.sendScope}`,
{
filterCriteria: this.girdListIds.join(',') || this.deptListIds.join(',') || ''
}).then(res => {
if (res.code === 0) {
this.wxGroups = res.data
uni.hideLoading()
uni.setStorageSync('wxGroupsUser', this.wxGroups)
}
}).then(()=> {
uni.hideLoading()
uni.navigateBack()
}).finally(()=> {
uni.hideLoading()
})
},
// 群发朋友圈、居民
getSendScope() {
uni.showLoading({title: '加载中'})
let formData = {}
if(this.sendScope == 0) {
formData = {
@@ -106,6 +113,11 @@ export default {
}
uni.setStorageSync('wxGroupsUser', this.wxGroups)
}
}).then(()=> {
uni.hideLoading()
uni.navigateBack()
}).finally(()=> {
uni.hideLoading()
})
}
},