/**
 * 配置文件
 */
const {ccclass, property} = cc._decorator;

export const ChannelType = cc.Enum({
    DEV: 3,
    TEST: 1,
    FQ: 2,
});


@ccclass
export default class Profile extends cc.Component {


    public url:string = null;

    @property({
        displayName:'开发环境地址'
    })
    url_dev: string = 'http://127.0.0.1:9999';


    @property({
        displayName:'测试环境地址'
    })
    url_test: string = 'http://127.0.0.1:9999';

    @property({
        displayName:'正式环境地址'
    })
    url_prod: string = 'http://127.0.0.1:9999';
    
    @property({
        type: ChannelType,
        displayName: '渠道',
    })
    mChannel = ChannelType.TEST;



    onLoad(){
        // if (CC_DEBUG) {
        //     this.url = this.url_dev;
        // }else{
        //     this.url = this.url_prod;
        // }
        if(this.mChannel == ChannelType.DEV){
            this.url = this.url_dev;
        }else if(this.mChannel == ChannelType.TEST){
            this.url = this.url_test;
        }else if(this.mChannel == ChannelType.FQ){
            this.url = this.url_prod;
        }


        // let http:CHttp = new CHttp(this.url);
        // let fd = new FormData();
        // fd.append('userName','admin');
        // fd.append('passWord','123');
        // http.sendForm('/login',fd,(state,reve)=>{
        //     cc.log('state : ',state);
        //     cc.log('reve : ',reve);
        // })


    }

}
