diff --git a/src/utils/request.ts b/src/utils/request.ts index cd59ec6..99aae49 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -4,6 +4,7 @@ import { useUserInfoStore } from '@/stores/modules/userInfo' const store = useUserInfoStore() import { getLocal } from '@/utils/local' import router from '@/router/index' +import { useOverallStore } from '@/stores' // 创建axios实例 @@ -152,22 +153,18 @@ function removePending(config: any) { } } // ----------------------------------loading的函数------------------------------- -const LoadingInstance: { _target: any; _count: number } = { - _target: null, // 保存Loading实例 +const LoadingInstance: { _count: number } = { _count: 0 } function openLoading(loadingDom: any) { - LoadingInstance._target = showNotify({ - message: '数据正在加载中', - background: 'rgba(25, 32, 53, 1)' - }) + useOverallStore().setLoading(true) } function closeLoading() { if (LoadingInstance._count > 0) LoadingInstance._count-- if (LoadingInstance._count === 0) { - LoadingInstance._target?.close() - LoadingInstance._target = null + useOverallStore().setLoading(false) } + } export default service