Commit 80daba30 authored by wangqinghua's avatar wangqinghua

上拉 下拉

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