优化启动页
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
const selectedItem = ref(null)
|
||||
const displayedCommunities = ref([])
|
||||
const isLoading = ref(false)
|
||||
const isConfirming = ref(false)
|
||||
let searchTimeout = null
|
||||
const defaultVillageId = ref('')
|
||||
|
||||
@@ -123,10 +124,13 @@
|
||||
|
||||
// 确认选择
|
||||
const handleConfirm = () => {
|
||||
// 防重复点击
|
||||
if (isConfirming.value) return
|
||||
if (!selectedItem.value) {
|
||||
uni.showToast({ title: '请先选择小区', icon: 'none', duration: 2000 })
|
||||
return
|
||||
}
|
||||
isConfirming.value = true
|
||||
uni.showLoading({ title: '切换中...', mask: true })
|
||||
switchVillage({ villageId: selectedItem.value.id }).then((res) =>{
|
||||
if(res.code === 200){
|
||||
@@ -137,9 +141,12 @@
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}else{
|
||||
isConfirming.value = false
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: res.msg || '切换失败', icon: 'none' })
|
||||
}
|
||||
}).catch((err)=>{
|
||||
isConfirming.value = false
|
||||
uni.hideLoading()
|
||||
uni.showToast({title:err.msg || '网络异常',icon:'none'})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user