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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {AppService} from "../../../../../service/http.service";
@IonicPage()
@Component({
selector: 'page-set',
templateUrl: 'set.html',
})
export class SetPage {
id; // 问卷ID;
isans = null; //匿名
isopen; //公开
temp = {
id: '',
isopen: null,
isans: null,
title: '',
explai: '',
usergroup: '',
state: ''
};
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() {
//是否匿名
if (this.isans == true || this.isans == 1) {
this.temp.isans = 1;
} else {
this.temp.isans = 2;
}
//是否公开问卷结果
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)
.subscribe((res) => {
if (res) {
this.navCtrl.pop();
}
})
}
}