fix: update page

This commit is contained in:
zzc
2026-02-03 02:41:19 +08:00
parent 52af2aad8f
commit bd45082544
6 changed files with 149 additions and 72 deletions

View File

@@ -1,32 +1,37 @@
<template>
<uni-popup ref="popupRef" type="bottom" :safe-area="false">
<view class="popup-container">
<view class="popup-header">
<text class="popup-title">登录授权</text>
</view>
<view>
<uni-popup ref="popupRef" type="bottom" :safe-area="false">
<view class="popup-container">
<view class="popup-header">
<text class="popup-title">登录授权</text>
</view>
<view class="avatar-nickname">
<button
open-type="chooseAvatar"
@chooseavatar="onChooseAvatar"
class="avatar-selector custom-button"
>
<image v-if="avatarUrl" :src="avatarUrl" class="avatar-preview" />
<text v-else>点击获取头像</text>
<view class="avatar-nickname">
<button
open-type="chooseAvatar"
@chooseavatar="onChooseAvatar"
class="avatar-selector custom-button"
>
<image v-if="avatarUrl" :src="avatarUrl" class="avatar-preview" />
<text v-else>点击获取头像</text>
</button>
<input
class="nickname-input"
type="nickname"
v-model="nickname"
placeholder="请输入昵称"
/>
</view>
<button class="confirm-btn custom-button" @tap="confirmLogin">
确认登录
</button>
<input
class="nickname-input"
type="nickname"
v-model="nickname"
placeholder="请输入昵称"
/>
</view>
</uni-popup>
<button class="confirm-btn custom-button" @tap="confirmLogin">
确认登录
</button>
</view>
</uni-popup>
<!-- 隐私协议弹窗 -->
<PrivacyPopup ref="privacyRef" @agree="onPrivacyAgree" />
</view>
</template>
<script setup>
@@ -36,8 +41,10 @@ import { getPlatformProvider } from "@/utils/system";
import { uploadImage } from "@/utils/common";
import { apiLogin } from "@/api/auth.js";
import { wxLogin } from "@/utils/login.js";
import PrivacyPopup from "@/components/PrivacyPopup/PrivacyPopup.vue";
const popupRef = ref(null);
const privacyRef = ref(null);
const avatarUrl = ref("");
const nickname = ref("");
@@ -46,19 +53,65 @@ const userStore = useUserStore();
const emit = defineEmits(["logind"]);
const festivalNames = [
'春意','福星','小福','新禧','瑞雪','花灯','喜乐','元宝','春芽','年年',
'花灯','月圆','灯影','小灯','星灯','彩灯',
'清风','微风','小晴','碧波','流泉',
'月光','玉轮','桂香','秋叶','星河','小月','露华','秋水',
'雪落','冰晶','暖阳','小雪','冬影','雪花','松影'
"春意",
"福星",
"小福",
"新禧",
"瑞雪",
"花灯",
"喜乐",
"元宝",
"春芽",
"年年",
"花灯",
"月圆",
"灯影",
"小灯",
"星灯",
"彩灯",
"清风",
"微风",
"小晴",
"碧波",
"流泉",
"月光",
"玉轮",
"桂香",
"秋叶",
"星河",
"小月",
"露华",
"秋水",
"雪落",
"冰晶",
"暖阳",
"小雪",
"冬影",
"雪花",
"松影",
];
const getFestivalName = () => {
const idx = Math.floor(Math.random() * festivalNames.length);
return festivalNames[idx];
}
};
const open = () => {
const open = async () => {
console.log(22223333);
// #ifdef MP-WEIXIN
const isAgreed = await privacyRef.value.check();
console.log(1111, isAgreed);
if (isAgreed) {
popupRef.value.open();
}
// #endif
// #ifndef MP-WEIXIN
popupRef.value.open();
// #endif
};
const onPrivacyAgree = () => {
popupRef.value.open();
};
@@ -75,7 +128,9 @@ const confirmLogin = async () => {
const platform = getPlatformProvider();
if (platform === "mp-weixin") {
const code = await wxLogin();
const imageUrl = avatarUrl.value ? await uploadImage(avatarUrl.value) : "";
const imageUrl = avatarUrl.value
? await uploadImage(avatarUrl.value)
: "";
const loginRes = await apiLogin({
code,