|
|
|
@ -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,72 @@ 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) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//参加考试
|
|
|
|
|
takeTest (e) { |
|
|
|
|
window.open(`/examinationDetails?testId=${e.id}`) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|