From d5fb13fe86c8eeabef50655c675ecd2e871e3289 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Sat, 26 Dec 2020 16:08:41 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20=E8=80=83=E7=94=9F?= =?UTF-8?q?=E8=80=83=E8=AF=95=E9=A1=B5=E9=9D=A2=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 86 +++++++----------- package.json | 1 + src/app/app.module.ts | 3 +- .../examination-details.component.html | 33 +++++-- .../examination-details.component.scss | 19 +++- .../examination-details.component.ts | 90 ++++++++++++++++--- src/app/student/student.module.ts | 5 +- 7 files changed, 159 insertions(+), 78 deletions(-) diff --git a/package-lock.json b/package-lock.json index f568697..b980c95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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 } } }, diff --git a/package.json b/package.json index 1716269..0479b61 100644 --- a/package.json +++ b/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", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9aa784e..70298a2 100644 --- a/src/app/app.module.ts +++ b/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] diff --git a/src/app/student/examination-details/examination-details.component.html b/src/app/student/examination-details/examination-details.component.html index 9ba6542..a758c9a 100644 --- a/src/app/student/examination-details/examination-details.component.html +++ b/src/app/student/examination-details/examination-details.component.html @@ -1,5 +1,6 @@
-
+
alarm
+
@@ -26,12 +27,28 @@ - + - + - +
+
{{item.name}}
+
+
+
{{element.propertyName}}
+ +
+ + +
+
+
+
+ +
+
+
@@ -56,9 +73,9 @@
{{item.name}}
-
{{element.propertyName}}
+
{{element.propertyName}}
- +
@@ -76,9 +93,9 @@
{{item.name}}
-
{{element.propertyName}}
+
{{element.propertyName}}
- +
diff --git a/src/app/student/examination-details/examination-details.component.scss b/src/app/student/examination-details/examination-details.component.scss index a44383a..c8ead11 100644 --- a/src/app/student/examination-details/examination-details.component.scss +++ b/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; diff --git a/src/app/student/examination-details/examination-details.component.ts b/src/app/student/examination-details/examination-details.component.ts index 2ca888c..de3cf58 100644 --- a/src/app/student/examination-details/examination-details.component.ts +++ b/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) diff --git a/src/app/student/student.module.ts b/src/app/student/student.module.ts index a817ae3..8170140 100644 --- a/src/app/student/student.module.ts +++ b/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() } ] })