import { GameGetSubmitResultData } from '../../libs/tw/data/game/submit/GameGetSubmitResultData';
import { GetInfoData } from '../../libs/tw/data/game/getInfo/GetInfoData';
import Panel from "../views/Panel";
import MItem from '../components/MItem';
import PanelCtrl from '../ctrls/panelCtrl';
import { ModuleTypes } from '../types/sceneTypes';
import { NetPromise } from '../NetPromise';
import { DataManager } from '../../libs/tw/manager/DataManager';
import { NetName } from '../../libs/tw/enum/NetName';
import { GDispatcher } from '../../libs/tc/util/GDispatcher';
import { NetBuried } from '../NetBuried';

export default class RedItem extends MItem {

    public amount:eui.Label;
    public time:eui.Label;
    
    constructor() {
        super();
    }
   
    dataChanged(){

        this.btn_0.visible=false;
        this.btn_1.visible=false;
        this.btn_3.visible=false;
        this.btn_4.visible=false;

        console.log(this.data)
        if(this["btn_"+this.data.status]){
            this["btn_"+this.data.status].visible=true;
        }
        
        if(this.data.type=="share"){
            this.title.text="每日分享"
            this.desc.text="可额外获得一次游戏次数"
        }else if(this.data.type=="bind"){
            this.title.text="一键绑定云闪付"
            this.desc.text="有机会获得精美奖品"
        }else if(this.data.type=="mobile"){
            this.title.text="签约手机号转账"
            this.desc.text="有机会获得精美奖品"
        }
       
    }

    onSkinComplete(){
        //去完成按钮
        this.btn_0.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onTap_btn_0,this)
        this.btn_1.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onTap_btn_1,this)
        this.btn_3.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onTap_btn_3,this)
        this.btn_4.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onTap_btn_4,this)
    }


    //去完成
    onTap_btn_0(){
        if(this.data.type=="share"){
            window["App"].showSharePanel();
        }else if(this.data.type=="bind"){
            window.location.href=window["bindUrl"];
        }else if(this.data.type=="mobile"){
            window.location.href=window["mobileUrl"];
        }
    }
    //待发奖
    onTap_btn_1(){

    }
    //待领奖
    onTap_btn_3(){

    }
    //已完成
    onTap_btn_4(){

    }
}