This commit is contained in:
2025-07-18 20:27:53 +08:00
parent 7a17c58a19
commit 2135cb549c
+23 -23
View File
@@ -124,29 +124,29 @@ export const queryCurrentUser = (data) => request({
const localFilePath = '_downloads/' + filename
// 先检查是否存在
uni.getFileInfo({
filePath: localFilePath,
success: () => {
console.log('头像已存在,无需下载');
updateUserAvatar(localFilePath)
},
fail: () => {
console.log('开始下载头像:', url);
const dtask = plus.downloader.createDownload(
url, {
method: 'GET',
filename: '_downloads/' + filename
},
(download, status) => {
if (status === 200) {
console.log('头像下载成功:', download.filename);
updateUserAvatar(download.filename)
}
}
)
dtask.start();
}
})
// uni.getFileInfo({
// filePath: localFilePath,
// success: () => {
// console.log('头像已存在,无需下载');
// updateUserAvatar(localFilePath)
// },
// fail: () => {
// console.log('开始下载头像:', url);
// const dtask = plus.downloader.createDownload(
// url, {
// method: 'GET',
// filename: '_downloads/' + filename
// },
// (download, status) => {
// if (status === 200) {
// console.log('头像下载成功:', download.filename);
// updateUserAvatar(download.filename)
// }
// }
// )
// dtask.start();
// }
// })
} catch (error) {