|
@@ -3,6 +3,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
|
import { CommonCompModule } from '../../../services/common.modules';
|
|
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
|
import { NzSelectModule } from 'ng-zorro-antd/select';
|
|
|
+import Parse from 'parse';
|
|
|
import {
|
|
|
FormControl,
|
|
|
FormGroup,
|
|
@@ -25,6 +26,7 @@ import { ProfileComponent } from '../components/profile/profile.component'
|
|
|
styleUrls: ['./create-collection.component.scss'],
|
|
|
})
|
|
|
export class CreateCollectionComponent implements OnInit {
|
|
|
+ eduCollection:Parse.Object|undefined
|
|
|
provinces: Array<string> = provinces.options
|
|
|
showEdit:boolean = false
|
|
|
|
|
@@ -40,6 +42,7 @@ export class CreateCollectionComponent implements OnInit {
|
|
|
area: ['', [Validators.required]],
|
|
|
})
|
|
|
constructor(
|
|
|
+ private activeRoute: ActivatedRoute,
|
|
|
private router: Router,
|
|
|
public tbookSer: textbookServer,
|
|
|
private fb: NonNullableFormBuilder,
|
|
@@ -47,7 +50,23 @@ export class CreateCollectionComponent implements OnInit {
|
|
|
private modal: NzModalService
|
|
|
) { }
|
|
|
|
|
|
- ngOnInit() {}
|
|
|
+ ngOnInit() {
|
|
|
+ this.activeRoute.paramMap.subscribe(async (params) => {
|
|
|
+ let id = params.get('id');
|
|
|
+ if (id) {
|
|
|
+ let query = new Parse.Query('EduCollection');
|
|
|
+ query.equalTo('objectId', id);
|
|
|
+ this.eduCollection = await query.first()
|
|
|
+ }
|
|
|
+ this.validateForm = this.fb.group({
|
|
|
+ name: [this.eduCollection?.get('this.eduCollection') ||'', [Validators.required]],
|
|
|
+ desc: [this.eduCollection?.get('this.desc') ||'', [Validators.required]],
|
|
|
+ code: [this.eduCollection?.get('this.code') ||'', [Validators.required]],
|
|
|
+ area: [this.eduCollection?.get('this.area') ||'', [Validators.required]],
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
submitForm(): void {
|
|
|
if (this.validateForm.valid) {
|
|
|
console.log('submit', this.validateForm.value);
|