17daf254cd
Updated the onboarding page to include a navigation area with a step indicator and adjusted the progress bar styling. In the profile page, simplified the user section, added options for clearing cache and copying feedback email, and improved layout consistency. Enhanced overall visual design with a light green gradient theme.
214 lines
4.2 KiB
Vue
214 lines
4.2 KiB
Vue
<template>
|
||
<view class="page">
|
||
<view class="user-section">
|
||
<image class="avatar" :src="userAvatar" mode="aspectFill"></image>
|
||
<text class="user-name">{{ userName }}</text>
|
||
</view>
|
||
|
||
<view class="section">
|
||
<view class="menu-list">
|
||
<view class="menu-item" @tap="goOnboarding">
|
||
<view class="menu-icon menu-icon-green">📝</view>
|
||
<view class="menu-content">
|
||
<text class="menu-label">重新填写问卷</text>
|
||
<text class="menu-desc">修改吸烟基线与个人信息</text>
|
||
</view>
|
||
<text class="menu-arrow">›</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="section">
|
||
<view class="menu-list">
|
||
<view class="menu-item" @tap="clearCache">
|
||
<view class="menu-icon menu-icon-gray">🗑️</view>
|
||
<view class="menu-content">
|
||
<text class="menu-label">清除缓存</text>
|
||
</view>
|
||
<text class="menu-arrow">›</text>
|
||
</view>
|
||
<view class="menu-item" @tap="copyInfo">
|
||
<view class="menu-icon menu-icon-gray">💬</view>
|
||
<view class="menu-content">
|
||
<text class="menu-label">意见反馈</text>
|
||
</view>
|
||
<text class="menu-arrow">›</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="logout-btn" @tap="logout">
|
||
<text class="logout-text">退出登录</text>
|
||
</view>
|
||
|
||
<text class="version">版本 1.0.0</text>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { computed, onMounted } from 'vue'
|
||
import { useUserStore } from '@/stores/user'
|
||
import { useLogin } from '@/hooks/useLogin'
|
||
|
||
const userStore = useUserStore()
|
||
const { waitForLogin } = useLogin()
|
||
|
||
const userName = computed(() => userStore.user?.nickname || '戒烟用户')
|
||
const userAvatar = computed(() => userStore.user?.avatar_url || '/static/images/default-avatar.png')
|
||
|
||
function goOnboarding() {
|
||
uni.navigateTo({ url: '/pages/onboarding/index' })
|
||
}
|
||
|
||
function clearCache() {
|
||
uni.showModal({
|
||
title: '清除缓存',
|
||
content: '将清除本地缓存数据,不会影响云端记录',
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
try {
|
||
uni.clearStorageSync()
|
||
uni.showToast({ title: '缓存已清除', icon: 'success' })
|
||
} catch (e) {
|
||
uni.showToast({ title: '清除失败', icon: 'none' })
|
||
}
|
||
}
|
||
}
|
||
})
|
||
}
|
||
|
||
function copyInfo() {
|
||
uni.setClipboardData({
|
||
data: '806669289@qq.com',
|
||
success: () => {
|
||
uni.showToast({ title: '反馈邮箱已复制', icon: 'success' })
|
||
}
|
||
})
|
||
}
|
||
|
||
function logout() {
|
||
uni.showModal({
|
||
title: '确认退出',
|
||
content: '确定要退出登录吗?',
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
userStore.logout()
|
||
uni.reLaunch({ url: '/pages/index/index' })
|
||
}
|
||
}
|
||
})
|
||
}
|
||
|
||
onMounted(async () => {
|
||
await waitForLogin()
|
||
})
|
||
</script>
|
||
|
||
<style scoped>
|
||
.page {
|
||
min-height: 100vh;
|
||
background: linear-gradient(to bottom, #D1FAE5 0%, #F0FDF4 45%, #FFFFFF 100%);
|
||
padding: 32rpx;
|
||
padding-bottom: 160rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.user-section {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
padding: 48rpx 0 40rpx;
|
||
}
|
||
|
||
.avatar {
|
||
width: 140rpx;
|
||
height: 140rpx;
|
||
border-radius: 50%;
|
||
border: 4rpx solid #A7F3D0;
|
||
background-color: #ECFDF5;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
|
||
.user-name {
|
||
font-size: 38rpx;
|
||
font-weight: 700;
|
||
color: #111827;
|
||
}
|
||
|
||
.section { margin-bottom: 24rpx; }
|
||
|
||
.menu-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.menu-item {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 24rpx;
|
||
background-color: #FFFFFF;
|
||
border-radius: 24rpx;
|
||
padding: 28rpx 24rpx;
|
||
border: 2rpx solid #ECFDF3;
|
||
box-shadow: 0 8rpx 20rpx rgba(16, 185, 129, 0.08);
|
||
}
|
||
|
||
.menu-icon {
|
||
width: 64rpx;
|
||
height: 64rpx;
|
||
border-radius: 16rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 32rpx;
|
||
}
|
||
|
||
.menu-icon-green { background-color: #DCFCE7; }
|
||
.menu-icon-gray { background-color: #F3F4F6; }
|
||
|
||
.menu-content {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4rpx;
|
||
}
|
||
|
||
.menu-label {
|
||
font-size: 30rpx;
|
||
color: #111827;
|
||
}
|
||
|
||
.menu-desc {
|
||
font-size: 24rpx;
|
||
color: #6B7280;
|
||
}
|
||
|
||
.menu-arrow {
|
||
font-size: 36rpx;
|
||
color: #9CA3AF;
|
||
}
|
||
|
||
.logout-btn {
|
||
text-align: center;
|
||
padding: 28rpx;
|
||
margin-top: 40rpx;
|
||
background-color: #FFFFFF;
|
||
border-radius: 24rpx;
|
||
border: 2rpx solid #FEE2E2;
|
||
}
|
||
|
||
.logout-text {
|
||
color: #EF4444;
|
||
font-size: 30rpx;
|
||
}
|
||
|
||
.version {
|
||
display: block;
|
||
text-align: center;
|
||
font-size: 22rpx;
|
||
color: #9CA3AF;
|
||
margin-top: 32rpx;
|
||
}
|
||
</style>
|