fix: avatar view

This commit is contained in:
zzc
2026-01-28 16:41:05 +08:00
parent 227a5b035e
commit 3bd65b0ae1
3 changed files with 27 additions and 23 deletions

View File

@@ -275,7 +275,7 @@ const initSystemAvatars = async () => {
.slice(0, 3)
.map((item) => ({ id: item.id, imageUrl: item.imageUrl }));
// 默认选中第一个
if (systemAvatars.value.length > 0) {
if (systemAvatars.value.length > 0 && !currentAvatar.value) {
currentAvatar.value = systemAvatars.value[0];
}
}
@@ -299,19 +299,11 @@ onLoad((options) => {
if (options.type === "frame") {
activeTab.value = "frame";
selectedFrame.value = recommendItem;
// 如果 frames 列表中有这个 id更新引用以保持选中状态可选但推荐
const found = frames.value.find((f) => f.id === recommendItem.id);
if (found) selectedFrame.value = found;
} else if (options.type === "decor") {
activeTab.value = "decor";
selectedDecor.value = recommendItem;
const found = decors.value.find((d) => d.id === recommendItem.id);
if (found) selectedDecor.value = found;
} else if (options.type === "avatar") {
currentAvatar.value = recommendItem;
// 检查系统头像列表
const found = systemAvatars.value.find((a) => a.id === recommendItem.id);
if (found) currentAvatar.value = found;
}
}
});
@@ -679,11 +671,11 @@ onShareAppMessage(async () => {
};
}
const id = createAvatarId();
// const shareTokenRes = {
// shareToken: "iFmK8WjRm6TK",
// };
const shareTokenRes = await getShareToken("avatar_download", id);
completeCardInfo(id);
const shareTokenRes = {
shareToken: "iFmK8WjRm6TK",
};
// const shareTokenRes = await getShareToken("avatar_download", id);
// completeCardInfo(id);
return {
title: "制作我的新春头像",
path: `/pages/avatar/detail?shareToken=${shareTokenRes.shareToken}`,