Browse Source

[完善] 考生考试页面完善

master
陈鹏飞 4 years ago
parent
commit
d5fb13fe86
  1. 86
      package-lock.json
  2. 1
      package.json
  3. 3
      src/app/app.module.ts
  4. 33
      src/app/student/examination-details/examination-details.component.html
  5. 19
      src/app/student/examination-details/examination-details.component.scss
  6. 90
      src/app/student/examination-details/examination-details.component.ts
  7. 5
      src/app/student/student.module.ts

86
package-lock.json generated

@ -10532,8 +10532,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"aproba": {
"version": "1.2.0",
@ -10554,14 +10553,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -10576,20 +10573,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@ -10706,8 +10700,7 @@
"inherits": {
"version": "2.0.4",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@ -10719,7 +10712,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -10734,7 +10726,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -10742,14 +10733,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -10768,7 +10757,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -10858,8 +10846,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@ -10871,7 +10858,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -10957,8 +10943,7 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
@ -10994,7 +10979,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -11014,7 +10998,6 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -11058,14 +11041,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"yallist": {
"version": "3.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
}
}
},
@ -12018,6 +11999,21 @@
"tslib": "^1.9.0"
}
},
"ngx-countdown": {
"version": "11.0.1",
"resolved": "https://registry.npm.taobao.org/ngx-countdown/download/ngx-countdown-11.0.1.tgz",
"integrity": "sha1-/k/mciHFbUuk/Obb6cO/KJxTpvA=",
"requires": {
"tslib": "^2.0.0"
},
"dependencies": {
"tslib": {
"version": "2.0.3",
"resolved": "https://registry.npm.taobao.org/tslib/download/tslib-2.0.3.tgz?cache=0&sync_timestamp=1602286724979&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftslib%2Fdownload%2Ftslib-2.0.3.tgz",
"integrity": "sha1-jgdBrEX8DCJuWKF7/D5kubxsphw="
}
}
},
"ngx-echarts": {
"version": "4.2.2",
"resolved": "https://registry.npm.taobao.org/ngx-echarts/download/ngx-echarts-4.2.2.tgz",
@ -17608,8 +17604,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"aproba": {
"version": "1.2.0",
@ -17652,8 +17647,7 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
@ -17664,8 +17658,7 @@
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@ -17782,8 +17775,7 @@
"inherits": {
"version": "2.0.4",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@ -17795,7 +17787,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -17825,7 +17816,6 @@
"version": "2.9.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -17844,7 +17834,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -17934,8 +17923,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@ -17947,7 +17935,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -18033,8 +18020,7 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
@ -18070,7 +18056,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -18090,7 +18075,6 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -18134,14 +18118,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"yallist": {
"version": "3.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
}
}
},

1
package.json

@ -31,6 +31,7 @@
"firebase": "^7.6.2",
"ng-zorro-antd": "^10.2.0",
"ng2-file-upload": "^1.4.0",
"ngx-countdown": "^11.0.1",
"ngx-echarts": "^4.2.2",
"ngx-perfect-scrollbar": "^8.0.0",
"pixi-filters": "^3.1.1",

3
src/app/app.module.ts

@ -30,7 +30,6 @@ import zh from '@angular/common/locales/zh';
import { ExaminerModule } from './examiner/examiner.module';
import { StudentModule} from './student/student.module'
registerLocaleData(zh);
import { from } from 'rxjs';
@NgModule({
declarations: [
@ -48,7 +47,7 @@ import { from } from 'rxjs';
FormsModule,
HttpClientModule,
ExaminerModule,
StudentModule
StudentModule,
],
providers: [httpInterceptorProviders, CacheTokenService,TreeService,ComponentServiceService],
bootstrap: [AppComponent]

33
src/app/student/examination-details/examination-details.component.html

@ -1,5 +1,6 @@
<div class="content">
<div><app-tabbar></app-tabbar></div>
<div class="countdown"><mat-icon>alarm</mat-icon><countdown #countdown [config]="{ leftTime: surplusTime,notify: [600],formatDate: formatDate }" (event)="handleEvent($event)"></countdown></div>
<div style="min-height: 60px;"><app-tabbar></app-tabbar></div>
<div class="center">
<div class="left">
@ -26,12 +27,28 @@
<mat-accordion multi>
<!-- 基本信息 -->
<mat-expansion-panel>
<mat-expansion-panel *ngIf="selectPaper.basicInfoData && selectPaper.basicInfoData.length">
<mat-expansion-panel-header class="panelHeader">
<label class="mariginRight">基本信息</label>
<label>总分: <label class="mark"> 25</label>分, </label><label>单项<label class="mark">2</label></label>
<label>总分: <label class="mark"> {{selectPaper.basicInfoScore}}</label>分, </label><label>单项<label class="mark"></label></label>
</mat-expansion-panel-header>
<div class="publicTest" *ngFor="let item of selectPaper.basicInfoData;let itemkey = index">
<div class="publicTitle">{{item.name}}</div>
<div class="publicTable" *ngIf="item.tabledata && item.tabledata.length">
<div class="tableRow" *ngFor="let element of item.tabledata; let key = index">
<div class="tabelHeader overflowText" title="{{element.propertyName}}">{{element.propertyName}}</div>
<ng-container *ngFor="let elements of element.data">
<div class="tabelCenter" *ngIf="rowIsShow(selectPaper.basicInfoData[itemkey].children,elements.tag)">
<label *ngIf="key===0" class="overflowText">{{elements.result}}</label>
<input type="text" [(ngModel)]="elements.userAnswer" name="userAnswer" *ngIf="key!=0">
</div>
</ng-container>
</div>
</div>
<ng-container *ngIf="!item.tabledata || !item.tabledata.length">
<div class="publicInput" *ngFor="let element of item.children"><label>{{element.name}}:</label><input type="text" [(ngModel)]="element.userAnswer" name="userAnswer"></div>
</ng-container>
</div>
</mat-expansion-panel>
<!-- 基本信息 -->
<!-- 四周毗邻 -->
@ -56,9 +73,9 @@
<div class="publicTitle">{{item.name}}</div>
<div class="publicTable">
<div class="tableRow" *ngFor="let element of item.tabledata; let key = index">
<div class="tabelHeader">{{element.propertyName}}</div>
<div class="tabelHeader overflowText" title="{{element.propertyName}}">{{element.propertyName}}</div>
<div class="tabelCenter" *ngFor="let elements of element.data">
<label *ngIf="key===0">{{elements.result}}</label>
<label *ngIf="key===0" class="overflowText">{{elements.result}}</label>
<input type="text" [(ngModel)]="elements.userAnswer" name="userAnswer" *ngIf="key!=0">
</div>
</div>
@ -76,9 +93,9 @@
<div class="publicTitle">{{item.name}}</div>
<div class="publicTable">
<div class="tableRow" *ngFor="let element of item.tabledata; let key = index">
<div class="tabelHeader">{{element.propertyName}}</div>
<div class="tabelHeader overflowText" title="{{element.propertyName}}">{{element.propertyName}}</div>
<div class="tabelCenter" *ngFor="let elements of element.data">
<label *ngIf="key===0">{{elements.result}}</label>
<label *ngIf="key===0" class="overflowText">{{elements.result}}</label>
<input type="text" [(ngModel)]="elements.userAnswer" name="userAnswer" *ngIf="key!=0">
</div>
</div>

19
src/app/student/examination-details/examination-details.component.scss

@ -7,6 +7,23 @@ table { text-align: center; border-collapse: collapse; padding:2px;}
display: flex;
flex-direction: column;
box-sizing: border-box;
.countdown {
width: 150px;
height: 30px;
line-height: 30px;
text-align: center;
position: fixed;
z-index: 111;
top: 15px;
left: 50%;
margin-left: -75px;
color: #07CDCF;
font-size: 18px;
.mat-icon {
font-size: 20px;
vertical-align: middle;
}
}
.center {
flex: 1;
overflow: hidden;
@ -161,7 +178,7 @@ input {
.tableRow {
flex: 1;
overflow: hidden;
.tabelHeader { background: #F5FDFE; }
.tabelHeader { background: #F5FDFE; cursor: pointer; }
>div {
width: 100%;
height: 36px;

90
src/app/student/examination-details/examination-details.component.ts

@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { ActivatedRoute } from '@angular/router';
import { CanvasShareDataService } from 'src/app/canvas-share-data.service';
@ -24,11 +24,33 @@ export class ExaminationDetailsComponent implements OnInit {
paperCompanyData:any = []; //考生具体考卷
selectPaper:any = {id:null}; //选择当前考卷
selectPaperType:string = '1'; //选择当前考卷内容 基本信息/作战部署
surplusTime:number = 3600; //考试剩余时间
//倒计时 处理时间格式
formatDate (e) {
let hours = parseInt( (e.date / (1000 * 60 * 60)).toString() )
var minutes = parseInt( ((e.date % (1000 * 60 * 60)) / (1000 * 60)).toString() );
var seconds = (e.date % (1000 * 60)) / 1000;
return `${hours} : ${minutes} : ${seconds}`
}
//基本信息表格 是否展示当前行
rowIsShow (children,tag) {
let isShow:boolean = false
children.forEach(element => {
element.result == tag? isShow = true : null
});
return isShow
}
//获取考卷
async getTestInfo () {
await new Promise((resolve, reject) => {
this.http.get(`/api/Papers/${this.paperId}`).subscribe((data:any)=>{
let now = (new Date()).getTime()
let endTime = (new Date(data.endTime)).getTime()
let surplusTime = Math.floor( (endTime - now) / 1000 ); //考试剩余时间
surplusTime >=0? this.surplusTime = surplusTime : this.surplusTime = 0
this.paperData = data
this.paperData.paperDataInfo.forEach(element => {
element.adjoinData? element.adjoinData = JSON.parse(element.adjoinData) : null
@ -39,23 +61,28 @@ export class ExaminationDetailsComponent implements OnInit {
});
this.paperCompanyData = JSON.parse( JSON.stringify(data.paperDataInfo) ) //具体考卷
this.selectPaper = this.paperCompanyData[0] || {id:null} //当前选择考卷
this.handlePaperData()
resolve(1)
})
})
}
//处理考卷 数据格式
handlePaperData () {
console.log(this.selectPaper)
}
//切换 选择考卷
togglePaper (e) {
if (this.selectPaper.id != e.id) {
this.selectPaper = e
this.handlePaperData()
console.log(this.selectPaper)
}
}
//考试倒计时
handleEvent (e) {
if (e.left == 600000) { //距离考试结束 剩余10分钟
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 5000
this.snackBar.open('注: 距离考试结束还剩10分钟!','确定',config);
} else if (e.left == 0) {//考试结束
this.uploadPaper() //交卷
}
}
@ -107,18 +134,55 @@ export class ExaminationDetailsComponent implements OnInit {
})
//计算总分
this.examScore = examScore + examScore2
console.log(678,this.paperCompanyData)
}
//交卷
uploadPaper () {
console.log(this.paperCompanyData)
// let body = {
// id: this.route.snapshot.queryParams.examId,
// // name: null,
// // serverTime: null,
// // startTime: null,
// // endTime: null,
// // deadline: null,
// // isMarked: null,
// // totalScore: null,
// // examineeId: null,
// // examineeName: null,
// // paperId: null,
// // paperEndTime: null,
// examinationDataInfo: []
// }
// let uploadPaper = JSON.parse( JSON.stringify(this.paperCompanyData) )
// uploadPaper.forEach(element => {
// delete element.score
// delete element.planScore
// delete element.planList
// delete element.id
// delete element.paperId
// element.examinationId = this.route.snapshot.queryParams.examId
// element.adjoinData = JSON.stringify( element.adjoinData || [] )
// element.basicInfoData = JSON.stringify( element.basicInfoData || [] )
// element.facilityData = JSON.stringify( element.facilityData || [] )
// element.functionalDivisionData = JSON.stringify( element.functionalDivisionData || [] )
// element.importLocationData = JSON.stringify( element.importLocationData || [] )
// });
// console.log(body)
// body.examinationDataInfo = uploadPaper
// this.http.put(`/api/Examinations/UpdateExaminationData/${this.route.snapshot.queryParams.examId}`,body).subscribe(data=>{
// console.log(data)
// })
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('试卷提交成功! 本页面即将关闭','确定',config);
// window.setTimeout(()=>{
// window.close()
// },10000)
}
//进入作战部署 考卷
enterExam(item){
console.log(item)
console.log(this.selectPaper)
sessionStorage.setItem('companyName',this.selectPaper.companyInfo.name)
sessionStorage.setItem('planId',item.planComponentId)
sessionStorage.setItem('buildingTypeId',this.selectPaper.companyInfo.buildingTypes[0].id)

5
src/app/student/student.module.ts

@ -55,7 +55,7 @@ import { StudentExamRecordComponent } from './student-exam-record/student-exam-r
import { ExaminationDetailsComponent } from './examination-details/examination-details.component';
import { PlanLevel } from '../pipes/size.pipe';
import { ExaminerModule } from '../examiner/examiner.module';
import { CountdownModule } from 'ngx-countdown';
@NgModule({
declarations: [StudentIndexComponent, StudentExamRecordComponent, ExaminationDetailsComponent],
imports: [
@ -108,7 +108,8 @@ import { ExaminerModule } from '../examiner/examiner.module';
NavigationModule,
NzTreeModule,
NzDatePickerModule,
ExaminerModule
ExaminerModule,
CountdownModule,
],
providers: [ { provide: MatPaginatorIntl, useValue: myPaginator() } ]
})

Loading…
Cancel
Save