Newer
Older
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
id: '',
isopen: null,
isans: null,
title: '',
explai: '',
usergroup: '',
state: ''
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
62
63
64
65
66
67
68
69
70
71
72
constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService) {
}
ionViewDidLoad() {
this.id = this.navParams.get('id');
this.appService.ObserverHttpPostAdd('/wisdomgroup/modules/question/edit/', this.id).subscribe((res) => {
this.temp = res.json().data;
if (this.temp.isans == 1) {
this.isans = true;
} else {
this.isans = false;
}
if (this.temp.isopen == 1) {
this.isopen = true;
} else {
this.isopen = false;
}
});
}
save() {
//是否匿名
console.log(this.isans);
if (this.isans == true || this.isans == 1) {
this.temp.isans = 1;
} else {
this.temp.isans = 2;
}
console.log(this.temp.isans);
//是否公开问卷结果
if (this.isopen == true || this.isopen == 1) {
this.temp.isopen = 1;
} else {
this.temp.isopen = 0;
}
const data = {
id: this.temp.id,
title: this.temp.title, //问卷标题
explai: this.temp.explai, //问卷说明
usergroup: this.temp.usergroup, //用户组id
isopen: this.temp.isopen, //是否公开
isans: this.temp.isans, //是否匿名
state: this.temp.state //状态
};
this.appService.ObserverHttpPost('/wisdomgroup/modules/question/updateOnApp', data)