import Panel from "../views/Panel";
import { DataManager } from "../../libs/tw/manager/DataManager";

export default class GetTicketPanel extends Panel {
    public get skinKey() { return "GetTicketPanel" }
    public btnOk: eui.Button;
    public ticketName: eui.Label;
    public ticketArea: eui.Image;

    constructor(data: any) {
        super(data);
    }

    onSkinComplete() {
        super.onSkinComplete();
        this.ticketName.text = DataManager.ins.getPlugOrderStatusData.lottery.title;
        this.ticketArea.source = DataManager.ins.getPlugOrderStatusData.lottery.img;
    }

    initEvents(){
        super.initEvents()
        this.btnOk.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_btnOk, this);
        this.ticketArea.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_btnOk, this);
    }

    removeEvents(){
        super.removeEvents()
        this.btnOk.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_btnOk, this);
        this.ticketArea.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_btnOk, this);
    }

    onTap_btnOk(){
        window.location.href=DataManager.ins.getPlugOrderStatusData.lottery.link;
    }

}