yangyongyong преди 4 години
родител
ревизия
3b11885c55
променени са 1 файла, в които са добавени 12 реда и са изтрити 4 реда
  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();
+          }
+        } );
       });
   },
   //选择问题 多选