Commit 9cb0a8b3 authored by wangqinghua's avatar wangqinghua

上拉 下拉

parent f18605d3
......@@ -11,7 +11,7 @@
<ion-content>
<div class="main-container">
<ion-slides>
<ion-slide *ngFor="let item of list;">
<ion-slide *ngFor="let item of list;let i = index;">
<div class="learn-item">
<div class="learn-title">学习测试标题学习测试标题学习测试标题</div>
<div class="item-container">
......@@ -19,10 +19,10 @@
<!--判断题目类型-->
<p>
<span class="color-red" *ngIf="item.isAns == 1">*</span>{{index}}、
<span *ngIf="item.questionType == 1">(判断)</span>
<span *ngIf="item.questionType == 2">(选)</span>
<span *ngIf="item.questionType == 3">(多选)</span>
<span *ngIf="item.questionType == 4">(填空)</span>
<span *ngIf="item.questionType == 1">(单选)</span>
<span *ngIf="item.questionType == 2">(选)</span>
<span *ngIf="item.questionType == 3">(填空)</span>
<span *ngIf="item.questionType == 4">(判断)</span>
<span *ngIf="item.questionType == 5">(问答)</span>
{{item.questionContent}}
</p>
......@@ -46,7 +46,7 @@
<ng-container *ngFor=" let option2 of item.options;let quesIndex = index;">
<p>
<label>
<input type="checkbox" (change)="mutiSelect(i,quesIndex)" 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>
......
......@@ -15,7 +15,7 @@ export class LearningDoPage {
@ViewChild(Slides) slides: Slides;
@ViewChild(Navbar) navbar: Navbar
clock; //
clock; //倒计时的定时器
list = [];
timeText = '00:00:00';
totalTime;
......@@ -24,7 +24,7 @@ export class LearningDoPage {
public toastCtrl: ToastController, public appService: AppService, public datePipe: DatePipe) {
}
ionViewDidLoad() {
ionViewDidEnter() {
const testId = this.navParams.get('testId');
const data = {
testId: testId
......@@ -32,6 +32,7 @@ export class LearningDoPage {
this.learnSer.startTest(data).subscribe(
(res) => {
this.list = res.data.detailVos;
this.list.forEach(e=>e.answerdesc = '');
this.totalTime = res.data.timeLimit;
this.countTime();
}
......@@ -43,6 +44,13 @@ export class LearningDoPage {
}
}
//清楚定时器
ionViewDidLeave(){
this.index = 1;
this.slides.slideTo(0);
window.clearInterval(this.clock);
}
//倒计时
countTime() {
let totalTime = this.totalTime;
......@@ -63,11 +71,6 @@ export class LearningDoPage {
}, 1000)
}
//清楚定时器
ionViewDidLeave(){
window.clearInterval(this.clock);
}
//上一题
prev() {
if (this.index == 1) {
......@@ -93,8 +96,9 @@ export class LearningDoPage {
}
//多选
mutiSelect(i, quesIndex) {
mutiSelect(i, option) {
this.list[i].answerdesc += option;
console.log(this.list);
}
//强制交卷
......@@ -106,6 +110,7 @@ export class LearningDoPage {
//交卷
submit() {
console.log(this.list);
this.appService.alert("确定提交问卷", () => {
this.navCtrl.push("LearningResultPage")
})
......
page-learning-list {
.swiper-container{
overflow: auto;
overflow-x: hidden;
overflow-y: scroll;
}
.swiper-slide{
align-items: normal;
......
......@@ -14,12 +14,14 @@ export class LearningListPage {
@ViewChild(Slides) slides: Slides;
@ViewChild('tips') tips: ElementRef;
index;
index = 0;
tabsList = [{name: "全部",}, {name: "未完成",}, {name: "已完成",}];
noList = [];
doList = [];
list = []; //全部测试
link = false; //是否请求完成
pageNumber = 1; //页码
pageSize = 25; //每页显示条数
constructor(public navCtrl: NavController, public navParams: NavParams,
public learnSer: LearnService, public datePipe: DatePipe) {
......@@ -34,9 +36,9 @@ export class LearningListPage {
getList() {
const nowDate = this.datePipe.transform(new Date(), 'yyyy/MM/dd HH:hh:ss')
const data = {
pageNumber:'1',
pageSize:'15',
selectType:'1',
pageNumber:this.pageNumber,
pageSize:this.pageSize,
selectType:'1', //全部状态
queryTime:nowDate,
};
this.learnSer.getLearnTestList(data).subscribe(
......@@ -51,25 +53,59 @@ export class LearningListPage {
)
}
change(index) {
// 下拉
doRefresh(refresher){
this.pageNumber = 1;
const nowDate = this.datePipe.transform(new Date(), 'yyyy/MM/dd HH:hh:ss')
const data = {
pageNumber:this.pageNumber,
pageSize:this.pageSize,
selectType:'1', //全部状态
queryTime:nowDate,
};
this.learnSer.getLearnTestList(data).subscribe(
(res) => {
if(res.data){
this.list = res.data.list;
this.noList = res.data.list.filter((e)=>e.testResult == 0);
this.doList = res.data.list.filter((e)=>e.testResult == 2);
}
refresher.complete()
this.link = true;
}
)
}
//上拉
doInfinite(infiniteScroll){
this.pageNumber ++;
const nowDate = this.datePipe.transform(new Date(), 'yyyy/MM/dd HH:hh:ss')
const data = {
pageNumber:this.pageNumber,
pageSize:this.pageSize,
selectType:'1', //全部状态
queryTime:nowDate,
};
this.learnSer.getLearnTestList(data).subscribe(
(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);
}
infiniteScroll.complete();
this.link = true;
}
)
}
change(index) {
let itemWidth = window.screen.width / 3;
// 自身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 / 3;
// 自身div的一半 - 滑块的一半
this.tips.nativeElement.style.left = itemWidth * this.index + itemWidth / 2 - this.tips.nativeElement.offsetWidth / 2 + 'px';
}
}
goToResult(item) {
this.navCtrl.push("LearningExplainPage", {
item: item
......
......@@ -9,6 +9,7 @@ import {ReviewLearnPage} from "../review-learn/review-learn";
})
export class LearningResultPage {
@ViewChild(Navbar) navbar:Navbar;
testId;
starList = [
{class: 'star-yellow'},
......@@ -20,6 +21,7 @@ export class LearningResultPage {
}
ionViewDidLoad() {
this.testId = this.navParams.get('testId');
this.navbar.backButtonClick = (event)=>{
let index = this.navCtrl.length() -2;
this.navCtrl.remove(2,index)
......
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