Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
FH
飞鹤小程序
Commits
b096e1ef
Commit
b096e1ef
authored
Jul 28, 2025
by
weishengfei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of gitlab2.dui88.com:fh/20250528_FHQ1 into dev
parents
59e6db41
3cf81339
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
253 additions
and
64 deletions
+253
-64
feedingIndex.vue
pages/feedingIndex/feedingIndex.vue
+178
-47
feedingRecord.vue
pages/feedingRecord/feedingRecord.vue
+74
-15
shengzhangTestResult.vue
pages/shengzhangTestResult/shengzhangTestResult.vue
+1
-2
No files found.
pages/feedingIndex/feedingIndex.vue
View file @
b096e1ef
This diff is collapsed.
Click to expand it.
pages/feedingRecord/feedingRecord.vue
View file @
b096e1ef
...
...
@@ -8,9 +8,13 @@
<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"
>
<text
class=
"baby-name"
>
{{
babyList
[
currentBabyIndex
].
name
}}
</text>
<text
class=
"baby-age"
>
{{
calculateBabyAge
(
babyList
[
currentBabyIndex
].
birthday
)
}}
</text>
<view
class=
"baby-info"
@
click=
"showBabySwitch"
v-if=
"babyList.length > 1"
>
<text
class=
"baby-name"
>
{{
getCurrentBabyName
()
}}
</text>
<text
class=
"baby-age"
>
{{
getCurrentBabyAge
()
}}
</text>
</view>
<view
class=
"baby-info"
v-else
>
<text
class=
"baby-name"
>
{{
getCurrentBabyName
()
}}
</text>
<text
class=
"baby-age"
>
{{
getCurrentBabyAge
()
}}
</text>
</view>
<image
:src=
"feedingRecordRes.icon_baby_change"
class=
"baby-icon-change"
/>
</view>
...
...
@@ -206,6 +210,7 @@
:baby-list=
"babyList"
:selected-index=
"currentBabyIndex"
@
change=
"onBabyChange"
v-if=
"babyList.length > 1"
/>
</template>
...
...
@@ -715,7 +720,10 @@ function goBack() {
// 宝宝切换相关方法
function
showBabySwitch
()
{
showBabySwitchPopup
.
value
=
true
// 只有当有多个宝宝时才显示切换弹窗
if
(
babyList
.
value
.
length
>
1
)
{
showBabySwitchPopup
.
value
=
true
}
}
function
onBabyChange
(
baby
,
index
)
{
...
...
@@ -737,18 +745,69 @@ function onBabyChange(baby, index) {
}
function
calculateBabyAge
(
birthday
)
{
const
birthDate
=
new
Date
(
birthday
)
const
today
=
new
Date
()
const
diffTime
=
Math
.
abs
(
today
-
birthDate
)
const
diffDays
=
Math
.
ceil
(
diffTime
/
(
1000
*
60
*
60
*
24
))
const
years
=
Math
.
floor
(
diffDays
/
365
)
const
days
=
diffDays
%
365
// 检查生日参数是否有效
if
(
!
birthday
)
{
return
'0天'
}
if
(
years
>
0
)
{
return
`
${
years
}
岁
${
days
}
天`
}
else
{
return
`
${
days
}
天`
try
{
const
birthDate
=
new
Date
(
birthday
)
const
today
=
new
Date
()
// 检查日期是否有效
if
(
isNaN
(
birthDate
.
getTime
())
||
isNaN
(
today
.
getTime
()))
{
console
.
warn
(
'无效的日期格式:'
,
birthday
)
return
'0天'
}
const
diffTime
=
Math
.
abs
(
today
-
birthDate
)
const
diffDays
=
Math
.
ceil
(
diffTime
/
(
1000
*
60
*
60
*
24
))
// 检查计算结果是否有效
if
(
isNaN
(
diffDays
)
||
diffDays
<
0
)
{
console
.
warn
(
'日期计算错误:'
,
{
birthday
,
diffDays
})
return
'0天'
}
const
years
=
Math
.
floor
(
diffDays
/
365
)
const
days
=
diffDays
%
365
if
(
years
>
0
)
{
return
`
${
years
}
岁
${
days
}
天`
}
else
{
return
`
${
days
}
天`
}
}
catch
(
error
)
{
console
.
error
(
'计算宝宝年龄时出错:'
,
error
,
birthday
)
return
'0天'
}
}
// 安全获取当前宝宝姓名
function
getCurrentBabyName
()
{
try
{
const
currentBaby
=
babyList
.
value
[
currentBabyIndex
.
value
]
if
(
currentBaby
&&
currentBaby
.
name
)
{
return
currentBaby
.
name
}
return
'宝宝'
}
catch
(
error
)
{
console
.
error
(
'获取宝宝姓名时出错:'
,
error
)
return
'宝宝'
}
}
// 安全获取当前宝宝年龄
function
getCurrentBabyAge
()
{
try
{
const
currentBaby
=
babyList
.
value
[
currentBabyIndex
.
value
]
if
(
currentBaby
&&
currentBaby
.
birthday
)
{
return
calculateBabyAge
(
currentBaby
.
birthday
)
}
return
'0天'
}
catch
(
error
)
{
console
.
error
(
'获取宝宝年龄时出错:'
,
error
)
return
'0天'
}
}
...
...
pages/shengzhangTestResult/shengzhangTestResult.vue
View file @
b096e1ef
...
...
@@ -415,7 +415,6 @@ const generateCurveData1 = (lineData, type, arrayName, minOrMax) =>{
data
.
push
(
point
);
});
console
.
log
(
'data888888='
,
data
);
return
data
;
}
// slightHighRange
...
...
@@ -963,7 +962,7 @@ const onScroll = (e) => {
<
style
lang=
"less"
scoped
>
.shengzhang-test-result-container {
width: 100%;
//
height: 2700rpx;
height: 2700rpx;
// box-sizing: border-box;
position: relative;
overflow-x: hidden;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment