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
aa82a575
Commit
aa82a575
authored
Aug 27, 2025
by
tao.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 保存延迟
parent
e40ec048
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
30 deletions
+28
-30
person.vue
pages/person/person.vue
+28
-30
No files found.
pages/person/person.vue
View file @
aa82a575
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
}"
}"
>
>
<text
class=
"form-label"
>
<text
class=
"form-label"
>
{{
getlabelFn
(
item
)
}}
{{
getlabelFn
(
item
)
}}
<!--
{{
item
.
label
}}
-->
<!--
{{
item
.
label
}}
-->
<text
v-if=
"item.required"
class=
"required"
>
*
</text>
<text
v-if=
"item.required"
class=
"required"
>
*
</text>
</text>
</text>
...
@@ -232,7 +232,7 @@ import { showLoading, hideLoading } from "../../utils/index.js";
...
@@ -232,7 +232,7 @@ import { showLoading, hideLoading } from "../../utils/index.js";
import
{
updateBabyInfo
,
getGestationalWeeks
}
from
"../../api/user.js"
;
import
{
updateBabyInfo
,
getGestationalWeeks
}
from
"../../api/user.js"
;
import
{
usePageCfgStore
}
from
"../../stores/pageCfg"
;
import
{
usePageCfgStore
}
from
"../../stores/pageCfg"
;
import
md
from
"../../md.js"
;
import
md
from
"../../md.js"
;
import
{
jump
,
JumpType
}
from
'../../utils/index.js'
;
import
{
jump
,
JumpType
}
from
"../../utils/index.js"
;
const
userStore
=
useUserStore
();
const
userStore
=
useUserStore
();
const
pageType
=
ref
(
"add"
);
const
pageType
=
ref
(
"add"
);
const
babyId
=
ref
(
""
);
const
babyId
=
ref
(
""
);
...
@@ -512,12 +512,11 @@ const onRadioChange = (e, name) => {
...
@@ -512,12 +512,11 @@ const onRadioChange = (e, name) => {
formData
.
value
[
name
]
=
e
.
detail
.
value
;
formData
.
value
[
name
]
=
e
.
detail
.
value
;
};
};
const
sleep
=
(
delay
)
=>
{
const
sleep
=
(
delay
)
=>
{
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
setTimeout
(()
=>
resolve
(),
delay
)
setTimeout
(()
=>
resolve
(),
delay
);
})
})
;
}
}
;
const
onSubmit
=
async
(
e
)
=>
{
const
onSubmit
=
async
(
e
)
=>
{
md
.
sensorLogTake
({
md
.
sensorLogTake
({
...
@@ -587,24 +586,24 @@ const onSubmit = async (e) => {
...
@@ -587,24 +586,24 @@ const onSubmit = async (e) => {
hideLoading
();
hideLoading
();
if
(
res
.
success
)
{
if
(
res
.
success
)
{
data
?.
id
&&
data
?.
id
&&
userStore
.
setBabyNickCache
(
data
?.
id
,
formData
.
value
.
babyName
);
userStore
.
setBabyNickCache
(
data
?.
id
,
formData
.
value
.
babyName
);
uni
.
showToast
({
title
:
"提交成功"
,
icon
:
"success"
,
});
uni
.
navigateBack
();
// jump({
// jump({
// type: JumpType.INNER,
// type: JumpType.INNER,
// url: "/pages/index/index"
// url: "/pages/index/index"
// })
// })
showLoading
();
showLoading
();
await
sleep
(
3000
);
await
sleep
(
3000
);
await
userStore
.
loadUserInfo
();
await
userStore
.
loadUserInfo
();
await
userStore
.
loadBabyInfo
();
await
userStore
.
loadBabyInfo
();
await
userStore
.
loadHomeInfo
();
await
userStore
.
loadHomeInfo
();
hideLoading
();
hideLoading
();
uni
.
showToast
({
title
:
"提交成功"
,
icon
:
"success"
,
});
uni
.
navigateBack
();
}
else
{
}
else
{
uni
.
showToast
({
uni
.
showToast
({
title
:
res
.
message
,
title
:
res
.
message
,
...
@@ -683,21 +682,18 @@ function onDateStatusChange(status) {
...
@@ -683,21 +682,18 @@ function onDateStatusChange(status) {
}
}
return
true
;
return
true
;
}
}
const
getlabelFn
=
(
item
)
=>
{
const
getlabelFn
=
(
item
)
=>
{
if
(
item
.
name
===
"babyBirthday"
)
{
if
(
item
.
name
===
"babyBirthday"
)
{
item
.
label
=
formData
.
value
.
babyStage
==
1
?
'预产日期'
:
'宝宝出生日期'
item
.
label
=
formData
.
value
.
babyStage
==
1
?
"预产日期"
:
"宝宝出生日期"
;
}
}
return
item
.
label
return
item
.
label
;
}
}
;
// getLabelByValue 支持所有映射字段
// getLabelByValue 支持所有映射字段
const
getLabelByValue
=
(
item
,
value
)
=>
{
const
getLabelByValue
=
(
item
,
value
)
=>
{
if
(
item
.
name
===
"babyStage"
)
{
if
(
item
.
name
===
"babyStage"
)
{
return
babyStageMap
.
find
((
i
)
=>
i
.
value
===
value
)?.
label
||
""
;
return
babyStageMap
.
find
((
i
)
=>
i
.
value
===
value
)?.
label
||
""
;
}
}
if
(
item
.
name
===
"babyType"
)
{
if
(
item
.
name
===
"babyType"
)
{
return
babyTypeMap
.
find
((
i
)
=>
i
.
value
===
value
)?.
label
||
""
;
return
babyTypeMap
.
find
((
i
)
=>
i
.
value
===
value
)?.
label
||
""
;
}
}
...
@@ -708,8 +704,12 @@ const getLabelByValue = (item, value) => {
...
@@ -708,8 +704,12 @@ const getLabelByValue = (item, value) => {
// // 添加根据切换状态修改文案
// // 添加根据切换状态修改文案
if
(
item
.
name
===
"babyBirthday"
)
{
if
(
item
.
name
===
"babyBirthday"
)
{
// console.log("🚀 ~ getLabelByValue ~ formData:", formData.value, item)
// console.log("🚀 ~ getLabelByValue ~ formData:", formData.value, item)
item
.
placeholder
=
formData
.
value
.
babyBirthday
?
formData
.
value
.
babyBirthday
:
formData
.
value
.
babyStage
==
1
?
'请选择预产日期'
:
'请选择出生日期'
item
.
placeholder
=
formData
.
value
.
babyBirthday
return
item
.
placeholder
?
formData
.
value
.
babyBirthday
:
formData
.
value
.
babyStage
==
1
?
"请选择预产日期"
:
"请选择出生日期"
;
return
item
.
placeholder
;
}
}
return
value
;
return
value
;
};
};
...
@@ -749,7 +749,6 @@ const initData = () => {
...
@@ -749,7 +749,6 @@ const initData = () => {
// 更新表单项的选项数据
// 更新表单项的选项数据
formItems
.
value
.
forEach
((
item
)
=>
{
formItems
.
value
.
forEach
((
item
)
=>
{
if
(
item
.
name
===
"contentPreference"
)
{
if
(
item
.
name
===
"contentPreference"
)
{
item
.
range
=
contentLikeOptions
.
value
;
item
.
range
=
contentLikeOptions
.
value
;
}
else
if
(
item
.
name
===
"productPreference"
)
{
}
else
if
(
item
.
name
===
"productPreference"
)
{
...
@@ -770,7 +769,6 @@ const initData = () => {
...
@@ -770,7 +769,6 @@ const initData = () => {
formData
.
value
.
babyStage
==
2
?
"请选择出生日期"
:
"请选择预产日期"
;
formData
.
value
.
babyStage
==
2
?
"请选择出生日期"
:
"请选择预产日期"
;
}
}
});
});
};
};
onMounted
(()
=>
{
onMounted
(()
=>
{
...
@@ -783,13 +781,13 @@ onMounted(() => {
...
@@ -783,13 +781,13 @@ onMounted(() => {
});
});
onLoad
((
options
)
=>
{
onLoad
((
options
)
=>
{
console
.
log
(
"🚀 ~ options-新增和修改:"
,
options
)
console
.
log
(
"🚀 ~ options-新增和修改:"
,
options
)
;
// debugger;
// debugger;
pageType
.
value
=
options
.
type
||
"add"
;
pageType
.
value
=
options
.
type
||
"add"
;
babyId
.
value
=
options
.
id
||
""
;
babyId
.
value
=
options
.
id
||
""
;
if
(
pageType
.
value
===
"edit"
)
{
if
(
pageType
.
value
===
"edit"
)
{
const
baby
=
userStore
.
babyInfo
;
const
baby
=
userStore
.
babyInfo
;
console
.
log
(
"🚀 ~ baby:"
,
baby
)
console
.
log
(
"🚀 ~ baby:"
,
baby
)
;
formData
.
value
.
babyStage
=
baby
.
babyStage
??
2
;
formData
.
value
.
babyStage
=
baby
.
babyStage
??
2
;
formData
.
value
.
babyName
=
baby
.
babyName
||
""
;
formData
.
value
.
babyName
=
baby
.
babyName
||
""
;
formData
.
value
.
babyBirthday
=
baby
.
content
?.
babyBirthday
||
""
;
formData
.
value
.
babyBirthday
=
baby
.
content
?.
babyBirthday
||
""
;
...
...
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