优化启动页

This commit is contained in:
zhouyanli
2026-08-17 15:31:17 +08:00
parent 9d5310e4a7
commit cb885dc1f2
8 changed files with 88 additions and 24 deletions

View File

@@ -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'})
})