import Panel from "../views/Panel";
import StartScene from "../startScene/StartScene";
import ToastCtrl from "../ctrls/toastCtrl";
import { DataManager } from "../../libs/tw/manager/DataManager";

export default class PrizePanel extends Panel{
    protected get skinKey() { return 'Prize' }
    public closeBtn:eui.Button;
    public prizename:eui.Label;
    public getBtn:eui.Button;
    public prizeImg:eui.Image;

    constructor(data){
        super();
        this.initUI(data);
    }
    initUI(data){
        // if(data.type == "bronze"){
        //     if(data.prizenum == 1){
        //         this.prizeImg.source = "bronzeprize1_png";
        //         this.prizename.text = "拼多多1-100元红包";
        //     }else if(data.prizenum == 2){
        //         this.prizeImg.source = "bronzeprize2_png";
        //         this.prizename.text = "优酷会员全场7折";
        //     }else if(data.prizenum == 3){
        //         this.prizeImg.source = "bronzeprize3_png";
        //         this.prizename.text = "爱奇艺钻石会员58折";
        //     }else if(data.prizenum == 4){
        //         this.prizeImg.source = "bronzeprize4_png";
        //         this.prizename.text = "芒果TV会员55大促";
        //     }
        // }else if(data.type == "gold"){
        //     if(data.prizenum == 1){
        //         this.prizeImg.source = "goldprize1_png";
        //         this.prizename.text = "现金红包38元";
        //     }else if(data.prizenum == 2){
        //         this.prizeImg.source = "goldprize2_png";
        //         this.prizename.text = "百事通年卡";
        //     }else if(data.prizenum == 3){
        //         this.prizeImg.source = "goldprize3_png";
        //         this.prizename.text = "888元红包";
        //     }
        // }else if(data.type == "king"){
        //     if(data.prizenum == 1){
        //         this.prizeImg.source = "kingprize1_png";
        //         this.prizename.text = "现金红包48元";
        //     }else if(data.prizenum == 2){
        //         this.prizeImg.source = "kingprize2_png";
        //         this.prizename.text = "iPhone";
        //     }else if(data.prizenum == 3){
        //         this.prizeImg.source = "kingprize3_png";
        //         this.prizename.text = "代还借款账单";
        //     }
        // }else{
        //     this.prizeImg.source = "prize1_png";
        //     this.prizename.text = "现金红包18元";
        // }
        this.prizeImg.source = data.icon;
        this.prizename.text = data.prizeName;
        
    }

    initEvents(){
        super.initEvents();
        this.onTap(this.closeBtn,this.onTap_closeBtn);
        this.onTap(this.getBtn,this.onTap_closeBtn);
    }


    onTap_closeBtn(){
        
        // huanbeNet.getTask((s)=>{
        //     if(!s){
        //         ToastCtrl.instance.show(`活动太火爆了，请稍后再来~`);
        //     }
        //         let data = DataManager.ins.getData("getTask").data;
        //         StartScene.instance.updateData(data);
                this.hidePanel();
            
        // },window['projectId'])
        
    }
}