柒零 преди 1 година
родител
ревизия
115d259ac5

+ 53 - 17
subpages/constitutionDiagnosis/constitutionDiagnosis.js

@@ -489,24 +489,60 @@ Page({
 
 		var isFinish = true;
 		var emptyKey = "";
+		let checkList = {
+			bodySynthesis: this.data.bodySynthesis,
+			facialFeatures: this.data.facialFeatures,
+			skinHair: this.data.skinHair,
+			emotion: this.data.emotion,
+			menstruation: this.data.menstruation,
+			character: this.data.character,
+			sleep: this.data.sleep,
+			tongueState: this.data.tongueState
+		}
 
-		// if (!isFinish) {
-		// 	wx.showModal({
-		// 		title: '无法提交',
-		// 		content: '您还有部分题目未完成,请检查后重新提交',
-		// 		showCancel: false,
-		// 		confirmColor: '#0BC3AA',
-		// 		confirmText: "好的",
-		// 		success(res) {
-		// 			console.log(emptyKey.toString());
-		// 			that.setData({
-		// 				mInputId: emptyKey.toString()
-		// 			})
-
-		// 		}
-		// 	})
-		// 	return;
-		// }
+		for (const key in checkList) {
+			if (checkList.hasOwnProperty(key)) {
+				const element = checkList[key];
+				if (!element || (Array.isArray(element) && element.length <= 0)) { // 检查属性值是否为空  
+					// 这里可以添加更复杂的判断,比如仅针对字符串检查是否为空字符串  
+					// if (typeof obj[key] === 'string' && obj[key].trim() === '') {  
+					isFinish = false;
+					emptyKey = key;
+					wx.showModal({
+						title: '无法提交',
+						content: '您还有部分题目未完成,请检查后重新提交',
+						showCancel: false,
+						confirmColor: '#0BC3AA',
+						confirmText: "好的",
+						success(res) {
+							console.log(emptyKey.toString());
+							that.setData({
+								mInputId: emptyKey.toString()
+							})
+
+						}
+					})
+					return; // 停止循环  
+				}
+			}
+		}
+		if (!isFinish) {
+			wx.showModal({
+				title: '无法提交',
+				content: '您还有部分题目未完成,请检查后重新提交',
+				showCancel: false,
+				confirmColor: '#0BC3AA',
+				confirmText: "好的",
+				success(res) {
+					console.log(emptyKey.toString());
+					that.setData({
+						mInputId: emptyKey.toString()
+					})
+
+				}
+			})
+			return;
+		}
 
 		// 将surveyData发送到服务器  
 		console.log('提交的问卷数据:', surveyData);

+ 1 - 1
subpages/constitutionDiagnosis/constitutionDiagnosis.wxml

@@ -133,7 +133,7 @@
 			</view>
 
 			<!-- 提交按钮 --><text class="commit-btn" bindtap="submitSurvey">提交问卷</text>
-			<text class="export-btn" bindtap="export">导出</text>
+			<!-- <text class="export-btn" bindtap="export">导出</text> -->
 			<view style="height: 80rpx;"></view>
 			<!-- <view class="bottom-view">
       <text style="font-weight:600">感谢您的参与和支持!</text>

+ 1 - 1
subpages/constitutionDiagnosis/constitutionDiagnosis.wxss

@@ -200,7 +200,7 @@ input {
   display: block;
   color: #FFFFFF;
   font-size: 32rpx;
-  margin: 80rpx auto 40rpx auto;
+  margin: 80rpx auto 80rpx auto;
   background: linear-gradient(278deg, #0ABCA4 0%, rgba(11, 195, 170, 0.8) 100%);
 }