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:
claw_bot 2026-03-13 03:24:10 +00:00
parent 63335e9512
commit c8dc511560

View File

@ -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 {