Commit 74f73c4a authored by weishengfei's avatar weishengfei

Merge branch 'dev' of gitlab2.dui88.com:fh/20250528_FHQ1 into dev

parents 6f6b9a1b 0cf17783
......@@ -32,7 +32,7 @@
<!-- 宝宝头像 -->
<image
class="baby-avatar"
:src="baby.avatar || `https://course.feihe.com/momclub-picture/common/default_avatar.png`"
:src="baby.babyAvatar || `https://course.feihe.com/momclub-picture/common/default_avatar.png`"
mode="aspectFill"
/>
......@@ -42,7 +42,7 @@
<text class="baby-name">{{ baby.babyName }}</text>
<image
class="gender-icon"
:src="baby.gender === 1 ? `${$baseUrl}shengzhangTool/1001/sex1.png` : `${$baseUrl}shengzhangTool/1001/sex0.png`"
:src="baby.babyGender === 'M' ? `${$baseUrl}shengzhangTool/1001/sex1.png` : `${$baseUrl}shengzhangTool/1001/sex0.png`"
mode="aspectFit"
/>
</view>
......
......@@ -3,18 +3,21 @@
<view class="popup-content" @click.stop>
<!-- 关闭按钮 -->
<view class="close-btn" @click="closePopup">
<image class="close-icon" :src="`${$baseUrl}shengzhangTool/1001/tipsPopIcon.png`" mode="aspectFit"></image>
<image class="close-icon" :src="`${$baseUrl}shengzhangTool/1001/changeBaby/closeBtn.png`" mode="aspectFit"></image>
</view>
<!-- 弹窗标题 -->
<view class="popup-title">
<text class="title-text">什么是生长曲线</text>
<!-- 固定标题区域 -->
<view class="fixed-title">
<view class="title-icon">
<image class="icon-image" :src="`${$baseUrl}shengzhangTool/1001/tipsPopIcon.png`" mode="aspectFit"></image>
</view>
</view>
<!-- 弹窗内容 -->
<view class="popup-body">
<!-- 第一段文字 -->
<view class="content-section">
<text class="section-title">什么是生长曲线</text>
<text class="content-text">生长曲线,就是把宝宝在每个成长节点测量的身高、体重、头围绘制在一个表格里,并形成一条曲线图,数据落在不同的区间内代表当前不同的发育情况。</text>
</view>
......@@ -25,13 +28,13 @@
<!-- 第二段文字 -->
<view class="content-section">
<text class="content-text">生长曲线有什么作用</text>
<text class="section-title">生长曲线有什么作用</text>
<text class="content-text">将宝宝的生长曲线与标准的生长曲线对比,可以看出宝宝当前的身高、体重、头围与全国儿童的标准值相比是偏高(大)还是偏低(偏小)。通过连续的生长曲线的趋势和变化状态,可以判断宝宝的体格发育是否正常,以及当前的基本健康状况。</text>
</view>
<!-- 第三段文字 -->
<view class="content-section">
<text class="content-text">生长曲线怎么使用</text>
<text class="section-title">生长曲线怎么使用</text>
<text class="content-text">定期连续测量宝宝的身高、体重、头围数据,使用本软件测评即可。0-3岁儿童每月至少测量一次。</text>
</view>
</view>
......@@ -66,7 +69,6 @@ const closePopup = () => {
<style lang="less" scoped>
.popup-overlay {
overflow: hidden;
position: fixed;
top: 0;
left: 0;
......@@ -77,17 +79,19 @@ const closePopup = () => {
display: flex;
align-items: center;
justify-content: center;
pointer-events: none; // 允许点击穿透到背景页面
}
.popup-content {
width: 661rpx;
height: 882rpx;
max-height: 882rpx;
background-color: #ffffff;
border-radius: 24rpx;
position: relative;
display: flex;
flex-direction: column;
overflow: hidden;
pointer-events: auto; // 恢复弹窗内容的点击事件
}
.close-btn {
......@@ -104,39 +108,60 @@ const closePopup = () => {
}
}
.popup-title {
.fixed-title {
padding: 60rpx 40rpx 30rpx 40rpx;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
background-color: #ffffff;
.title-icon {
width: 79rpx;
height: 79rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: center;
.icon-image {
width: 100%;
height: 100%;
}
}
.title-text {
font-size: 36rpx;
color: #333;
font-size: 30rpx;
color: #d3a358;
font-weight: bold;
line-height: 1.2;
text-align: center;
}
}
.popup-body {
flex: 1;
padding: 0 40rpx;
padding: 0 40rpx 20rpx 40rpx;
overflow-y: auto;
}
.content-section {
margin-bottom: 30rpx;
.section-title {
font-size: 30rpx;
color: #d3a358;
font-weight: bold;
line-height: 1.4;
display: block;
margin-bottom: 15rpx;
}
.content-text {
font-size: 28rpx;
color: #666;
color: #666666;
line-height: 1.6;
display: block;
margin-bottom: 15rpx;
&:first-child {
font-size: 30rpx;
color: #333;
font-weight: bold;
margin-bottom: 20rpx;
}
}
}
......@@ -144,26 +169,28 @@ const closePopup = () => {
margin: 30rpx 0;
display: flex;
justify-content: center;
align-items: center;
.curve-image {
width: 100%;
height: 300rpx;
border-radius: 12rpx;
background-color: #ffffff;
}
}
.confirm-btn {
position: relative;
margin: 30rpx 40rpx 40rpx 40rpx;
height: 80rpx;
height: 97rpx;
display: flex;
align-items: center;
justify-content: center;
.btn-bg {
position: absolute;
width: 100%;
height: 100%;
width: 565rpx;
height: 97rpx;
z-index: 1;
}
}
......
This diff is collapsed.
......@@ -7,8 +7,9 @@
<view class="header">
<view class="nav-left">
<image :src="feedingRecordRes.icon_return" class="back-btn" @click="goBack" />
<image :src="feedingRecordRes.icon_star" class="baby-icon-star" />
<view class="baby-info" @click="showBabySwitch" v-if="hasMultipleStage2Babies">
<!-- <image :src="feedingRecordRes.icon_star" class="baby-icon-star" /> -->
<image class="avatar-img" :src="currentBaby?.babyAvatar || feedingRecordRes.avatar" />
<view class="baby-info" @click="showBabySwitch" v-if="babyList.length > 1">
<text class="baby-name">{{ getCurrentBabyName() }}</text>
<text class="baby-age">{{ getCurrentBabyAge() }}</text>
</view>
......@@ -16,7 +17,7 @@
<text class="baby-name">{{ getCurrentBabyName() }}</text>
<text class="baby-age">{{ getCurrentBabyAge() }}</text>
</view>
<image :src="feedingRecordRes.icon_baby_change" class="baby-icon-change" />
<image :src="feedingRecordRes.icon_baby_change" class="baby-icon-change" v-if="babyList.length > 1" />
</view>
</view>
......@@ -180,7 +181,7 @@
</view>
<!-- 切换宝宝弹窗 -->
<BabySwitchPopup v-model:visible="showBabySwitchPopup" :baby-list="babyList" :selected-index="currentBabyIndex"
<BabySwitchPopup v-model:visible="showBabySwitchPopup" :selected-index="currentBabyIndex"
@change="onBabyChange" v-if="babyList.length > 1" />
</template>
......@@ -226,6 +227,7 @@ const feedingRecordRes = {
add_btn: $baseUrl + `feedingRecord/${version}/addBtn.png`,
icon_change_btn_confirm: $baseUrl + `feedingRecord/${version}/icon_change_btn_confirm.png`,
icon_change_btn_cancel: $baseUrl + `feedingRecord/${version}/icon_change_btn_cancel.png`,
avatar: $baseUrl + `feedingRecord/${version}/avatar.png`,
}
......@@ -285,8 +287,12 @@ const loadingCalendar = ref(new Set()) // 正在加载的日历月份集合,
const recordsCache = ref(new Map()) // 记录数据缓存,避免重复请求
const calendarCache = ref(new Map()) // 日历状态缓存,避免重复请求
// 计算属性 - 获取宝宝信息
const babyList = computed(() => userStore.babyInfo?.allBabyBaseInfo || [])
// 计算属性 - 获取宝宝信息(只显示已出生的宝宝)
const babyList = computed(() => {
const allBabies = userStore.babyInfo?.allBabyBaseInfo || []
// 只返回已出生的宝宝(babyStage === 2)
return allBabies.filter(baby => baby.babyStage === 2)
})
const currentBabyIndex = computed(() => {
if (!babyList.value || !currentBaby.value) return 0
return babyList.value.findIndex(baby => baby.id === currentBaby.value.id)
......@@ -294,12 +300,7 @@ const currentBabyIndex = computed(() => {
const currentBaby = computed(() => userStore.babyInfo?.content)
const currentBabyId = computed(() => userStore.babyInfo?.content?.id)
// 检查是否有多个 stage == 2 的宝宝
const hasMultipleStage2Babies = computed(() => {
if (!babyList.value || babyList.value.length === 0) return false
const stage2Babies = babyList.value.filter(baby => baby.babyStage === 2)
return stage2Babies.length > 1
})
// 检查是否有多个宝宝(已移除,直接使用 babyList.length > 1)
// 计算属性 - 当前选中日期的记录
const todayRecords = computed(() => {
......@@ -457,7 +458,7 @@ function selectDate(dateObj) {
// 直接设置新的日期和月份键
const newCurrentDate = new Date(dateObj.date.getFullYear(), dateObj.date.getMonth(), 1)
const newMonthKey = `${dateObj.date.getFullYear()}-${dateObj.date.getMonth()}`
const newMonthKey = `${dateObj.date.getFullYear()}-${String(dateObj.date.getMonth() + 1).padStart(2, '0')}`
console.log('设置新月份:', newMonthKey)
......@@ -523,7 +524,7 @@ function onDateChange(event) {
// 计算新的月份(使用已声明的selectedDate变量)
const newCurrentDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), 1)
const newMonthKey = `${selectedDate.getFullYear()}-${selectedDate.getMonth()}`
const newMonthKey = `${selectedDate.getFullYear()}-${String(selectedDate.getMonth() + 1).padStart(2, '0')}`
console.log('设置新月份:', newMonthKey)
......@@ -860,8 +861,8 @@ function calculateBabyAge(birthday) {
// 安全获取当前宝宝姓名
function getCurrentBabyName() {
try {
if (userStore.babyInfo && userStore.babyInfo.babyName) {
return userStore.babyInfo.babyName
if (currentBaby.value?.babyName) {
return currentBaby.value.babyName
}
return '宝宝'
} catch (error) {
......@@ -873,7 +874,7 @@ function getCurrentBabyName() {
// 安全获取当前宝宝年龄
function getCurrentBabyAge() {
try {
if (userStore.babyInfo && userStore.babyInfo.babyAge) {
if (userStore.babyInfo?.babyAge) {
return userStore.babyInfo.babyAge
}
return '0天'
......@@ -1047,6 +1048,7 @@ async function loadCalendarStatus(month) {
const timeoutPromise = new Promise((_, reject) => {
setTimeout(() => reject(new Error('请求超时')), 10000) // 10秒超时
})
console.log('刷新当前月份日历状态:', month)
const apiPromise = feedingRecordsCalendarStatus({
babyId: currentBabyId,
......@@ -1330,7 +1332,7 @@ onLoad(() => {
const todayString = formatDateString(today)
currentSelectedDate.value = todayString
currentDate.value = new Date(today.getFullYear(), today.getMonth(), 1) // 当前月份的第一天
currentMonthKey.value = `${today.getFullYear()}-${today.getMonth()}` // 设置月份键
currentMonthKey.value = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}` // 设置月份键
console.log('初始化今日日期:', todayString, '当前月份:', currentDate.value, '月份键:', currentMonthKey.value)
// 初始化API数据
......@@ -1361,7 +1363,7 @@ function handleMonthChange(newDate, source = 'unknown') {
console.log('新月份:', newDate.getMonth() + 1)
// 只更新月份键和强制更新,避免重复修改currentDate
const newMonthKey = `${newDate.getFullYear()}-${newDate.getMonth()}`
const newMonthKey = `${newDate.getFullYear()}-${String(newDate.getMonth() + 1).padStart(2, '0')}`
console.log('更新月份键:', currentMonthKey.value, '->', newMonthKey)
currentMonthKey.value = newMonthKey
......@@ -1390,7 +1392,7 @@ watch(currentDate, (newDate, oldDate) => {
if (oldDate && (oldDate.getMonth() !== newDate.getMonth() || oldDate.getFullYear() !== newDate.getFullYear())) {
console.log('月份发生变化,调用handleMonthChange')
// 只更新月份键和强制更新,不再次修改currentDate
const newMonthKey = `${newDate.getFullYear()}-${newDate.getMonth()}`
const newMonthKey = `${newDate.getFullYear()}-${String(newDate.getMonth() + 1).padStart(2, '0')}`
currentMonthKey.value = newMonthKey
forceUpdate.value++
......@@ -1500,6 +1502,13 @@ function testApiIntegration() {
margin-right: 10rpx;
}
.avatar-img {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
margin-right: 10rpx;
}
.baby-info {
display: flex;
flex-direction: column;
......
......@@ -110,7 +110,7 @@
:value="height"
@input="onHeightInput"
@blur="onHeightBlur"
placeholder="输入身高"
@focus="onHeightFocus"
:disabled="isHeightTipActive"
/>
<text class="unit">cm</text>
......@@ -140,7 +140,7 @@
:value="weight"
@input="onWeightInput"
@blur="onWeightBlur"
placeholder="输入体重"
@focus="onWeightFocus"
:disabled="isWeightTipActive"
/>
<text class="unit">kg</text>
......@@ -170,7 +170,7 @@
:value="headCircumference"
@input="onHeadInput"
@blur="onHeadBlur"
placeholder="输入头围"
@focus="onHeadFocus"
:disabled="isHeadTipActive"
/>
<text class="unit">cm</text>
......@@ -416,6 +416,10 @@ const onHeightBlur = (e) => {
}
}
const onHeightFocus = () => {
height.value = '' // 清空输入框
}
const onWeightInput = (e) => {
const value = e.detail.value
weight.value = value
......@@ -443,6 +447,10 @@ const onWeightBlur = (e) => {
}
}
const onWeightFocus = () => {
weight.value = '' // 清空输入框
}
const onHeadInput = (e) => {
const value = e.detail.value
headCircumference.value = value
......@@ -470,6 +478,10 @@ const onHeadBlur = (e) => {
}
}
const onHeadFocus = () => {
headCircumference.value = '' // 清空输入框
}
// 其他方法保持不变
const changeBaby = () => {
console.log('切换宝宝')
......@@ -1009,13 +1021,13 @@ const refreshBabyInfo = async () => {
z-index: 3;
width: 60rpx;
height: 30rpx;
background: transparent;
background: #ffffff;
border: none;
font-size: 24rpx;
font-size: 28rpx;
color: #333;
text-align: center;
font-weight: bold;
margin-left: 120rpx;
margin-left: 0rpx;
&:disabled {
opacity: 0.4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment