- 新增 utils/icons.js:61 个 24x24 线性图标(stroke 1.8,圆角端点), 纯 JS base64 编码生成 data URI,H5/App/小程序一致,任意尺寸不失真 - 新增 components/hq-icon/hq-icon.vue:尺寸/颜色/描边可配置, 并内置 resolveIcon() 兼容后端历史 emoji 字段(自动映射为矢量图标) - 18 个页面与组件全部替换:底部导航、首页快捷入口/心语/提醒、周期心情、 情绪 5 情绪与记录、我的设置项与提醒、会员勾选、备孕任务与同疾锁态、 急救包/咨询热线、关系卡片、亲子活动、健康建议 Tab、登录页花瓣与输入框、 内容详情头图、各页空状态 - 新增 scripts/verify/no_emoji_check.py:拦截 emoji/字符图标、 未定义图标名与未注册组件,纳入回归 - 图标质量已用 SVG 精灵表渲染逐个人工核对;61 图标 XML 解析 100% 通过 验证:no_emoji 0 问题 / 契约 84 接口 0 偏差 / Vue 20-20 / SCSS 19-19
363 行
7.4 KiB
Vue
363 行
7.4 KiB
Vue
<template>
|
||
<view class="hq-page">
|
||
<view class="report-head">
|
||
<view class="report-month">
|
||
<text class="report-month-text">{{ monthText }}</text>
|
||
<text class="report-month-sub">{{ range[0] }} 至 {{ range[1] }}</text>
|
||
</view>
|
||
<view class="report-score">
|
||
<text class="report-score-value">{{ summary.regularity || 0 }}</text>
|
||
<text class="report-score-label">规律性</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="score-bar">
|
||
<view class="score-bar-inner" :style="{ width: (summary.regularity || 0) + '%' }"></view>
|
||
</view>
|
||
<text class="score-text">{{ summary.regularity_text || '继续记录,数据会更准确' }}</text>
|
||
|
||
<!-- 关键指标 -->
|
||
<view class="hq-section-head">
|
||
<text class="hq-section-title">本期数据</text>
|
||
</view>
|
||
<view class="metrics">
|
||
<view class="metric">
|
||
<text class="metric-value">{{ stats.log_days || 0 }}</text>
|
||
<text class="metric-label">记录天数</text>
|
||
</view>
|
||
<view class="metric">
|
||
<text class="metric-value">{{ stats.avg_pain || 0 }}</text>
|
||
<text class="metric-label">平均痛经</text>
|
||
</view>
|
||
<view class="metric">
|
||
<text class="metric-value">{{ stats.avg_sleep || 0 }}</text>
|
||
<text class="metric-label">平均睡眠(h)</text>
|
||
</view>
|
||
<view class="metric">
|
||
<text class="metric-value">{{ stats.mood_days || 0 }}</text>
|
||
<text class="metric-label">情绪记录</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 常见症状 -->
|
||
<view class="hq-card" v-if="stats.top_symptoms && stats.top_symptoms.length">
|
||
<view class="hq-section-head">
|
||
<text class="hq-section-title">常见症状</text>
|
||
<text class="hq-muted">按出现次数</text>
|
||
</view>
|
||
<view class="symptom-row" v-for="item in stats.top_symptoms" :key="item.name">
|
||
<text class="symptom-name">{{ item.name }}</text>
|
||
<view class="symptom-bar-wrap">
|
||
<view class="symptom-bar" :style="{ width: Math.min(100, item.count * 20) + '%' }"></view>
|
||
</view>
|
||
<text class="symptom-count">{{ item.count }} 次</text>
|
||
</view>
|
||
</view>
|
||
<view class="hq-card" v-else>
|
||
<view class="hq-empty">
|
||
<hq-icon name="sprout" :size="72" color="#E6D3C9" />
|
||
<text class="hq-empty-text">本期还没有症状记录</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 建议 -->
|
||
<view class="hq-card">
|
||
<view class="hq-section-head">
|
||
<text class="hq-section-title">给你的建议</text>
|
||
</view>
|
||
<view class="advice-item" v-for="(item, index) in advice" :key="index">
|
||
<view class="advice-dot"></view>
|
||
<text class="advice-text">{{ item }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 深度报告(会员权益) -->
|
||
<view class="deep-card">
|
||
<view class="deep-head">
|
||
<text class="deep-title">深度分析报告</text>
|
||
<text class="deep-tag" v-if="!access.deep">会员专享</text>
|
||
</view>
|
||
<text class="deep-desc" v-if="!access.deep">{{ access.tip }}</text>
|
||
<text class="deep-desc" v-else>已解锁:包含趋势对比、症状归因与周期优化建议</text>
|
||
<view class="deep-btn" v-if="!access.deep" @tap="goMember">
|
||
<text class="deep-btn-text">开通会员解锁</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 { monthOf, monthText } from '@/utils/date.js'
|
||
import hqIcon from '@/components/hq-icon/hq-icon.vue'
|
||
|
||
export default {
|
||
components: { hqIcon },
|
||
data() {
|
||
return {
|
||
month: monthOf(new Date()),
|
||
range: ['', ''],
|
||
summary: {},
|
||
stats: {},
|
||
advice: [],
|
||
access: { deep: false, tip: '' }
|
||
}
|
||
},
|
||
computed: {
|
||
monthText() {
|
||
return monthText(this.month)
|
||
}
|
||
},
|
||
onLoad(options) {
|
||
if (!store.token) {
|
||
uni.reLaunch({ url: '/pages/login/index' })
|
||
return
|
||
}
|
||
if (options && options.month) {
|
||
this.month = options.month
|
||
}
|
||
this.load()
|
||
},
|
||
methods: {
|
||
async load() {
|
||
try {
|
||
const data = await api.cycleReport('month', this.month)
|
||
this.range = (data && data.range) || ['', '']
|
||
this.summary = (data && data.summary) || {}
|
||
this.stats = (data && data.stats) || {}
|
||
this.advice = (data && data.advice) || []
|
||
this.access = (data && data.access) || { deep: false, tip: '' }
|
||
} catch (e) {}
|
||
},
|
||
goMember() {
|
||
uni.navigateTo({ url: '/pages/member/index' })
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.report-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 32rpx 0 20rpx;
|
||
}
|
||
|
||
.report-month {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.report-month-text {
|
||
font-size: 40rpx;
|
||
font-weight: 600;
|
||
color: #3E2C27;
|
||
letter-spacing: 2rpx;
|
||
}
|
||
|
||
.report-month-sub {
|
||
margin-top: 6rpx;
|
||
font-size: 22rpx;
|
||
color: #B9A79E;
|
||
}
|
||
|
||
.report-score {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: flex-end;
|
||
}
|
||
|
||
.report-score-value {
|
||
font-size: 56rpx;
|
||
font-weight: 600;
|
||
color: #E8604C;
|
||
line-height: 1;
|
||
}
|
||
|
||
.report-score-label {
|
||
margin-top: 4rpx;
|
||
font-size: 20rpx;
|
||
color: #B9A79E;
|
||
}
|
||
|
||
.score-bar {
|
||
height: 12rpx;
|
||
border-radius: 999rpx;
|
||
background-color: #FFF1E9;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.score-bar-inner {
|
||
height: 100%;
|
||
border-radius: 999rpx;
|
||
background: linear-gradient(90deg, #F5A65B 0%, #E8604C 100%);
|
||
}
|
||
|
||
.score-text {
|
||
display: block;
|
||
margin-top: 12rpx;
|
||
font-size: 22rpx;
|
||
color: #8C7367;
|
||
}
|
||
|
||
.metrics {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
margin-bottom: 12rpx;
|
||
}
|
||
|
||
.metric {
|
||
width: 50%;
|
||
box-sizing: border-box;
|
||
background-color: #FFFFFF;
|
||
border-radius: 28rpx;
|
||
padding: 28rpx;
|
||
margin-bottom: 16rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
box-shadow: 0 10rpx 28rpx rgba(232, 96, 76, 0.06);
|
||
}
|
||
|
||
.metric:nth-child(odd) {
|
||
width: calc(50% - 8rpx);
|
||
margin-right: 16rpx;
|
||
}
|
||
|
||
.metric:nth-child(even) {
|
||
width: calc(50% - 8rpx);
|
||
}
|
||
|
||
.metric-value {
|
||
font-size: 44rpx;
|
||
font-weight: 600;
|
||
color: #3E2C27;
|
||
}
|
||
|
||
.metric-label {
|
||
margin-top: 6rpx;
|
||
font-size: 22rpx;
|
||
color: #8C7367;
|
||
}
|
||
|
||
.symptom-row {
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 14rpx 0;
|
||
}
|
||
|
||
.symptom-name {
|
||
width: 140rpx;
|
||
font-size: 26rpx;
|
||
color: #3E2C27;
|
||
}
|
||
|
||
.symptom-bar-wrap {
|
||
flex: 1;
|
||
height: 12rpx;
|
||
border-radius: 999rpx;
|
||
background-color: #FFF1E9;
|
||
overflow: hidden;
|
||
margin: 0 16rpx;
|
||
}
|
||
|
||
.symptom-bar {
|
||
height: 100%;
|
||
border-radius: 999rpx;
|
||
background: linear-gradient(90deg, #F5A65B 0%, #E8604C 100%);
|
||
}
|
||
|
||
.symptom-count {
|
||
font-size: 22rpx;
|
||
color: #B9A79E;
|
||
}
|
||
|
||
.advice-item {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
padding: 12rpx 0;
|
||
}
|
||
|
||
.advice-dot {
|
||
width: 12rpx;
|
||
height: 12rpx;
|
||
border-radius: 50%;
|
||
background-color: #F5A65B;
|
||
margin-top: 14rpx;
|
||
margin-right: 14rpx;
|
||
}
|
||
|
||
.advice-text {
|
||
flex: 1;
|
||
font-size: 26rpx;
|
||
color: #5C4A43;
|
||
line-height: 1.8;
|
||
}
|
||
|
||
.deep-card {
|
||
border-radius: 32rpx;
|
||
padding: 32rpx;
|
||
background: linear-gradient(135deg, #FFF1E0 0%, #FFE0CE 100%);
|
||
border: 2rpx solid #F7DCC8;
|
||
}
|
||
|
||
.deep-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.deep-title {
|
||
font-size: 30rpx;
|
||
font-weight: 600;
|
||
color: #A8452F;
|
||
}
|
||
|
||
.deep-tag {
|
||
font-size: 20rpx;
|
||
color: #FFFFFF;
|
||
background: linear-gradient(135deg, #F5A65B 0%, #E8604C 100%);
|
||
padding: 6rpx 16rpx;
|
||
border-radius: 999rpx;
|
||
}
|
||
|
||
.deep-desc {
|
||
display: block;
|
||
margin-top: 12rpx;
|
||
font-size: 22rpx;
|
||
color: #B5715B;
|
||
line-height: 1.7;
|
||
}
|
||
|
||
.deep-btn {
|
||
margin-top: 24rpx;
|
||
height: 80rpx;
|
||
border-radius: 40rpx;
|
||
background-color: #FFFFFF;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.deep-btn-text {
|
||
font-size: 26rpx;
|
||
color: #C9482F;
|
||
}
|
||
|
||
.footer {
|
||
padding: 24rpx 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.footer-text {
|
||
font-size: 20rpx;
|
||
color: #C9B4AA;
|
||
}
|
||
</style>
|