Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {AppService} from "../../../../service/http.service";
import {Storage} from "@ionic/storage";
import {SurveyResultPage} from "../survey-result/survey-result";
@IonicPage()
@Component({
selector: 'page-survey-preview',
templateUrl: 'survey-preview.html',
})
export class SurveyPreviewPage {
item;
userId;
survey;
contentList;
constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService, public storage: Storage) {
}
ionViewDidLoad() {
this.item = this.navParams.get('item');
this.getInfo()
}
getInfo() {
this.storage.get('user').then((res) => {
this.userId = res.id;
const data = {
userId: this.userId,
id: this.item.id
};
this.appService.ObserverHttpPost('/wisdomgroup/modules/question/showOnApp', data)
.subscribe((res) => {
this.survey = res.json().data;
this.contentList = res.json().data.ques.datalist;
this.contentList.forEach(e => {
const selectArr = e.option.answerdesc.split(",");
e.quesDesc = JSON.parse(e.quesDesc);
if (e.quesType == 3 && e.option) {
e.quesDesc.forEach(data=>{
if( selectArr.indexOf(data.index +"") != -1 ){
data.select = true;
}else{
data.select = false;
}
});
}
});
})
});
}
goToResult() {
this.navCtrl.push('SurveyResultPage', {item: this.survey});
}
}