yangg 2 ماه پیش
والد
کامیت
66b8135ec8

+ 217 - 17
pages/Personal/Personal.vue

@@ -621,18 +621,18 @@
 				class="nav-btn prev-btn" 
 				@click="prevStep"
 			>上一步</button>
-			
-			<button 
-				v-if="showNextButton" 
-				class="nav-btn next-btn" 
-				@click="nextStep"
-			>下一步</button>
-			
 			<button 
 				v-if="showSubmitButton" 
 				class="submit-btn" 
 				@click="submitForm"
 			>提交</button>
+			<button 
+				v-else
+				class="nav-btn next-btn" 
+				@click="nextStep"
+			>下一步</button>
+			<!-- v-if="showNextButton"  -->
+			
 		</view>
 	</view>
 </template>
@@ -838,16 +838,100 @@ import { apiBaseUrl } from '@/common/config.js';
 			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() {
@@ -994,8 +1078,93 @@ import { apiBaseUrl } from '@/common/config.js';
 				const fields = ['relation', 'name', 'workplace', 'position', 'phone'];
 				return fields.some(field => this.safeFamilyFieldsConfig[field]?.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 => this.safeWorkFieldsConfig[field]?.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;
+					
+					// 滚动到页面顶部
+					uni.pageScrollTo({
+						scrollTop: 0,
+						duration: 300
+					});
+				}
+			},
 			 // 输入时限制小数位数
 			 handleInput(event, field, maxDecimals) {
 				let value = event.detail.value;
@@ -1848,6 +2017,11 @@ import { apiBaseUrl } from '@/common/config.js';
 							targetIndex--;
 							continue;
 						}
+						// 如果是工作经历步骤且不需要显示,则跳过
+						if (stepId === 8 && !this.shouldShowWorkStep) {
+							targetIndex--;
+							continue;
+						}
 						
 						// 找到有效步骤,跳出循环
 						break;
@@ -1884,7 +2058,7 @@ import { apiBaseUrl } from '@/common/config.js';
 					// 检查下一步是否需要跳过
 					while (targetIndex < this.steps.length) {
 						const stepId = this.steps[targetIndex].id;
-						
+							console.log(this.steps[targetIndex].id)
 						// 如果是家庭成员步骤且不需要显示,则跳过
 						if (stepId === 3 && !this.shouldShowFamilyStep) {
 							targetIndex++;
@@ -1900,14 +2074,24 @@ import { apiBaseUrl } from '@/common/config.js';
 							targetIndex++;
 							continue;
 						}
+						// 如果是工作经历步骤且不需要显示,则跳过
+						if (stepId === 8 && !this.shouldShowWorkStep) {
+							targetIndex++;
+							continue;
+						}
 						
 						// 找到有效步骤,跳出循环
 						break;
+
 					}
 					
 					// 如果找到有效步骤,跳转到该步骤
 					if (targetIndex < this.steps.length) {
 						this.currentStep = this.steps[targetIndex].id;
+					} else {
+						// 如果没有找到下一个有效步骤,说明当前步骤是最后一个需要显示的步骤
+						// 此时应该显示提交按钮,不需要跳转
+						console.log('当前步骤是最后一个需要显示的步骤,显示提交按钮');
 					}
 					
 					// 滚动到页面顶部
@@ -1946,13 +2130,23 @@ import { apiBaseUrl } from '@/common/config.js';
 						console.log(res);
 						if (res.data.code === 200) {
 							// 验证通过,进入下一步
-							const nextIndex = this.currentStepIndex + 1;
-							if (nextIndex < this.steps.length) {
-								this.currentStep = this.steps[nextIndex].id;
-								uni.pageScrollTo({
-									scrollTop: 0,
-									duration: 300
-								});
+							let targetIndex = this.currentStepIndex + 1;
+							// 跳过不需要显示的步骤(与 nextStep 保持一致)
+							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;
+								uni.pageScrollTo({ scrollTop: 0, duration: 300 });
+							} else {
+								// 如果没有找到下一个有效步骤,说明当前步骤是最后一个需要显示的步骤
+								// 此时应该显示提交按钮,不需要跳转
+								console.log('身份验证通过后,当前步骤是最后一个需要显示的步骤,显示提交按钮');
 							}
 							/* 保存姓名 */
 							this.setUserInfo(this.formData);
@@ -2134,6 +2328,11 @@ import { apiBaseUrl } from '@/common/config.js';
 					},
 					complete: () => {
 						this.isLoading = false;
+						
+						// 数据加载完成后,检查当前步骤是否需要显示
+						this.$nextTick(() => {
+							this.ensureValidStep();
+						});
 					}
 				});
 			},
@@ -3311,3 +3510,4 @@ import { apiBaseUrl } from '@/common/config.js';
 	} */
 </style>
 
+

+ 195 - 16
unpackage/dist/dev/mp-weixin/pages/Personal/Personal.js

@@ -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);

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/Personal/Personal.wxml


+ 1 - 1
unpackage/dist/dev/mp-weixin/project.config.json

@@ -8,7 +8,7 @@
     "urlCheck": false,
     "es6": true,
     "postcss": false,
-    "minified": false,
+    "minified": true,
     "newFeature": true,
     "bigPackageSizeSupport": true,
     "babelSetting": {

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است