Commit 2bc44936 authored by wangqinghua's avatar wangqinghua

页面路由返回

parent fa2d5a01
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.smart19.starter.test" version="4.1.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="io.ionic.smart19.starter.test" version="4.1.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>党建云平台(测试)</name> <name>党建云平台(测试)</name>
<description>An awesome Ionic/Cordova app.</description> <description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author> <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
......
...@@ -11,18 +11,19 @@ ...@@ -11,18 +11,19 @@
<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"-->
refreshingSpinner="bubbles"> <!--refreshingSpinner="bubbles">-->
</ion-refresher-content> <!--</ion-refresher-content>-->
</ion-refresher> <!--</ion-refresher>-->
<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" > <div class="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>
...@@ -44,11 +45,14 @@ ...@@ -44,11 +45,14 @@
<span *ngIf="item.testResult == 0" (click)="goToResult(item)" float-right class="join">开始测试</span> <span *ngIf="item.testResult == 0" (click)="goToResult(item)" float-right class="join">开始测试</span>
</div> </div>
<div class="content-button padding-15-0 fontSize-15"> <div class="content-button padding-15-0 fontSize-15">
<span class="margin-right-10">最高分:<span
*ngIf="!item?.maxNum && item?.maxNum != 0"></span>
<span class="color-red">{{item.maxNum}}</span>
</span>
<span>排名:</span> <span>排名:</span>
<span *ngIf="!item?.ranking"></span> <span *ngIf="!item?.ranking"></span>
<span class="color-red">{{item.ranking}}</span> <span class="color-red">{{item.ranking}}</span>
<span class="margin-left-10">最高分:<span *ngIf="!item?.maxNum"></span>{{item.maxNum}}
</span>
<span (click)="goToRank(item)" float-right class="look">TOP5排行榜</span> <span (click)="goToRank(item)" float-right class="look">TOP5排行榜</span>
</div> </div>
</div> </div>
...@@ -78,7 +82,8 @@ ...@@ -78,7 +82,8 @@
<span *ngIf="item.testResult == 2" float-right class="green">测试通过</span> <span *ngIf="item.testResult == 2" float-right class="green">测试通过</span>
<span *ngIf="item.testResult == 3" float-right class="yellow">等待评分</span> <span *ngIf="item.testResult == 3" float-right class="yellow">等待评分</span>
</div> </div>
<div class="item-header-style" style="font-size: 1.4rem;margin-top: 5px;color: #666666"> <div class="item-header-style"
style="font-size: 1.4rem;margin-top: 5px;color: #666666">
<span>重复测试:</span> <span>重复测试:</span>
<span *ngIf="item.isRepeat == 1">允许</span> <span *ngIf="item.isRepeat == 1">允许</span>
<span *ngIf="item.isRepeat == 0">不允许</span> <span *ngIf="item.isRepeat == 0">不允许</span>
...@@ -87,15 +92,19 @@ ...@@ -87,15 +92,19 @@
<div class="content-button padding-15-0 fontSize-15"> <div class="content-button padding-15-0 fontSize-15">
<span>参与人员:</span> <span>参与人员:</span>
<span *ngIf="item.testObject">{{item.testObject}}</span> <span *ngIf="item.testObject">{{item.testObject}}</span>
<span *ngIf="item.testResult != 0" (click)="goToResult(item)" float-right class="look">查看结果</span> <span *ngIf="item.testResult != 0" (click)="goToResult(item)" float-right
<span *ngIf="item.testResult == 0" (click)="goToResult(item)" float-right class="join">开始测试</span> class="look">查看结果</span>
<span *ngIf="item.testResult == 0" (click)="goToResult(item)" float-right
class="join">开始测试</span>
</div> </div>
<div class="content-button padding-15-0 fontSize-15"> <div class="content-button padding-15-0 fontSize-15">
<span class="margin-right-10">最高分:<span
*ngIf="!item?.maxNum && item?.maxNum != 0"></span>
<span class="color-red">{{item.maxNum}}</span>
</span>
<span>排名:</span> <span>排名:</span>
<span *ngIf="!item?.ranking"></span> <span *ngIf="!item?.ranking"></span>
<span class="color-red">{{item.ranking}}</span> <span class="color-red">{{item.ranking}}</span>
<span class="margin-left-10">最高分:<span *ngIf="!item?.maxNum"></span>{{item.maxNum}}
</span>
<span (click)="goToRank(item)" float-right class="look">TOP5排行榜</span> <span (click)="goToRank(item)" float-right class="look">TOP5排行榜</span>
</div> </div>
</div> </div>
...@@ -126,7 +135,8 @@ ...@@ -126,7 +135,8 @@
<span *ngIf="item.testResult == 2" float-right class="green">测试通过</span> <span *ngIf="item.testResult == 2" float-right class="green">测试通过</span>
<span *ngIf="item.testResult == 3" float-right class="yellow">等待评分</span> <span *ngIf="item.testResult == 3" float-right class="yellow">等待评分</span>
</div> </div>
<div class="item-header-style" style="font-size: 1.4rem;margin-top: 5px;color: #666666"> <div class="item-header-style"
style="font-size: 1.4rem;margin-top: 5px;color: #666666">
<span>重复测试:</span> <span>重复测试:</span>
<span *ngIf="item.isRepeat == 1">允许</span> <span *ngIf="item.isRepeat == 1">允许</span>
<span *ngIf="item.isRepeat == 0">不允许</span> <span *ngIf="item.isRepeat == 0">不允许</span>
...@@ -135,15 +145,19 @@ ...@@ -135,15 +145,19 @@
<div class="content-button padding-15-0 fontSize-15"> <div class="content-button padding-15-0 fontSize-15">
<span>参与人员:</span> <span>参与人员:</span>
<span *ngIf="item.testObject">{{item.testObject}}</span> <span *ngIf="item.testObject">{{item.testObject}}</span>
<span *ngIf="item.testResult != 0" (click)="goToResult(item)" float-right class="look">查看结果</span> <span *ngIf="item.testResult != 0" (click)="goToResult(item)" float-right
<span *ngIf="item.testResult == 0" (click)="goToResult(item)" float-right class="join">开始测试</span> class="look">查看结果</span>
<span *ngIf="item.testResult == 0" (click)="goToResult(item)" float-right
class="join">开始测试</span>
</div> </div>
<div class="content-button padding-15-0 fontSize-15"> <div class="content-button padding-15-0 fontSize-15">
<span class="margin-right-10">最高分:<span
*ngIf="!item?.maxNum && item?.maxNum != 0"></span>
<span class="color-red">{{item.maxNum}}</span>
</span>
<span>排名:</span> <span>排名:</span>
<span *ngIf="!item?.ranking"></span> <span *ngIf="!item?.ranking"></span>
<span class="color-red">{{item.ranking}}</span> <span class="color-red">{{item.ranking}}</span>
<span class="margin-left-10">最高分:<span *ngIf="!item?.maxNum"></span>{{item.maxNum}}
</span>
<span (click)="goToRank(item)" float-right class="look">TOP5排行榜</span> <span (click)="goToRank(item)" float-right class="look">TOP5排行榜</span>
</div> </div>
</div> </div>
...@@ -162,8 +176,8 @@ ...@@ -162,8 +176,8 @@
</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>-->
</ion-content> </ion-content>
...@@ -7,6 +7,7 @@ import {LearningResultPage} from "../learning-result/learning-result"; ...@@ -7,6 +7,7 @@ import {LearningResultPage} from "../learning-result/learning-result";
import {TabsService} from "../../../tabs/tabs.service"; import {TabsService} from "../../../tabs/tabs.service";
import {CommonService} from "../../../../service/common.service"; import {CommonService} from "../../../../service/common.service";
import {RankPage} from "../rank/rank"; import {RankPage} from "../rank/rank";
import {EmitService} from "../../../../service/emit.service";
@IonicPage() @IonicPage()
...@@ -28,7 +29,8 @@ export class LearningListPage { ...@@ -28,7 +29,8 @@ export class LearningListPage {
pageSize = 25; //每页显示条数 pageSize = 25; //每页显示条数
constructor(public navCtrl: NavController, public navParams: NavParams,public tabSer:TabsService, constructor(public navCtrl: NavController, public navParams: NavParams,public tabSer:TabsService,
public learnSer: LearnService, public datePipe: DatePipe,public commonSer:CommonService) { public learnSer: LearnService, public datePipe: DatePipe,public commonSer:CommonService,
public emitSer:EmitService) {
} }
...@@ -39,6 +41,7 @@ export class LearningListPage { ...@@ -39,6 +41,7 @@ export class LearningListPage {
} }
ionViewDidEnter() { ionViewDidEnter() {
this.emitSer.eventEmit.emit('false'); //设置物理按键正常返回
this.getList(); this.getList();
} }
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
<div> <div>
<button class="submit-btn submit" (click)="reviewTest()">测试回顾</button> <button class="submit-btn submit" (click)="reviewTest()">测试回顾</button>
<button class="submit-btn submit" (click)="resetTest()">重新测试</button> <button class="submit-btn submit" (click)="resetTest()">重新测试</button>
<p class="margin-top-20 color-999">备注:重新测试不改变测试结果。</p>
</div> </div>
</div> </div>
</ng-container> </ng-container>
......
import {Component, ViewChild} from '@angular/core'; import {Component, EventEmitter, ViewChild} from '@angular/core';
import {IonicPage, Nav, Navbar, NavController, NavParams} from 'ionic-angular'; import {IonicPage, Nav, Navbar, NavController, NavParams} from 'ionic-angular';
import {ReviewLearnPage} from "../review-learn/review-learn"; import {ReviewLearnPage} from "../review-learn/review-learn";
import {LearnService} from "../learn.service"; import {LearnService} from "../learn.service";
import {EmitService} from "../../../../service/emit.service";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -9,7 +10,7 @@ import {LearnService} from "../learn.service"; ...@@ -9,7 +10,7 @@ import {LearnService} from "../learn.service";
templateUrl: 'learning-result.html', templateUrl: 'learning-result.html',
}) })
export class LearningResultPage { export class LearningResultPage {
@ViewChild(Navbar) navbar:Navbar; @ViewChild(Navbar) navbar: Navbar;
testId; testId;
title; title;
result; result;
...@@ -21,58 +22,65 @@ export class LearningResultPage { ...@@ -21,58 +22,65 @@ export class LearningResultPage {
]; ];
constructor(public navCtrl: NavController, public navParams: NavParams, constructor(public navCtrl: NavController, public navParams: NavParams,
public learnSer:LearnService) { public learnSer: LearnService, public eventEmitSer: EmitService) {
} }
ionViewDidEnter() {
//发射物理键返回 返回列表的信息
this.eventEmitSer.eventEmit.emit('result');
}
ionViewDidLoad() { ionViewDidLoad() {
this.testId = this.navParams.get('testId'); this.testId = this.navParams.get('testId');
this.title = this.navParams.get('title'); this.title = this.navParams.get('title');
const data = { const data = {
testId:this.testId testId: this.testId
}; };
this.learnSer.viewTestResult(data).subscribe( this.learnSer.viewTestResult(data).subscribe(
(res)=>{ (res) => {
this.result = res.data; this.result = res.data;
let c = this.result.score/this.result.fullmarks; let c = this.result.score / this.result.fullmarks;
if(this.result.score == 0){
//一颗星代表80%以下,两颗星80%-90%(不含90%),三颗星90%-100%以上
if (this.result.score == 0) {
this.starList = [{class: 'star-gray'}, {class: 'star-gray'}, {class: 'star-gray'},]; this.starList = [{class: 'star-gray'}, {class: 'star-gray'}, {class: 'star-gray'},];
} }
if( 0.9 > c && c > 0.8){ if (0 < c && c < 0.8 ) {
this.starList = [{class: 'star-yellow'}, {class: 'star-gray'}, {class: 'star-gray'},]; this.starList = [{class: 'star-yellow'}, {class: 'star-gray'}, {class: 'star-gray'},];
} }
if( 0.8 > c && c > 0){ if ( c == 0.8 ) {
this.starList = [{class: 'star-yellow'}, {class: 'star-gray'}, {class: 'star-gray'},]; this.starList = [{class: 'star-yellow'}, {class: 'star-gray'}, {class: 'star-gray'},];
} }
if( 1 > c && c > 0.9){ if (0.8 < c && c < 0.9) {
this.starList = [{class: 'star-yellow'}, {class: 'star-yellow'}, {class: 'star-gray'},]; this.starList = [{class: 'star-yellow'}, {class: 'star-yellow'}, {class: 'star-gray'},];
} }
if( this.result.score == this.result.fullmarks){ if (0.9 < c || c == 0.9) {
this.starList = [{class: 'star-yellow'}, {class: 'star-yellow'}, {class: 'star-yellow'},]; this.starList = [{class: 'star-yellow'}, {class: 'star-yellow'}, {class: 'star-yellow'},];
} }
} }
) );
this.navbar.backButtonClick = (event)=>{ this.navbar.backButtonClick = (event) => {
let index = this.navCtrl.length() -2; let index = this.navCtrl.length() - 2;
this.navCtrl.remove(2,index) this.navCtrl.remove(2, index)
} }
} }
//测试回顾 //测试回顾
reviewTest() { reviewTest() {
this.navCtrl.push("ReviewLearnPage",{ this.navCtrl.push("ReviewLearnPage", {
recordId:this.result.recordId, recordId: this.result.recordId,
score:this.result.score, score: this.result.score,
title:this.title, title: this.title,
}) })
} }
//重新测试 //重新测试
resetTest() { resetTest() {
this.navCtrl.push('LearningDoPage',{ this.navCtrl.push('LearningDoPage', {
testId: this.testId, testId: this.testId,
title:this.title, title: this.title,
type:'reset' type: 'reset'
}); });
} }
} }
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
<div> <div>
<button class="submit-btn submit" (click)="reviewTest()">测试回顾</button> <button class="submit-btn submit" (click)="reviewTest()">测试回顾</button>
<button class="submit-btn submit" (click)="resetTest()">重新测试</button> <button class="submit-btn submit" (click)="resetTest()">重新测试</button>
<p class="margin-top-20 color-999">备注:重新测试不改变测试结果。</p>
</div> </div>
</div> </div>
</ng-container> </ng-container>
......
...@@ -3,14 +3,15 @@ import {IonicPage, Navbar, NavController, NavParams, Slides, ToastController} fr ...@@ -3,14 +3,15 @@ import {IonicPage, Navbar, NavController, NavParams, Slides, ToastController} fr
import {message} from "../../../../app/main"; import {message} from "../../../../app/main";
import {LearnService} from "../learn.service"; import {LearnService} from "../learn.service";
import {AppService} from "../../../../service/appHttpService"; import {AppService} from "../../../../service/appHttpService";
import {EmitService} from "../../../../service/emit.service";
@IonicPage() @IonicPage()
@Component({ @Component({
selector: 'page-review-result', selector: 'page-review-result',
templateUrl: 'review-result.html', templateUrl: 'review-result.html',
}) })
export class ReviewResultPage { export class ReviewResultPage {
@ViewChild(Navbar) navbar:Navbar; @ViewChild(Navbar) navbar: Navbar;
testId; testId;
title; title;
...@@ -19,48 +20,54 @@ export class ReviewResultPage { ...@@ -19,48 +20,54 @@ export class ReviewResultPage {
starList = []; starList = [];
constructor(public navCtrl: NavController, public navParams: NavParams, constructor(public navCtrl: NavController, public navParams: NavParams,
public learnSer:LearnService) { public learnSer: LearnService, public eventEmitSer: EmitService) {
}
ionViewDidEnter() {
//发射物理键返回 返回列表的信息
this.eventEmitSer.eventEmit.emit('result');
} }
ionViewDidLoad() { ionViewDidLoad() {
this.result = this.navParams.get('result'); this.result = this.navParams.get('result');
this.title = this.navParams.get('title'); this.title = this.navParams.get('title');
let c = this.result.score/this.result.fullmarks; let c = this.result.score / this.result.fullmarks;
if(this.result.score == 0){ //一颗星代表80%以下,两颗星80%-90%(不含90%),三颗星90%-100%以上
if (this.result.score == 0) {
this.starList = [{class: 'star-gray'}, {class: 'star-gray'}, {class: 'star-gray'},]; this.starList = [{class: 'star-gray'}, {class: 'star-gray'}, {class: 'star-gray'},];
} }
if( 0.9 > c && c > 0.8){ if (0 < c && c < 0.8 ) {
this.starList = [{class: 'star-yellow'}, {class: 'star-gray'}, {class: 'star-gray'},]; this.starList = [{class: 'star-yellow'}, {class: 'star-gray'}, {class: 'star-gray'},];
} }
if( 0.8 > c && c > 0){ if ( c == 0.8 ) {
this.starList = [{class: 'star-yellow'}, {class: 'star-gray'}, {class: 'star-gray'},]; this.starList = [{class: 'star-yellow'}, {class: 'star-gray'}, {class: 'star-gray'},];
} }
if( 1 > c && c > 0.9){ if (0.8 < c && c < 0.9) {
this.starList = [{class: 'star-yellow'}, {class: 'star-yellow'}, {class: 'star-gray'},]; this.starList = [{class: 'star-yellow'}, {class: 'star-yellow'}, {class: 'star-gray'},];
} }
if( this.result.score == this.result.fullmarks){ if (0.9 < c || c == 0.9) {
this.starList = [{class: 'star-yellow'}, {class: 'star-yellow'}, {class: 'star-yellow'},]; this.starList = [{class: 'star-yellow'}, {class: 'star-yellow'}, {class: 'star-yellow'},];
} }
this.navbar.backButtonClick = (event)=>{ this.navbar.backButtonClick = (event) => {
let index = this.navCtrl.length() -2; let index = this.navCtrl.length() - 2;
this.navCtrl.remove(2,index) this.navCtrl.remove(2, index)
} }
} }
//测试回顾 //测试回顾
reviewTest() { reviewTest() {
this.navCtrl.push("ReviewLearnPage",{ this.navCtrl.push("ReviewLearnPage", {
recordId:this.result.recordId, recordId: this.result.recordId,
score:this.result.score score: this.result.score
}) })
} }
//重新测试 //重新测试
resetTest() { resetTest() {
this.navCtrl.push('LearningDoPage',{ this.navCtrl.push('LearningDoPage', {
testId: this.testId, testId: this.testId,
title:this.title, title: this.title,
type:'reset' type: 'reset'
}); });
} }
} }
...@@ -14,8 +14,8 @@ export class AppGlobal { ...@@ -14,8 +14,8 @@ export class AppGlobal {
//接口基地址 //接口基地址
// static domain = "http://101.89.112.92:80"; //正式环境 // static domain = "http://101.89.112.92:80"; //正式环境
// static domain = "http://180.168.156.212:2931"; //测试环境 static domain = "http://180.168.156.212:2931"; //测试环境
static domain = ""; //本地环境 // static domain = ""; //本地环境
//图片地址 //图片地址
......
import {EventEmitter, Injectable} from '@angular/core'; import {EventEmitter, Injectable} from '@angular/core';
import { Platform, ToastController, App, NavController, Tabs } from 'ionic-angular'; import {Platform, ToastController, App, NavController, Tabs} from 'ionic-angular';
import {EmitService} from "./emit.service"; import {EmitService} from "./emit.service";
@Injectable() @Injectable()
...@@ -8,18 +8,16 @@ export class BackButtonService { ...@@ -8,18 +8,16 @@ export class BackButtonService {
//控制硬件返回按钮是否触发,默认false //控制硬件返回按钮是否触发,默认false
backButtonPressed: boolean = false; backButtonPressed: boolean = false;
isDo = false; //是否答题中,默认false; // 1.false 正常返回上一层,2.true,禁止返回上一层,3.result,返回列表页面
isDo = 'false';
//构造函数 依赖注入 //构造函数 依赖注入
constructor(public platform: Platform, constructor(public platform: Platform,
public appCtrl: App,public eventEmitSer:EmitService, public appCtrl: App, public eventEmitSer: EmitService,
public toastCtrl: ToastController) { public toastCtrl: ToastController) {
// 接收发射过来的数据 // 接收发射过来的数据
this.eventEmitSer.eventEmit.subscribe((value: any) => { this.eventEmitSer.eventEmit.subscribe((value: any) => {
if(value == "true") { //答题中 this.isDo = value;
this.isDo = true;
}else{ //答题结束
this.isDo = false;
}
}); });
} }
...@@ -33,9 +31,13 @@ export class BackButtonService { ...@@ -33,9 +31,13 @@ export class BackButtonService {
//如果可以返回上一页,则执行pop //如果可以返回上一页,则执行pop
if (activeNav.canGoBack()) { if (activeNav.canGoBack()) {
if(!this.isDo){ if (this.isDo === 'false') { //正常返回
activeNav.pop(); activeNav.pop();
} }
if (this.isDo === 'result') {
let index = activeNav.length() - 2;
activeNav.remove(2, index)
}
} else { } else {
if (tabRef == null || tabRef._selectHistory[tabRef._selectHistory.length - 1] === tabRef.getByIndex(0).id) { if (tabRef == null || tabRef._selectHistory[tabRef._selectHistory.length - 1] === tabRef.getByIndex(0).id) {
//执行退出 //执行退出
......
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