|
@@ -13,7 +13,7 @@ Page({
|
|
|
},
|
|
|
getservantlist(subjectType){
|
|
|
request.httpServiceGet(apiUrl.servantappletservicePath,{subjectType:subjectType}).then(data=>{
|
|
|
- console.log(data);
|
|
|
+ //console.log(data);
|
|
|
this.setData({
|
|
|
servantlist: data
|
|
|
});
|
|
@@ -41,8 +41,53 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
answerselected(e){
|
|
|
- let checkeditem=e.detail.value;
|
|
|
- console.log(checkeditem);
|
|
|
+ //console.log(e.target.dataset.id);
|
|
|
+ //console.log(e.detail.value);
|
|
|
+
|
|
|
+ let checkedlist=e.detail.value;
|
|
|
+ let servantlist=this.data.servantlist;
|
|
|
+ //先做清除
|
|
|
+ for(let i=0;i<servantlist.length;i++){
|
|
|
+ for(let j=0;j<servantlist[i].subjectList.length;j++){
|
|
|
+ if(servantlist[i].subjectList[j].subjectId==e.target.dataset.id){
|
|
|
+ for(let t=0;t<servantlist[i].subjectList[j].answer.length;t++){
|
|
|
+ servantlist[i].subjectList[j].answer[t].isChoose=0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //添加选中
|
|
|
+ for(let i=0;i<servantlist.length;i++){
|
|
|
+ for(let j=0;j<servantlist[i].subjectList.length;j++){
|
|
|
+ if(servantlist[i].subjectList[j].subjectId==e.target.dataset.id){
|
|
|
+ for(let t=0;t<servantlist[i].subjectList[j].answer.length;t++){
|
|
|
+ for(let u=0;u<checkedlist.length;u++){
|
|
|
+ if(checkedlist[u]==servantlist[i].subjectList[j].answer[t].answer){
|
|
|
+ servantlist[i].subjectList[j].answer[t].isChoose=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ servantlist: servantlist
|
|
|
+ })
|
|
|
+ },
|
|
|
+ customanswer(e){
|
|
|
+ console.log(e.target.dataset.id);
|
|
|
+ let servantlist=this.data.servantlist;
|
|
|
+ for(let i=0;i<servantlist.length;i++){
|
|
|
+ for(let j=0;j<servantlist[i].subjectList.length;j++){
|
|
|
+ if(servantlist[i].subjectList[j].subjectId==e.target.dataset.id){
|
|
|
+ servantlist[i].subjectList[j].customAnswer = e.detail.value;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ servantlist: servantlist
|
|
|
+ })
|
|
|
},
|
|
|
});
|
|
|
|