This commit is contained in:
zzc
2026-02-02 14:59:34 +08:00
parent 1ce775436d
commit 526e2aad70
12 changed files with 89 additions and 80 deletions

View File

@@ -12,7 +12,7 @@
class="avatar-selector custom-button"
>
<image v-if="avatarUrl" :src="avatarUrl" class="avatar-preview" />
<text v-else>获取头像</text>
<text v-else>点击获取头像</text>
</button>
<input
class="nickname-input"
@@ -45,6 +45,19 @@ const userStore = useUserStore();
const emit = defineEmits(["logind"]);
const festivalNames = [
'春意','福星','小福','新禧','瑞雪','花灯','喜乐','元宝','春芽','年年',
'花灯','月圆','灯影','小灯','星灯','彩灯',
'清风','微风','小晴','碧波','流泉',
'月光','玉轮','桂香','秋叶','星河','小月','露华','秋水',
'雪落','冰晶','暖阳','小雪','冬影','雪花','松影'
];
const getFestivalName = () => {
const idx = Math.floor(Math.random() * festivalNames.length);
return festivalNames[idx];
}
const open = () => {
popupRef.value.open();
};
@@ -62,11 +75,11 @@ const confirmLogin = async () => {
const platform = getPlatformProvider();
if (platform === "mp-weixin") {
const code = await wxLogin();
const imageUrl = await uploadImage(avatarUrl.value);
const imageUrl = avatarUrl.value ? await uploadImage(avatarUrl.value) : "";
const loginRes = await apiLogin({
code,
nickname: nickname.value,
nickname: nickname.value || getFestivalName(),
avatarUrl: imageUrl,
platform: "wx",
});