Commit 80daba30 authored by wangqinghua's avatar wangqinghua

上拉 下拉

parent 9cb0a8b3
......@@ -3,17 +3,22 @@
<ion-navbar>
<ion-title>测试管理</ion-title>
</ion-navbar>
</ion-header>
<ion-content class="bgc-e7e8ed">
<div class="tabs-parent">
<div *ngFor="let item of tabsList;let i = index" (click)="change(i)" class="tabs-children" >{{item.name}}</div>
<span #tips id="tips"></span>
</div>
<ion-slides (ionSlideDidChange)="slideChanged()">
<ion-slide>
</ion-header>
<ion-content class="bgc-e7e8ed">
<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content pullingText="下拉刷新"
pullingIcon="arrow-dropdown"
refreshingSpinner="bubbles">
</ion-refresher-content>
</ion-refresher>
<ng-container *ngIf="link">
<ng-container *ngIf="index == 0">
<ion-list>
<ng-container *ngIf="list.length > 0">
<ng-container *ngFor="let item of list" >
......@@ -48,24 +53,24 @@
</ion-list>
</ng-container>
</ion-list>
</ion-slide>
<ion-slide>
</ng-container>
<ng-container *ngIf="index == 1">
<ion-list>
<ng-container *ngIf="list.length > 0">
<ng-container *ngFor="let item of noList" >
<ng-container *ngIf="noList.length > 0">
<ng-container *ngFor="let item of doList">
<ion-item class="item-list margin-bottom-10" >
<div class="item" (click)="goToResult(item)">
<div class="item-header padding-15-0">
<div class="item-header-style">
<span class="item-title">{{item.title}}</span>
<span float-right class="gray">未作答</span>
<span float-right class="green">已完成</span>
</div>
</div>
<div class="content-button padding-15-0">
<span>参与人员:</span>
<span *ngIf="item.groupName">{{item.groupName}}</span>
<span *ngIf="!item.groupName">全体人员</span>
<span float-right class="join">测试</span>
<span float-right class="look">查看</span>
</div>
</div>
</ion-item>
......@@ -80,8 +85,8 @@
</ion-list>
</ng-container>
</ion-list>
</ion-slide>
<ion-slide>
</ng-container>
<ng-container *ngIf="index == 2">
<ion-list>
<ng-container *ngIf="doList.length > 0">
<ng-container *ngFor="let item of doList">
......@@ -112,8 +117,8 @@
</ion-list>
</ng-container>
</ion-list>
</ion-slide>
<ion-slide>
</ng-container>
<ng-container *ngIf="index == 3">
<ion-list>
<ng-container *ngIf="edList.length > 0">
<ng-container *ngFor="let item of edList">
......@@ -144,6 +149,10 @@
</ion-list>
</ng-container>
</ion-list>
</ion-slide>
</ion-slides>
</ng-container>
</ng-container>
<!--上滑加载数据-->
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
......@@ -12,14 +12,14 @@ export class LearnManagePage {
@ViewChild(Slides) slides: Slides;
@ViewChild('tips') tips:ElementRef;
index;
index = 0;
link = true;
tabsList = [
{name:"全部",},
{name:"待发布",},
{name:"已发布",},
{name:"已过期",}
];
allList = []; //全部
noList = []; //待发布
doList = []; //已发布
edList = []; //已过期
......@@ -56,18 +56,17 @@ export class LearnManagePage {
let itemWidth = window.screen.width /4;
// 自身div的一半 - 滑块的一半
this.tips.nativeElement.style.left = itemWidth * index + itemWidth / 2 - this.tips.nativeElement.offsetWidth / 2 + 'px';
this.slides.slideTo(index)
this.index = index;
}
//
slideChanged(){
this.index = this.slides.getActiveIndex();
if(this.index < 3){
let itemWidth = window.screen.width /4;
// 自身div的一半 - 滑块的一半
this.tips.nativeElement.style.left = itemWidth * this.index + itemWidth / 2 - this.tips.nativeElement.offsetWidth / 2 + 'px';
}
//下拉刷新
doRefresh(refresher){
refresher.complete();
}
//上滑
doInfinite(infiniteScroll){
infiniteScroll.complete()
}
goToResult(item){
......
......@@ -34,7 +34,7 @@
<ng-container *ngFor=" let option1 of item.options;let optIndex = index;">
<p>
<label>
<input [(ngModel)]="item.answerdesc" type="radio" value="{{optIndex}}" name="{{item.questionId}}">
<input [(ngModel)]="item.answerdesc" type="radio" [value]="option1.option" [name]="item.questionId">
<span class=" selectIndex">{{optIndex +1 | charCode}}</span>&nbsp;&nbsp;
{{option1.comment}}
</label>
......@@ -46,7 +46,7 @@
<ng-container *ngFor=" let option2 of item.options;let quesIndex = index;">
<p>
<label>
<input type="checkbox" (change)="mutiSelect(i,option2.option)" value="{{quesIndex}}" name="{{item.questionId}}">
<input type="checkbox" (change)="mutiSelect(i,option2.option)" [value]="quesIndex" [name]="item.questionId">
<span class="input-duox selectIndex">{{quesIndex +1 | charCode}}</span>&nbsp;&nbsp;
{{option2.comment}}
</label>
......@@ -61,14 +61,14 @@
<ng-container *ngIf="item.questionType == 4">
<p>
<label>
<input [(ngModel)]="item.answerdesc" name="{{item.questionQueId}}" value="0" type="radio">
<input [(ngModel)]="item.answerdesc" [name]="item.questionQueId" value="A type="radio">
<span class=" selectIndex">A</span>&nbsp;&nbsp;
</label>
</p>
<p>
<label>
<input [(ngModel)]="item.answerdesc" name="{{item.questionQueId}}" value="1" type="radio">
<input [(ngModel)]="item.answerdesc" [name]="item.questionQueId" value="B" type="radio">
<span class=" selectIndex">B</span>&nbsp;&nbsp;
</label>
......
......@@ -57,11 +57,11 @@ export class LearningDoPage {
this.clock = window.setInterval(() => {
totalTime--;
let hourse = (Math.floor(totalTime / 3600)).toString();
hourse = (hourse.length > 1 ? hourse:hourse + '0');
hourse = (hourse.length > 1 ? hourse:'0'+ hourse);
let minutes = Math.floor(totalTime / 60).toString();
minutes = (minutes.length > 1 ? minutes:minutes + '0');
minutes = (minutes.length > 1 ? minutes: '0'+ minutes);
let seconds = Math.floor(totalTime % 60).toString();
seconds = (seconds.length > 1 ? seconds:seconds + '0');
seconds = (seconds.length > 1 ? seconds: '0'+ seconds );
this.timeText = hourse + ":" + minutes + ":" + seconds;
if (totalTime < 0) {
window.clearInterval(this.clock)
......@@ -97,7 +97,11 @@ export class LearningDoPage {
//多选
mutiSelect(i, option) {
this.list[i].answerdesc += option;
if(this.list[i].answerdesc.includes(option)){
this.list[i].answerdesc = this.list[i].answerdesc.replace(option,'');
}else{
this.list[i].answerdesc += option;
}
console.log(this.list);
}
......@@ -110,8 +114,19 @@ export class LearningDoPage {
//交卷
submit() {
let message = "确定交卷吗"; //提示信息
let number = 0; //有number题未答
this.list.forEach(e=>{
if(e.answerdesc.length == 0){
number ++;
}
});
if(number > 0){
message = "您有"+number+"题未作答,确定交卷吗";
}
console.log(this.list);
this.appService.alert("确定提交问卷", () => {
this.appService.alert(message, () => {
this.navCtrl.push("LearningResultPage")
})
}
......
......@@ -90,8 +90,8 @@ export class LearningListPage {
(res) => {
if(res.data){
this.list = this.list.concat( res.data.list );
this.noList = res.data.list.filter((e)=>e.testResult == 0);
this.doList = res.data.list.filter((e)=>e.testResult == 2);
this.noList = this.list.filter((e)=>e.testResult == 0);
this.doList = this.list.filter((e)=>e.testResult == 2);
}
infiniteScroll.complete();
this.link = true;
......
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