feat: release

This commit is contained in:
zzc
2026-05-20 23:32:59 +08:00
parent c03a699ab9
commit 1107d296ce
2 changed files with 64 additions and 65 deletions

View File

@@ -165,6 +165,7 @@ import { smartNavigateBack } from "@/utils/page";
import {
uploadImage,
FILE_BASE_URL,
chooseAndUploadImage,
} from "@/utils/common.js";
const statusBarHeight = ref(getStatusBarHeight() || 0);
@@ -225,76 +226,26 @@ const handlePreview = () => {
});
};
const chooseCover = () => {
uni.chooseImage({
count: 1,
sizeType: ["original", "compressed"],
sourceType: ["album"],
success: (res) => {
const path = res.tempFilePaths[0];
// #ifdef MP-ALIPAY
// 支付宝小程序不支持 cropImage直接使用原图
onAvatarSelect(path);
// #endif
// #ifndef MP-ALIPAY
// 调用系统裁剪,强制 1:1
uni.cropImage({
src: path,
aspectRatio: "1:1",
success: (cropRes) => {
onAvatarSelect(cropRes.tempFilePath);
},
fail: (err) => {
console.warn("Crop failed or cancelled", err);
onAvatarSelect(path);
},
});
// #endif
},
fail: (err) => {
console.warn("Crop failed or cancelled", err);
},
});
};
const onAvatarSelect = async (url) => {
if (!url) return;
uni.showLoading({ title: "上传中...", mask: true });
const chooseCover = async () => {
try {
const imageUrl = await uploadImage(url);
formData.coverUrl = imageUrl;
uni.hideLoading();
const urls = await chooseAndUploadImage({ count: 1 });
if (urls && urls.length > 0) {
formData.coverUrl = urls[0];
}
} catch (e) {
uni.hideLoading();
uni.showToast({ title: e || "上传失败", icon: "none" });
console.error("Upload avatar error", e);
console.error("选择封面失败", e);
}
};
const chooseParticipantAvatar = (index) => {
uni.chooseImage({
count: 1,
success: async (res) => {
const url = res.tempFilePaths[0];
uni.showLoading({ title: '上传中...' });
try {
const imageUrl = await uploadImage(url);
participants.value[index].avatar = imageUrl;
uni.hideLoading();
} catch (e) {
uni.hideLoading();
uni.showToast({
title: "上传失败",
icon: "none",
});
console.error(e);
}
},
});
const chooseParticipantAvatar = async (index) => {
try {
const urls = await chooseAndUploadImage({ count: 1 });
if (urls && urls.length > 0) {
participants.value[index].avatar = urls[0];
}
} catch (e) {
console.error("选择评分对象头像失败", e);
}
};
const handleAddTag = () => {