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
998a14ac
Commit
998a14ac
authored
Jul 28, 2025
by
王炽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
666666
parent
6ed1201b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
180 additions
and
15 deletions
+180
-15
shengzhangTools.js
api/shengzhangTools.js
+4
-0
shengzhangTestResult.vue
pages/shengzhangTestResult/shengzhangTestResult.vue
+103
-12
shengzhangTools.vue
pages/shengzhangTools/shengzhangTools.vue
+29
-2
shengzhangResult.js
stores/shengzhangResult.js
+44
-1
No files found.
api/shengzhangTools.js
View file @
998a14ac
...
...
@@ -12,4 +12,8 @@ export const growthHome = (babyId) => api.post('/c/growth/home', { babyId });
export
const
guideCompleted
=
()
=>
api
.
post
(
'/c/growth/guide/Completed'
);
export
const
assessmentSave
=
(
data
)
=>
api
.
post
(
'/c/growth/assessment/save'
,
data
);
export
const
getGrowthCurveData
=
(
babyData
)
=>
api
.
post
(
'/c/growth/curve/data'
,
babyData
);
export
const
getGrowthHistoryList
=
()
=>
api
.
post
(
'/c/growth/history/list'
);
// export const fetchHomeJSON = () => api.get('/c/front/content',{type:'home'});
\ No newline at end of file
pages/shengzhangTestResult/shengzhangTestResult.vue
View file @
998a14ac
...
...
@@ -8,9 +8,9 @@
<!--
<view
class=
"back-btn"
@
click=
"backHandler"
>
<text
class=
"back-text"
>
←
</text>
</view>
-->
<text
class=
"title"
>
生长测评
</text>
<image
@
tap=
"backHandler"
class=
"back-btn"
:src=
"`/static/shengzhangTool/backBtn.png`"
></image>
<text
class=
"title"
>
生长测评
</text>
<view
class=
"content-wrapper"
>
...
...
@@ -177,6 +177,7 @@
<view
class=
"legend-color normal"
></view>
<text
class=
"legend-text"
>
正常
</text>
</view>
<view
class=
"legend-item"
>
<view
class=
"legend-color slightly-high"
></view>
<text
class=
"legend-text"
>
略高
</text>
...
...
@@ -263,7 +264,8 @@
<
script
setup
>
import
{
ref
,
onMounted
}
from
'vue'
import
{
useShengzhangStore
}
from
'../../stores/shengzhangResult.js'
;
import
{
formatDate
}
from
'../../utils/index.js'
;
import
{
formatDate
,
jump
,
JumpType
}
from
'../../utils/index.js'
;
import
{
getGrowthHistoryList
}
from
'../../api/shengzhangTools'
;
// 导航标签状态
const
activeTab
=
ref
(
'latest'
)
// 默认显示最新内容
...
...
@@ -359,6 +361,9 @@ const curveData = ref([
{
month
:
7
,
height
:
72
}
])
const
curveDataPostHeight
=
ref
([]);
const
curveDataPostWeight
=
ref
([]);
const
curveDataPostHead
=
ref
([]);
// 生成0-36个月的数据点
/**
* @param {number} startValue - 起始值(0个月时的数值)
...
...
@@ -377,22 +382,40 @@ const generateCurveData = (startValue, endValue, type) => {
return
data
}
//获取宝宝曲线数据范围4条线,用于绘制曲线
const
generateCurveData1
=
(
lineData
,
type
,
arrayName
,
minOrMax
)
=>
{
const
data
=
[];
lineData
.
forEach
(
element
=>
{
const
point
=
{
month
:
element
.
monthAge
}
point
[
type
]
=
minOrMax
===
'min'
?
element
?.[
arrayName
]?.
min
:
element
?.[
arrayName
]?.
max
data
.
push
(
point
);
});
console
.
log
(
'data888888='
,
data
);
return
data
;
}
// slightHighRange
// slightLowRange
// 标准生长曲线数据(多条线,延长到36个月)
const
standardCurves
=
ref
({
height
:
{
slightlyLow
:
generateCurveData
(
45
,
105
,
'height'
),
normal
:
generateCurveData
(
50
,
110
,
'height'
),
slightlyHigh
:
generateCurveData
(
55
,
115
,
'height'
)
slightlyLow
:
generateCurveData1
(
curveDataPostHeight
.
value
,
'height'
,
'slightLowRange'
,
'min'
),
// normal: generateCurveData(50, 110, 'height'),
normal
:
generateCurveData1
(
curveDataPostHeight
.
value
,
'height'
,
'normalRange'
,
'min'
),
normal2
:
generateCurveData1
(
curveDataPostHeight
.
value
,
'height'
,
'normalRange'
,
'max'
),
// 新增的a8e6cf颜色曲线
slightlyHigh
:
generateCurveData1
(
curveDataPostHeight
.
value
,
'height'
,
'slightHighRange'
,
'max'
)
},
weight
:
{
slightlyLow
:
generateCurveData
(
2.5
,
15.0
,
'weight'
),
normal
:
generateCurveData
(
3.0
,
16.5
,
'weight'
),
slightlyHigh
:
generateCurveData
(
3.5
,
18.0
,
'weight'
)
slightlyLow
:
generateCurveData1
(
curveDataPostWeight
.
value
,
'weight'
,
'slightLowRange'
,
'min'
),
normal
:
generateCurveData1
(
curveDataPostWeight
.
value
,
'weight'
,
'normalRange'
,
'min'
),
normal2
:
generateCurveData1
(
curveDataPostWeight
.
value
,
'weight'
,
'normalRange'
,
'max'
),
// 新增的a8e6cf颜色曲线
slightlyHigh
:
generateCurveData1
(
curveDataPostWeight
.
value
,
'weight'
,
'slightHighRange'
,
'max'
)
},
head
:
{
slightlyLow
:
generateCurveData
(
32
,
52
,
'head'
),
normal
:
generateCurveData
(
34
,
54
,
'head'
),
slightlyHigh
:
generateCurveData
(
36
,
56
,
'head'
)
slightlyLow
:
generateCurveData1
(
curveDataPostHead
.
value
,
'head'
,
'slightLowRange'
,
'min'
),
normal
:
generateCurveData1
(
curveDataPostHead
.
value
,
'head'
,
'normalRange'
,
'min'
),
normal2
:
generateCurveData1
(
curveDataPostHead
.
value
,
'head'
,
'normalRange'
,
'max'
),
// 新增的a8e6cf颜色曲线
slightlyHigh
:
generateCurveData1
(
curveDataPostHead
.
value
,
'head'
,
'slightHighRange'
,
'max'
)
}
})
...
...
@@ -461,6 +484,17 @@ const switchCurveTab = (tab) => {
},
100
)
}
//获取当前宝宝曲线数据,用于绘制曲线
const
generateCurveData2
=
(
lineData
,
type
,
arrayName
,
minOrMax
)
=>
{
const
data
=
[];
lineData
.
forEach
(
element
=>
{
const
point
=
{
month
:
element
.
monthAge
}
point
[
type
]
=
minOrMax
===
'min'
?
element
?.[
arrayName
]?.
min
:
element
?.[
arrayName
]?.
max
data
.
push
(
point
);
});
return
data
;
}
// 获取Y轴标签
/**
* @returns {string} 根据当前曲线类型返回对应的Y轴标签
...
...
@@ -521,6 +555,7 @@ const consultExpert = () => {
* 处理返回按钮点击事件,尝试返回上一页或跳转到首页
*/
const
backHandler
=
()
=>
{
console
.
log
(
'backHandler'
);
try
{
uni
.
navigateBack
({
success
:
()
=>
{
...
...
@@ -537,12 +572,17 @@ const backHandler = () => {
}
}
onMounted
(()
=>
{
const
backFailHandler
=
()
=>
{
console
.
log
(
'backFailHandler'
);
}
onMounted
(
async
()
=>
{
// 初始化绘制曲线
setTimeout
(()
=>
{
drawGrowthCurve
()
},
100
)
//分析结果处理
const
shengzhangStore
=
useShengzhangStore
();
const
data
=
{...
shengzhangStore
.
shengzhangInfo
.
babyInfo
};
data
.
assessmentDate
=
formatDate
(
shengzhangStore
.
shengzhangInfo
.
assessmentDate
);
...
...
@@ -554,6 +594,50 @@ onMounted(() => {
contentText
.
value
=
shengzhangStore
.
shengzhangInfo
.
content
;
//生长曲线处理
curveDataPostHeight
.
value
=
shengzhangStore
.
getGrowthCurveDataInfoHeight
.
curveData
;
curveDataPostWeight
.
value
=
shengzhangStore
.
getGrowthCurveDataInfoWeight
.
curveData
;
curveDataPostHead
.
value
=
shengzhangStore
.
getGrowthCurveDataInfoHead
.
curveData
;
console
.
log
(
'curveDataPostHeight.value='
,
curveDataPostHeight
.
value
);
standardCurves
.
value
=
{
height
:
{
// slightlyLow: generateCurveData(45, 105, 'height'),
// normal: generateCurveData(50, 110, 'height'),
slightlyLow
:
generateCurveData1
(
curveDataPostHeight
.
value
,
'height'
,
'slightLowRange'
,
'min'
),
normal
:
generateCurveData1
(
curveDataPostHeight
.
value
,
'height'
,
'normalRange'
,
'min'
),
normal2
:
generateCurveData1
(
curveDataPostHeight
.
value
,
'height'
,
'normalRange'
,
'max'
),
// 新增的a8e6cf颜色曲线
slightlyHigh
:
generateCurveData1
(
curveDataPostHeight
.
value
,
'height'
,
'slightHighRange'
,
'max'
),
// slightlyHigh: generateCurveData(55, 115, 'height')slightHighRange
},
weight
:
{
// slightlyLow: generateCurveData(2.5, 15.0, 'weight'),
// normal: generateCurveData(3.0, 16.5, 'weight'),
// normal2: generateCurveData(3.2, 17.0, 'weight'), // 新增的a8e6cf颜色曲线
// slightlyHigh: generateCurveData(3.5, 18.0, 'weight')
slightlyLow
:
generateCurveData1
(
curveDataPostWeight
.
value
,
'weight'
,
'slightLowRange'
,
'min'
),
normal
:
generateCurveData1
(
curveDataPostWeight
.
value
,
'weight'
,
'normalRange'
,
'min'
),
normal2
:
generateCurveData1
(
curveDataPostWeight
.
value
,
'weight'
,
'normalRange'
,
'max'
),
// 新增的a8e6cf颜色曲线
slightlyHigh
:
generateCurveData1
(
curveDataPostWeight
.
value
,
'weight'
,
'slightHighRange'
,
'max'
),
},
head
:
{
// slightlyLow: generateCurveData(32, 52, 'head'),
// normal: generateCurveData(34, 54, 'head'),
// normal2: generateCurveData(35, 55, 'head'), // 新增的a8e6cf颜色曲线
// slightlyHigh: generateCurveData(36, 56, 'head')
slightlyLow
:
generateCurveData1
(
curveDataPostHead
.
value
,
'head'
,
'slightLowRange'
,
'min'
),
normal
:
generateCurveData1
(
curveDataPostHead
.
value
,
'head'
,
'normalRange'
,
'min'
),
normal2
:
generateCurveData1
(
curveDataPostHead
.
value
,
'head'
,
'normalRange'
,
'max'
),
// 新增的a8e6cf颜色曲线
slightlyHigh
:
generateCurveData1
(
curveDataPostHead
.
value
,
'head'
,
'slightHighRange'
,
'max'
),
}
};
debugger
;
const
historyListData
=
await
getGrowthHistoryList
();
console
.
log
(
'historyListData='
,
historyListData
);
})
// 绘制生长曲线
...
...
@@ -727,6 +811,9 @@ const drawStandardCurves = (ctx, curves, margin, chartWidth, chartHeight, type)
// 绘制正常曲线 - 浅绿色
drawCurve
(
ctx
,
curves
.
normal
,
margin
,
chartWidth
,
chartHeight
,
type
,
'#a8e6cf'
,
2
)
// 绘制新增的正常曲线2 - 浅绿色(不重合)
drawCurve
(
ctx
,
curves
.
normal2
,
margin
,
chartWidth
,
chartHeight
,
type
,
'#a8e6cf'
,
2
)
// 绘制略高曲线 - 紫色
drawCurve
(
ctx
,
curves
.
slightlyHigh
,
margin
,
chartWidth
,
chartHeight
,
type
,
'#d4a5f5'
,
2
)
}
...
...
@@ -1437,6 +1524,10 @@ const onScroll = (e) => {
background-color: #89caa2; // 浅绿色
}
&.normal2 {
background-color: #a8e6cf; // 浅绿色(第二条线)
}
&.slightly-high {
background-color: #f3d1e9; // 紫色
}
...
...
pages/shengzhangTools/shengzhangTools.vue
View file @
998a14ac
...
...
@@ -227,7 +227,7 @@ import BabySwitchPopup from '@/components/BabySwitchPopup.vue'
import
BabyFeedSwitchPopup
from
'@/components/BabyFeedSwitchPopup.vue'
import
DatePickerPopup
from
'@/components/DatePickerPopup.vue'
import
BabyTestTipsPopup
from
'@/components/BabyTestTipsPopup.vue'
import
{
growthHome
,
guideCompleted
}
from
'../../api/shengzhangTools'
import
{
growthHome
,
guideCompleted
,
getGrowthCurveData
}
from
'../../api/shengzhangTools'
import
{
onLoad
}
from
"@dcloudio/uni-app"
;
import
{
throttleTap
,
jump
,
JumpType
,
formatDate
}
from
'../../utils/index.js'
;
import
{
useShengzhangStore
}
from
'../../stores/shengzhangResult.js'
;
...
...
@@ -391,8 +391,35 @@ const submitData = throttleTap(async () => {
await
shengzhangStore
.
assessmentSave
(
submitData
);
console
.
log
(
'shengzhangStore='
,
shengzhangStore
.
shengzhangInfo
);
const
babyDataHeight
=
{
babyId
:
babyId
.
value
,
curveType
:
'HEIGHT'
,
startMonth
:
0
,
endMonth
:
36
,
};
await
shengzhangStore
.
getGrowthCurveData
(
babyDataHeight
);
const
babyDataWeight
=
{
babyId
:
babyId
.
value
,
curveType
:
'WEIGHT'
,
startMonth
:
0
,
endMonth
:
36
,
};
await
shengzhangStore
.
getGrowthCurveData
(
babyDataWeight
);
const
babyDataHead
=
{
babyId
:
babyId
.
value
,
curveType
:
'HEAD'
,
startMonth
:
0
,
endMonth
:
36
,
};
await
shengzhangStore
.
getGrowthCurveData
(
babyDataHead
);
//跳转测评结果页
if
(
shengzhangStore
.
shengzhangInfo
.
success
){
jump
({
type
:
JumpType
.
INNER
,
...
...
stores/shengzhangResult.js
View file @
998a14ac
import
{
defineStore
}
from
"pinia"
;
import
{
assessmentSave
assessmentSave
,
getGrowthCurveData
}
from
"../api/shengzhangTools.js"
;
export
const
useShengzhangStore
=
defineStore
(
"shengzhangInfo"
,
{
state
:
()
=>
{
return
{
shengzhangInfo
:
null
,
getGrowthCurveDataInfoHeight
:
null
,
getGrowthCurveDataInfoWeight
:
null
,
getGrowthCurveDataInfoHead
:
null
,
getGrowthCurveDataInfoBmi
:
null
,
};
},
actions
:
{
...
...
@@ -27,5 +32,43 @@ export const useShengzhangStore = defineStore("shengzhangInfo", {
}
},
setGetGrowthCurveDataHeightInfo
(
getGrowthCurveDataInfo
)
{
this
.
getGrowthCurveDataInfoHeight
=
getGrowthCurveDataInfo
;
},
setGetGrowthCurveDataWeightInfo
(
getGrowthCurveDataInfo
)
{
this
.
getGrowthCurveDataInfoWeight
=
getGrowthCurveDataInfo
;
},
setGetGrowthCurveDataHeadInfo
(
getGrowthCurveDataInfo
)
{
this
.
getGrowthCurveDataInfoHead
=
getGrowthCurveDataInfo
;
},
setGetGrowthCurveDataBmiInfo
(
getGrowthCurveDataInfo
)
{
this
.
getGrowthCurveDataInfoBmi
=
getGrowthCurveDataInfo
;
},
async
getGrowthCurveData
(
babyData
)
{
const
data
=
await
getGrowthCurveData
(
babyData
);
if
(
data
.
success
){
data
.
data
.
success
=
data
.
success
;
switch
(
babyData
.
curveType
){
case
'HEIGHT'
:
this
.
setGetGrowthCurveDataHeightInfo
(
data
.
data
);
break
;
case
'WEIGHT'
:
this
.
setGetGrowthCurveDataWeightInfo
(
data
.
data
);
break
;
case
'HEAD'
:
this
.
setGetGrowthCurveDataHeadInfo
(
data
.
data
);
break
;
case
'BMI'
:
this
.
setGetGrowthCurveDataBmiInfo
(
data
.
data
);
break
;
}
}
},
},
});
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