From 7d0b79bd16adc7800e8af467446af0eb0762b1ad Mon Sep 17 00:00:00 2001 From: zzc <1761997216@qq.com> Date: Tue, 3 Feb 2026 05:04:10 +0800 Subject: [PATCH] fix: metadata --- pages/avatar/index.vue | 3 ++- utils/common.js | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pages/avatar/index.vue b/pages/avatar/index.vue index 2c0e1d2..be386a3 100644 --- a/pages/avatar/index.vue +++ b/pages/avatar/index.vue @@ -478,6 +478,7 @@ const onChooseAvatar = async (e) => { uni.showLoading({ title: "上传中...", mask: true }); try { const imageUrl = await uploadImage(avatarUrl); + currentAvatar.value = { id: "wechat_" + Date.now(), imageUrl: imageUrl, @@ -485,7 +486,7 @@ const onChooseAvatar = async (e) => { uni.hideLoading(); } catch (e) { uni.hideLoading(); - uni.showToast({ title: "上传失败", icon: "none" }); + uni.showToast({ title: e || "上传失败", icon: "none" }); console.error("Upload avatar error", e); } }; diff --git a/utils/common.js b/utils/common.js index 77ad4d2..f2aa462 100644 --- a/utils/common.js +++ b/utils/common.js @@ -21,8 +21,12 @@ export const uploadImage = (filePath) => { if (res.statusCode < 400) { try { const keyJson = JSON.parse(res.data); - const url = `https://file.lihailezzc.com/${keyJson?.data.key}`; - resolve(url); + if (keyJson?.data?.result === "auditFailed") { + reject("图片不符合发布规范,请稍作修改后再试"); + } else { + const url = `https://file.lihailezzc.com/${keyJson?.data.key}`; + resolve(url); + } } catch (e) { reject(e); }