import { Component, OnInit } from '@angular/core';
import { AppComponent } from '../../../../..';
import { FrameRequest } from '../../../../../shared/frame/frame-request';

@Component({
  selector: 'app-histroy-collegescore',
  templateUrl: './histroy-collegescore.component.html',
  styleUrls: ['./histroy-collegescore.component.scss']
})
export class HistroyCollegeScoreComponent implements OnInit {

  public query = {
    std_name: "",
    ticket_no: "",
    cert_no: "",
    old_ticket_no : ""
  };

  historyScore = []; //考生历史成绩
  paperScore = []; //毕业论文成绩
  orderNum : any;

  HISTROY_SCORE_URL = "kj/kjUnifiedScoreDetail/collegeScore.htm";
  PAPER_SCORE_URL = "kj/kjUnifiedScoreDetail/collegeScore.htm";

  constructor() { }

  ngOnInit() {
  }

  searchStdScore() {
    if(!this.query.std_name && !this.query.ticket_no && !this.query.cert_no && !this.query.old_ticket_no) {
      AppComponent.alert({title:'提示', text: '请输入准考证号或身份证号或老考号'});
      return;
    }
    
    FrameRequest.requestArray(this.HISTROY_SCORE_URL, {
      ticket_no : this.query.ticket_no,
      cert_no : this.query.cert_no,
      old_ticket_no : this.query.old_ticket_no
    }, (array) => {
      this.historyScore = array;
    });
  }

  //重置
  reset() {
    this.query.std_name = "";
    this.query.ticket_no= "";
    this.query.cert_no = "";
    this.query.old_ticket_no = "";
    this.historyScore = [];
    this.paperScore = [];
  }

}
