Commit cf0b4e52 authored by wangqinghua's avatar wangqinghua

结果页面

parent ad6e761b
......@@ -32,6 +32,7 @@
1、node版本装8.9.0 的 不然跑不起来
2、http文件里面的请求改成本地请求的方式 本地跑
3、这个项目的接口基本都是用form表单提交的
4.ionic.config.json 文件是本地配置跨域问题的nginx文件 service 里面的domain参数要设置
******常见问题******
如果build android 报错了请在platforms/build.gradle里面的最后添加如下代码:
......
......@@ -23,4 +23,14 @@ export class LearnService{
submitPaper(data): Observable<any>{
return this.http.post(AppGlobal.domain+'/wisdomgroup/modules/learnTest/submitPaper',data)
}
//查看测试页面
viewTestResult(data): Observable<any>{
return this.http.post(AppGlobal.domain+'/wisdomgroup/modules/learnTest/viewTestResult',this.commonSer.toFormData(data));
}
//查看题目页面
viewAnswerDetail(data): Observable<any>{
return this.http.post(AppGlobal.domain+'/wisdomgroup/modules/learnTest/viewAnswerDetail',this.commonSer.toFormData(data));
}
}
\ No newline at end of file
......@@ -124,7 +124,9 @@ page-learning-do {
margin-right: 5px;
color: #666;
font-size: 1.5rem;
position: relative;
}
input:checked +.selectIndex{
background-color: #ec1826;
color: #ffffff;
......
......@@ -16,8 +16,10 @@ export class LearningDoPage {
@ViewChild(Slides) slides: Slides;
@ViewChild(Navbar) navbar: Navbar
type; //是否重做
title; // 问卷标题
recordId;
recordId; //试卷记录ID
testId; //试卷ID
clock; //倒计时的定时器
list = [];
timeText = '00:00:00';
......@@ -29,10 +31,11 @@ export class LearningDoPage {
}
ionViewDidEnter() {
const testId = this.navParams.get('testId');
this.testId = this.navParams.get('testId');
this.title = this.navParams.get('title');
this.type = this.navParams.get('type');
const data = {
testId: testId
testId: this.testId
};
this.learnSer.startTest(data).subscribe(
(res) => {
......@@ -60,7 +63,6 @@ export class LearningDoPage {
//倒计时
countTime() {
let totalTime = this.totalTime;
this.useTime = this.totalTime;
this.clock = window.setInterval(() => {
totalTime--;
this.useTime ++;
......@@ -106,11 +108,10 @@ export class LearningDoPage {
//多选
mutiSelect(i, option) {
console.log(option);
if (this.list[i].answer.includes(option)) {
this.list[i].answer = this.list[i].answer.replace(option, '');
} else {
this.list[i].answer += option + ",";
this.list[i].answer += option + ";";
}
}
......@@ -141,30 +142,38 @@ export class LearningDoPage {
}
submit(){
const data = {
listMap: this.list.map(e => {
if (e.answer.length > 1) {
e.answer = e.answer.substr(0, e.answer.length - 1);
if(this.type == 'reset'){
this.navCtrl.push("LearningResultPage",{
testId:this.testId,
title:this.title
});
}else{
const data = {
listMap: this.list.map(e => {
if (e.answer.length > 1) {
e.answer = e.answer.substr(0, e.answer.length - 1);
}
const d = {
questionId: e.questionId,
questionType: e.questionType,
answer: e.answer
};
return d;
}),
recordId: this.recordId,
answerTime: this.useTime,
};
this.learnSer.submitPaper(data).subscribe(
(res) => {
this.commonSer.toast("提交成功");
this.navCtrl.push("LearningResultPage",{
testId:this.testId,
title:this.title
})
}
const d = {
questionId: e.questionId,
questionType: e.questionType,
answer: e.answer
};
return d;
}),
recordId: this.recordId,
answerTime: this.useTime,
};
this.learnSer.submitPaper(data).subscribe(
(res) => {
this.commonSer.toast("提交成功");
this.navCtrl.push("LearningResultPage",{
result:res.data,
title:this.title
})
}
)
)
}
}
}
......@@ -10,6 +10,6 @@
<ion-content>
<p class="explain margin-top-100">本次答题共计{{item?.questionCount}}题,满分{{item?.fullMarks}}分</p>
<p class="explain margin-top-20">时间:{{item?.timeLimit | formatTime}}</p>
<p class="explain margin-top-20">分数超过{{item?.fullMarks *0.6}}分合格</p>
<p class="explain margin-top-20">分数超过{{item?.fullMarks}}分合格</p>
<button class="submit-btn submit" (click)="goToDO()">开始答题</button>
</ion-content>
......@@ -16,7 +16,7 @@ export class LearningExplainPage {
title;
item = {
questionCount: 0,
fullMarks: '0',
fullMarks: 0,
timeLimit: 0,
testId:null
}; //测试对象
......@@ -34,6 +34,7 @@ export class LearningExplainPage {
this.learnSer.startTest(data).subscribe(
(res) => {
this.item = res.data;
this.item.fullMarks = Math.floor(this.item.fullMarks *0.6);
}
)
}
......
......@@ -28,14 +28,14 @@ export class LearningListPage {
public learnSer: LearnService, public datePipe: DatePipe) {
}
ionViewDidLoad() {
ionViewDidEnter() {
let itemWidth = window.screen.width / 3;
this.tips.nativeElement.style.left = itemWidth / 2 - this.tips.nativeElement.offsetWidth / 2 + 'px';
this.getList();
}
getList() {
const nowDate = this.datePipe.transform(new Date(), 'yyyy/MM/dd HH:hh:ss')
const nowDate = this.datePipe.transform(new Date(), 'yyyy/MM/dd HH:mm:ss')
const data = {
pageNumber:this.pageNumber,
pageSize:this.pageSize,
......@@ -114,7 +114,8 @@ export class LearningListPage {
})
}else{
this.navCtrl.push("LearningResultPage", {
item: item
testId: item.testId,
title:item.title
})
}
......
import {Component, ViewChild} from '@angular/core';
import {IonicPage, Navbar, NavController, NavParams} from 'ionic-angular';
import {ReviewLearnPage} from "../review-learn/review-learn";
import {LearnService} from "../learn.service";
@IonicPage()
@Component({
......@@ -9,22 +10,48 @@ import {ReviewLearnPage} from "../review-learn/review-learn";
})
export class LearningResultPage {
@ViewChild(Navbar) navbar:Navbar;
result;
testId;
title;
result;
starList = [
{class: 'star-yellow'},
{class: 'star-yellow'},
{class: 'star-gray'},
]
{class: 'star-yellow'},
];
constructor(public navCtrl: NavController, public navParams: NavParams) {
constructor(public navCtrl: NavController, public navParams: NavParams,
public learnSer:LearnService) {
}
ionViewDidLoad() {
this.result = this.navParams.get('result');
this.testId = this.navParams.get('testId');
this.title = this.navParams.get('title');
console.log(this.result);
const data = {
testId:this.testId
};
this.learnSer.viewTestResult(data).subscribe(
(res)=>{
this.result = res.data;
let c = this.result.score/this.result.fullmarks;
console.log(c)
if(this.result.score == 0){
this.starList = [{class: 'star-gray'}, {class: 'star-gray'}, {class: 'star-gray'},];
}
if( 0.6 > c && c > 0.3){
this.starList = [{class: 'star-yellow'}, {class: 'star-gray'}, {class: 'star-gray'},];
}
if( 0.3 > c && c > 0){
this.starList = [{class: 'star-yellow'}, {class: 'star-gray'}, {class: 'star-gray'},];
}
if( 1 > c && c > 0.6){
this.starList = [{class: 'star-yellow'}, {class: 'star-yellow'}, {class: 'star-gray'},];
}
if( this.result.score == this.result.fullmarks){
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)
......@@ -33,11 +60,18 @@ export class LearningResultPage {
//测试回顾
reviewTest() {
this.navCtrl.push("ReviewLearnPage")
this.navCtrl.push("ReviewLearnPage",{
recordId:this.result.recordId,
score:this.result.score
})
}
//重新测试
resetTest() {
this.navCtrl.pop()
this.navCtrl.push('LearningDoPage',{
testId: this.testId,
title:this.title,
type:'reset'
});
}
}
......@@ -17,64 +17,71 @@
<!--判断题目类型-->
<p>
<span class="color-red" *ngIf="item.isAns == 1">*</span>{{index}}、
<span *ngIf="item.quesType == 1">(判断)</span>
<span *ngIf="item.quesType == 2">(单选)</span>
<span *ngIf="item.quesType == 3">(多选)</span>
<span *ngIf="item.quesType == 4">(填空)</span>
<span *ngIf="item.quesType == 5">(问答)</span>
{{item.title}}
<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>
</div>
<div class="ans-tips">
<span class="ans-green">回答正确</span>
<span class="ans-red">回答错误</span>
<span *ngIf="item.result == 1" class="ans-green">回答正确</span>
<span *ngIf="item.result == 0" class="ans-red">回答错误</span>
<span class="margin-left-20">您的答案:{{item.myAnswer}}</span>
</div>
<div class="item-content">
<div class="padding-0-30">
<!--单选题-->
<ng-container *ngIf="item.quesType == 1">
<p>
<label>
<input [(ngModel)]="item.answerdesc" name="{{item.questionQueId}}" value="0" type="radio">
<span class="input-radio"></span>
</label>
</p>
<p>
<label>
<input [(ngModel)]="item.answerdesc" name="{{item.questionQueId}}" value="1" type="radio">
<span class="input-radio"></span>
</label>
</p>
</ng-container>
<!--多选题-->
<ng-container *ngIf="item.quesType == 2">
<ng-container *ngFor=" let option1 of item.quesDesc;let optIndex = index;">
<ng-container *ngIf="item.questionType == 1">
<ng-container *ngFor=" let option1 of item.options;let optIndex = index;">
<p>
<label>
<input [(ngModel)]="item.answerdesc" type="radio" value="{{optIndex}}" name="{{item.questionQueId}}">{{option1.option_title}}
<span class="input-radio"></span>
<input [(ngModel)]="item.answer" disabled type="radio" [value]="option1.option" [name]="item.questionId">
<span class="selectIndex" [ngClass]="{'select-right' : option1.answer == 'right',
'select-error':option1.answer == 'error'}">{{option1.option}}</span>&nbsp;&nbsp;
{{option1.comment}}
</label>
</p>
</ng-container>
</ng-container>
<!--判断题-->
<ng-container *ngIf="item.quesType == 3">
<ng-container *ngFor=" let option2 of item.quesDesc;let quesIndex = index;">
<!--多选题-->
<ng-container *ngIf="item.questionType == 2">
<ng-container *ngFor=" let option2 of item.options;let quesIndex = index;">
<p>
<label>
<input type="checkbox" (change)="mutiSelect(i,quesIndex)" value="{{quesIndex}}">{{option2.option_title}}
<span class="input-check"></span>
<input type="checkbox" (change)="mutiSelect(i,option2.option)" [value]="quesIndex" [name]="item.questionId">
<span class="selectIndex" [ngClass]="{'select-right' : option2.answer == 'right',
'select-error':option2.answer == 'error'}">{{option2.option}}</span>&nbsp;&nbsp;
{{option2.comment}}
</label>
</p>
</ng-container>
</ng-container>
<!--填空-->
<ng-container *ngIf="item.quesType == 4">
<textarea [(ngModel)]="item.answerdesc" class="content-textarea"></textarea>
<ng-container *ngIf="item.questionType == 3">
<textarea disabled [(ngModel)]="item.myAnswer" class="content-textarea"></textarea>
</ng-container>
<!--判断题-->
<ng-container *ngIf="item.questionType == 4">
<p>
<label>
<input [(ngModel)]="item.answer" [name]="item.questionQueId" value="A type="radio">
<span class=" selectIndex">A</span>&nbsp;&nbsp;
</label>
</p>
<p>
<label>
<input [(ngModel)]="item.answer" [name]="item.questionQueId" value="B" type="radio">
<span class=" selectIndex">B</span>&nbsp;&nbsp;
</label>
</p>
</ng-container>
<!--问答-->
<ng-container *ngIf="item.quesType == 5">
<textarea [(ngModel)]="item.answerdesc" class="content-textarea"></textarea>
<ng-container *ngIf="item.questionType == 5">
<textarea [(ngModel)]="item.answer" class="content-textarea"></textarea>
</ng-container>
</div>
</div>
......@@ -89,8 +96,8 @@
<div (click)="next()" class="next">下一题</div>
</div>
<div class="footer-submit">
<div class="time">答题得分&nbsp;&nbsp;80</div>
<div class="submit" (click)="submit()">
<div class="time">答题得分&nbsp;&nbsp;{{score}}</div>
<div class="submit" (click)="lookError()">
<span>只看错题</span>
</div>
</div>
......
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { ReviewLearnPage } from './review-learn';
import {NgModule} from '@angular/core';
import {IonicPageModule} from 'ionic-angular';
import {ReviewLearnPage} from './review-learn';
import {PipesModule} from "../../../../pipes/pipes.module";
@NgModule({
declarations: [
ReviewLearnPage,
],
imports: [
IonicPageModule.forChild(ReviewLearnPage),
],
declarations: [
ReviewLearnPage,
],
imports: [
PipesModule,
IonicPageModule.forChild(ReviewLearnPage),
],
})
export class ReviewLearnPageModule {}
export class ReviewLearnPageModule {
}
......@@ -37,6 +37,9 @@ page-review-learn {
}
.item-content {
padding: 1rem;
p{
margin: 1rem 0;
}
}
.footer-subject {
padding: 0 1rem;
......@@ -100,6 +103,26 @@ page-review-learn {
margin-left: 2rem;
border-radius: 4px;
}
.selectIndex{
position: relative;
}
.select-right::before{
content: '\2713';
position: absolute;
left: -24px;
top: -4px;
transform: rotate(7deg);
color: #50b632;
font-size: 2.5rem;
}
.select-error::before{
content: '\2718';
position: absolute;
left: -20px;
top: 0;
color: #ec1826;
font-size: 2rem;
}
.item-ios p {
margin: 15px 0;
white-space: normal;
......@@ -123,7 +146,7 @@ page-review-learn {
}
}
input:checked + .input-radio::after {
content: '2713';
content: '\2713';
position: absolute;
width: 10px;
top: 2px;
......
......@@ -2,6 +2,7 @@ import {Component, ViewChild} from '@angular/core';
import {IonicPage, NavController, NavParams, Slides, ToastController} from 'ionic-angular';
import {AppService} from "../../../../service/appHttpService";
import {message} from "../../../../app/main";
import {LearnService} from "../learn.service";
@IonicPage()
......@@ -12,20 +13,38 @@ import {message} from "../../../../app/main";
export class ReviewLearnPage {
@ViewChild(Slides) slides: Slides;
list = [
{title:"你最喜欢玩的游戏是什么?",quesType:'1',option:[{ans:"苹果",index:1},{ans:"香蕉",index:2},{ans:"梨",index:3},]}, //单选题
{title:"你最喜欢吃的水果是什么",quesType:'2',option:[{ans:"苹果",index:1},{ans:"香蕉",index:2},{ans:"梨",index:3},]}, //多选题
{title:"你最喜欢玩的地方是什么?",quesType:'3'}, //判断题
{title:"你最喜欢什么手机?",quesType:'4'}, //填空题
{title:"你最喜欢什么耳机?",quesType:'5'} //问答题
];
list = [];
index = 1; //当前题目的序号
constructor(public navCtrl: NavController, public navParams: NavParams,
score; //得分
constructor(public navCtrl: NavController, public navParams: NavParams,public learnSer:LearnService,
public toastCtrl:ToastController,public appService:AppService) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad LearningDoPage');
const recordId = this.navParams.get('recordId');
this.score = this.navParams.get('score');
const data = {
recordId:recordId,
}
this.learnSer.viewAnswerDetail(data).subscribe(
(res)=>{
this.list = res.data;
this.list.forEach(e=>{
if(e.questionType == 1 || e.questionType == 2 || e.questionType == 4){
e.options.forEach(s=>{
if(e.correctAnswer.includes(s.option)){
s.answer = 'right';
}else if(!e.correctAnswer.includes(s.option) && e.myAnswer.includes(s.option)){
s.answer = 'error'
}else{
s.answer = 'normal'
}
})
}
})
console.log(this.list);
}
)
}
//上一题
......@@ -53,10 +72,16 @@ export class ReviewLearnPage {
}
//只看错题
submit(){
this.appService.alert("确定提交问卷",()=>{
this.navCtrl.push("LearningResultPage")
})
lookError(){
this.index = 1;
this.slides.slideTo(this.index-1)
let arr = [];
this.list.map(e=>{
if(e.result == 0){
arr.push(e);
}
});
this.list = arr;
}
}
......@@ -80,15 +80,6 @@ export class LoginPage {
enableBackdropDismiss: true //点击页面其他地方则关闭 正在登录
});
loading.present();
let formData = new FormData()
formData.append('mobile',this.user.mobile);
formData.append('password',this.user.password);
// formData.append('remember',true);
this.loginSer.loginpost(formData).subscribe(
(res)=>{
}
)
this.appService.ObserverHttpPost("/wisdomgroup/app/loginpost", this.user)
.subscribe((res: Response) => {
loading.dismiss();
......
......@@ -14,7 +14,7 @@ export class AppGlobal {
//接口基地址
// static domain = "http://101.89.112.92:80"; //正式环境
//测试环境 通过nginx配置
// static domain = "http://180.168.156.212:2931"; //测试环境
static domain = ""; //本地环境
......
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