This commit is contained in:
张成
2026-02-07 13:08:28 +08:00
parent 5a10c73adf
commit 536619ebfc
8 changed files with 58 additions and 49 deletions

View File

@@ -129,23 +129,30 @@ class HttpService {
// 隐藏loading支持多个并发请求
private hideLoading(): void {
this.loadingCount = Math.max(0, this.loadingCount - 1)
try {
this.loadingCount = Math.max(0, this.loadingCount - 1)
// 只有所有请求都完成时才隐藏loading
if (this.loadingCount === 0) {
// 清除之前的延时器
if (this.hideLoadingTimer) {
clearTimeout(this.hideLoadingTimer)
this.hideLoadingTimer = null
// 只有所有请求都完成时才隐藏loading
if (this.loadingCount === 0) {
// 清除之前的延时器
if (this.hideLoadingTimer) {
clearTimeout(this.hideLoadingTimer)
this.hideLoadingTimer = null
}
// 延时300ms后隐藏loading避免频繁切换
this.hideLoadingTimer = setTimeout(() => {
Taro.hideLoading()
this.currentLoadingText = ''
this.hideLoadingTimer = null
}, 800)
}
// 延时300ms后隐藏loading避免频繁切换
this.hideLoadingTimer = setTimeout(() => {
Taro.hideLoading()
this.currentLoadingText = ''
this.hideLoadingTimer = null
}, 800)
}
catch (e) {
console.warn(e)
}
}
// 处理响应
@@ -175,7 +182,7 @@ class HttpService {
url: '/login_pages/index/index'
})
reject(new Error('用户不存在'))
return response.data
return response.data
}
@@ -187,7 +194,7 @@ class HttpService {
} else {
reject(response.data)
}
return response.data
return response.data
}
}