过滤数据慢,添加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: { methods: {
getAllGrids() { getAllGrids() {
uni.showLoading({title: '加载中'})
this.$http.post('/app/appgirdinfo/listByInfo').then((res) => { this.$http.post('/app/appgirdinfo/listByInfo').then((res) => {
if (res?.data) { if (res?.data) {
let parents = res.data.map(e => e.parentGirdId) let parents = res.data.map(e => e.parentGirdId)
this.allData = res.data.map(e => ({...e, hasChildren: parents.includes(e.id)})) this.allData = res.data.map(e => ({...e, hasChildren: parents.includes(e.id)}))
this.gridInit() this.gridInit()
} }
}).then(()=> {
uni.hideLoading()
}).finally(()=> {
uni.hideLoading()
}) })
}, },
gridInit() { gridInit() {

View File

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