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