|
@@ -489,24 +489,60 @@ Page({
|
|
|
|
|
|
|
|
var isFinish = true;
|
|
var isFinish = true;
|
|
|
var emptyKey = "";
|
|
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发送到服务器
|
|
// 将surveyData发送到服务器
|
|
|
console.log('提交的问卷数据:', surveyData);
|
|
console.log('提交的问卷数据:', surveyData);
|