|
|
@@ -204,16 +204,93 @@ const _sfc_main = {
|
|
|
this.fetchUserData();
|
|
|
console.log(this.configData);
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ // 监听步骤显示状态的变化
|
|
|
+ shouldShowWorkStep(newVal) {
|
|
|
+ console.log("工作经历显示状态变化:", newVal);
|
|
|
+ if (!newVal && this.currentStep === 8) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.jumpToLastVisibleStep();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ shouldShowSkillsStep(newVal) {
|
|
|
+ console.log("专业技能显示状态变化:", newVal);
|
|
|
+ },
|
|
|
+ shouldShowEducationStep(newVal) {
|
|
|
+ console.log("教育经历显示状态变化:", newVal);
|
|
|
+ },
|
|
|
+ shouldShowFamilyStep(newVal) {
|
|
|
+ console.log("家庭成员显示状态变化:", newVal);
|
|
|
+ }
|
|
|
+ },
|
|
|
computed: {
|
|
|
// 添加计算属性来控制按钮显示
|
|
|
showPrevButton() {
|
|
|
return this.currentStep !== 1;
|
|
|
},
|
|
|
showNextButton() {
|
|
|
- return this.currentStep !== 8;
|
|
|
+ const currentIndex = this.currentStepIndex;
|
|
|
+ if (currentIndex === -1)
|
|
|
+ return false;
|
|
|
+ for (let i = currentIndex + 1; i < this.steps.length; i++) {
|
|
|
+ const nextStepId = this.steps[i].id;
|
|
|
+ let shouldShowNextStep = true;
|
|
|
+ switch (nextStepId) {
|
|
|
+ case 3:
|
|
|
+ shouldShowNextStep = this.shouldShowFamilyStep;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ shouldShowNextStep = this.shouldShowEducationStep;
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ shouldShowNextStep = this.shouldShowSkillsStep;
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ shouldShowNextStep = this.shouldShowWorkStep;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ shouldShowNextStep = true;
|
|
|
+ }
|
|
|
+ if (shouldShowNextStep)
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
},
|
|
|
showSubmitButton() {
|
|
|
- return this.currentStep === 8;
|
|
|
+ let lastVisibleStepId = null;
|
|
|
+ for (let i = this.steps.length - 1; i >= 0; i--) {
|
|
|
+ const stepId = this.steps[i].id;
|
|
|
+ let shouldShowStep = false;
|
|
|
+ switch (stepId) {
|
|
|
+ case 3:
|
|
|
+ shouldShowStep = this.shouldShowFamilyStep;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ shouldShowStep = this.shouldShowEducationStep;
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ shouldShowStep = this.shouldShowSkillsStep;
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ shouldShowStep = this.shouldShowWorkStep;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ shouldShowStep = true;
|
|
|
+ }
|
|
|
+ if (shouldShowStep) {
|
|
|
+ lastVisibleStepId = stepId;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log("当前步骤:", this.currentStep);
|
|
|
+ console.log("最后一个可见步骤:", lastVisibleStepId);
|
|
|
+ console.log("家庭成员显示:", this.shouldShowFamilyStep);
|
|
|
+ console.log("教育经历显示:", this.shouldShowEducationStep);
|
|
|
+ console.log("专业技能显示:", this.shouldShowSkillsStep);
|
|
|
+ console.log("工作经历显示:", this.shouldShowWorkStep);
|
|
|
+ console.log("是否显示提交按钮:", this.currentStep === lastVisibleStepId);
|
|
|
+ return this.currentStep === lastVisibleStepId;
|
|
|
},
|
|
|
// 获取当前步骤在数组中的索引
|
|
|
currentStepIndex() {
|
|
|
@@ -389,9 +466,80 @@ const _sfc_main = {
|
|
|
var _a;
|
|
|
return ((_a = this.safeFamilyFieldsConfig[field]) == null ? void 0 : _a.visible) !== false;
|
|
|
});
|
|
|
+ },
|
|
|
+ // 判断是否显示工作经历
|
|
|
+ shouldShowWorkStep() {
|
|
|
+ if (Object.keys(this.safeWorkFieldsConfig).length === 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ const fields = ["start_date", "end_date", "company_name", "department", "company_size", "position", "monthly_salary", "direct_supervisor", "supervisor_phone"];
|
|
|
+ return fields.some((field) => {
|
|
|
+ var _a;
|
|
|
+ return ((_a = this.safeWorkFieldsConfig[field]) == null ? void 0 : _a.visible) !== false;
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 确保当前步骤是有效的(如果需要显示的话)
|
|
|
+ ensureValidStep() {
|
|
|
+ const currentStepId = this.currentStep;
|
|
|
+ let shouldShowCurrentStep = true;
|
|
|
+ switch (currentStepId) {
|
|
|
+ case 3:
|
|
|
+ shouldShowCurrentStep = this.shouldShowFamilyStep;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ shouldShowCurrentStep = this.shouldShowEducationStep;
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ shouldShowCurrentStep = this.shouldShowSkillsStep;
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ shouldShowCurrentStep = this.shouldShowWorkStep;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ shouldShowCurrentStep = true;
|
|
|
+ }
|
|
|
+ if (!shouldShowCurrentStep) {
|
|
|
+ this.jumpToLastVisibleStep();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 跳转到最后一个可见步骤
|
|
|
+ jumpToLastVisibleStep() {
|
|
|
+ let lastVisibleStepId = null;
|
|
|
+ for (let i = this.steps.length - 1; i >= 0; i--) {
|
|
|
+ const stepId = this.steps[i].id;
|
|
|
+ let shouldShowStep = false;
|
|
|
+ switch (stepId) {
|
|
|
+ case 3:
|
|
|
+ shouldShowStep = this.shouldShowFamilyStep;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ shouldShowStep = this.shouldShowEducationStep;
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ shouldShowStep = this.shouldShowSkillsStep;
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ shouldShowStep = this.shouldShowWorkStep;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ shouldShowStep = true;
|
|
|
+ }
|
|
|
+ if (shouldShowStep) {
|
|
|
+ lastVisibleStepId = stepId;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (lastVisibleStepId) {
|
|
|
+ console.log("跳转到最后一个可见步骤:", lastVisibleStepId);
|
|
|
+ this.currentStep = lastVisibleStepId;
|
|
|
+ common_vendor.index.pageScrollTo({
|
|
|
+ scrollTop: 0,
|
|
|
+ duration: 300
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
// 输入时限制小数位数
|
|
|
handleInput(event, field, maxDecimals) {
|
|
|
let value = event.detail.value;
|
|
|
@@ -1122,6 +1270,10 @@ const _sfc_main = {
|
|
|
targetIndex--;
|
|
|
continue;
|
|
|
}
|
|
|
+ if (stepId === 8 && !this.shouldShowWorkStep) {
|
|
|
+ targetIndex--;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
if (targetIndex >= 0) {
|
|
|
@@ -1146,6 +1298,7 @@ const _sfc_main = {
|
|
|
let targetIndex = nextIndex;
|
|
|
while (targetIndex < this.steps.length) {
|
|
|
const stepId = this.steps[targetIndex].id;
|
|
|
+ console.log(this.steps[targetIndex].id);
|
|
|
if (stepId === 3 && !this.shouldShowFamilyStep) {
|
|
|
targetIndex++;
|
|
|
continue;
|
|
|
@@ -1158,10 +1311,16 @@ const _sfc_main = {
|
|
|
targetIndex++;
|
|
|
continue;
|
|
|
}
|
|
|
+ if (stepId === 8 && !this.shouldShowWorkStep) {
|
|
|
+ targetIndex++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
if (targetIndex < this.steps.length) {
|
|
|
this.currentStep = this.steps[targetIndex].id;
|
|
|
+ } else {
|
|
|
+ console.log("当前步骤是最后一个需要显示的步骤,显示提交按钮");
|
|
|
}
|
|
|
common_vendor.index.pageScrollTo({
|
|
|
scrollTop: 0,
|
|
|
@@ -1194,13 +1353,32 @@ const _sfc_main = {
|
|
|
common_vendor.index.hideLoading();
|
|
|
console.log(res);
|
|
|
if (res.data.code === 200) {
|
|
|
- const nextIndex = this.currentStepIndex + 1;
|
|
|
- if (nextIndex < this.steps.length) {
|
|
|
- this.currentStep = this.steps[nextIndex].id;
|
|
|
- common_vendor.index.pageScrollTo({
|
|
|
- scrollTop: 0,
|
|
|
- duration: 300
|
|
|
- });
|
|
|
+ let targetIndex = this.currentStepIndex + 1;
|
|
|
+ while (targetIndex < this.steps.length) {
|
|
|
+ const stepId = this.steps[targetIndex].id;
|
|
|
+ if (stepId === 3 && !this.shouldShowFamilyStep) {
|
|
|
+ targetIndex++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (stepId === 5 && !this.shouldShowEducationStep) {
|
|
|
+ targetIndex++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (stepId === 6 && !this.shouldShowSkillsStep) {
|
|
|
+ targetIndex++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (stepId === 8 && !this.shouldShowWorkStep) {
|
|
|
+ targetIndex++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (targetIndex < this.steps.length) {
|
|
|
+ this.currentStep = this.steps[targetIndex].id;
|
|
|
+ common_vendor.index.pageScrollTo({ scrollTop: 0, duration: 300 });
|
|
|
+ } else {
|
|
|
+ console.log("身份验证通过后,当前步骤是最后一个需要显示的步骤,显示提交按钮");
|
|
|
}
|
|
|
this.setUserInfo(this.formData);
|
|
|
} else {
|
|
|
@@ -1343,6 +1521,9 @@ const _sfc_main = {
|
|
|
},
|
|
|
complete: () => {
|
|
|
this.isLoading = false;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.ensureValidStep();
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
@@ -2148,14 +2329,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
}, $options.showPrevButton ? {
|
|
|
ea: common_vendor.o((...args) => $options.prevStep && $options.prevStep(...args))
|
|
|
} : {}, {
|
|
|
- eb: $options.showNextButton
|
|
|
- }, $options.showNextButton ? {
|
|
|
- ec: common_vendor.o((...args) => $options.nextStep && $options.nextStep(...args))
|
|
|
- } : {}, {
|
|
|
- ed: $options.showSubmitButton
|
|
|
+ eb: $options.showSubmitButton
|
|
|
}, $options.showSubmitButton ? {
|
|
|
- ee: common_vendor.o((...args) => $options.submitForm && $options.submitForm(...args))
|
|
|
- } : {});
|
|
|
+ ec: common_vendor.o((...args) => $options.submitForm && $options.submitForm(...args))
|
|
|
+ } : {
|
|
|
+ ed: common_vendor.o((...args) => $options.nextStep && $options.nextStep(...args))
|
|
|
+ });
|
|
|
}
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
|
wx.createPage(MiniProgramPage);
|