revert 解决冲突
This commit is contained in:
2025-11-27 15:38:24 +08:00
parent 3da220526b
commit 64abd3d4ab
28 changed files with 1059 additions and 705 deletions

View File

@@ -8,7 +8,6 @@ import { t } from '@/utils/i18n'
export function createRequestClient(cfg: ICreateClientConfig) {
const baseURL = cfg.baseURL;
const timeout = cfg.timeout ?? REQUEST_TIMEOUT;
let reqCount= 0
async function request<T = any>(options: IRequestOptions): Promise<T> {
// 组装 final options
@@ -24,18 +23,14 @@ export function createRequestClient(cfg: ICreateClientConfig) {
// 全局处理请求 loading
const loading = !cfg.loading ? true : cfg.loading // 接口请求参数不传loading默认显示loading
if (loading) {
uni.showLoading({ mask: true })
reqCount++
}
loading && uni.showLoading()
return new Promise((resolve, reject) => {
uni.request({
...intercepted,
complete() {
// 请求完成关闭 loading
loading && reqCount--
reqCount <= 0 && uni.hideLoading()
loading && uni.hideLoading()
},
success(res: any) {
// 委托给响应拦截器处理