Browse Source

[完善]删除多余代码

master
邵佳豪 4 years ago
parent
commit
642c5c94f4
  1. 2
      src/app/app-routing.module.ts
  2. 3
      src/app/examiner/examiner-routing.ts
  3. 14
      src/app/navigation/adddatabank.html
  4. 14
      src/app/navigation/editdatabankname.html
  5. 4
      src/app/navigation/navigation.component.html
  6. 64
      src/app/navigation/navigation.component.ts
  7. 6
      src/app/navigation/navigation.module.ts
  8. 25
      src/app/pipes/size.pipe.ts
  9. 10
      src/app/tabbar/tabbar.component.ts
  10. 4
      src/app/ui/ui.module.ts

2
src/app/app-routing.module.ts

@ -21,7 +21,7 @@ const routes: Routes = [
]
},
{ path:'examiner/create-test-score', component:CreateTestScoreComponent,canActivate: [AuthGuard],}, //创建试卷具体分数页面
{ path: 'canvasTool', component:CollectionToolsComponent,canActivate: [AuthGuard], }, //编制工具
{ path:'canvasTool', component:CollectionToolsComponent,canActivate: [AuthGuard], }, //编制工具
{ path:'adminLogin', component:LoginComponent}, //管理员登录路由
{ path:'login', component:LockscreenComponent}, //教员学员登录路由

3
src/app/examiner/examiner-routing.ts

@ -15,14 +15,11 @@ import { MarkPapersTwoComponent } from './mark-papers-two/mark-papers-two.compon
import { StatisticAnalysisComponent } from './statistic-analysis/statistic-analysis.component'
const routes: Routes = [
// { path: '', component:CreateExamComponent }
{ path: 'createexam-index', component:ExaminerIndexComponent },
{ path: 'examiner-new-one', component:ExaminerNewOneComponent },
{ path: 'mark-papers-index',component:MarkPapersIndexComponent},
{ path: 'mark-papers-two',component:MarkPapersTwoComponent},
{ path: 'statistic-anaily',component:StatisticAnalysisComponent}
//{ path: 'createexam-index', component:ExaminerIndexComponent },
]
@NgModule({
imports: [RouterModule.forChild(routes)],

14
src/app/navigation/adddatabank.html

@ -1,14 +0,0 @@
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container">
<mat-form-field>
<input matInput id="name" name="name" type='text'
required
ngModel #name="ngModel" placeholder="请输入资料库名称">
</mat-form-field>
<div class="btn">
<button type="submit" class="savebtn" mat-raised-button color="primary" [disabled]='form.invalid'>确定</button>
<button type="button" mat-button (click)="onNoClick()" mat-raised-button>取消</button>
</div>
</form>

14
src/app/navigation/editdatabankname.html

@ -1,14 +0,0 @@
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container">
<mat-form-field>
<input matInput id="name" name="name" type='text'
required
[(ngModel)]="dataBankName" placeholder="修改资料库名称">
</mat-form-field>
<div class="btn">
<button type="submit" class="savebtn" mat-raised-button color="primary" [disabled]='form.invalid'>确定</button>
<button type="button" mat-button (click)="onNoClick()" mat-raised-button>取消</button>
</div>
</form>

4
src/app/navigation/navigation.component.html

@ -7,7 +7,7 @@
* @LastEditTime: 2020-12-15 14:32:13
-->
<mat-sidenav-container class="example-container" autosize [class.myapp-dark-theme]="darktheme">
<mat-sidenav-container class="example-container" autosize>
<mat-sidenav #drawer class="example-sidenav" mode="side" opened="true" color="primary" style="overflow-x: hidden;">
<div class="backtopleft">
<img src="../../assets/images/backleft.png" style="height: 60px;width: 93px;">
@ -40,7 +40,7 @@
<div class="example-sidenav-content">
<div style="height: 60px; min-height: 60px;">
<app-tabbar (toggleDarkTheme)="switchTheme($event)" (defaulttheme)="defaulttheme()" (redtheme)="redtheme()"></app-tabbar>
<app-tabbar></app-tabbar>
</div>
<div style="flex: 1; overflow: hidden;">
<router-outlet></router-outlet>

64
src/app/navigation/navigation.component.ts

@ -18,70 +18,6 @@ export class NavigationComponent implements OnInit {
isAdmin:boolean = false
ngOnInit() {
// if(sessionStorage.getItem("roleType") == "0"){
// this.isAdmin = true
// }
}
darktheme = false;//黑夜主题
switchTheme (dark) { this.darktheme = dark; }
defaulttheme () { this.darktheme = false }
redtheme () { this.darktheme = true}
}
//新增资料库
@Component({
selector: 'adddatabank',
templateUrl: './adddatabank.html',
styleUrls: ['./navigation.component.scss']
})
export class AddDataBank {
myControl = new FormControl();
constructor(private http: HttpClient,public dialogRef: MatDialogRef<AddDataBank>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
onNoClick(): void {
this.dialogRef.close();
}
onSubmit(value){
if ( value.name.includes('/') ) {
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('名称不允许有特殊字符','确定',config);
} else {
this.dialogRef.close(value);
}
}
}
//更改资料库名称
@Component({
selector: 'editdatabankname',
templateUrl: './editdatabankname.html',
styleUrls: ['./navigation.component.scss']
})
export class EditDataBankName {
myControl = new FormControl();
constructor(private http: HttpClient,public dialogRef: MatDialogRef<EditDataBankName>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
dataBankName:any = this.data.name//要修改的资料库原名称
onNoClick(): void {
this.dialogRef.close();
}
onSubmit(value){
if ( value.name.includes('/') ) {
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('名称不允许有特殊字符','确定',config);
} else {
this.dialogRef.close(value);
}
}
}

6
src/app/navigation/navigation.module.ts

@ -1,6 +1,6 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NavigationComponent, AddDataBank, EditDataBankName } from './navigation.component';
import { NavigationComponent } from './navigation.component';
import { MatIconModule } from '@angular/material/icon';
import { MatSidenavModule } from '@angular/material/sidenav';
import { RouterModule } from '@angular/router';
@ -54,9 +54,7 @@ import {MatTreeModule} from '@angular/material/tree';
@NgModule({
declarations: [
NavigationComponent,
TabbarComponent,
AddDataBank,
EditDataBankName
TabbarComponent
],
imports: [
CommonModule,

25
src/app/pipes/size.pipe.ts

@ -1,29 +1,4 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'name'})
export class NamePipe implements PipeTransform {
transform(name: string): string {
let nameArr = name.split("/")
return nameArr[nameArr.length - 1]
}
}
@Pipe({name: 'name2'})
export class NamePipe2 implements PipeTransform {
transform(name: string): string {
let nameArr = name.split("/")
return nameArr[nameArr.length - 2]
}
}
@Pipe({name: 'name3'})
export class NamePipe3 implements PipeTransform {
transform(name: string): string {
if(name.charAt(name.length-1) == "/"){
return name.substr(0, name.length - 1).replace(/\//g,'>').substring(9,name.length)
}else{
return name.replace(/\//g,'>').substring(9,name.length)
}
}
}
@Pipe({name: 'testState'})
export class testState implements PipeTransform {
transform(name: string): string {

10
src/app/tabbar/tabbar.component.ts

@ -25,16 +25,6 @@ import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar';
})
export class TabbarComponent implements OnInit {
theme: boolean = true;
@Output()
toggle = new EventEmitter<void>();
@Output()
toggleDarkTheme = new EventEmitter<boolean>();
@Output()
defaulttheme = new EventEmitter<boolean>();
@Output()
redtheme = new EventEmitter<boolean>();
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService,public dialog: MatDialog,public isLogin:IsLoginService,public snackBar: MatSnackBar,) { }
ngOnInit() {

4
src/app/ui/ui.module.ts

@ -45,7 +45,7 @@ import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatPaginatorIntl } from '@angular/material/paginator';
import { ChangepasswordComponent } from './changepassword/changepassword.component';
import { NamePipe,NamePipe2, NamePipe3, testState} from '../pipes/size.pipe';
import { testState} from '../pipes/size.pipe';
import {ConfirmpswDirective} from './changepassword/equal-validator.directive';
import { FileUploadModule } from 'ng2-file-upload'
import { ChangeuserdataComponent } from './changeuserdata/changeuserdata.component';
@ -59,7 +59,7 @@ import {WorkingAreaComponent} from '../working-area/working-area.component'
import { NzTreeModule } from 'ng-zorro-antd/tree';
import { examinationQuestions,uploadQuestions } from './collection-tools/examinationQuestions'
@NgModule({
declarations: [ChangepasswordComponent,NamePipe,NamePipe2,NamePipe3,ConfirmpswDirective, ChangeuserdataComponent,testState,CollectionToolsComponent,CreateBuilding,EditBuilding,ViewDetailss,leftFunctionalDomainComponent,editPlaneFigureComponent,addDisposalNodeComponent,editDisposalNodeComponent,saveOneDialog,saveTwoDialog,WorkingAreaComponent,examinationQuestions,uploadQuestions],
declarations: [ChangepasswordComponent,ConfirmpswDirective, ChangeuserdataComponent,testState,CollectionToolsComponent,CreateBuilding,EditBuilding,ViewDetailss,leftFunctionalDomainComponent,editPlaneFigureComponent,addDisposalNodeComponent,editDisposalNodeComponent,saveOneDialog,saveTwoDialog,WorkingAreaComponent,examinationQuestions,uploadQuestions],
imports: [
NzDatePickerModule,

Loading…
Cancel
Save