Commit 1b2d899b authored by wangqinghua's avatar wangqinghua

问卷调查

parent 68f53ae9
......@@ -7,7 +7,7 @@
"proxies": [
{
"path": "/wisdomgroup",
"proxyUrl": "http://180.168.156.212:2931/wisdomgroup"
"proxyUrl": "http://10.10.200.34:8080/wisdomgroup"
}
]
}
\ No newline at end of file
......@@ -28,6 +28,10 @@
height: 35px;
}
.text-center{
text-align: center;
}
//tabs-icon
ion-icon {
&[class*="custom-"] {
......
......@@ -6,3 +6,8 @@ platformBrowserDynamic().bootstrapModule(AppModule);
export const monthCh = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
export const weekDay = ['日', '一', '二', '三', '四', '五', '六'];
export const message = {
duration:2000,
cssClass:'text-center',
position:'middle',
};
\ No newline at end of file
......@@ -32,9 +32,9 @@
<ion-item>
<ion-label>字数限制</ion-label>
<ion-select [(ngModel)]="set.more">
<ion-option value="1">1</ion-option>
<ion-option value="2">2</ion-option>
<ion-option value="3">3</ion-option>
<ion-option value="100">100</ion-option>
<ion-option value="200">200</ion-option>
<ion-option value="300">300</ion-option>
</ion-select>
</ion-item>
</ng-container>
......@@ -48,13 +48,13 @@
<ng-container *ngIf="qType == 3">
<ion-item>
<ion-label>最少选择</ion-label>
<ion-select [(ngModel)]="lastchange">
<ion-select [(ngModel)]="set.lastchange">
<ion-option value="1">1</ion-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label>最多选择</ion-label>
<ion-select [(ngModel)]="morechange">
<ion-select [(ngModel)]="set.morechange">
<ion-option value="1">1</ion-option>
<ion-option value="2">2</ion-option>
<ion-option value="3">3</ion-option>
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angular';
import {EditPage} from "../edit/edit";
import {AppService} from "../../../../service/appHttpService";
import {message} from "../../../../app/main";
@IonicPage()
@Component({
selector: 'page-create',
templateUrl: 'create.html',
selector: 'page-create',
templateUrl: 'create.html',
})
export class CreatePage {
qType; //题目类型
qType; //题目类型
temp; //问卷信息
titile; //标题
titile; //标题
quesDescList = [ //选项
{
option_title:'' , //选项文字
canFill:2, // 1是 2否
isNeed:1, // 1是 2否
index:0 //序号
option_title: '', //选项文字
canFill: 2, // 1是 2否
isNeed: 1, // 1是 2否
index: 0 //序号
},
]
lastchange;
morechange;
set:{ //设置
lastchange:'1',
morechange:'1',
isAns :''
};
];
set = { //设置
lastchange: '1',
morechange: '1',
isAns: '',
more: '100'
};
constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService) {
}
constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService, public toastCtrl: ToastController) {
}
ionViewDidLoad() {
this.qType = this.navParams.get('type');
this.temp = this.navParams.get('temp');
}
ionViewDidLoad() {
this.qType = this.navParams.get('type');
this.temp = this.navParams.get('temp');
}
addOption(){
const option = {
option_title:'' , //选项文字
canFill:2, // 1是 2否
isNeed:1, // 1是 2否
index:0
}; //序号
this.quesDescList.push(option);
addOption() {
const option = {
option_title: '', //选项文字
canFill: 2, // 1是 2否
isNeed: 1, // 1是 2否
index: 0
}; //序号
this.quesDescList.push(option);
}
removeOption(i){
this.quesDescList.splice(i,1);
removeOption(i) {
this.quesDescList.splice(i, 1);
}
submit(){
// this.navCtrl.push('EditPage');
submit() {
// this.navCtrl.push('EditPage');
const arr = [
{
questionId:this.temp.id,
isAns:1,
quesType:this.qType,
title:this.titile,
limit:1000, //问答的字数限制
quesDesc:this.quesDescList,
minOps:0,
maxOps:0,
index:0 //序号
questionId: this.temp.id,
isAns: 1,
quesType: this.qType,
title: this.titile,
limit: 1000, //问答的字数限制
quesDesc: this.quesDescList,
minOps: 0,
maxOps: 0,
index: 0 //序号
}
]
const data ={
];
const data = {
array: JSON.stringify(arr)
};
console.log(data);
this.appService.ObserverHttpPost('/wisdomgroup/modules/question/saveQuestion',data)
console.log(this.temp);
const toast = this.toastCtrl.create(message);
this.appService.ObserverHttpPost('/wisdomgroup/modules/question/saveQuestion', data)
.subscribe(
(res)=>{
console.log(res);
(res) => {
toast.setMessage('添加成功');
toast.present();
setTimeout((res) => {
this.navCtrl.push('EditPage', {
temp: this.temp
});
}, 2000)
}
)
}
......
import { Component } from '@angular/core';
import {IonicPage, ModalController, NavController, NavParams} from 'ionic-angular';
import {IonicPage, ModalController, NavController, NavParams, ToastController} from 'ionic-angular';
import {EditPage} from "../edit/edit";
import {PersonPage} from "../../modal/person/person";
import { AppService } from "../../../../service/appHttpService";
import {message} from "../../../../app/main";
@IonicPage()
......@@ -19,12 +20,12 @@ export class DesicrPage {
isopen:0, //是否公开
isans:1, //是否匿名
state:1 //状态
};
groupName = '选择用户组';
constructor(public navCtrl: NavController, public navParams: NavParams,
public modalCtrl: ModalController,public appService: AppService) {
public modalCtrl: ModalController,public appService: AppService,
public toastCtrl: ToastController) {
}
ionViewDidLoad() {
......@@ -32,12 +33,16 @@ export class DesicrPage {
}
submitOrder(){
// this.navCtrl.push('EditPage');
const toast = this.toastCtrl.create(message);
const data = {}
this.appService.ObserverHttpPost('/wisdomgroup/modules/question/create',this.desrc)
.subscribe(
(res)=>{
this.navCtrl.pop();
toast.setMessage('创建成功');
toast.present();
setTimeout((res) => {
this.navCtrl.pop();
}, 2000);
}
)
}
......
......@@ -8,5 +8,25 @@
<ion-content padding>
<p>{{temp.title}}</p>
<ion-list *ngFor="let item of detail;let i = index;">
<p>{{i +1}}.{{item.title}}</p>
<ng-container *ngIf="item.quesType == 1">
<p><input type="radio"></p>
<p><input type="radio"></p>
</ng-container>
<ng-container *ngIf="item.quesType == 2">
<ng-container *ngFor=" let option1 of item.quesDesc">
<p>{{option1.option_title}}</p>
</ng-container>
</ng-container>
<ng-container *ngIf="item.quesType == 3">
<ng-container *ngFor=" let option2 of item.quesDesc">
<p>{{option2.option_title}}</p>
</ng-container>
</ng-container>
<ng-container *ngIf="item.quesType == 4">
<textarea placeholder="文字"></textarea>
</ng-container>
</ion-list>
</ion-content>
......@@ -9,13 +9,18 @@ import { AppService } from "../../../../service/appHttpService";
})
export class DetailPage {
temp; //问卷信息
temp = {
title:'',
id:''
}; //问卷信息
detail;
constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService) {
}
ionViewDidLoad() {
this.temp = this.navParams.get('item');
this.temp = this.navParams.get('temp');
console.log(this.temp);
this.getDetail();
}
......@@ -23,7 +28,10 @@ export class DetailPage {
this.appService.ObserverHttpGet('/wisdomgroup/modules/question/findQuesByQuestionId',{id:this.temp.id})
.subscribe(
(res)=>{
console.log(res);
this.detail = res.json().datalist;
for( let i = 0;i < this.detail.length;i++ ){
this.detail[i].quesDesc = JSON.parse(this.detail[i].quesDesc);
}
}
)
}
......
......@@ -17,8 +17,23 @@
<ion-item *ngFor="let item of contentList;let i = index" (click)="itemEdit(i)">
<div class="item-content">
<p>{{i +1}}.{{item.title}}</p>
<p><input type="radio"></p>
<p><input type="radio"></p>
<ng-container *ngIf="item.quesType == 1">
<p><input type="radio"></p>
<p><input type="radio"></p>
</ng-container>
<ng-container *ngIf="item.quesType == 2">
<ng-container *ngFor=" let option1 of item.quesDesc">
<p>{{option1.option_title}}</p>
</ng-container>
</ng-container>
<ng-container *ngIf="item.quesType == 3">
<ng-container *ngFor=" let option2 of item.quesDesc">
<p>{{option2.option_title}}</p>
</ng-container>
</ng-container>
<ng-container *ngIf="item.quesType == 4">
<textarea placeholder="文字"></textarea>
</ng-container>
</div>
<div class="item-opra" *ngIf="editIndex == i">
<div (click)="itemEdit(item)"><span>编辑</span></div>
......
......@@ -26,9 +26,8 @@ export class EditPage {
{name:'测试'}
];
ionViewDidLoad() {
this.temp = this.navParams.get('item');
console.log(this.temp);
ionViewDidEnter() {
this.temp = this.navParams.get('temp');
this.getDetail();
}
......@@ -36,7 +35,10 @@ export class EditPage {
this.appService.ObserverHttpGet('/wisdomgroup/modules/question/findQuesByQuestionId',{id:this.temp.id})
.subscribe(
(res)=>{
this.contentList = res.datalist;
this.contentList = res.json().datalist;
for( let i = 0;i < this.contentList.length;i++ ){
this.contentList[i].quesDesc = JSON.parse(this.contentList[i].quesDesc);
}
}
)
}
......@@ -55,12 +57,16 @@ export class EditPage {
//查看
look(){
this.navCtrl.push('DetailPage');
this.navCtrl.push('DetailPage',{
temp:this.temp
});
}
//设置
set(){
this.navCtrl.push('SetPage');
this.navCtrl.push('SetPage',{
temp:this.temp
});
}
//保存
......
......@@ -7,7 +7,7 @@
<ion-content padding>
<p>请选择需要添加的题型</p>
<p class="title">请选择需要添加的题型</p>
<div>
<p><button class="submit-btn submit" (click)="select(1)">判断题</button></p>
<p><button class="submit-btn submit" (click)="select(2)">单选题</button></p>
......
page-select-type {
.title{
font-size: 1.6rem;
margin-bottom: 3rem;
}
}
......@@ -13,13 +13,14 @@
<ion-item>
<ion-label>问卷结果公开</ion-label>
<ion-toggle [(ngModel)]="isopen"></ion-toggle>
<ion-toggle [(ngModel)]="temp.isopen"></ion-toggle>
</ion-item>
<ion-item>
<ion-label>匿名回答</ion-label>
<ion-toggle [(ngModel)]="isans"></ion-toggle>
<ion-toggle [(ngModel)]="temp.isans"></ion-toggle>
</ion-item>
</ion-list>
<button class="submit-btn submit" (click)="save()">确认</button>
</ion-content>
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {AppService} from "../../../../service/appHttpService";
@IonicPage()
......@@ -9,13 +10,51 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
})
export class SetPage {
isopen;
isans
constructor(public navCtrl: NavController, public navParams: NavParams) {
temp = {
id:'',
isopen:null,
isans:null,
title:'',
explai:'',
usergroup:'',
state:''
};
constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad SetPage');
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();
}
})
}
}
......@@ -37,7 +37,8 @@
</div>
<div class="content-button">
<span>参与人员:</span>
<span>{{item.groupName}}</span>
<span *ngIf="item.groupName">{{item.groupName}}</span>
<span *ngIf="!item.groupName">全体人员</span>
</div>
</div>
</ion-item>
......
......@@ -35,7 +35,7 @@ export class ListPage {
public appService: AppService) {
}
ionViewDidLoad() {
ionViewDidEnter() {
this.initSwiper();
this.selectPageMenu(0);
this.swiperIndex = 0;
......@@ -100,16 +100,19 @@ export class ListPage {
//创建
create(){
this.navCtrl.push('DesicrPage');
this.showOp = false;
this.navCtrl.push('DesicrPage');
}
//查看
look(){
this.navCtrl.push('EditPage',{item:this.temp});
this.showOp = false;
this.navCtrl.push('EditPage',{temp:this.temp});
}
//结果
result(){
this.showOp = false;
this.navCtrl.push('ResultPage');
}
......
......@@ -12,7 +12,14 @@
<div class="notice">
<div class="notice-card" *ngFor="let item of noticeList;">
<div class="notice-type">
<div class="type-img"></div>
<div class="type-img">
<img *ngIf="item.type == 1" src="../../../assets/imgs/notice/notice-zbpb.png" alt="">
<img *ngIf="item.type == 2" src="../../../assets/imgs/notice/notice-rzzf.png" alt="">
<img *ngIf="item.type == 3" src="../../../assets/imgs/notice/notice-srzf.png" alt="">
<img *ngIf="item.type == 4" src="../../../assets/imgs/notice/notice-hdtx.png" alt="">
<img *ngIf="item.type == 5" src="../../../assets/imgs/notice/notice-wcbb.png" alt="">
<img *ngIf="item.type == 6" src="../../../assets/imgs/notice/notice-wjtc.png" alt="">
</div>
<div class="type-info" style="width:50%;">{{item.title}}</div>
<div class="type-time" style="width:30%;">{{item.sendTime | date:'yyyy-MM-dd' }}</div>
</div>
......
......@@ -15,7 +15,11 @@ page-notice {
align-items: center;
}
.type-img{
text-align: center;
width: 20%;
img{
width: 65%;
}
}
.type-info{
width: 50%;
......
This diff is collapsed.
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