Browse Source

新设置阿姨偏好

yangyongyong 4 years ago
parent
commit
3b11885c55
1 changed files with 12 additions and 4 deletions
  1. 12 4
      client/pages/servant/servantsettings/servantsettings.js

+ 12 - 4
client/pages/servant/servantsettings/servantsettings.js

@@ -45,18 +45,26 @@ Page({
           let answerstr='';
             for(let t=0;t<this.data.servantlist[i].subjectList[j].answer.length;t++){
                 if(this.data.servantlist[i].subjectList[j].answer[t].isChoose){
-                  answerstr += this.data.servantlist[i].subjectList[j].answer[t].answer+',';
+                  answerstr += this.data.servantlist[i].subjectList[j].answer[t].answer +',';
                 }
             }
           //console.log(answerstr);
-          servantselectedlist.push({answer: [answerstr],customAnswer: this.data.servantlist[i].subjectList[j].subject,subjectId: this.data.servantlist[i].subjectList[j].subjectId});
+          if(answerstr.length>0||this.data.servantlist[i].subjectList[j].customAnswer.length>0){
+            answerstr=answerstr.substring(0,answerstr.length - 1);
+            servantselectedlist.push({answer: [answerstr],customAnswer: this.data.servantlist[i].subjectList[j].customAnswer,subjectId: this.data.servantlist[i].subjectList[j].subjectId});
+          }
         }
     }
         //console.log(servantselectedlist);
       request.httpServicePost(apiUrl.insertNewservantappletservicePath,{employRelationNo:employRelationNo,subjectList:servantselectedlist,subjectType:"SN000002"}).then(data=>{
         my.alert({
-          title: data,
-        });
+          title: '提示',
+          content: '设置完成',
+          buttonText: '确定',
+          success: () => {
+            my.navigateBack();
+          }
+        } );
       });
   },
   //选择问题 多选