import { Component, OnInit } from '@angular/core';
import {NzMessageService} from 'ng-zorro-antd';
import {ActivatedRoute} from '@angular/router';
import {CompanyService} from '../../../services/company.service';
import {environment} from '../../../../environments/environment';

@Component({
  selector: 'app-company-detail',
  templateUrl: './company-detail.component.html',
  styleUrls: ['./company-detail.component.scss']
})
export class CompanyDetailComponent implements OnInit {
  FILE_URL = environment.imageUrl;
  data: any = {};
  id: number;
  constructor(
      private company: CompanyService,
      private message: NzMessageService, // 信息提示
      private activatedRoute: ActivatedRoute,
  ) { }

  ngOnInit(): void {
    this.activatedRoute.queryParams.subscribe(queryParams => {
      if (queryParams.companyId != null) {
        this.id = queryParams.companyId;
        this.getDetails(queryParams.companyId);
      }
    });
  }

  // 查询详情
  public getDetails(id: number) {
    this.company.companyView(id , data => {
      console.log(data);
      this.data = data['return_data'];
    });
  }
}
