From 5a26c5f28e0c18be784b2a0538ce8af174f17eea Mon Sep 17 00:00:00 2001 From: chenjingyu Date: Tue, 22 Dec 2020 10:09:28 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=BB=BA]=E8=80=83=E7=94=9F=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../examiner-index.component.ts | 11 +-- .../student-index.component.html | 39 ++++++++- .../student-index.component.scss | 35 ++++++++ .../student-index/student-index.component.ts | 82 ++++++++++++++++++- 4 files changed, 159 insertions(+), 8 deletions(-) diff --git a/src/app/examiner/examiner-index/examiner-index.component.ts b/src/app/examiner/examiner-index/examiner-index.component.ts index 56b309a..ab104e8 100644 --- a/src/app/examiner/examiner-index/examiner-index.component.ts +++ b/src/app/examiner/examiner-index/examiner-index.component.ts @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2020-12-11 09:06:03 * @LastEditors: sueRimn - * @LastEditTime: 2020-12-21 11:03:07 + * @LastEditTime: 2020-12-21 14:25:29 */ import { Component, OnInit, ViewChild, Inject,Input } from '@angular/core'; import {HttpClient} from '@angular/common/http' @@ -167,6 +167,7 @@ export class ExaminerIndexComponent implements OnInit { this.http.get("/api/Papers",{params:paramsdata}).subscribe((data:any)=>{ this.tabledataSource=data.items this.length=data.totalCount + //console.log(this.tabledataSource) }) } //获取消防救援对信息 @@ -191,7 +192,7 @@ export class ExaminerIndexComponent implements OnInit { //获取optionid getoption(){ var selectIndex =document.getElementById("cars"); - console.log(selectIndex) + //console.log(selectIndex) //var activeName_value =document.getElementById("usertype").options[selectIndex].id; } //查询按钮 @@ -208,7 +209,7 @@ export class ExaminerIndexComponent implements OnInit { }) } console.log(this.accound) */ - console.log(this.jscheck,this.jsId) + //console.log(this.jscheck,this.jsId) this.PageNumber = 1 this.pageEvent.pageIndex = 0 this.getAlltabledate() @@ -339,7 +340,7 @@ export class FinishDia{ creatorId: this.Profiles.id, paperDataInfo: null } - console.log(params) + //console.log(params) this.http.post('/api/Papers',params).subscribe(data => { this.snackBar.open('创建成功','确定',config); this.dialogRef.close(); @@ -349,7 +350,7 @@ export class FinishDia{ sessionStorage.setItem("paperId",this.tabledate.id) this.router.navigate(['/home/createexam-index/examiner-new-one']) //跳转试卷列表页面 },err => { - this.snackBar.open('创建失败','确定',config); + this.snackBar.open(err,'确定',config); }) } } diff --git a/src/app/student/student-index/student-index.component.html b/src/app/student/student-index/student-index.component.html index 6db07b8..5e2e9a6 100644 --- a/src/app/student/student-index/student-index.component.html +++ b/src/app/student/student-index/student-index.component.html @@ -1 +1,38 @@ -

student-index works!

+ +
+
+ + + + + + + + + + + + + + + + + + + + +
试卷名称考核队站开始时间结束时间考试时长操作
{{item.title}}广西总队{{item.startTime|date:'yyyy-MM-dd HH:mm'}}{{item.endTime|date:'yyyy-MM-dd HH:mm'}}{{item.duration}}分钟参加考试
+ + +
+
diff --git a/src/app/student/student-index/student-index.component.scss b/src/app/student/student-index/student-index.component.scss index e69de29..311f7b3 100644 --- a/src/app/student/student-index/student-index.component.scss +++ b/src/app/student/student-index/student-index.component.scss @@ -0,0 +1,35 @@ +.content { + width: 100%; + height: 100%; + overflow: hidden; + background: #F2F5F6; + overflow-y: auto; + } + .centertable{ + width: 95%; + margin-right: 40px; + margin-left: 40px; + margin-top: 40px; + background-color: #FFFFFF; + table{ + width: 100%; + td,th{ + height: 48px; + font-size: 16px; + } + td{ + border-bottom: 1px solid #F2F5F6; + text-align: center; + } + thead{ + background-color:#F5FDFE; + width: 100%; + } + .green{ + color: #07CDCF; + } + .red{ + color: #FF8678; + } + } + } \ No newline at end of file diff --git a/src/app/student/student-index/student-index.component.ts b/src/app/student/student-index/student-index.component.ts index 2492f3b..18b1f79 100644 --- a/src/app/student/student-index/student-index.component.ts +++ b/src/app/student/student-index/student-index.component.ts @@ -1,4 +1,23 @@ -import { Component, OnInit } from '@angular/core'; +/* + * @Descripttion: + * @version: + * @Author: sueRimn + * @Date: 2020-12-20 15:01:30 + * @LastEditors: sueRimn + * @LastEditTime: 2020-12-22 10:08:19 + */ +import { Component, OnInit, ViewChild, Inject,Input } from '@angular/core'; +import {HttpClient} from '@angular/common/http' +import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; +import { PageEvent } from '@angular/material/paginator'; +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; +import {FormControl} from '@angular/forms'; +import { Router,ActivatedRoute } from '@angular/router'; +import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'; +import { FlatTreeControl } from '@angular/cdk/tree'; +import { TreeService } from '../../http-interceptors/tree.service' @Component({ selector: 'app-student-index', @@ -7,9 +26,68 @@ import { Component, OnInit } from '@angular/core'; }) export class StudentIndexComponent implements OnInit { - constructor() { } + constructor(private router: Router,private activatedRoute: ActivatedRoute,public http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,private tree: TreeService) { } ngOnInit(): void { + this.getAlltabledate() + setInterval(()=>this.getAlltabledate(),60000) + //this.idtime=setInterval(()=>this.jishi("","2020-12-22 11:03"),1000) + //console.log(this.idtime) + } + + idtime + + //分页 + @ViewChild(MatPaginator, {static: true}) + pageEvent: PageEvent; + paginator: MatPaginator; + length:any; //共多少条数据 + pageSize:any; //每页条数 + pageSizeOptions: number[] = [10] //设置每页条数 + PageNumber:any //第几页 + startTime:[] + endTime:[] + tabledataSource//表格数据 + timecha + + //分页事件 + chagePage(e){ + this.PageNumber = e.pageIndex+1 + this.getAlltabledate() + } + + //获取表格信息 + getAlltabledate(){ + let paramsdata:any = { + PageNumber: this.PageNumber || '1', + PageSize: this.pageSizeOptions[0], + Sort: null, + SortType: null, + Status:1 + } + this.http.get("/api/Papers",{params:paramsdata}).subscribe((data:any)=>{ + this.tabledataSource=data.items + this.length=data.totalCount + console.log(this.tabledataSource) + }) + } + //计时器 + jishi(startTime,endTime){ + startTime=new Date + var nowtime = new Date(startTime), //获取当前时间 + endtime = new Date(endTime); //定义结束时间 + var lefttime = endtime.getTime() - nowtime.getTime(), //距离结束时间的毫秒数 + leftd = Math.floor(lefttime/(1000*60*60*24)), //计算天数 + lefth = Math.floor(lefttime/(1000*60*60)), //计算小时数 + leftm = Math.floor(lefttime/(1000*60)%60), //计算分钟数 + lefts = Math.floor(lefttime/1000%60); //计算秒数 + this.timecha=lefth+":"+leftm+":"+lefts + + if(this.timecha=='0:0:0'){ + this.timecha="已结束" + clearInterval(this.idtime) + } + console.log(this.timecha) } }