Browse Source

[修改]创建考试编辑修改时间和试卷名称

master
chenjingyu 4 years ago
parent
commit
5c0d762f94
  1. 2
      package-lock.json
  2. 32
      src/app/examiner/examiner-index/editors.html
  3. 94
      src/app/examiner/examiner-index/examiner-index.component.ts
  4. 10
      src/app/examiner/examiner-new-one/examiner-new-one.component.ts
  5. 3
      src/app/examiner/examiner.module.ts

2
package-lock.json generated

@ -11999,7 +11999,7 @@
},
"parse5": {
"version": "5.1.1",
"resolved": "https://registry.npm.taobao.org/parse5/download/parse5-5.1.1.tgz?cache=0&sync_timestamp=1595849319979&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fparse5%2Fdownload%2Fparse5-5.1.1.tgz",
"resolved": "https://registry.npm.taobao.org/parse5/download/parse5-5.1.1.tgz",
"integrity": "sha1-9o5OW6GFKsLK3AD0VV//bCq7YXg=",
"optional": true
},

32
src/app/examiner/examiner-index/editors.html

@ -0,0 +1,32 @@
<!--
* @Descripttion:
* @version:
* @Author: sueRimn
* @Date: 2021-02-23 14:49:48
* @LastEditors: sueRimn
* @LastEditTime: 2021-02-23 15:38:47
-->
<div class="box">
<div class="diaone">
<div style="margin-bottom: 5px;"><label>请填写修改后的试卷名称:</label></div>
<div><input placeholder="请填写" [(ngModel)]="examName"></div>
</div>
<div class="diatwo">
<div class="starttime">
<div style="margin-bottom: 5px;"><label>请选择开始时间:</label></div>
<!-- <div><nz-range-picker class="datepicker" nzFormat="yyyy-MM-dd HH:mm" [nzShowTime]="{ nzHideDisabledOptions: true, nzDefaultOpenValue: timeDefaultValue }" [nzDisabledTime]="disabledDateTime" [(ngModel)]="date" (ngModelChange)="onChange($event)"></nz-range-picker>
</div> -->
<div><input type="datetime-local" name="start_time" [(ngModel)]="startTime" /></div>
</div>
<div class="endtime">
<div style="margin-bottom: 5px;"><label>请选择结束时间:</label></div>
<div><input type="datetime-local" name="end_time" [(ngModel)]="endTime"/></div>
</div>
</div>
<div mat-dialog-actions style="margin-top: 20px;">
<button mat-button (click)="onNoClick()" style="background-color: #07CDCF;margin-left: 200px;color: #fff;">确定</button>
<button mat-button type="button" (click)="close()" style=" background-color: #FF8678;margin-left: 25px;color: #fff;">取消</button>
</div>
</div>

94
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: 2021-01-04 16:13:12
* @LastEditTime: 2021-02-23 17:04:01
*/
import { Component, OnInit, ViewChild, Inject,Input } from '@angular/core';
import {HttpClient} from '@angular/common/http'
@ -126,14 +126,25 @@ export class ExaminerIndexComponent implements OnInit {
//编辑试卷
editPaper(item){
console.log(item)
if(item.status == 2){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('考试结束,不能编辑','确定',config);
}else{
sessionStorage.setItem("paperId",item.id)
this.router.navigateByUrl("/examiner/create-test-score?pattern=edit")
}else if(item.status == 1){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('开考中,不能编辑','确定',config);
}
else{
const dialogRef = this.dialog.open(editorsDia, {
width: '650px',
data: item
});
/* sessionStorage.setItem("paperId",item.id)
this.router.navigateByUrl("/examiner/create-test-score?pattern=edit") */
}
}
lookPaper(item){
@ -308,6 +319,7 @@ export class ExaminerIndexComponent implements OnInit {
}
//创建试题弹窗
@Component({
selector: 'finish-dialog',
templateUrl: 'finishDia.html',
@ -361,8 +373,6 @@ export class FinishDia{
var n=min2-min1;
//将日期和时间两个部分计算出来的差值相加,即得到两个时间相减后的分钟数
var minutes=m+n;
console.log(this.startTime,this.endTime)
let params = {
id: null,
title: this.examName,
@ -375,7 +385,7 @@ export class FinishDia{
creatorId: this.Profiles.id,
paperDataInfo: null
}
//console.log(params)
this.http.post('/api/Papers',params).subscribe(data => {
this.snackBar.open('创建成功','确定',config);
this.dialogRef.close();
@ -401,6 +411,76 @@ export class FinishDia{
}
close(){
this.dialogRef.close();
}
}
//编辑试题弹窗
@Component({
selector: 'finish-dialog',
templateUrl: 'editors.html',
styleUrls: ['finishDia.scss']
})
export class editorsDia{
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<editorsDia>,@Inject(MAT_DIALOG_DATA) public datas: any) {}
ngOnInit(): void {
/* this.startTime=this.datas.startTime
this.endTime=this.datas.endTime */
this.startTime=this.datas.startTime.split("+")[0]
this.endTime=this.datas.endTime.split("+")[0]
this.examName=this.datas.title
}
//获取登录账号的个人资料
Profiles:any
getProfiles(){
this.http.get('/api/ExamAccounts/Profiles').subscribe((data:any) => {
console.log(data)
this.Profiles = data
sessionStorage.setItem('creatorData',JSON.stringify(data))
})
}
startTime:string//考试开始时间
endTime:string//考试结束时间
examName:string//考试名称
indexid:string//创建考试的id
tabledate
//弹窗确定点击事件
onNoClick(): void {
//console.log( this.startTime,this.endTime)
if(this.startTime>this.endTime){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('开始时间不能早于结束时间','确定',config);
}else{
let body = {
id:this.datas.id,
startTime:this.startTime,
endTime:this.endTime,
title:this.examName
}
this.http.put(`/api/Papers/${this.datas.id}`,body).subscribe(data => {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('修改名称时间成功','确定',config);
setTimeout(() => {
sessionStorage.setItem("paperId",this.datas.id)
//this.router.navigateByUrl("/examiner/create-test-score?pattern=edit")
this.router.navigateByUrl("/createexam-index/examiner-new-one?pattern=edit")
this.dialogRef.close();
}, 1000);
})
}
}
close(){
this.dialogRef.close();
}

10
src/app/examiner/examiner-new-one/examiner-new-one.component.ts

@ -4,7 +4,7 @@
* @Author: sueRimn
* @Date: 2020-12-11 16:34:26
* @LastEditors: sueRimn
* @LastEditTime: 2020-12-21 11:03:29
* @LastEditTime: 2021-02-23 17:13:27
*/
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http'
@ -36,6 +36,7 @@ export class ExaminerNewOneComponent implements OnInit {
this.getUnittype();
this.getAllKeyUnit();
}
pattern:any = this.route.snapshot.queryParams.pattern || ''
indexid=sessionStorage.getItem("paperId") //上个页面传过来的id
removeClass=document.getElementsByClassName("mat-form-field-underline")
@ -343,7 +344,7 @@ export class ExaminerNewOneComponent implements OnInit {
}
//下一步事件
nextClick(){
//console.log(this.selectedunitArr)
console.log(this.pattern)
/* var workDate=[]
for(var i=0;i<this.selectedunitArr.length;i++){
workDate.push(this.selectedunitArr[i].buildingTypes)
@ -356,11 +357,16 @@ export class ExaminerNewOneComponent implements OnInit {
this.snackBar.open('请选择单位','确定',config);
}
else{
if(this.pattern=='edit'){
this.router.navigateByUrl("/examiner/create-test-score?pattern=edit")
}else{
sessionStorage.setItem(this.indexid,JSON.stringify(this.selectedunitArr) )
this.router.navigateByUrl("/examiner/create-test-score")
}
}
}
//编辑单位信息
editunit(){
sessionStorage.setItem("six","edit")

3
src/app/examiner/examiner.module.ts

@ -58,10 +58,11 @@ import { MarkPapersTwoComponent } from './mark-papers-two/mark-papers-two.compon
import { StatisticAnalysisComponent } from './statistic-analysis/statistic-analysis.component';
import { FinishDia }from './examiner-index/examiner-index.component';
import { ReviewFilesComponent,editRightWrongComponent } from './review-files/review-files.component'
import { editorsDia } from './examiner-index/examiner-index.component'
@NgModule({
declarations: [CreateTestScoreComponent,AddPlanDialog,AddPlanTwoDialog,LookTreeNodeDialog,ExaminerIndexComponent, ExaminerNewOneComponent,FinishDialog,PlanLevel,MarkPapersIndexComponent, MarkPapersTwoComponent, StatisticAnalysisComponent,FinishDia, ReviewFilesComponent,editRightWrongComponent],
declarations: [CreateTestScoreComponent,AddPlanDialog,AddPlanTwoDialog,LookTreeNodeDialog,ExaminerIndexComponent, ExaminerNewOneComponent,FinishDialog,PlanLevel,MarkPapersIndexComponent, MarkPapersTwoComponent, StatisticAnalysisComponent,FinishDia, ReviewFilesComponent,editRightWrongComponent,editorsDia],
imports: [
CommonModule,
examinerRoutingModule,

Loading…
Cancel
Save