Browse Source

[修改]编辑时间弹窗位置修改

master
chenjingyu 4 years ago
parent
commit
b0749fd597
  1. 109
      src/app/examiner/create-test-score/create-test-score.component.ts
  2. 32
      src/app/examiner/create-test-score/editors.html
  3. 44
      src/app/examiner/create-test-score/finishDia.scss
  4. 105
      src/app/examiner/examiner-index/examiner-index.component.ts
  5. 2
      src/app/examiner/examiner.module.ts

109
src/app/examiner/create-test-score/create-test-score.component.ts

@ -75,8 +75,10 @@ export class CreateTestScoreComponent implements OnInit {
}
//获得指定试卷信息。
editdata
getSoloPaper(){
this.http.get(`/api/Papers/${sessionStorage.getItem('paperId')}`).subscribe((data:any) => {
this.editdata=data
data.paperDataInfo.forEach(item => {
this.unitId.push(JSON.parse(item.originalData))
})
@ -1283,13 +1285,17 @@ export class CreateTestScoreComponent implements OnInit {
paperDataInfo:paperDataInfo
}
this.http.put(`/api/Papers/UpdatePaperData/${sessionStorage.getItem('paperId')}`,body).subscribe(data => {
const config = new MatSnackBarConfig();
const dialogRef = this.dialog.open(editorsDia, {
width: '650px',
data: this.editdata
});
/* const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('创建试卷成功,页面将于一秒后退出','确定',config);
setTimeout(() => {
this.router.navigateByUrl('/home/createexam-index')
}, 1000);
}, 1000); */
})
})
@ -1550,3 +1556,102 @@ export class LookTreeNodeDialog {
}
}
//编辑试题弹窗
@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
console.log(this.datas)
}
//获取登录账号的个人资料
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
}
let params = {
id: null,
title: this.examName,
duration: this.datas.duration,
modifiedTime: new Date(),
deleted: false,
startTime: this.startTime,
endTime: this.endTime,
organizationId: this.datas.organizationId,
creatorId: this.datas.creatorId,
paperDataInfo: null
}
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);
this.router.navigateByUrl('/home/createexam-index')
this.dialogRef.close();
/* setTimeout(() => {
this.http.get(`/api/Papers/${this.datas.id}`).subscribe((data:any) => {
if(data.paperDataInfo.length==0){
this.http.delete(`/api/Papers/${this.datas.id}`).subscribe((data:any) => {
})
this.http.post('/api/Papers',params).subscribe(data => {
//sessionStorage.removeItem("checkedWork")
sessionStorage.setItem("paperId",this.datas.id)
this.router.navigate(['/home/createexam-index/examiner-index']) //跳转试卷列表页面
},err => {
this.snackBar.open(err,'确定',config);
})
}else{
sessionStorage.setItem("paperId",this.datas.id)
this.router.navigateByUrl("/examiner/create-test-score?pattern=edit")
}
})
this.dialogRef.close();
}, 1000); */
})
}
}
close(){
this.dialogRef.close();
}
}

32
src/app/examiner/create-test-score/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>

44
src/app/examiner/create-test-score/finishDia.scss

@ -0,0 +1,44 @@
.box{
display: flex;
flex-direction: column;
margin-left: 20px;
input{
width: 260px;
height: 40px;
line-height: 34px;
border-radius: 5px;
padding-left: 5px;
outline: none;
border: 1px solid rgb(226, 211, 211);
}
.diaone{
display: flex;
flex-direction: column;
button {
border: none;
color: white;
padding: 5px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 8px;
outline:0 none !important;
}
}
.diatwo{
margin-top: 20px;
display: flex;
flex-direction: row;
.endtime{
margin-left: 20px;
}
.datepicker{
height: 44px;
border-radius: 5px;
}
}
}

105
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-02-24 15:37:32
* @LastEditTime: 2021-02-25 10:16:21
*/
import { Component, OnInit, ViewChild, Inject,Input } from '@angular/core';
import {HttpClient} from '@angular/common/http'
@ -139,12 +139,12 @@ export class ExaminerIndexComponent implements OnInit {
this.snackBar.open('开考中,不能编辑','确定',config);
}
else{
const dialogRef = this.dialog.open(editorsDia, {
/* const dialogRef = this.dialog.open(editorsDia, {
width: '650px',
data: item
});
/* sessionStorage.setItem("paperId",item.id)
this.router.navigateByUrl("/examiner/create-test-score?pattern=edit") */
}); */
sessionStorage.setItem("paperId",item.id)
this.router.navigateByUrl("/examiner/create-test-score?pattern=edit")
}
}
lookPaper(item){
@ -416,99 +416,4 @@ export class FinishDia{
}
}
//编辑试题弹窗
@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
console.log(this.datas)
}
//获取登录账号的个人资料
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
}
let params = {
id: null,
title: this.examName,
duration: this.datas.duration,
modifiedTime: new Date(),
deleted: false,
startTime: this.startTime,
endTime: this.endTime,
organizationId: this.datas.organizationId,
creatorId: this.datas.creatorId,
paperDataInfo: null
}
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(() => {
this.http.get(`/api/Papers/${this.datas.id}`).subscribe((data:any) => {
if(data.paperDataInfo.length==0){
this.http.delete(`/api/Papers/${this.datas.id}`).subscribe((data:any) => {
})
this.http.post('/api/Papers',params).subscribe(data => {
//sessionStorage.removeItem("checkedWork")
sessionStorage.setItem("paperId",this.datas.id)
this.router.navigate(['/home/createexam-index/examiner-new-one']) //跳转试卷列表页面
},err => {
this.snackBar.open(err,'确定',config);
})
}else{
sessionStorage.setItem("paperId",this.datas.id)
this.router.navigateByUrl("/examiner/create-test-score?pattern=edit")
}
})
this.dialogRef.close();
}, 1000);
})
}
}
close(){
this.dialogRef.close();
}
}

2
src/app/examiner/examiner.module.ts

@ -58,7 +58,7 @@ 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'
import { editorsDia } from './create-test-score/create-test-score.component'
@NgModule({

Loading…
Cancel
Save