Commit 2bc44936 authored by wangqinghua's avatar wangqinghua

页面路由返回

parent fa2d5a01
<?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>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
......
......@@ -11,18 +11,19 @@
<ion-content class="bgc-e7e8ed">
<!--下拉刷新-->
<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content pullingText="下拉刷新"
pullingIcon="arrow-dropdown"
refreshingSpinner="bubbles">
</ion-refresher-content>
</ion-refresher>
<!--<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 *ngFor="let item of list">
<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-style">
<span class="item-title">{{item.title}}</span>
......@@ -44,11 +45,14 @@
<span *ngIf="item.testResult == 0" (click)="goToResult(item)" float-right class="join">开始测试</span>
</div>
<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 *ngIf="!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>
</div>
</div>
......@@ -78,7 +82,8 @@
<span *ngIf="item.testResult == 2" float-right class="green">测试通过</span>
<span *ngIf="item.testResult == 3" float-right class="yellow">等待评分</span>
</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 *ngIf="item.isRepeat == 1">允许</span>
<span *ngIf="item.isRepeat == 0">不允许</span>
......@@ -87,15 +92,19 @@
<div class="content-button padding-15-0 fontSize-15">
<span>参与人员:</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 class="join">开始测试</span>
<span *ngIf="item.testResult != 0" (click)="goToResult(item)" float-right
class="look">查看结果</span>
<span *ngIf="item.testResult == 0" (click)="goToResult(item)" float-right
class="join">开始测试</span>
</div>
<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 *ngIf="!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>
</div>
</div>
......@@ -126,7 +135,8 @@
<span *ngIf="item.testResult == 2" float-right class="green">测试通过</span>
<span *ngIf="item.testResult == 3" float-right class="yellow">等待评分</span>
</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 *ngIf="item.isRepeat == 1">允许</span>
<span *ngIf="item.isRepeat == 0">不允许</span>
......@@ -135,15 +145,19 @@
<div class="content-button padding-15-0 fontSize-15">
<span>参与人员:</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 class="join">开始测试</span>
<span *ngIf="item.testResult != 0" (click)="goToResult(item)" float-right
class="look">查看结果</span>
<span *ngIf="item.testResult == 0" (click)="goToResult(item)" float-right
class="join">开始测试</span>
</div>
<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 *ngIf="!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>
</div>
</div>
......@@ -162,8 +176,8 @@
</ng-container>
</ng-container>
<!--上滑加载数据-->
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
<!--<ion-infinite-scroll (ionInfinite)="doInfinite($event)">-->
<!--<ion-infinite-scroll-content></ion-infinite-scroll-content>-->
<!--</ion-infinite-scroll>-->
</ion-content>
......@@ -7,6 +7,7 @@ import {LearningResultPage} from "../learning-result/learning-result";
import {TabsService} from "../../../tabs/tabs.service";
import {CommonService} from "../../../../service/common.service";
import {RankPage} from "../rank/rank";
import {EmitService} from "../../../../service/emit.service";
@IonicPage()
......@@ -28,7 +29,8 @@ export class LearningListPage {
pageSize = 25; //每页显示条数
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 {
}
ionViewDidEnter() {
this.emitSer.eventEmit.emit('false'); //设置物理按键正常返回
this.getList();
}
......
......@@ -35,7 +35,6 @@
<div>
<button class="submit-btn submit" (click)="reviewTest()">测试回顾</button>
<button class="submit-btn submit" (click)="resetTest()">重新测试</button>
<p class="margin-top-20 color-999">备注:重新测试不改变测试结果。</p>
</div>
</div>
</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 {ReviewLearnPage} from "../review-learn/review-learn";
import {LearnService} from "../learn.service";
import {EmitService} from "../../../../service/emit.service";
@IonicPage()
@Component({
......@@ -9,7 +10,7 @@ import {LearnService} from "../learn.service";
templateUrl: 'learning-result.html',
})
export class LearningResultPage {
@ViewChild(Navbar) navbar:Navbar;
@ViewChild(Navbar) navbar: Navbar;
testId;
title;
result;
......@@ -21,58 +22,65 @@ export class LearningResultPage {
];
constructor(public navCtrl: NavController, public navParams: NavParams,
public learnSer:LearnService) {
public learnSer: LearnService, public eventEmitSer: EmitService) {
}
ionViewDidEnter() {
//发射物理键返回 返回列表的信息
this.eventEmitSer.eventEmit.emit('result');
}
ionViewDidLoad() {
this.testId = this.navParams.get('testId');
this.title = this.navParams.get('title');
const data = {
testId:this.testId
testId: this.testId
};
this.learnSer.viewTestResult(data).subscribe(
(res)=>{
(res) => {
this.result = res.data;
let c = this.result.score/this.result.fullmarks;
if(this.result.score == 0){
let c = this.result.score / this.result.fullmarks;
//一颗星代表80%以下,两颗星80%-90%(不含90%),三颗星90%-100%以上
if (this.result.score == 0) {
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'},];
}
if( 0.8 > c && c > 0){
if ( c == 0.8 ) {
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'},];
}
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.navbar.backButtonClick = (event)=>{
let index = this.navCtrl.length() -2;
this.navCtrl.remove(2,index)
);
this.navbar.backButtonClick = (event) => {
let index = this.navCtrl.length() - 2;
this.navCtrl.remove(2, index)
}
}
//测试回顾
reviewTest() {
this.navCtrl.push("ReviewLearnPage",{
recordId:this.result.recordId,
score:this.result.score,
title:this.title,
this.navCtrl.push("ReviewLearnPage", {
recordId: this.result.recordId,
score: this.result.score,
title: this.title,
})
}
//重新测试
resetTest() {
this.navCtrl.push('LearningDoPage',{
this.navCtrl.push('LearningDoPage', {
testId: this.testId,
title:this.title,
type:'reset'
title: this.title,
type: 'reset'
});
}
}
......@@ -34,7 +34,6 @@
<div>
<button class="submit-btn submit" (click)="reviewTest()">测试回顾</button>
<button class="submit-btn submit" (click)="resetTest()">重新测试</button>
<p class="margin-top-20 color-999">备注:重新测试不改变测试结果。</p>
</div>
</div>
</ng-container>
......
......@@ -3,6 +3,7 @@ import {IonicPage, Navbar, NavController, NavParams, Slides, ToastController} fr
import {message} from "../../../../app/main";
import {LearnService} from "../learn.service";
import {AppService} from "../../../../service/appHttpService";
import {EmitService} from "../../../../service/emit.service";
@IonicPage()
@Component({
......@@ -10,7 +11,7 @@ import {AppService} from "../../../../service/appHttpService";
templateUrl: 'review-result.html',
})
export class ReviewResultPage {
@ViewChild(Navbar) navbar:Navbar;
@ViewChild(Navbar) navbar: Navbar;
testId;
title;
......@@ -19,48 +20,54 @@ export class ReviewResultPage {
starList = [];
constructor(public navCtrl: NavController, public navParams: NavParams,
public learnSer:LearnService) {
public learnSer: LearnService, public eventEmitSer: EmitService) {
}
ionViewDidEnter() {
//发射物理键返回 返回列表的信息
this.eventEmitSer.eventEmit.emit('result');
}
ionViewDidLoad() {
this.result = this.navParams.get('result');
this.title = this.navParams.get('title');
let c = this.result.score/this.result.fullmarks;
if(this.result.score == 0){
let c = this.result.score / this.result.fullmarks;
//一颗星代表80%以下,两颗星80%-90%(不含90%),三颗星90%-100%以上
if (this.result.score == 0) {
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'},];
}
if( 0.8 > c && c > 0){
if ( c == 0.8 ) {
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'},];
}
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.navbar.backButtonClick = (event)=>{
let index = this.navCtrl.length() -2;
this.navCtrl.remove(2,index)
this.navbar.backButtonClick = (event) => {
let index = this.navCtrl.length() - 2;
this.navCtrl.remove(2, index)
}
}
//测试回顾
reviewTest() {
this.navCtrl.push("ReviewLearnPage",{
recordId:this.result.recordId,
score:this.result.score
this.navCtrl.push("ReviewLearnPage", {
recordId: this.result.recordId,
score: this.result.score
})
}
//重新测试
resetTest() {
this.navCtrl.push('LearningDoPage',{
this.navCtrl.push('LearningDoPage', {
testId: this.testId,
title:this.title,
type:'reset'
title: this.title,
type: 'reset'
});
}
}
......@@ -14,8 +14,8 @@ export class AppGlobal {
//接口基地址
// static domain = "http://101.89.112.92:80"; //正式环境
// static domain = "http://180.168.156.212:2931"; //测试环境
static domain = ""; //本地环境
static domain = "http://180.168.156.212:2931"; //测试环境
// static domain = ""; //本地环境
//图片地址
......
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";
@Injectable()
......@@ -8,18 +8,16 @@ export class BackButtonService {
//控制硬件返回按钮是否触发,默认false
backButtonPressed: boolean = false;
isDo = false; //是否答题中,默认false;
// 1.false 正常返回上一层,2.true,禁止返回上一层,3.result,返回列表页面
isDo = 'false';
//构造函数 依赖注入
constructor(public platform: Platform,
public appCtrl: App,public eventEmitSer:EmitService,
public appCtrl: App, public eventEmitSer: EmitService,
public toastCtrl: ToastController) {
// 接收发射过来的数据
this.eventEmitSer.eventEmit.subscribe((value: any) => {
if(value == "true") { //答题中
this.isDo = true;
}else{ //答题结束
this.isDo = false;
}
this.isDo = value;
});
}
......@@ -33,9 +31,13 @@ export class BackButtonService {
//如果可以返回上一页,则执行pop
if (activeNav.canGoBack()) {
if(!this.isDo){
if (this.isDo === 'false') { //正常返回
activeNav.pop();
}
if (this.isDo === 'result') {
let index = activeNav.length() - 2;
activeNav.remove(2, index)
}
} else {
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