Commit a7df09c7 by chenwq

优化步骤导航逻辑,简化返回上一步的处理

1 parent a8389602
...@@ -181,26 +181,12 @@ Page({ ...@@ -181,26 +181,12 @@ Page({
handlePrevStep() { handlePrevStep() {
if (this.data.currentStep > 1) { if (this.data.currentStep > 1) {
if (this.data.currentStep === 2) { const prevNum = this.data.currentStep - 1;
const secondStepComp = this.selectComponent("#SecondStep"); const stepMap = { 1: "first", 2: "second", 3: "third", 4: "fourth" };
if (secondStepComp) { this.setData({
const errorObj = secondStepComp.validate(); currentStep: prevNum,
if (errorObj) return; step: stepMap[prevNum],
} });
} else if (this.data.currentStep === 3) {
const thirdStepComp = this.selectComponent("#ThirdStep");
if (thirdStepComp) {
const errorObj = thirdStepComp.validate();
if (errorObj) return;
}
} else if (this.data.currentStep === 4) {
const fourthStepComp = this.selectComponent("#FourthStep");
if (fourthStepComp) {
const errorObj = fourthStepComp.validate();
if (errorObj) return;
}
}
this.saveOrderData("prev");
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!