fix: metadata
This commit is contained in:
@@ -478,6 +478,7 @@ const onChooseAvatar = async (e) => {
|
|||||||
uni.showLoading({ title: "上传中...", mask: true });
|
uni.showLoading({ title: "上传中...", mask: true });
|
||||||
try {
|
try {
|
||||||
const imageUrl = await uploadImage(avatarUrl);
|
const imageUrl = await uploadImage(avatarUrl);
|
||||||
|
|
||||||
currentAvatar.value = {
|
currentAvatar.value = {
|
||||||
id: "wechat_" + Date.now(),
|
id: "wechat_" + Date.now(),
|
||||||
imageUrl: imageUrl,
|
imageUrl: imageUrl,
|
||||||
@@ -485,7 +486,7 @@ const onChooseAvatar = async (e) => {
|
|||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.showToast({ title: "上传失败", icon: "none" });
|
uni.showToast({ title: e || "上传失败", icon: "none" });
|
||||||
console.error("Upload avatar error", e);
|
console.error("Upload avatar error", e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,8 +21,12 @@ export const uploadImage = (filePath) => {
|
|||||||
if (res.statusCode < 400) {
|
if (res.statusCode < 400) {
|
||||||
try {
|
try {
|
||||||
const keyJson = JSON.parse(res.data);
|
const keyJson = JSON.parse(res.data);
|
||||||
const url = `https://file.lihailezzc.com/${keyJson?.data.key}`;
|
if (keyJson?.data?.result === "auditFailed") {
|
||||||
resolve(url);
|
reject("图片不符合发布规范,请稍作修改后再试");
|
||||||
|
} else {
|
||||||
|
const url = `https://file.lihailezzc.com/${keyJson?.data.key}`;
|
||||||
|
resolve(url);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user