文件
huaqiapp/pages/mine/index.vue
linda ea2be7af8c style(ui): 图标整体放大并与页面比例协调
按 6 级尺寸阶梯统一放大图标,避免小而散、提升大气感:
- 底部导航 40 -> 48,容器 104 -> 116,标签 22 -> 23
- 首页快捷入口 40 -> 52,容器 96 -> 112、圆角 32 -> 36,标签 22 -> 24
- 首页品牌花标 40 -> 46,牌标容器 72 -> 84
- 今日心语 52 -> 62,提醒 38 -> 46
- 情绪选择 40 -> 50(容器 76),记录 30 -> 36,疗愈内容 34 -> 42
- 健康 Tab 26 -> 32(Tab 76 -> 84),建议项 34 -> 42(容器 84)
- 我的设置项 32 -> 40,头像 108 -> 116
- 备孕/关系/亲子勾选 20 -> 24(容器 40 -> 46),会员勾选 18 -> 22
- 咨询师头像 40 -> 50(容器 100),热线 34/36 -> 42,急救工具 44 -> 54
- 空状态与会员锁 72 -> 96,内容详情头图 64 -> 78,登录花瓣与输入框图标同步放大
- 大尺寸图标描边降至 1.6-1.8,小尺寸保持 1.8-2.4,线宽视觉统一
- 文档补充「图标尺寸阶梯」规范

验证:no_emoji 0 问题 / 契约 84 接口 0 偏差 / Vue 20-20 / SCSS 19-19
2026-11-06 10:25:41 +08:00

872 行
20 KiB
Vue

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<template>
<view class="hq-page">
<!-- 用户卡 -->
<view class="profile hq-fade-up">
<view class="profile-left">
<view class="avatar">
<text class="avatar-text">{{ avatarText }}</text>
</view>
<view class="profile-info">
<text class="profile-name">{{ user.nickname || user.username || '花期用户' }}</text>
<text class="profile-bio">{{ user.bio || '愿花期常伴,身体被温柔对待' }}</text>
</view>
</view>
<view class="profile-badge" :class="{ 'profile-badge-vip': isMember }" @tap="goMember">
<text class="profile-badge-text">{{ isMember ? (member.plan_name || '会员') : '未开通' }}</text>
</view>
</view>
<!-- 数据概览 -->
<view class="hq-card">
<view class="stat-row">
<view class="stat">
<text class="stat-value">{{ summary.cycle_length || 28 }}</text>
<text class="stat-label">平均周期</text>
</view>
<view class="stat-divider"></view>
<view class="stat">
<text class="stat-value">{{ summary.log_count || 0 }}</text>
<text class="stat-label">身体记录</text>
</view>
<view class="stat-divider"></view>
<view class="stat">
<text class="stat-value">{{ summary.mood_count || 0 }}</text>
<text class="stat-label">情绪记录</text>
</view>
</view>
<view class="regularity">
<text class="regularity-text">周期规律性:{{ summary.regularity_text || '数据不足' }}</text>
<text class="regularity-score" v-if="summary.regularity">{{ summary.regularity }} 分</text>
</view>
</view>
<!-- 会员 -->
<view class="vip-card" @tap="goMember">
<view class="vip-main">
<text class="vip-title">{{ isMember ? '花期会员 · ' + (member.plan_name || '') : '开通花期会员' }}</text>
<text class="vip-desc" v-if="isMember">
{{ member.forever ? '终身有效 · 感谢你的信任' : '有效期至 ' + member.expire_date + '(剩余 ' + member.days_left + ' 天)' }}
</text>
<text class="vip-desc" v-else>深度报告 · 精准备孕 · 专属心语主题</text>
</view>
<view class="vip-action">
<text class="vip-action-text">{{ isMember ? '查看权益' : '立即了解' }}</text>
</view>
</view>
<!-- 隐私设置 -->
<view class="hq-section-head">
<text class="hq-section-title">隐私与安全</text>
</view>
<view class="hq-card setting-card">
<view class="hq-cell" @tap="chooseLock">
<view class="cell-left">
<hq-icon name="lock" :size="40" :stroke="1.7" color="#C79A7B" style="margin-right: 20rpx" />
<text class="hq-cell-label">应用锁</text>
</view>
<view class="cell-right">
<text class="hq-cell-value">{{ lockText }}</text>
<text class="hq-arrow">›</text>
</view>
</view>
<view class="hq-cell">
<view class="cell-left">
<hq-icon name="smartphone" :size="40" :stroke="1.7" color="#C79A7B" style="margin-right: 20rpx" />
<text class="hq-cell-label">仅本地存储</text>
</view>
<switch
:checked="setting.local_only === 1"
color="#E8604C"
style="transform: scale(0.8)"
@change="toggleLocalOnly"
/>
</view>
<view class="cell-tip" v-if="setting.local_only === 1">
<text class="cell-tip-text">已开启仅本地存储:敏感记录仅保存在本机,不参与云端同步</text>
</view>
</view>
<!-- 提醒设置 -->
<view class="hq-section-head">
<text class="hq-section-title">提醒</text>
<text class="hq-section-more">温柔提醒,不打扰</text>
</view>
<view class="hq-card setting-card">
<view class="hq-cell" v-for="item in remindItems" :key="item.key">
<view class="cell-left">
<hq-icon :name="item.icon" :size="40" :stroke="1.7" color="#C79A7B" style="margin-right: 20rpx" />
<text class="hq-cell-label">{{ item.label }}</text>
</view>
<switch
:checked="!!remind[item.key]"
color="#E8604C"
style="transform: scale(0.8)"
@change="toggleRemind(item.key, $event)"
/>
</view>
<picker mode="time" :value="remind.time || '21:00'" @change="onTimeChange">
<view class="hq-cell">
<view class="cell-left">
<hq-icon name="clock" :size="40" :stroke="1.7" color="#C79A7B" style="margin-right: 20rpx" />
<text class="hq-cell-label">提醒时间</text>
</view>
<view class="cell-right">
<text class="hq-cell-value">{{ remind.time || '21:00' }}</text>
<text class="hq-arrow">›</text>
</view>
</view>
</picker>
</view>
<!-- 自定义提醒中心 -->
<view class="hq-card setting-card">
<view class="hq-cell">
<text class="hq-cell-label">我的提醒</text>
<text class="hq-cell-value">{{ reminders.length }} 条</text>
</view>
<view class="reminder-item" v-for="item in reminders" :key="item.id">
<view class="reminder-body">
<text class="reminder-title">{{ item.title }}</text>
<text class="reminder-sub">{{ item.remind_time }} · {{ repeatText(item.repeat_rule) }}</text>
</view>
<switch
:checked="item.enabled === 1"
color="#E8604C"
style="transform: scale(0.7)"
@change="toggleReminder(item, $event)"
/>
<text class="reminder-del" @tap="removeReminder(item)">删除</text>
</view>
<view class="reminder-add">
<input class="reminder-input" v-model="newReminder.title" placeholder="吃药 / 复诊 / 记录…" placeholder-class="note-placeholder" />
<picker mode="time" :value="newReminder.time" @change="onNewReminderTime">
<view class="reminder-time"><text class="reminder-time-text">{{ newReminder.time }}</text></view>
</picker>
<view class="reminder-add-btn" @tap="addReminder"><text class="reminder-add-text">添加</text></view>
</view>
</view>
<!-- 数据备份 -->
<view class="hq-section-head">
<text class="hq-section-title">数据备份</text>
<text class="hq-section-more" @tap="backupNow">立即备份</text>
</view>
<view class="hq-card setting-card">
<view class="hq-cell">
<text class="hq-cell-label">备份记录</text>
<text class="hq-cell-value">{{ backups.length }} 份(保留最近 5 份)</text>
</view>
<view class="backup-item" v-for="item in backups" :key="item.id">
<view class="backup-body">
<text class="backup-name">{{ item.name }}</text>
<text class="backup-sub">{{ item.date }} · {{ item.size_text }}</text>
</view>
<text class="backup-restore" @tap="restoreBackup(item)">恢复</text>
</view>
<text class="cell-tip-text">备份包含周期记录、每日记录、情绪、体温、任务与纪念日;恢复会覆盖当前同一范围的数据</text>
</view>
<!-- 关于 -->
<view class="hq-section-head">
<text class="hq-section-title">关于花期</text>
</view>
<view class="hq-card setting-card">
<view class="hq-cell">
<text class="hq-cell-label">版本</text>
<text class="hq-cell-value">v1.0.0</text>
</view>
<view class="hq-cell" @tap="showDisclaimer">
<text class="hq-cell-label">健康内容声明</text>
<text class="hq-arrow">›</text>
</view>
<view class="hq-cell" @tap="showAbout">
<text class="hq-cell-label">关于我们</text>
<text class="hq-arrow">›</text>
</view>
</view>
<view class="logout" @tap="logout">
<text class="logout-text">退出登录</text>
</view>
<view class="footer">
<text class="footer-text">花期 · 温柔记录,静待花开</text>
</view>
<!-- 应用锁密码输入弹层(跨端一致) -->
<view class="mask" v-if="lockModal.show" @tap="closeLockModal">
<view class="modal" @tap.stop>
<text class="modal-title">设置应用锁</text>
<text class="modal-desc">请输入 4-6 位数字密码</text>
<input
class="modal-input"
type="number"
maxlength="6"
v-model="lockModal.code"
placeholder="······"
placeholder-class="note-placeholder"
/>
<view class="modal-actions">
<view class="modal-btn modal-btn-plain" @tap="closeLockModal">
<text class="modal-btn-plain-text">取消</text>
</view>
<view class="modal-btn modal-btn-primary" @tap="confirmLockCode">
<text class="modal-btn-primary-text">确定</text>
</view>
</view>
</view>
</view>
<hq-tabbar current="mine" />
</view>
</template>
<script>
import api from '@/utils/api.js'
import store from '@/utils/store.js'
import hqTabbar from '@/components/hq-tabbar/hq-tabbar.vue'
import hqIcon from '@/components/hq-icon/hq-icon.vue'
export default {
components: { hqIcon, hqTabbar },
data() {
return {
user: {},
summary: {},
member: {},
setting: { app_lock: 'none', local_only: 0 },
lockModal: { show: false, code: '' },
reminders: [],
newReminder: { title: '', time: '21:00' },
backups: [],
remind: { period: true, ovulation: true, record: true, care: true, time: '21:00' },
remindItems: [
{ key: 'period', label: '经期来临提醒', icon: 'droplet' },
{ key: 'ovulation', label: '排卵日提醒', icon: 'sprout' },
{ key: 'record', label: '每日记录提醒', icon: 'edit' },
{ key: 'care', label: '关怀提醒(家人)', icon: 'heart' }
]
}
},
computed: {
avatarText() {
const name = this.user.nickname || this.user.username || '花'
return name.slice(0, 1)
},
isMember() {
return !!this.member.is_member
},
lockText() {
const map = { none: '未开启', password: '数字密码', biometric: '生物识别' }
return map[this.setting.app_lock] || '未开启'
}
},
onShow() {
if (!store.token) {
uni.reLaunch({ url: '/pages/login/index' })
return
}
this.load()
},
methods: {
async load() {
try {
const [detail, setting] = await Promise.all([api.detail(), api.settingIndex()])
this.user = (detail && detail.user) || {}
this.summary = (detail && detail.summary) || {}
this.member = (detail && detail.member) || {}
this.setting = {
app_lock: setting.app_lock || 'none',
local_only: setting.local_only || 0
}
this.remind = Object.assign({}, this.remind, setting.remind || {})
store.setUser(this.user)
store.setMember(this.member)
this.loadReminders()
this.loadBackups()
} catch (e) {}
},
chooseLock() {
const options = ['关闭应用锁', '设置数字密码(4-6 位)']
uni.showActionSheet({
itemList: options,
success: (res) => {
if (res.tapIndex === 0) {
this.saveSetting({ app_lock: 'none' })
} else {
this.inputLockCode()
}
}
})
},
inputLockCode() {
this.lockModal = { show: true, code: '' }
},
closeLockModal() {
this.lockModal.show = false
},
confirmLockCode() {
const code = String(this.lockModal.code || '').trim()
if (!/^\d{4,6}$/.test(code)) {
uni.showToast({ title: '请输入 4-6 位数字', icon: 'none' })
return
}
this.lockModal.show = false
this.saveSetting({ app_lock: 'password', app_lock_code: code })
},
toggleLocalOnly(e) {
const value = e.detail.value ? 1 : 0
this.setting.local_only = value
this.saveSetting({ local_only: value })
},
toggleRemind(key, e) {
this.remind[key] = e.detail.value
this.saveRemind()
},
onTimeChange(e) {
this.remind.time = e.detail.value
this.saveRemind()
},
saveRemind() {
const data = {
remind_period: this.remind.period ? 1 : 0,
remind_ovulation: this.remind.ovulation ? 1 : 0,
remind_record: this.remind.record ? 1 : 0,
remind_care: this.remind.care ? 1 : 0,
remind_time: this.remind.time
}
this.saveSetting(data, '提醒已更新')
},
async saveSetting(data, tip) {
try {
await api.settingSave(data)
uni.showToast({ title: tip || '已保存', icon: 'none' })
this.load()
} catch (e) {}
},
async loadReminders() {
try {
const res = await api.reminderList()
this.reminders = (res && res.list) || []
} catch (e) {}
},
repeatText(rule) {
const map = { daily: '每天', once: '单次', weekly: '每周' }
return map[rule] || rule
},
onNewReminderTime(e) {
this.newReminder.time = e.detail.value
},
async addReminder() {
const title = (this.newReminder.title || '').trim()
if (!title) {
uni.showToast({ title: '请输入提醒内容', icon: 'none' })
return
}
try {
await api.reminderSave({ title, remind_time: this.newReminder.time, repeat_rule: 'daily' })
this.newReminder.title = ''
this.loadReminders()
} catch (e) {}
},
async toggleReminder(item, e) {
try {
await api.reminderSave({
id: item.id,
title: item.title,
remind_time: item.remind_time,
repeat_rule: item.repeat_rule,
enabled: e.detail.value ? 1 : 0
})
this.loadReminders()
} catch (e) {}
},
removeReminder(item) {
uni.showModal({
title: '删除提醒',
content: '确定删除「' + item.title + '」吗?',
confirmColor: '#E8604C',
success: async (res) => {
if (!res.confirm) return
try {
await api.reminderRemove(item.id)
this.loadReminders()
} catch (e) {}
}
})
},
async loadBackups() {
try {
const res = await api.backupList()
this.backups = (res && res.list) || []
} catch (e) {}
},
async backupNow() {
try {
const res = await api.backupCreate()
uni.showToast({ title: '备份完成 ' + (res.size_text || ''), icon: 'none' })
this.loadBackups()
} catch (e) {}
},
restoreBackup(item) {
uni.showModal({
title: '恢复数据',
content: '将用该备份覆盖当前的周期、情绪、任务等记录,确定继续?',
confirmColor: '#E8604C',
success: async (res) => {
if (!res.confirm) return
try {
await api.backupRestore(item.id)
uni.showToast({ title: '已恢复', icon: 'none' })
this.load()
} catch (e) {}
}
})
},
goMember() {
uni.navigateTo({ url: '/pages/member/index' })
},
showDisclaimer() {
uni.showModal({
title: '健康内容声明',
content: '花期提供的内容仅供参考,不能替代医疗诊断。如有不适或异常出血、剧烈疼痛,请及时就医。',
showCancel: false,
confirmColor: '#E8604C'
})
},
showAbout() {
uni.showModal({
title: '关于花期',
content: '花期是一款陪伴女性了解身体节律与情绪的 App。我们坚持零广告,用温柔的方式记录每一次花开。',
showCancel: false,
confirmColor: '#E8604C'
})
},
logout() {
uni.showModal({
title: '退出登录',
content: '确定要退出当前账号吗?',
confirmColor: '#E8604C',
success: (res) => {
if (!res.confirm) return
store.clear()
uni.reLaunch({ url: '/pages/login/index' })
}
})
}
}
}
</script>
<style lang="scss" scoped>
.profile {
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx 0 28rpx;
}
.profile-left {
display: flex;
align-items: center;
}
.avatar {
width: 116rpx;
height: 116rpx;
border-radius: 38rpx;
background: linear-gradient(135deg, #F58C7C 0%, #E8604C 100%);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 12rpx 28rpx rgba(232, 96, 76, 0.24);
}
.avatar-text {
font-size: 48rpx;
color: #FFFFFF;
font-weight: 600;
}
.profile-info {
margin-left: 24rpx;
display: flex;
flex-direction: column;
}
.profile-name {
font-size: 38rpx;
font-weight: 600;
color: #3E2C27;
}
.profile-bio {
margin-top: 6rpx;
font-size: 22rpx;
color: #8C7367;
}
.profile-badge {
padding: 10rpx 22rpx;
border-radius: 999rpx;
background-color: #FFFFFF;
border: 2rpx solid #F5E7DF;
}
.profile-badge-vip {
background: linear-gradient(135deg, #FFE9C9 0%, #FFD9BE 100%);
border-color: #F7DCC8;
}
.profile-badge-text {
font-size: 22rpx;
color: #B5715B;
}
.stat-row {
display: flex;
align-items: center;
}
.stat {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.stat-value {
font-size: 40rpx;
font-weight: 600;
color: #3E2C27;
}
.stat-label {
margin-top: 4rpx;
font-size: 22rpx;
color: #8C7367;
}
.stat-divider {
width: 2rpx;
height: 48rpx;
background-color: #F5E7DF;
}
.regularity {
margin-top: 20rpx;
padding-top: 20rpx;
border-top: 2rpx solid #F5E7DF;
display: flex;
align-items: center;
justify-content: space-between;
}
.regularity-text {
font-size: 22rpx;
color: #8C7367;
}
.regularity-score {
font-size: 22rpx;
color: #E8604C;
font-weight: 600;
}
.vip-card {
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx;
border-radius: 32rpx;
background: linear-gradient(135deg, #FFF1E0 0%, #FFE0CE 100%);
border: 2rpx solid #F7DCC8;
margin-bottom: 24rpx;
}
.vip-main {
flex: 1;
display: flex;
flex-direction: column;
}
.vip-title {
font-size: 30rpx;
font-weight: 600;
color: #A8452F;
}
.vip-desc {
margin-top: 8rpx;
font-size: 22rpx;
color: #B5715B;
}
.vip-action {
padding: 14rpx 28rpx;
border-radius: 999rpx;
background-color: #FFFFFF;
}
.vip-action-text {
font-size: 22rpx;
color: #C9482F;
}
.setting-card {
padding: 8rpx 32rpx;
}
.cell-left {
display: flex;
align-items: center;
}
.cell-icon {
margin-right: 16rpx;
}
.cell-right {
display: flex;
align-items: center;
}
.cell-tip {
padding: 0 0 24rpx 46rpx;
}
.cell-tip-text {
font-size: 20rpx;
color: #B9A79E;
line-height: 1.6;
}
.reminder-item {
display: flex;
align-items: center;
padding: 16rpx 0;
}
.reminder-item + .reminder-item {
border-top: 2rpx solid #F5E7DF;
}
.reminder-body {
flex: 1;
display: flex;
flex-direction: column;
}
.reminder-title {
font-size: 26rpx;
color: #3E2C27;
}
.reminder-sub {
margin-top: 4rpx;
font-size: 20rpx;
color: #B9A79E;
}
.reminder-del {
margin-left: 12rpx;
font-size: 20rpx;
color: #C9B4AA;
}
.reminder-add {
display: flex;
align-items: center;
margin-top: 16rpx;
}
.reminder-input {
flex: 1;
height: 72rpx;
padding: 0 20rpx;
background-color: #FFF9F5;
border-radius: 18rpx;
font-size: 24rpx;
color: #3E2C27;
}
.reminder-time {
margin-left: 10rpx;
height: 72rpx;
padding: 0 20rpx;
background-color: #FFF9F5;
border-radius: 18rpx;
display: flex;
align-items: center;
}
.reminder-time-text {
font-size: 22rpx;
color: #8C7367;
}
.reminder-add-btn {
margin-left: 10rpx;
height: 72rpx;
padding: 0 24rpx;
border-radius: 18rpx;
background-color: #FFF1E9;
display: flex;
align-items: center;
}
.reminder-add-text {
font-size: 24rpx;
color: #E8604C;
}
.backup-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16rpx 0;
}
.backup-item + .backup-item {
border-top: 2rpx solid #F5E7DF;
}
.backup-body {
flex: 1;
display: flex;
flex-direction: column;
}
.backup-name {
font-size: 24rpx;
color: #3E2C27;
}
.backup-sub {
margin-top: 4rpx;
font-size: 20rpx;
color: #B9A79E;
}
.backup-restore {
font-size: 22rpx;
color: #E8604C;
}
.logout {
margin-top: 32rpx;
height: 88rpx;
border-radius: 44rpx;
background-color: #FFFFFF;
border: 2rpx solid #F5E7DF;
display: flex;
align-items: center;
justify-content: center;
}
.logout-text {
font-size: 28rpx;
color: #B5715B;
}
.mask {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(62, 44, 39, 0.42);
display: flex;
align-items: center;
justify-content: center;
z-index: 200;
}
.modal {
width: 560rpx;
background-color: #FFFFFF;
border-radius: 36rpx;
padding: 40rpx 36rpx 32rpx;
box-shadow: 0 24rpx 64rpx rgba(62, 44, 39, 0.18);
}
.modal-title {
font-size: 32rpx;
font-weight: 600;
color: #3E2C27;
display: block;
text-align: center;
}
.modal-desc {
display: block;
margin-top: 10rpx;
font-size: 22rpx;
color: #8C7367;
text-align: center;
}
.modal-input {
margin-top: 28rpx;
height: 100rpx;
background-color: #FFF9F5;
border-radius: 24rpx;
text-align: center;
font-size: 40rpx;
letter-spacing: 12rpx;
color: #3E2C27;
}
.note-placeholder {
color: #D8C6BD;
font-size: 32rpx;
letter-spacing: 8rpx;
}
.modal-actions {
display: flex;
margin-top: 28rpx;
}
.modal-btn {
flex: 1;
height: 84rpx;
border-radius: 42rpx;
display: flex;
align-items: center;
justify-content: center;
}
.modal-btn-plain {
background-color: #FFF4EE;
margin-right: 20rpx;
}
.modal-btn-plain-text {
font-size: 28rpx;
color: #8C7367;
}
.modal-btn-primary {
background: linear-gradient(135deg, #F58C7C 0%, #E8604C 100%);
}
.modal-btn-primary-text {
font-size: 28rpx;
color: #FFFFFF;
}
.footer {
padding: 24rpx 0;
text-align: center;
}
.footer-text {
font-size: 20rpx;
color: #C9B4AA;
}
</style>