Commit 834fea86 authored by tao.huang's avatar tao.huang

fix: 保存生日字段修改

parent 0e06b7c8
...@@ -240,7 +240,6 @@ const formData = ref({ ...@@ -240,7 +240,6 @@ const formData = ref({
babyStage: 2, babyStage: 2,
babyName: "", babyName: "",
babyBirthday: "", babyBirthday: "",
dueDate: "",
babyGender: "", babyGender: "",
babyType: "", babyType: "",
feedingType: "", feedingType: "",
...@@ -272,7 +271,7 @@ const FormMap = { ...@@ -272,7 +271,7 @@ const FormMap = {
0: ["babyStage", "contentPreference", "followInfo"], 0: ["babyStage", "contentPreference", "followInfo"],
1: [ 1: [
"babyStage", "babyStage",
"dueDate", "babyBirthday",
"gestationalWeeks", "gestationalWeeks",
"babyType", "babyType",
"contentPreference", "contentPreference",
...@@ -343,14 +342,6 @@ const formItems = ref([ ...@@ -343,14 +342,6 @@ const formItems = ref([
mode: "date", mode: "date",
defaultToday: true, defaultToday: true,
}, },
{
label: "预产日期",
name: "dueDate",
required: true,
placeholder: "请选择预产日期",
type: "picker",
mode: "date",
},
{ {
label: "宝宝胎数", label: "宝宝胎数",
name: "babyType", name: "babyType",
...@@ -426,7 +417,6 @@ const formItems = ref([ ...@@ -426,7 +417,6 @@ const formItems = ref([
const clearFormFields = () => { const clearFormFields = () => {
formData.value.babyBirthday = ""; formData.value.babyBirthday = "";
formData.value.dueDate = "";
if (!userStore.babyInfo.content?.babyType) { if (!userStore.babyInfo.content?.babyType) {
formData.value.babyType = ""; formData.value.babyType = "";
} }
...@@ -542,10 +532,7 @@ const onSubmit = async (e) => { ...@@ -542,10 +532,7 @@ const onSubmit = async (e) => {
} }
const data = { const data = {
dueDate: babyBirthday: formData.value.babyBirthday,
formData.value.babyStage == 2
? formData.value.babyBirthday
: formData.value.dueDate,
babyType: formData.value.babyType, babyType: formData.value.babyType,
contentPreference: formData.value.contentPreference, contentPreference: formData.value.contentPreference,
followInfo: formData.value.followInfo, followInfo: formData.value.followInfo,
...@@ -722,6 +709,10 @@ const initData = () => { ...@@ -722,6 +709,10 @@ const initData = () => {
userStore.babyInfo.content?.babyType userStore.babyInfo.content?.babyType
) { ) {
item.type = "display-obj"; item.type = "display-obj";
} else if (item.name === "babyBirthday") {
item.label = formData.value.babyStage == 2 ? "宝宝出生日期" : "预产日期";
item.placeholder =
formData.value.babyStage == 2 ? "请选择预产日期" : "请选择出生日期";
} }
}); });
}; };
...@@ -738,7 +729,6 @@ onLoad((options) => { ...@@ -738,7 +729,6 @@ onLoad((options) => {
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 || "";
formData.value.dueDate = baby.content?.dueDate || "";
formData.value.babyType = baby.content?.babyType || ""; formData.value.babyType = baby.content?.babyType || "";
formData.value.babyGender = baby.content?.babyGender || ""; formData.value.babyGender = baby.content?.babyGender || "";
formData.value.feedingType = baby.content?.feedingType || ""; formData.value.feedingType = baby.content?.feedingType || "";
...@@ -754,7 +744,6 @@ onLoad((options) => { ...@@ -754,7 +744,6 @@ onLoad((options) => {
babyStage: 2, babyStage: 2,
babyName: "", babyName: "",
babyBirthday: "", babyBirthday: "",
dueDate: "",
babyGender: "", babyGender: "",
babyType: "", babyType: "",
feedingType: "", feedingType: "",
...@@ -775,7 +764,7 @@ onLoad((options) => { ...@@ -775,7 +764,7 @@ onLoad((options) => {
// 监听 babyStage 和 dueDate // 监听 babyStage 和 dueDate
watch( watch(
() => [formData.value.babyStage, formData.value.dueDate], () => [formData.value.babyStage, formData.value.babyBirthday],
async ([stage, dueDate], [oldStage, oldDueDate]) => { async ([stage, dueDate], [oldStage, oldDueDate]) => {
if (stage === 1) { if (stage === 1) {
// 1. 没有孕周 // 1. 没有孕周
......
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