Skip to content
set.ts 1.54 KiB
Newer Older
wangqinghua's avatar
wangqinghua committed
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
wangqinghua's avatar
wangqinghua committed
import {AppService} from "../../../../service/appHttpService";
wangqinghua's avatar
wangqinghua committed


@IonicPage()
@Component({
  selector: 'page-set',
  templateUrl: 'set.html',
})
export class SetPage {

wangqinghua's avatar
wangqinghua committed
    temp = {
        id:'',
        isopen:null,
        isans:null,
        title:'',
        explai:'',
        usergroup:'',
        state:''
    };
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public appService: AppService) {
wangqinghua's avatar
wangqinghua committed
  }

  ionViewDidLoad() {
wangqinghua's avatar
wangqinghua committed
      this.temp = this.navParams.get('temp');
        console.log(this.temp);
  }

  save(){
     if( this.temp.isans == true || this.temp.isans == 1 ){
         this.temp.isans = 1;
     }else{
         this.temp.isans = 0;
     }
      if( this.temp.isopen == true || this.temp.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   //状态
      };
console.log(this.temp);
        this.appService.ObserverHttpPost('/wisdomgroup/modules/question/updateOnApp', data)
            .subscribe((res)=>{
                if(res){
                    this.navCtrl.pop();
                }
            })
wangqinghua's avatar
wangqinghua committed
  }

}