Files
spring-festival-greetings/pages/mine/mine.vue

441 lines
10 KiB
Vue
Raw Normal View History

2026-01-09 11:24:40 +08:00
<template>
2026-01-15 08:43:10 +08:00
<view class="mine-page">
<!-- Custom Navbar -->
2026-01-21 22:33:37 +08:00
<view
class="nav-bar"
:style="{ paddingTop: navBarTop + 'px', height: navBarHeight + 'px' }"
>
2026-01-15 08:43:10 +08:00
<!-- <text class="nav-title">我的</text> -->
</view>
2026-01-21 22:33:37 +08:00
<scroll-view
scroll-y
class="content-scroll"
:style="{ paddingTop: navBarTop + navBarHeight + 'px' }"
>
2026-01-15 08:43:10 +08:00
<view class="content-wrap">
<!-- User Card -->
<view class="user-card" @tap="handleUserClick">
<view class="avatar-box">
2026-01-21 22:33:37 +08:00
<image :src="userInfo.avatarUrl" class="avatar" mode="aspectFill" />
<view class="red-badge"><text class="fire">🔥</text></view>
2026-01-15 08:43:10 +08:00
</view>
<view class="user-info">
<view class="row-1">
<text class="nickname">{{ userInfo.nickName }}</text>
<view class="vip-tag" v-if="isLoggedIn">
<text class="vip-text">VIP 祥瑞会员</text>
</view>
</view>
<view class="row-2" v-if="isLoggedIn">
<text class="arrow-icon"></text>
2026-01-21 22:33:37 +08:00
<text class="stats-text"
>已发送 <text class="num">3</text> 条新春祝福</text
>
2026-01-15 08:43:10 +08:00
</view>
<view class="row-2" v-else>
<text class="stats-text">点击登录解锁更多功能</text>
</view>
</view>
<view class="card-arrow"></view>
</view>
<!-- My Creations -->
<view class="section-title">我的创作</view>
<view class="menu-group">
<view class="menu-item" @tap="navTo('greetings')">
<view class="icon-box red-bg"><text>🧧</text></view>
<text class="menu-text">我的新春祝福</text>
<text class="arrow"></text>
</view>
2026-01-21 22:33:37 +08:00
<view class="menu-item" @tap="navTo('fortune-record')">
2026-01-15 08:43:10 +08:00
<view class="icon-box orange-bg"><text>📹</text></view>
2026-01-21 22:33:37 +08:00
<text class="menu-text">我的新年运势</text>
2026-01-15 08:43:10 +08:00
<text class="arrow"></text>
</view>
2026-01-28 23:08:34 +08:00
<view class="menu-item" @tap="navTo('avatar')">
2026-01-15 08:43:10 +08:00
<view class="icon-box pink-bg"><text></text></view>
2026-01-28 23:08:34 +08:00
<text class="menu-text">我的新春头像</text>
2026-01-15 08:43:10 +08:00
<text class="arrow"></text>
</view>
2026-01-28 23:08:34 +08:00
<view class="menu-item" @tap="navTo('wallpaper')">
2026-01-15 08:43:10 +08:00
<view class="icon-box yellow-bg"><text>🖼</text></view>
2026-01-28 23:08:34 +08:00
<text class="menu-text">我的新春壁纸</text>
2026-01-15 08:43:10 +08:00
<view class="new-badge">NEW</view>
<text class="arrow"></text>
</view>
</view>
<!-- History -->
2026-01-26 11:18:24 +08:00
<!-- <view class="section-title">历史记录</view>
2026-01-15 08:43:10 +08:00
<view class="menu-group">
<view class="menu-item" @tap="navTo('history')">
<view class="icon-box gray-bg"><text>🕒</text></view>
<text class="menu-text">新春祝福记录</text>
<text class="arrow"></text>
</view>
<view class="menu-item" @tap="navTo('archive')">
<view class="icon-box gray-bg"><text>📂</text></view>
<text class="menu-text">历年祝福存档</text>
<text class="arrow"></text>
</view>
2026-01-26 11:18:24 +08:00
</view> -->
2026-01-15 08:43:10 +08:00
2026-01-21 22:33:37 +08:00
<!-- Other Actions -->
2026-01-15 08:43:10 +08:00
<view class="menu-group mt-30">
<button class="menu-item share-btn" open-type="share">
<view class="icon-left"><text class="share-icon">🔗</text></view>
<text class="menu-text">分享给好友</text>
<text class="arrow"></text>
</button>
2026-01-26 11:18:24 +08:00
<view class="menu-item" @tap="navTo('feedback')">
<view class="icon-left"><text class="feedback-icon">📝</text></view>
<text class="menu-text">意见反馈</text>
<text class="arrow"></text>
</view>
2026-01-15 08:43:10 +08:00
<view class="menu-item" @tap="navTo('help')">
<view class="icon-left"><text class="help-icon"></text></view>
<text class="menu-text">使用说明 / 帮助</text>
<text class="arrow"></text>
</view>
</view>
<!-- Footer -->
<view class="version-info">2026 丙午马年 · 新春助手 v1.0.2</view>
2026-01-21 22:33:37 +08:00
2026-01-15 08:43:10 +08:00
<!-- Bottom Spacer for TabBar -->
2026-01-21 22:33:37 +08:00
<view style="height: 120rpx"></view>
2026-01-15 08:43:10 +08:00
</view>
</scroll-view>
<!-- Login Popup -->
2026-01-21 22:33:37 +08:00
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
2026-01-15 08:43:10 +08:00
</view>
2026-01-09 11:24:40 +08:00
</template>
<script setup>
2026-01-21 22:33:37 +08:00
import { ref, computed, onMounted } from "vue";
import { wxLogin } from "@/utils/login.js";
import { getPlatformProvider, getBavBarHeight } from "@/utils/system";
import { useUserStore } from "@/stores/user";
import { apiLogin } from "@/api/auth.js";
2026-01-09 11:24:40 +08:00
2026-01-21 22:33:37 +08:00
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
2026-01-15 08:43:10 +08:00
2026-01-21 22:33:37 +08:00
const userStore = useUserStore();
const loginPopupRef = ref(null);
2026-01-09 11:24:40 +08:00
2026-01-15 08:43:10 +08:00
// Navigation Bar
2026-01-21 22:33:37 +08:00
const navBarTop = ref(20);
const navBarHeight = ref(44);
2026-01-15 08:43:10 +08:00
// User Info
2026-01-21 22:33:37 +08:00
const defaultAvatarUrl =
"https://file.lihailezzc.com/resource/d9b329082b32f8305101f708593a4882.png";
2026-01-09 11:24:40 +08:00
const userInfo = computed(() => ({
2026-01-21 22:33:37 +08:00
nickName: userStore.userInfo.nickName || "点击登录",
avatarUrl: userStore.userInfo.avatarUrl || defaultAvatarUrl,
}));
2026-01-09 11:24:40 +08:00
2026-01-21 22:33:37 +08:00
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
2026-01-09 11:24:40 +08:00
onMounted(() => {
2026-01-21 22:33:37 +08:00
const sysInfo = uni.getSystemInfoSync();
navBarTop.value = sysInfo.statusBarHeight;
2026-01-15 08:43:10 +08:00
// Assuming standard nav bar height
2026-01-21 22:33:37 +08:00
navBarHeight.value = 44;
});
2026-01-09 11:24:40 +08:00
2026-01-15 08:43:10 +08:00
const handleUserClick = () => {
if (!isLoggedIn.value) {
2026-01-21 22:33:37 +08:00
loginPopupRef.value.open();
2026-01-15 08:43:10 +08:00
} else {
// Navigate to profile details or do nothing
}
2026-01-21 22:33:37 +08:00
};
2026-01-09 11:24:40 +08:00
2026-01-15 08:43:10 +08:00
const handleLogind = async () => {
// Logic after successful login if needed
2026-01-21 22:33:37 +08:00
};
2026-01-09 11:24:40 +08:00
2026-01-15 08:43:10 +08:00
const navTo = (page) => {
2026-01-28 22:54:40 +08:00
if (!isLoggedIn.value) {
loginPopupRef.value.open();
uni.showToast({ title: "请先登录", icon: "none" });
return;
}
2026-01-28 22:44:47 +08:00
if (page === "greetings") {
uni.navigateTo({
url: "/pages/mine/greeting",
});
return;
}
2026-01-21 22:33:37 +08:00
if (page === "fortune-record") {
uni.navigateTo({
url: "/pages/fortune/record",
});
return;
}
2026-01-28 23:08:34 +08:00
if (page === "wallpaper") {
uni.navigateTo({
url: "/pages/mine/wallpaper",
});
return;
}
2026-01-28 23:21:10 +08:00
if (page === "avatar") {
uni.navigateTo({
url: "/pages/mine/avatar",
});
return;
}
2026-01-26 11:18:24 +08:00
if (page === "feedback") {
uni.navigateTo({
url: "/pages/feedback/index",
});
return;
}
2026-01-28 23:54:15 +08:00
if (page === "help") {
uni.navigateTo({
url: "/pages/mine/help",
});
return;
}
2026-01-21 22:33:37 +08:00
uni.showToast({ title: "功能开发中", icon: "none" });
};
2026-01-09 11:24:40 +08:00
</script>
2026-01-15 08:43:10 +08:00
<style lang="scss" scoped>
.mine-page {
min-height: 100vh;
background: #f9f9f9;
box-sizing: border-box;
}
2026-01-09 11:24:40 +08:00
2026-01-15 08:43:10 +08:00
.nav-bar {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
display: flex;
align-items: center;
justify-content: center;
background: #f9f9f9;
}
.nav-title {
font-size: 32rpx;
font-weight: bold;
color: #000;
}
2026-01-09 11:24:40 +08:00
2026-01-15 08:43:10 +08:00
.content-scroll {
height: 100vh;
}
.content-wrap {
padding: 20rpx 30rpx 40rpx;
}
/* User Card */
.user-card {
background: #fff;
border-radius: 30rpx;
padding: 40rpx;
display: flex;
align-items: center;
margin-bottom: 40rpx;
position: relative;
2026-01-21 22:33:37 +08:00
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.03);
2026-01-15 08:43:10 +08:00
}
.avatar-box {
position: relative;
margin-right: 30rpx;
}
.avatar {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
border: 4rpx solid #fff;
2026-01-21 22:33:37 +08:00
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
2026-01-15 08:43:10 +08:00
}
.red-badge {
position: absolute;
top: 0;
right: -10rpx;
width: 40rpx;
height: 40rpx;
background: #ff3b30;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
border: 2rpx solid #fff;
}
.fire {
font-size: 24rpx;
color: #fff;
}
2026-01-09 11:24:40 +08:00
2026-01-15 08:43:10 +08:00
.user-info {
flex: 1;
}
.row-1 {
display: flex;
align-items: center;
margin-bottom: 12rpx;
}
.nickname {
font-size: 36rpx;
font-weight: bold;
color: #333;
margin-right: 16rpx;
}
.vip-tag {
background: #ffecec;
padding: 4rpx 16rpx;
border-radius: 999rpx;
}
.vip-text {
color: #ff3b30;
font-size: 20rpx;
font-weight: bold;
}
.row-2 {
display: flex;
align-items: center;
}
.arrow-icon {
color: #ff3b30;
font-size: 20rpx;
margin-right: 8rpx;
}
.stats-text {
font-size: 24rpx;
color: #666;
}
.num {
font-weight: bold;
color: #333;
margin: 0 4rpx;
}
.card-arrow {
font-size: 40rpx;
color: #ccc;
margin-left: 10rpx;
}
2026-01-09 11:24:40 +08:00
2026-01-15 08:43:10 +08:00
/* Section Title */
.section-title {
font-size: 26rpx;
font-weight: bold;
color: #999;
margin-bottom: 20rpx;
padding-left: 10rpx;
}
2026-01-09 11:24:40 +08:00
2026-01-15 08:43:10 +08:00
/* Menu Group */
.menu-group {
background: #fff;
border-radius: 24rpx;
overflow: hidden;
margin-bottom: 40rpx;
2026-01-21 22:33:37 +08:00
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.02);
2026-01-15 08:43:10 +08:00
}
.menu-group.mt-30 {
margin-top: 30rpx;
}
.menu-item {
display: flex;
align-items: center;
padding: 30rpx;
background: #fff;
position: relative;
}
.menu-item:active {
background: #f9f9f9;
}
/* For button reset */
.menu-item.share-btn {
width: 100%;
text-align: left;
line-height: normal;
border-radius: 0;
}
.menu-item.share-btn::after {
border: none;
}
2026-01-09 11:24:40 +08:00
2026-01-15 08:43:10 +08:00
.icon-box {
width: 72rpx;
height: 72rpx;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
font-size: 36rpx;
}
2026-01-21 22:33:37 +08:00
.red-bg {
background: #fff0f0;
color: #ff3b30;
}
.orange-bg {
background: #fff8e6;
color: #ff9500;
}
.pink-bg {
background: #fff0f5;
color: #ff2d55;
}
.yellow-bg {
background: #fffae0;
color: #ffcc00;
}
.gray-bg {
background: #f5f5f5;
color: #666;
}
2026-01-15 08:43:10 +08:00
.icon-left {
width: 40rpx;
display: flex;
justify-content: center;
margin-right: 24rpx;
margin-left: 16rpx;
}
2026-01-21 22:33:37 +08:00
.share-icon,
2026-01-26 11:18:24 +08:00
.help-icon,
.feedback-icon {
2026-01-15 08:43:10 +08:00
font-size: 36rpx;
color: #666;
}
.menu-text {
flex: 1;
font-size: 28rpx;
color: #333;
font-weight: 500;
}
.new-badge {
background: #ff3b30;
color: #fff;
font-size: 20rpx;
padding: 2rpx 10rpx;
border-radius: 8rpx;
margin-right: 16rpx;
}
.arrow {
color: #ccc;
font-size: 32rpx;
}
/* Version Info */
.version-info {
text-align: center;
color: #ccc;
font-size: 22rpx;
margin-top: 60rpx;
2026-01-09 11:24:40 +08:00
}
2026-01-21 22:33:37 +08:00
</style>