文件
huaqiapp/pages/prepare/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

676 行
14 KiB
Vue

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

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

<template>
<view class="hq-page">
<view class="head">
<text class="head-title">科学备孕</text>
<text class="head-sub">{{ cycle.has_data ? cycle.phase_text + ' · 周期第 ' + cycle.day + ' 天' : '先记录经期,预测才能更准' }}</text>
</view>
<!-- 排卵预测 -->
<view class="predict-card">
<view class="predict-top">
<view class="predict-left">
<text class="predict-label">预计排卵日</text>
<text class="predict-date">{{ data.ovulation || '—' }}</text>
<text class="predict-sub" v-if="data.days_to_ovulation !== null">
{{ data.days_to_ovulation >= 0 ? '还有 ' + data.days_to_ovulation + ' 天' : '已过 ' + Math.abs(data.days_to_ovulation) + ' 天' }}
</text>
</view>
<view class="predict-right">
<text class="predict-label">易孕窗口</text>
<text class="predict-window" v-if="data.fertile && data.fertile.length">{{ data.fertile[0] }} ~ {{ data.fertile[1] }}</text>
<text class="predict-window" v-else>—</text>
</view>
</view>
<view class="predict-foot">
<text class="predict-foot-text">预测基于历史周期,实际以体温与试纸为准</text>
</view>
<view class="plan-row" v-if="data.plan_locked" @tap="goMember">
<text class="plan-text">精准备孕计划(会员)</text>
<text class="plan-arrow">›</text>
</view>
</view>
<!-- 基础体温 -->
<view class="hq-card">
<view class="hq-section-head">
<text class="hq-section-title">基础体温</text>
<text class="hq-muted">{{ bbt.count || 0 }} 天记录</text>
</view>
<view class="bbt-input">
<input class="bbt-field" type="digit" v-model="bbtForm.temperature" placeholder="36.5" placeholder-class="ph" />
<text class="bbt-unit">℃</text>
<picker mode="date" :value="bbtForm.log_date" :end="today" @change="onBbtDate">
<view class="bbt-date"><text class="bbt-date-text">{{ bbtForm.log_date }}</text></view>
</picker>
<view class="bbt-btn" @tap="saveBbt"><text class="bbt-btn-text">记录</text></view>
</view>
<view class="bbt-chart">
<view class="bbt-col" v-for="(d, i) in bbt.list || []" :key="i">
<view class="bbt-bar-wrap">
<view class="bbt-bar" :class="{ 'bbt-bar-empty': !d.temperature }" :style="{ height: barHeight(d.temperature) }"></view>
</view>
<text class="bbt-label" v-if="i % 2 === 0">{{ d.label }}</text>
</view>
</view>
<text class="bbt-note">{{ bbt.note }}</text>
</view>
<!-- 试纸识别 -->
<view class="hq-card">
<view class="hq-section-head">
<text class="hq-section-title">排卵试纸识别</text>
<text class="hq-muted">{{ quota.used }}/{{ quota.limit }} 次</text>
</view>
<view class="lh-select">
<view
v-for="opt in lhLevels"
:key="opt.value"
class="lh-option"
:class="{ 'lh-option-active': lhForm.level === opt.value }"
@tap="lhForm.level = opt.value"
>
<text class="lh-option-text" :class="{ 'lh-option-text-active': lhForm.level === opt.value }">{{ opt.label }}</text>
</view>
</view>
<view class="lh-actions">
<view class="hq-btn-ghost lh-btn" @tap="recognize">
<text class="lh-btn-text">{{ recognizing ? '识别中…' : '识别结果' }}</text>
</view>
<text class="lh-tip">{{ quota.tip }}</text>
</view>
<view class="lh-result" v-if="lhResult">
<text class="lh-result-text">识别结果:{{ lhResult.result_text }}(置信度 {{ lhResult.confidence }}%)</text>
<text class="lh-result-advice">{{ lhResult.advice }}</text>
</view>
<view class="lh-trend" v-if="(data.lh || []).length">
<view class="lh-trend-item" v-for="item in data.lh" :key="item.id">
<text class="lh-trend-date">{{ item.log_date.slice(5) }}</text>
<text class="lh-trend-result" :class="'lh-' + item.result">{{ item.result_text }}</text>
</view>
</view>
</view>
<!-- 备孕任务 -->
<view class="hq-card">
<view class="hq-section-head">
<text class="hq-section-title">备孕任务</text>
<text class="hq-muted">{{ taskDone }}/{{ (data.tasks || []).length }} 完成</text>
</view>
<view class="task" v-for="item in data.tasks || []" :key="item.id" @tap="toggleTask(item)">
<view class="task-check" :class="{ 'task-check-done': item.done }">
<hq-icon v-if="item.done" name="check" :size="24" :stroke="2.4" color="#FFFFFF" />
</view>
<text class="task-title" :class="{ 'task-title-done': item.done }">{{ item.title }}</text>
<text class="task-due" v-if="item.due_date">{{ item.due_date.slice(5) }}</text>
</view>
<view class="task-add">
<input class="task-input" v-model="taskTitle" placeholder="添加任务:如「预约孕前检查」" placeholder-class="ph" />
<view class="task-add-btn" @tap="addTask"><text class="task-add-text">添加</text></view>
</view>
</view>
<!-- 同房指导 -->
<view class="hq-card">
<view class="hq-section-head">
<text class="hq-section-title">同房指导</text>
<text class="hq-muted" v-if="data.intercourse_locked">会员权益</text>
</view>
<view class="hq-empty" v-if="data.intercourse_locked" @tap="goMember">
<hq-icon name="lock" :size="92" :stroke="1.6" color="#E6D3C9" />
<text class="hq-empty-text">开通会员后可查看受孕窗口、频率与体位建议</text>
</view>
<view class="guide-item" v-else v-for="item in guideList" :key="item.id" @tap="openContent(item)">
<text class="guide-title">{{ item.title }}</text>
<text class="guide-summary">{{ item.summary }}</text>
</view>
</view>
<view class="footer">
<text class="footer-text">以上内容仅供参考,不能替代医疗诊断</text>
</view>
</view>
</template>
<script>
import api from '@/utils/api.js'
import store from '@/utils/store.js'
import { today as todayStr } from '@/utils/date.js'
import hqIcon from '@/components/hq-icon/hq-icon.vue'
export default {
components: { hqIcon },
data() {
return {
data: { tasks: [], lh: [], fertile: [] },
bbt: { list: [] },
quota: { used: 0, limit: 5, tip: '' },
guideList: [],
today: todayStr(),
bbtForm: { temperature: '', log_date: todayStr() },
lhForm: { level: 2 },
lhResult: null,
recognizing: false,
taskTitle: '',
lhLevels: [
{ label: '极浅', value: 0 },
{ label: '弱阳', value: 1 },
{ label: '阳性', value: 2 },
{ label: '强阳', value: 3 },
{ label: '看不清', value: 4 }
]
}
},
computed: {
cycle() {
return this.data.cycle || {}
},
taskDone() {
return (this.data.tasks || []).filter((t) => t.done).length
}
},
onShow() {
if (!store.token) {
uni.reLaunch({ url: '/pages/login/index' })
return
}
this.load()
},
methods: {
async load() {
try {
const data = await api.prepareIndex()
this.data = data || {}
this.bbt = (data && data.bbt) || { list: [] }
this.quota = (data && data.lh_quota) || this.quota
if (!data.plan_locked) {
this.loadGuide()
}
} catch (e) {}
},
async loadGuide() {
try {
const g = await api.prepareGuide()
this.guideList = (g && g.list) || []
} catch (e) {}
},
barHeight(t) {
if (!t) return '10rpx'
const ratio = Math.min(1, Math.max(0, (t - 35.8) / 1.4))
return Math.round(16 + ratio * 96) + 'rpx'
},
onBbtDate(e) {
this.bbtForm.log_date = e.detail.value
},
async saveBbt() {
const value = parseFloat(this.bbtForm.temperature)
if (!value || value < 34 || value > 42) {
uni.showToast({ title: '请输入 34-42 之间的体温', icon: 'none' })
return
}
try {
const res = await api.bbtSave({
log_date: this.bbtForm.log_date,
temperature: value
})
this.bbt = res.bbt
this.bbtForm.temperature = ''
uni.showToast({ title: '已记录', icon: 'none' })
} catch (e) {}
},
async recognize() {
if (this.recognizing) return
this.recognizing = true
try {
const res = await api.lhTest({
test_type: 'lh',
log_date: todayStr(),
level: this.lhForm.level
})
this.lhResult = res
this.quota = res.quota
this.data.lh = res.trend ? res.trend.map((t, i) => ({
id: i, log_date: t.date, result: t.result, result_text: t.label
})) : this.data.lh
} catch (e) {
} finally {
this.recognizing = false
}
},
async toggleTask(item) {
try {
const res = await api.prepareTaskDone(item.id)
this.data.tasks = res.list
} catch (e) {}
},
async addTask() {
const title = (this.taskTitle || '').trim()
if (!title) {
uni.showToast({ title: '请输入任务内容', icon: 'none' })
return
}
try {
const res = await api.prepareTaskSave({ title, scope: 'prepare', category: 'check' })
this.data.tasks = res.list
this.taskTitle = ''
} catch (e) {}
},
openContent(item) {
uni.navigateTo({ url: '/pages/content/detail?id=' + item.id })
},
goMember() {
uni.navigateTo({ url: '/pages/member/index' })
}
}
}
</script>
<style lang="scss" scoped>
.head {
padding: 28rpx 0 20rpx;
}
.head-title {
font-size: 44rpx;
font-weight: 600;
color: #3E2C27;
}
.head-sub {
display: block;
margin-top: 8rpx;
font-size: 24rpx;
color: #8C7367;
}
.predict-card {
border-radius: 36rpx;
padding: 32rpx;
background: linear-gradient(135deg, #FFEFDF 0%, #FFDFCC 100%);
border: 2rpx solid #F7DCC8;
margin-bottom: 24rpx;
}
.predict-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.predict-left,
.predict-right {
display: flex;
flex-direction: column;
}
.predict-right {
align-items: flex-end;
}
.predict-label {
font-size: 22rpx;
color: #B5715B;
}
.predict-date {
margin-top: 6rpx;
font-size: 40rpx;
font-weight: 600;
color: #A8452F;
}
.predict-window {
margin-top: 8rpx;
font-size: 24rpx;
color: #A8452F;
}
.predict-sub {
margin-top: 4rpx;
font-size: 22rpx;
color: #B5715B;
}
.predict-foot {
margin-top: 20rpx;
padding-top: 16rpx;
border-top: 2rpx solid rgba(200, 120, 80, 0.18);
}
.predict-foot-text {
font-size: 20rpx;
color: #B5715B;
}
.plan-row {
margin-top: 16rpx;
display: flex;
align-items: center;
justify-content: space-between;
background-color: rgba(255, 255, 255, 0.7);
padding: 16rpx 20rpx;
border-radius: 20rpx;
}
.plan-text {
font-size: 24rpx;
color: #A8452F;
}
.plan-arrow {
font-size: 26rpx;
color: #C9482F;
}
.bbt-input {
display: flex;
align-items: center;
margin-bottom: 20rpx;
}
.bbt-field {
width: 150rpx;
height: 76rpx;
background-color: #FFF9F5;
border-radius: 20rpx;
text-align: center;
font-size: 30rpx;
color: #3E2C27;
}
.bbt-unit {
font-size: 24rpx;
color: #8C7367;
margin: 0 16rpx;
}
.bbt-date {
height: 76rpx;
padding: 0 20rpx;
background-color: #FFF9F5;
border-radius: 20rpx;
display: flex;
align-items: center;
}
.bbt-date-text {
font-size: 24rpx;
color: #8C7367;
}
.bbt-btn {
height: 76rpx;
padding: 0 28rpx;
margin-left: 12rpx;
border-radius: 20rpx;
background: linear-gradient(135deg, #F58C7C 0%, #E8604C 100%);
display: flex;
align-items: center;
justify-content: center;
}
.bbt-btn-text {
font-size: 26rpx;
color: #FFFFFF;
}
.bbt-chart {
display: flex;
align-items: flex-end;
height: 160rpx;
margin-top: 12rpx;
}
.bbt-col {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
}
.bbt-bar-wrap {
height: 120rpx;
display: flex;
align-items: flex-end;
}
.bbt-bar {
width: 14rpx;
border-radius: 999rpx;
background: linear-gradient(180deg, #F5A65B 0%, #E8604C 100%);
}
.bbt-bar-empty {
background-color: #F5E7DF;
}
.bbt-label {
margin-top: 8rpx;
font-size: 16rpx;
color: #C9B4AA;
}
.bbt-note {
display: block;
margin-top: 12rpx;
font-size: 22rpx;
color: #8C7367;
line-height: 1.6;
}
.lh-select {
display: flex;
flex-wrap: wrap;
}
.lh-option {
padding: 12rpx 26rpx;
border-radius: 999rpx;
background-color: #FFF4EE;
margin: 0 12rpx 12rpx 0;
}
.lh-option-active {
background: linear-gradient(135deg, #F58C7C 0%, #E8604C 100%);
}
.lh-option-text {
font-size: 24rpx;
color: #8C7367;
}
.lh-option-text-active {
color: #FFFFFF;
}
.lh-actions {
display: flex;
align-items: center;
margin-top: 8rpx;
}
.lh-btn {
height: 84rpx;
padding: 0 32rpx;
}
.lh-btn-text {
font-size: 26rpx;
color: #E8604C;
}
.lh-tip {
margin-left: 16rpx;
font-size: 20rpx;
color: #B9A79E;
}
.lh-result {
margin-top: 20rpx;
padding: 20rpx;
border-radius: 20rpx;
background-color: #FFF9F5;
}
.lh-result-text {
font-size: 26rpx;
color: #3E2C27;
font-weight: 500;
}
.lh-result-advice {
display: block;
margin-top: 8rpx;
font-size: 22rpx;
color: #8C7367;
line-height: 1.7;
}
.lh-trend {
display: flex;
flex-wrap: wrap;
margin-top: 20rpx;
}
.lh-trend-item {
display: flex;
flex-direction: column;
align-items: center;
margin: 0 20rpx 12rpx 0;
}
.lh-trend-date {
font-size: 18rpx;
color: #C9B4AA;
}
.lh-trend-result {
margin-top: 4rpx;
font-size: 22rpx;
color: #8C7367;
}
.lh-strong,
.lh-positive {
color: #E8604C;
font-weight: 600;
}
.task {
display: flex;
align-items: center;
padding: 18rpx 0;
}
.task + .task {
border-top: 2rpx solid #F5E7DF;
}
.task-check {
width: 46rpx;
height: 46rpx;
border-radius: 50%;
border: 2rpx solid #E4D3C9;
display: flex;
align-items: center;
justify-content: center;
margin-right: 16rpx;
}
.task-check-done {
background: linear-gradient(135deg, #F58C7C 0%, #E8604C 100%);
border-color: #E8604C;
}
.task-title {
flex: 1;
font-size: 26rpx;
color: #3E2C27;
}
.task-title-done {
color: #B9A79E;
text-decoration: line-through;
}
.task-due {
font-size: 20rpx;
color: #C9B4AA;
}
.task-add {
display: flex;
align-items: center;
margin-top: 16rpx;
}
.task-input {
flex: 1;
height: 76rpx;
padding: 0 24rpx;
background-color: #FFF9F5;
border-radius: 20rpx;
font-size: 24rpx;
color: #3E2C27;
}
.task-add-btn {
margin-left: 12rpx;
height: 76rpx;
padding: 0 28rpx;
border-radius: 20rpx;
background-color: #FFF1E9;
display: flex;
align-items: center;
justify-content: center;
}
.task-add-text {
font-size: 24rpx;
color: #E8604C;
}
.guide-item {
padding: 18rpx 0;
}
.guide-item + .guide-item {
border-top: 2rpx solid #F5E7DF;
}
.guide-title {
font-size: 26rpx;
color: #3E2C27;
}
.guide-summary {
display: block;
margin-top: 4rpx;
font-size: 22rpx;
color: #8C7367;
}
.ph {
color: #C9B4AA;
font-size: 24rpx;
}
.footer {
padding: 16rpx 0 24rpx;
text-align: center;
}
.footer-text {
font-size: 20rpx;
color: #C9B4AA;
}
</style>