fix: 修复api.js中toast调用方式
- uni.$u.toast.loading/hide 改为 uni.showLoading/hideLoading - uni.$u.toast.error 改为 uni.showToast - uview-plus的toast API与uview-ui不同
This commit is contained in:
parent
63335e9512
commit
c8dc511560
@ -17,7 +17,7 @@ let loginLock = null;
|
||||
let loadingCount = 0;
|
||||
const showLoading = () => {
|
||||
if (loadingCount === 0) {
|
||||
uni.$u.toast.loading('加载中...');
|
||||
uni.showLoading({ title: '加载中...', mask: true });
|
||||
}
|
||||
loadingCount++;
|
||||
};
|
||||
@ -25,7 +25,7 @@ const hideLoading = () => {
|
||||
loadingCount--;
|
||||
if (loadingCount <= 0) {
|
||||
loadingCount = 0;
|
||||
uni.$u.toast.hide();
|
||||
uni.hideLoading();
|
||||
}
|
||||
};
|
||||
|
||||
@ -196,7 +196,7 @@ const requestWithRetry = async (url, method = 'GET', data = {}, headers = {}, re
|
||||
return await requestWithRetry(url, method, data, headers, retryCount + 1);
|
||||
} else {
|
||||
console.error('❌ 达到最大重试次数');
|
||||
uni.$u.toast.error('系统异常,请稍后重试');
|
||||
uni.showToast({ title: '系统异常,请稍后重试', icon: 'none' });
|
||||
throw new Error('登录已过期,重试次数超限');
|
||||
}
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user