Commit 41126371 authored by wangqinghua's avatar wangqinghua

问卷调查

parent 1b2d899b
...@@ -81,7 +81,7 @@ export class DutyPage { ...@@ -81,7 +81,7 @@ export class DutyPage {
}; };
this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/getScheduleInfo',data) this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/getScheduleInfo',data)
.subscribe((res)=>{ .subscribe((res)=>{
this.dayObj = res; this.dayObj = res.json();
}); });
const data1 = { const data1 = {
...@@ -90,7 +90,7 @@ export class DutyPage { ...@@ -90,7 +90,7 @@ export class DutyPage {
}; };
this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/getScheduleInfo',data1) this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/getScheduleInfo',data1)
.subscribe((res)=>{ .subscribe((res)=>{
this.nightObj = res; this.nightObj = res.json();
}); });
} }
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<div (click)="itemEdit(item)"><span>编辑</span></div> <div (click)="itemEdit(item)"><span>编辑</span></div>
<div (click)="itemUp(item)"><span>上移</span></div> <div (click)="itemUp(item)"><span>上移</span></div>
<div (click)="itemDown(item)"><span>下移</span></div> <div (click)="itemDown(item)"><span>下移</span></div>
<div (click)="itemDelete(item)"><span>删除</span></div> <div (click)="itemDelete(i)"><span>删除</span></div>
</div> </div>
</ion-item> </ion-item>
</div> </div>
......
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,ModalController } from 'ionic-angular'; import {IonicPage, NavController, NavParams, ModalController, ToastController, AlertController} from 'ionic-angular';
import {SelectTypePage} from "../select-type/select-type"; import {SelectTypePage} from "../select-type/select-type";
import {AppService} from "../../../../service/appHttpService"; import {AppService} from "../../../../service/appHttpService";
import {message} from "../../../../app/main";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -13,11 +14,12 @@ export class EditPage { ...@@ -13,11 +14,12 @@ export class EditPage {
editIndex; editIndex;
temp = { temp = {
title:'', title:'',
id:'' id:'',
}; };
contentList = []; contentList = [];
constructor(public navCtrl: NavController, public navParams: NavParams, constructor(public navCtrl: NavController, public navParams: NavParams,
public modalCtrl: ModalController,public appService:AppService) { public modalCtrl: ModalController,public appService:AppService,
public toastCtrl: ToastController,public alertCtrl: AlertController) {
} }
qList = [ qList = [
{name:'测试'}, {name:'测试'},
...@@ -28,7 +30,7 @@ export class EditPage { ...@@ -28,7 +30,7 @@ export class EditPage {
ionViewDidEnter() { ionViewDidEnter() {
this.temp = this.navParams.get('temp'); this.temp = this.navParams.get('temp');
this.getDetail(); this.getDetail();
} }
getDetail(){ getDetail(){
...@@ -55,6 +57,39 @@ export class EditPage { ...@@ -55,6 +57,39 @@ export class EditPage {
this.editIndex = index; this.editIndex = index;
} }
//上移
itemUp(item){
}
//下移
itemDown(item){
}
//删除
itemDelete(index){
const confirm = this.alertCtrl.create({
title: '确认删除该题目?',
buttons: [
{
text: '取消',
handler: () => {
console.log('Disagree clicked');
}
},
{
text: '确认',
handler: () => {
this.contentList.splice(index,1);
this.editIndex = null;
}
}
]
});
confirm.present();
}
//查看 //查看
look(){ look(){
this.navCtrl.push('DetailPage',{ this.navCtrl.push('DetailPage',{
...@@ -71,7 +106,38 @@ export class EditPage { ...@@ -71,7 +106,38 @@ export class EditPage {
//保存 //保存
save(){ save(){
let newArr = [];
for( let i = 0;i<this.contentList.length;i++ ){
const arr = {
questionId: this.temp.id,
isAns: this.contentList[i].isAns,
quesType: this.contentList[i].quesType,
title: this.contentList[i].title,
limit: this.contentList[i].limit, //问答的字数限制
quesDesc: this.contentList[i].quesDesc,
minOps: this.contentList[i].minOps,
maxOps: this.contentList[i].maxOps,
index: this.contentList[i].index //序号
};
newArr.push(arr);
}
console.log(newArr);
const data = {
array: JSON.stringify(newArr),
id:this.temp.id
};
console.log(data);
const toast = this.toastCtrl.create(message);
this.appService.ObserverHttpPost('/wisdomgroup/modules/question/saveQuestion', data)
.subscribe(
(res) => {
toast.setMessage('编辑成功');
toast.present();
setTimeout((res) => {
this.getDetail();
}, 2000)
}
)
} }
} }
...@@ -9,9 +9,18 @@ ...@@ -9,9 +9,18 @@
<ion-content padding> <ion-content padding>
<p class="title">请选择需要添加的题型</p> <p class="title">请选择需要添加的题型</p>
<div> <div>
<p><button class="submit-btn submit" (click)="select(1)">判断题</button></p> <p><button class="submit-btn submit" (click)="select(1)">
<p><button class="submit-btn submit" (click)="select(2)">单选题</button></p> <img src="../../../../assets/imgs/survey/judge.png" alt="">
<p><button class="submit-btn submit" (click)="select(3)">多选题</button></p> <span>判断题</span>
<p><button class="submit-btn submit" (click)="select(4)">问答题</button></p> </button></p>
<p><button class="submit-btn submit" (click)="select(2)">
<img src="../../../../assets/imgs/survey/single.png" alt="">
<span>单选题</span></button></p>
<p><button class="submit-btn submit" (click)="select(3)">
<img src="../../../../assets/imgs/survey/multi.png" alt="">
<span>多选题</span></button></p>
<p><button class="submit-btn submit" (click)="select(4)">
<img src="../../../../assets/imgs/survey/qa.png" alt="">
<span>问答题</span></button></p>
</div> </div>
</ion-content> </ion-content>
...@@ -3,4 +3,14 @@ page-select-type { ...@@ -3,4 +3,14 @@ page-select-type {
font-size: 1.6rem; font-size: 1.6rem;
margin-bottom: 3rem; margin-bottom: 3rem;
} }
img{
width: 2.2rem;
vertical-align: middle;
}
.submit-btn{
display: flex;
align-items: center;
justify-content: center;
color: #333333;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment