1
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user