apply.component.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
  2. import { CommonCompModule } from '../../../services/common.modules';
  3. import { Router, ActivatedRoute } from '@angular/router';
  4. import { ReactiveFormsModule } from '@angular/forms';
  5. import { BasicInComponent } from '../components/basic-in/basic-in.component';
  6. import { TextbookPertainComponent } from '../components/textbook-pertain/textbook-pertain.component';
  7. import { TextbookContentComponent } from '../components/textbook-content/textbook-content.component';
  8. import { AttachmentComponent } from '../components/attachment/attachment.component';
  9. import { FaithComponent } from '../components/faith/faith.component';
  10. // import { NzLayoutModule } from 'ng-zorro-antd/layout';
  11. import Parse from 'parse';
  12. @Component({
  13. selector: 'app-apply',
  14. imports: [
  15. CommonCompModule,
  16. ReactiveFormsModule,
  17. BasicInComponent,
  18. TextbookPertainComponent,
  19. TextbookContentComponent,
  20. AttachmentComponent,
  21. FaithComponent
  22. ],
  23. standalone: true,
  24. templateUrl: './apply.component.html',
  25. styleUrls: ['./apply.component.scss'],
  26. })
  27. export class ApplyComponent implements OnInit {
  28. textBook: Parse.Object | any;
  29. state: number = 0;
  30. get stateMap() {
  31. let map: any = {
  32. '0': '教材基本信息',
  33. '1': '教材适用情况',
  34. '2': '申报教材建设历程',
  35. '3':'',
  36. '4': '附件材料',
  37. };
  38. return map[this.state];
  39. }
  40. showFrom: boolean = false;
  41. constructor(private router: Router, private activeRoute: ActivatedRoute) {}
  42. /** 路由传递教材id*/
  43. eduId:any
  44. async ngOnInit() {
  45. let that = this
  46. this.activeRoute.paramMap.subscribe(async (params) => {
  47. let id = params.get('id');
  48. that.eduId = id
  49. console.log(that.eduId)
  50. if (id) {
  51. let query = new Parse.Query('EduTextbook');
  52. query.equalTo('objectId', id);
  53. this.textBook = await query.first();
  54. console.log(this.textBook);
  55. if(this.textBook?.get('render')){
  56. window.alert("已提交,禁止编辑")
  57. history.back()
  58. }
  59. }
  60. this.showFrom = true;
  61. });
  62. }
  63. changeState(event: string | any) {
  64. console.log(event);
  65. if(event?.textBook){
  66. this.textBook = event?.textBook
  67. }
  68. if (event?.type == 'pre') {
  69. this.state--;
  70. } else if(event?.type == 'next'){
  71. this.state++;
  72. }
  73. let topEle = document.getElementById('top')
  74. if(topEle){
  75. topEle.scrollIntoView({ behavior: 'smooth' });
  76. }
  77. }
  78. save() {}
  79. back() {
  80. history.back();
  81. }
  82. }