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
21ec5c3f
Commit
21ec5c3f
authored
Jul 25, 2025
by
王炽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
666666
parent
cec72db5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
166 additions
and
31 deletions
+166
-31
request.js
api/request.js
+8
-5
shengzhangTools.js
api/shengzhangTools.js
+4
-1
BabyFeedSwitchPopup.vue
components/BabyFeedSwitchPopup.vue
+1
-1
DatePickerPopup.vue
components/DatePickerPopup.vue
+65
-10
shengzhangTools.vue
pages/shengzhangTools/shengzhangTools.vue
+67
-13
My.vue
views/My.vue
+21
-1
No files found.
api/request.js
View file @
21ec5c3f
...
@@ -17,17 +17,18 @@ const {
...
@@ -17,17 +17,18 @@ const {
// 通常可以吧 baseUrl 单独放在一个 js 文件了
// 通常可以吧 baseUrl 单独放在一个 js 文件了
// const baseUrl = "http://172.16.224.178:7777/pmall";
// const baseUrl = "http://172.16.224.178:7777/pmall";
// const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境
// const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境
let
baseUrl
=
"https://momclub.feihe.com/pmall"
;
//生产环境
//
let baseUrl = "https://momclub.feihe.com/pmall";//生产环境
// const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock
// const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock
const
baseUrl
=
"https://feihe.m.duibatest.com.cn/pmall"
const
request
=
(
options
=
{})
=>
{
const
request
=
(
options
=
{})
=>
{
// 在这里可以对请求头进行一些设置
// 在这里可以对请求头进行一些设置
// 例如:
// 例如:
options
.
header
=
{
//
options.header = {
"Content-Type"
:
"application/x-www-form-urlencoded"
//
"Content-Type": "application/x-www-form-urlencoded"
}
//
}
// if(options.url == '/c/ai/chat/query'){
// if(options.url == '/c/ai/chat/query'){
baseUrl
=
"https://docs.dui88.com/mock/1956"
;
//
baseUrl = "https://docs.dui88.com/mock/1956";
// }
// }
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
@@ -71,6 +72,7 @@ const request = (options = {}) => {
...
@@ -71,6 +72,7 @@ const request = (options = {}) => {
};
};
const
get
=
(
url
,
data
,
options
=
{})
=>
{
const
get
=
(
url
,
data
,
options
=
{})
=>
{
console
.
log
(
'6666666666'
);
options
.
type
=
"GET"
;
options
.
type
=
"GET"
;
options
.
data
=
data
;
options
.
data
=
data
;
options
.
url
=
url
;
options
.
url
=
url
;
...
@@ -78,6 +80,7 @@ const get = (url, data, options = {}) => {
...
@@ -78,6 +80,7 @@ const get = (url, data, options = {}) => {
};
};
const
post
=
(
url
,
data
,
options
=
{})
=>
{
const
post
=
(
url
,
data
,
options
=
{})
=>
{
console
.
log
(
'5555555555='
,
url
,
data
,
options
);
options
.
type
=
"POST"
;
options
.
type
=
"POST"
;
options
.
data
=
data
;
options
.
data
=
data
;
...
...
api/shengzhangTools.js
View file @
21ec5c3f
...
@@ -7,6 +7,9 @@ const {
...
@@ -7,6 +7,9 @@ const {
* 获取首页信息
* 获取首页信息
* @returns
* @returns
*/
*/
export
const
growthHome
=
(
)
=>
api
.
post
(
'/c/growth/home'
);
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 fetchHomeJSON = () => api.get('/c/front/content',{type:'home'});
// export const fetchHomeJSON = () => api.get('/c/front/content',{type:'home'});
\ No newline at end of file
components/BabyFeedSwitchPopup.vue
View file @
21ec5c3f
...
@@ -114,7 +114,7 @@ const handleOkTouchEnd = () => {
...
@@ -114,7 +114,7 @@ const handleOkTouchEnd = () => {
const
selectedFeed
=
feedOptions
.
value
[
index
]
const
selectedFeed
=
feedOptions
.
value
[
index
]
// 发送事件通知主页面
// 发送事件通知主页面
emit
(
'change'
,
selectedFeed
,
index
)
emit
(
'change'
,
selectedFeed
,
index
)
//只能传一个参数
closePopup
()
closePopup
()
}
}
...
...
components/DatePickerPopup.vue
View file @
21ec5c3f
...
@@ -75,6 +75,10 @@ const props = defineProps({
...
@@ -75,6 +75,10 @@ const props = defineProps({
selectedDate
:
{
selectedDate
:
{
type
:
String
,
type
:
String
,
default
:
'2025-06-06'
default
:
'2025-06-06'
},
babyBirthday
:
{
type
:
String
,
default
:
'2025-06-06'
}
}
})
})
...
@@ -91,25 +95,52 @@ const indicatorStyle = `height: 40px; border: none;`
...
@@ -91,25 +95,52 @@ const indicatorStyle = `height: 40px; border: none;`
// 当前选择的日期
// 当前选择的日期
const
currentDate
=
ref
(
new
Date
(
props
.
selectedDate
))
const
currentDate
=
ref
(
new
Date
(
props
.
selectedDate
))
const
babyBirthday
=
ref
(
new
Date
(
props
.
babyBirthday
))
// 生成年份范围 (2024-2030)
// 生成年份范围 (2024-2030)
const
yearRange
=
ref
([])
const
yearRange
=
ref
([])
for
(
let
i
=
2024
;
i
<=
2030
;
i
++
)
{
for
(
let
i
=
babyBirthday
.
value
.
getFullYear
()
;
i
<=
2030
;
i
++
)
{
yearRange
.
value
.
push
(
i
)
yearRange
.
value
.
push
(
i
)
}
}
// 生成月份范围 (1-12)
// 生成月份范围 (1-12)
const
monthRange
=
ref
([])
const
monthRange
=
computed
(()
=>
{
for
(
let
i
=
1
;
i
<=
12
;
i
++
)
{
const
monthRange
=
[]
monthRange
.
value
.
push
(
i
)
let
startMonth
=
babyBirthday
.
value
.
getMonth
()
+
1
;
}
if
(
currentDate
.
value
.
getFullYear
()
==
babyBirthday
.
value
.
getFullYear
()){
startMonth
=
babyBirthday
.
value
.
getMonth
()
+
1
;
}
else
{
startMonth
=
1
;
}
for
(
let
i
=
startMonth
;
i
<=
12
;
i
++
)
{
monthRange
.
push
(
i
)
}
return
monthRange
})
// 计算当前月份的天数
// 计算当前月份的天数
const
dayRange
=
computed
(()
=>
{
const
dayRange
=
computed
(()
=>
{
const
year
=
currentDate
.
value
.
getFullYear
()
const
year
=
babyBirthday
.
value
.
getFullYear
()
const
month
=
currentDate
.
value
.
getMonth
()
+
1
const
month
=
babyBirthday
.
value
.
getMonth
()
+
1
const
daysInMonth
=
new
Date
(
year
,
month
,
0
).
getDate
()
const
daysInMonth
=
new
Date
(
year
,
month
,
0
).
getDate
()
const
days
=
[]
const
days
=
[]
for
(
let
i
=
1
;
i
<=
daysInMonth
;
i
++
)
{
// currentDate.value.getFullYear() == babyBirthday.value.getFullYear() &&
let
startDay
=
babyBirthday
.
value
.
getDate
();
if
(
currentDate
.
value
.
getMonth
()
==
babyBirthday
.
value
.
getMonth
()
&&
currentDate
.
value
.
getFullYear
()
==
babyBirthday
.
value
.
getFullYear
()){
startDay
=
babyBirthday
.
value
.
getDate
();
}
else
{
startDay
=
1
;
}
for
(
let
i
=
startDay
;
i
<=
daysInMonth
;
i
++
)
{
days
.
push
(
i
)
days
.
push
(
i
)
}
}
return
days
return
days
...
@@ -135,6 +166,7 @@ watch(() => props.selectedDate, (newVal) => {
...
@@ -135,6 +166,7 @@ watch(() => props.selectedDate, (newVal) => {
// 日期选择变化处理
// 日期选择变化处理
const
onDateChange
=
(
e
)
=>
{
const
onDateChange
=
(
e
)
=>
{
console
.
log
(
'e11111='
,
e
.
detail
.
value
);
const
[
yearIndex
,
monthIndex
,
dayIndex
]
=
e
.
detail
.
value
const
[
yearIndex
,
monthIndex
,
dayIndex
]
=
e
.
detail
.
value
const
year
=
yearRange
.
value
[
yearIndex
]
const
year
=
yearRange
.
value
[
yearIndex
]
...
@@ -145,7 +177,8 @@ const onDateChange = (e) => {
...
@@ -145,7 +177,8 @@ const onDateChange = (e) => {
const
newDate
=
new
Date
(
year
,
month
-
1
,
day
)
const
newDate
=
new
Date
(
year
,
month
-
1
,
day
)
// 检查是否早于2024年1月1日
// 检查是否早于2024年1月1日
const
minDate
=
new
Date
(
2024
,
0
,
1
)
const
minDate
=
new
Date
(
babyBirthday
.
value
)
console
.
log
(
'babyBirthday='
,
babyBirthday
.
value
);
if
(
newDate
<
minDate
)
{
if
(
newDate
<
minDate
)
{
return
return
}
}
...
@@ -160,6 +193,17 @@ const handleCancelTouchStart = () => {
...
@@ -160,6 +193,17 @@ const handleCancelTouchStart = () => {
const
handleCancelTouchEnd
=
()
=>
{
const
handleCancelTouchEnd
=
()
=>
{
isCancelPressed
.
value
=
false
isCancelPressed
.
value
=
false
// 格式化日期为 YYYY-MM-DD
const
year
=
currentDate
.
value
.
getFullYear
()
const
month
=
String
(
currentDate
.
value
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
)
const
day
=
String
(
currentDate
.
value
.
getDate
()).
padStart
(
2
,
'0'
)
const
formattedDate
=
`
${
year
}
-
${
month
}
-
${
day
}
`
// 发送事件通知主页面
emit
(
'change'
,
formattedDate
)
emit
(
'update:selectedDate'
,
formattedDate
)
closePopup
()
closePopup
()
}
}
...
@@ -184,7 +228,18 @@ const handleOkTouchEnd = () => {
...
@@ -184,7 +228,18 @@ const handleOkTouchEnd = () => {
}
}
const
closePopup
=
()
=>
{
const
closePopup
=
()
=>
{
emit
(
'update:visible'
,
false
)
// 格式化日期为 YYYY-MM-DD
const
year
=
currentDate
.
value
.
getFullYear
()
const
month
=
String
(
currentDate
.
value
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
)
const
day
=
String
(
currentDate
.
value
.
getDate
()).
padStart
(
2
,
'0'
)
const
formattedDate
=
`
${
year
}
-
${
month
}
-
${
day
}
`
console
.
log
(
'formattedDate='
,
formattedDate
);
// 发送事件通知主页面
emit
(
'change'
,
formattedDate
)
emit
(
'update:selectedDate'
,
formattedDate
);
// emit('update:visible', false)
}
}
</
script
>
</
script
>
...
...
pages/shengzhangTools/shengzhangTools.vue
View file @
21ec5c3f
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
/>
/>
</swiper-item>
</swiper-item>
</swiper>
</swiper>
<image
@
tap=
"backHandler"
class=
"btnback"
:src=
"`/static/shengzhangTool/backBtn.png`"
></image>
<image
@
tap=
"backHandler"
class=
"btnback"
:src=
"`/static/shengzhangTool/backBtn.png`"
></image>
<text
class=
"title"
>
生长测评
</text>
<text
class=
"title"
>
生长测评
</text>
<view
class=
"info-container"
>
<view
class=
"info-container"
>
...
@@ -200,6 +200,7 @@
...
@@ -200,6 +200,7 @@
<DatePickerPopup
<DatePickerPopup
v-model:visible=
"showDatePickerPopup"
v-model:visible=
"showDatePickerPopup"
v-model:selectedDate=
"selectedDate"
v-model:selectedDate=
"selectedDate"
v-model:babyBirthday=
"babyBirthday"
@
change=
"onDateChange"
@
change=
"onDateChange"
/>
/>
...
@@ -215,7 +216,8 @@ import BabySwitchPopup from '@/components/BabySwitchPopup.vue'
...
@@ -215,7 +216,8 @@ import BabySwitchPopup from '@/components/BabySwitchPopup.vue'
import
BabyFeedSwitchPopup
from
'@/components/BabyFeedSwitchPopup.vue'
import
BabyFeedSwitchPopup
from
'@/components/BabyFeedSwitchPopup.vue'
import
DatePickerPopup
from
'@/components/DatePickerPopup.vue'
import
DatePickerPopup
from
'@/components/DatePickerPopup.vue'
import
BabyTestTipsPopup
from
'@/components/BabyTestTipsPopup.vue'
import
BabyTestTipsPopup
from
'@/components/BabyTestTipsPopup.vue'
import
{
growthHome
}
from
'../../api/shengzhangTools'
import
{
growthHome
,
guideCompleted
,
assessmentSave
}
from
'../../api/shengzhangTools'
import
{
onLoad
}
from
"@dcloudio/uni-app"
;
const
swiperData
=
ref
([
const
swiperData
=
ref
([
{
bannerImg
:
'/static/shengzhangTool/banner1.png'
},
{
bannerImg
:
'/static/shengzhangTool/banner1.png'
},
...
@@ -229,6 +231,8 @@ const babyBirthday = ref('2024-10-20')
...
@@ -229,6 +231,8 @@ const babyBirthday = ref('2024-10-20')
const
babyGender
=
ref
(
'M'
)
const
babyGender
=
ref
(
'M'
)
const
babyAvatar
=
ref
(
'/static/shengzhangTool/avatar.png'
)
const
babyAvatar
=
ref
(
'/static/shengzhangTool/avatar.png'
)
const
guideFlag
=
ref
(
false
);
const
bannerHandler
=
(
item
)
=>
{
const
bannerHandler
=
(
item
)
=>
{
console
.
log
(
item
)
console
.
log
(
item
)
}
}
...
@@ -263,6 +267,10 @@ const backFailHandler = (err) => {
...
@@ -263,6 +267,10 @@ const backFailHandler = (err) => {
const
height
=
ref
(
'50.3'
)
const
height
=
ref
(
'50.3'
)
const
weight
=
ref
(
'3.32'
)
const
weight
=
ref
(
'3.32'
)
const
headCircumference
=
ref
(
'34.5'
)
const
headCircumference
=
ref
(
'34.5'
)
const
babyId
=
ref
(
0
);
const
assessmentDate
=
ref
(
''
);
const
feedingType
=
ref
(
''
);
// 添加picker-view相关数据
// 添加picker-view相关数据
const
indicatorStyle
=
`height: 40px; border: none;`
const
indicatorStyle
=
`height: 40px; border: none;`
...
@@ -343,12 +351,26 @@ const viewRecords = () => {
...
@@ -343,12 +351,26 @@ const viewRecords = () => {
console
.
log
(
'查看测评记录'
)
console
.
log
(
'查看测评记录'
)
}
}
const
submitData
=
()
=>
{
const
submitData
=
async
()
=>
{
console
.
log
(
'提交数据'
,
{
const
submitData
=
{
babyId
:
babyId
.
value
,
height
:
height
.
value
,
height
:
height
.
value
,
weight
:
weight
.
value
,
weight
:
weight
.
value
,
headCircumference
:
headCircumference
.
value
headCircumference
:
headCircumference
.
value
,
})
assessmentDate
:
assessmentDate
.
value
,
feedingType
:
selectedFeedText
.
value
};
console
.
log
(
'提交数据'
,
submitData
);
const
data
=
await
assessmentSave
(
submitData
);
if
(
data
.
success
){
uni
.
showToast
({
title
:
'提交成功'
,
icon
:
'success'
})
}
}
}
// 添加以下数据
// 添加以下数据
...
@@ -461,22 +483,54 @@ const onClickTips = () => {
...
@@ -461,22 +483,54 @@ const onClickTips = () => {
const
guideIndex
=
ref
(
-
1
);
const
guideIndex
=
ref
(
-
1
);
const
guideHandler
=
()
=>
{
const
guideHandler
=
async
()
=>
{
guideIndex
.
value
++
guideIndex
.
value
++
if
(
guideIndex
.
value
>
2
)
{
if
(
guideIndex
.
value
>
2
)
{
guideIndex
.
value
=
-
1
;
// const data = await guideCompleted();
// if(data.success){
// guideFlag.value = true;
// guideIndex.value = -1;
// }else{
// //引导页完成失败,提示用户
// }
}
}
}
}
// 获取页面参数
onLoad
((
options
)
=>
{
console
.
log
(
'页面参数:'
,
options
.
toString
())
console
.
log
(
'options.babyId='
,
options
.
babyId
);
if
(
options
.
babyId
)
{
babyId
.
value
=
parseInt
(
options
.
babyId
)
console
.
log
(
'获取到的babyId:'
,
babyId
.
value
)
}
})
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
const
{
data
}
=
await
growthHome
();
const
{
data
}
=
await
growthHome
();
console
.
log
(
'data666666='
,
data
);
console
.
log
(
'data666666='
,
data
);
// const data = {"babyId":1234,"babyName":"小强","gender":"M","monthAge":3,"avatar":"https://momclub.feihe.com/pmall/momclub-picture/integral/1009/yuerBtn.png","birthDate":"2018-10-28 14:06:45","guideFlag":false};
// const data = {"babyId":1234,"babyName":"小强","gender":"M","monthAge":3,"avatar":"https://momclub.feihe.com/pmall/momclub-picture/integral/1009/yuerBtn.png","birthDate":"2018-10-28 14:06:45","guideFlag":false};
babyName
.
value
=
data
.
data
.
babyName
// babyName.value = data.babyName
babyAge
.
value
=
data
.
monthAge
+
'月龄'
// babyAge.value = data.monthAge + '月龄'
babyBirthday
.
value
=
data
.
birthDate
// babyBirthday.value = data.birthDate
babyGender
.
value
=
data
.
gender
// babyGender.value = data.gender
babyAvatar
.
value
=
data
.
avatar
// console.log('data.avatar=', data.avatar);
// babyAvatar.value = data.avatar
// assessmentDate.value = selectedDate.value;
// feedingType.value = selectedFeedText.value;
// guideFlag.value = data.guideFlag;
// if (guideFlag.value) {
// guideIndex.value = -1;
// }else{
// guideIndex.value = 0;
// }
})
})
</
script
>
</
script
>
...
...
views/My.vue
View file @
21ec5c3f
...
@@ -232,6 +232,8 @@ const babyInfo = computed(() => userStore?.babyInfo || {});
...
@@ -232,6 +232,8 @@ const babyInfo = computed(() => userStore?.babyInfo || {});
const
showRegisterLayer
=
ref
(
false
);
const
showRegisterLayer
=
ref
(
false
);
const
showBabySwitcher
=
ref
(
false
);
const
showBabySwitcher
=
ref
(
false
);
const
babyId
=
ref
(
0
);
const
handleHot
=
(
e
)
=>
{
const
handleHot
=
(
e
)
=>
{
const
type
=
e
.
currentTarget
.
dataset
.
type
;
const
type
=
e
.
currentTarget
.
dataset
.
type
;
md
.
sensorLog
(
e
);
md
.
sensorLog
(
e
);
...
@@ -245,6 +247,7 @@ const handleHot = (e) => {
...
@@ -245,6 +247,7 @@ const handleHot = (e) => {
}
}
};
};
// 页面跳转
// 页面跳转
const
navigateTo
=
(
url
)
=>
{
const
navigateTo
=
(
url
)
=>
{
uni
.
navigateTo
({
uni
.
navigateTo
({
...
@@ -325,7 +328,7 @@ const handleEditProfile = (e) => {
...
@@ -325,7 +328,7 @@ const handleEditProfile = (e) => {
const
type
=
const
type
=
userStore
.
babyInfo
?.
allBabyBaseInfo
?.
length
==
0
?
"add"
:
"edit"
;
userStore
.
babyInfo
?.
allBabyBaseInfo
?.
length
==
0
?
"add"
:
"edit"
;
const
babyId
=
userStore
.
babyInfo
?.
allBabyBaseInfo
.
find
(
babyId
.
value
=
userStore
.
babyInfo
?.
allBabyBaseInfo
.
find
(
(
item
)
=>
item
.
selected
(
item
)
=>
item
.
selected
)?.
id
;
)?.
id
;
...
@@ -436,11 +439,28 @@ onMounted(async () => {
...
@@ -436,11 +439,28 @@ onMounted(async () => {
await
pageCfgStore
.
fetchCfg
();
await
pageCfgStore
.
fetchCfg
();
initData
();
initData
();
hideLoading
();
hideLoading
();
console
.
log
(
'babyIdsdfsdfsdfsdfsdfsdfdsfsdf='
,
babyId
.
value
);
const
a
=
{
"bgUrl"
:
"my/babytest.png"
,
"desc"
:
"生长测评"
,
"link"
:
{
"extra"
:
{
babyId
:
babyId
.
value
},
"type"
:
1
,
"url"
:
"/pages/shengzhangTools/shengzhangTools"
},
"title"
:
"生长测评"
}
toolList
.
value
.
push
(
a
);
});
});
watch
([()
=>
userStore
.
userInfo
,
()
=>
userStore
.
babyInfo
],
()
=>
{
watch
([()
=>
userStore
.
userInfo
,
()
=>
userStore
.
babyInfo
],
()
=>
{
console
.
log
(
"userInfo/babyInfo变化"
,
userStore
.
userInfo
,
userStore
.
babyInfo
);
console
.
log
(
"userInfo/babyInfo变化"
,
userStore
.
userInfo
,
userStore
.
babyInfo
);
initData
();
initData
();
babyId
.
value
=
userStore
.
babyInfo
?.
allBabyBaseInfo
.
find
(
(
item
)
=>
item
.
selected
)?.
id
;
});
});
// 定义页面配置
// 定义页面配置
...
...
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