|
@@ -18,7 +18,6 @@ Component({
|
|
|
behaviors: [PageContainerBehavior, DictionariesBehavior, tickleBehavior],
|
|
behaviors: [PageContainerBehavior, DictionariesBehavior, tickleBehavior],
|
|
|
lifetimes: {
|
|
lifetimes: {
|
|
|
attached() {
|
|
attached() {
|
|
|
-
|
|
|
|
|
const channel = this.getOpenerEventChannel();
|
|
const channel = this.getOpenerEventChannel();
|
|
|
channel.on("navigateBack", (data) => {
|
|
channel.on("navigateBack", (data) => {
|
|
|
this.setData(data);
|
|
this.setData(data);
|
|
@@ -37,6 +36,7 @@ Component({
|
|
|
data: {
|
|
data: {
|
|
|
loading: false,
|
|
loading: false,
|
|
|
verifying: false,
|
|
verifying: false,
|
|
|
|
|
+ submitting: false,
|
|
|
model: {} as AnyObject,
|
|
model: {} as AnyObject,
|
|
|
name: "",
|
|
name: "",
|
|
|
cardno: "",
|
|
cardno: "",
|
|
@@ -103,6 +103,8 @@ Component({
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
async onSubmit(event: WechatMiniprogram.FormSubmit) {
|
|
async onSubmit(event: WechatMiniprogram.FormSubmit) {
|
|
|
|
|
+ if (this.data.submitting) return;
|
|
|
|
|
+ this.setData({ submitting: true });
|
|
|
const data = { ...this.data.model, ...event.detail.value };
|
|
const data = { ...this.data.model, ...event.detail.value };
|
|
|
data.phone = this.data.model.phone;
|
|
data.phone = this.data.model.phone;
|
|
|
const submitBtn = this.selectComponent("#submitBtn");
|
|
const submitBtn = this.selectComponent("#submitBtn");
|
|
@@ -110,26 +112,9 @@ Component({
|
|
|
if (submitBtn) submitBtn.resetState();
|
|
if (submitBtn) submitBtn.resetState();
|
|
|
return getTickleContext.call(this).showWarnMessage("请获取手机号码");
|
|
return getTickleContext.call(this).showWarnMessage("请获取手机号码");
|
|
|
}
|
|
}
|
|
|
- // if (!data.cardno) data.cardno = this.data.cardno;
|
|
|
|
|
- // if (data.sex == null) data.sex = this.data.sex;
|
|
|
|
|
if (!data.agemust) {
|
|
if (!data.agemust) {
|
|
|
data.agemust = this.data.privacyContract.agree ? "Y" : "N";
|
|
data.agemust = this.data.privacyContract.agree ? "Y" : "N";
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // if (!data.name)
|
|
|
|
|
- // return getTickleContext.call(this).showWarnMessage("请输入姓名");
|
|
|
|
|
- // if (data.cardno?.length !== 18)
|
|
|
|
|
- // return getTickleContext
|
|
|
|
|
- // .call(this)
|
|
|
|
|
- // .showWarnMessage("请输入正确的身份证号");
|
|
|
|
|
- // if (data.sex === "1" && !data.womenSpecialPeriod)
|
|
|
|
|
- // return getTickleContext
|
|
|
|
|
- // .call(this)
|
|
|
|
|
- // .showWarnMessage("请至少选择一项女性特殊期");
|
|
|
|
|
- // if (!data.height)
|
|
|
|
|
- // return getTickleContext.call(this).showWarnMessage("请输入身高");
|
|
|
|
|
- // if (!data.weight)
|
|
|
|
|
- // return getTickleContext.call(this).showWarnMessage("请输入体重");
|
|
|
|
|
if (data.agemust === "N") {
|
|
if (data.agemust === "N") {
|
|
|
if (submitBtn) submitBtn.resetState();
|
|
if (submitBtn) submitBtn.resetState();
|
|
|
this.setData({ "privacyContract.show": true });
|
|
this.setData({ "privacyContract.show": true });
|
|
@@ -140,22 +125,13 @@ Component({
|
|
|
}
|
|
}
|
|
|
wx.showLoading({ title: "保存中" });
|
|
wx.showLoading({ title: "保存中" });
|
|
|
try {
|
|
try {
|
|
|
- // const { patientId } = await createUserInfoMethod(<any>data);
|
|
|
|
|
const { patientId } = await createPhoneRegister(<any>data);
|
|
const { patientId } = await createPhoneRegister(<any>data);
|
|
|
- // await wx.navigateBack();
|
|
|
|
|
- // if (patientId) this.getOpenerEventChannel().emit('update', { patientId });
|
|
|
|
|
wx.setStorageSync("patientId", patientId);
|
|
wx.setStorageSync("patientId", patientId);
|
|
|
- // wx.redirectTo({
|
|
|
|
|
- // url: `/module/chats/pages/index/index?component=questionnaire`,
|
|
|
|
|
- // });
|
|
|
|
|
- // wx.redirectTo({
|
|
|
|
|
- // url: `/pages/home/home`,
|
|
|
|
|
- // });
|
|
|
|
|
// 回到相应的页面
|
|
// 回到相应的页面
|
|
|
if (this.data.type === "home") {
|
|
if (this.data.type === "home") {
|
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
|
- url: '/pages/home/home',
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ url: "/pages/home/home",
|
|
|
|
|
+ });
|
|
|
} else {
|
|
} else {
|
|
|
wx.navigateBack();
|
|
wx.navigateBack();
|
|
|
}
|
|
}
|
|
@@ -165,8 +141,10 @@ Component({
|
|
|
submitBtn.resetState();
|
|
submitBtn.resetState();
|
|
|
}
|
|
}
|
|
|
getTickleContext.call(this).showErrorMessage(error.errMsg);
|
|
getTickleContext.call(this).showErrorMessage(error.errMsg);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ this.setData({ submitting: false });
|
|
|
|
|
+ wx.hideLoading();
|
|
|
}
|
|
}
|
|
|
- wx.hideLoading();
|
|
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|