Commit c5004ead authored by wangqinghua's avatar wangqinghua

color

parent d16ab6c0
......@@ -43,7 +43,8 @@
<ion-item>
<ion-label class="set-font" color="primary">必须回答</ion-label>
<ion-toggle checked="false"></ion-toggle>
<ion-toggle *ngIf="isAns == 2" [checked]="false" (ionChange)="isAnsChange(1)"></ion-toggle>
<ion-toggle *ngIf="isAns == 1" [checked]="true" (ionChange)="isAnsChange(2)"></ion-toggle>
</ion-item>
<!--多选题-->
......
......@@ -20,6 +20,7 @@ export class CreatePage {
temp; //问卷信息
title; //标题
index = 0; //序号
isAns = 2; //是否必答
quesDescList = [];
set = { //设置
lastchange: '1',
......@@ -34,13 +35,15 @@ export class CreatePage {
ionViewDidLoad() {
this.temp = this.navParams.get('temp'); //问卷信息
if(this.navParams.get('edit')){ //编辑
if (this.navParams.get('edit')) { //编辑
this.editTemp = this.navParams.get('edit');
this.editIndex = this.navParams.get('index');
this.editIndex = this.navParams.get('index');
this.qType = this.editTemp[this.editIndex].quesType;
this.title = this.editTemp[this.editIndex].title;
this.isAns = this.editTemp[this.editIndex].isAns;
this.quesDescList = this.editTemp[this.editIndex].quesDesc;
}else{ //新增
console.log(this.editTemp[this.editIndex]);
} else { //新增
this.qType = this.navParams.get('type'); //题目类型
}
}
......@@ -52,7 +55,7 @@ export class CreatePage {
isNeed: 1, // 1是 2否
index: this.index
}; //序号
this.index ++;
this.index++;
this.quesDescList.push(option);
}
......@@ -60,13 +63,19 @@ export class CreatePage {
this.quesDescList.splice(i, 1);
}
//是否必答
isAnsChange(type){
this.isAns = type;
}
//提交编辑问卷
submitEdit(){
if( !this.check() ){
submitEdit() {
if (!this.check()) {
return false;
}
let newArr = [];
this.editTemp[this.editIndex].title = this.title;
this.editTemp[this.editIndex].isAns = this.isAns;
for (let i = 0; i < this.editTemp.length; i++) {
const arr = {
questionId: this.temp.id,
......@@ -104,11 +113,11 @@ export class CreatePage {
//提交问卷
submit() {
if( !this.check() ){
if (!this.check()) {
return false;
}
if( this.qType == 1 ){
if (this.qType == 1) {
const option1 = {
option_title: '是', //选项文字
canFill: 2, // 1是 2否
......@@ -157,24 +166,24 @@ export class CreatePage {
}
//校验
check(){
if(!this.title){
this.appService.popToastView('请输入标题','middle',1000);
check() {
if (!this.title) {
this.appService.popToastView('请输入标题', 'middle', 1000);
return false;
}
if(this.qType == 2 || this.qType ==3){
if(this.quesDescList.length == 0){
this.appService.popToastView('请输入选项','middle',1000);
if (this.qType == 2 || this.qType == 3) {
if (this.quesDescList.length == 0) {
this.appService.popToastView('请输入选项', 'middle', 1000);
return false;
}else{
} else {
let index = 0;
this.quesDescList.forEach((res)=>{
if(res.option_title.length == ''){
index ++;
this.quesDescList.forEach((res) => {
if (res.option_title.length == '') {
index++;
}
});
if(index > 0){
this.appService.popToastView('请输入选项','middle',1000);
if (index > 0) {
this.appService.popToastView('请输入选项', 'middle', 1000);
return false;
}
......
......@@ -54,7 +54,7 @@
<p class="survey-title">{{temp?.title}}</p>
<div class="footter-opr">
<div *ngIf="swiperIndex == 0" (click)="edit()"><span>编辑</span></div>
<div *ngIf="swiperIndex == 1" (click)="look()"><span>查看</span></div>
<div *ngIf="swiperIndex == 1" (click)="edit()"><span>查看</span></div>
<div *ngIf="swiperIndex == 1" (click)="overDue()"><span>设为过期</span></div>
<div *ngIf="swiperIndex == 0" (click)="release()"><span>发布</span></div>
<div *ngIf="swiperIndex == 1 || swiperIndex == 2" (click)="result()"><span>结果</span></div>
......
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