import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,ModalController } from 'ionic-angular';
import {SelectTypePage} from "../select-type/select-type";
import {AppService} from "../../../../service/appHttpService";

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

  editIndex;
  temp = {
      title:'',
      id:''
  };
  contentList = [];
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public modalCtrl: ModalController,public appService:AppService) {
  }
    qList = [
        {name:'测试'},
        {name:'测试'},
        {name:'测试'},
        {name:'测试'}
    ];

  ionViewDidLoad() {
      this.temp = this.navParams.get('item');
      console.log(this.temp);
    this.getDetail();
  }

  getDetail(){
      this.appService.ObserverHttpGet('/wisdomgroup/modules/question/findQuesByQuestionId',{id:this.temp.id})
          .subscribe(
              (res)=>{
                 this.contentList = res.datalist;
              }
          )
  }

  //添加题目
    add(){
     this.navCtrl.push('SelectTypePage',{
         temp:this.temp
     })
    }

    //操作
    itemEdit(index){
      this.editIndex = index;
    }

    //查看
    look(){
        this.navCtrl.push('DetailPage');
    }

    //设置
    set(){
      this.navCtrl.push('SetPage');
    }

    //保存
    save(){

    }

}
