(function(){
    X.pageLogic['personalsettings'] = {
        init : function(){

            X.laytpldata("#personalsettings-bg-box-dot",X.DATA.userinfo,".personalsettings-bg-box");

            
            $(document).off('click','.personalsettings-name').on('click','.personalsettings-name',function(){
                $(".personalsettings-mr-name").hide();
                $(".personalsettings-updata-name").show();
            })

            $(document).off('click','.personalsettings-name-qd').on('click','.personalsettings-name-qd',function(){
                $(".personalsettings-mr-name").show();
                $(".personalsettings-updata-name").hide();
            })

            $(document).off('click','.personalsettings-name-qx').on('click','.personalsettings-name-qx',function(){
                var tit = $(".personalsettings-name-txt").val();
                X.api("user/edit_profile","post",{nickname: tit},function(d){
                    console.log(d);
                    X.DATA.userinfo['nickname'] = d.nickname;
                    X.laytpldata("#personalsettings-bg-box-dot",X.DATA.userinfo,".personalsettings-bg-box");
                })
                $(".personalsettings-mr-name").show();
                $(".personalsettings-updata-name").hide();
            })
            
            $(document).off('click','.personalsettings-tel').on('click','.personalsettings-tel',function(){
                $(".personalsettings-mr-tel").hide();
                $(".personalsettings-binding-tel").show();
            })

            $(document).off('click','.personalsettings-tel-qd').on('click','.personalsettings-tel-qd',function(){
                $(".personalsettings-mr-tel").show();
                $(".personalsettings-binding-tel").hide();
            })

            $(document).off('click','.personalsettings-tel-qx').on('click','.personalsettings-tel-qx',function(){
                var tit = $(".personalsettings-tel-txt").val();
                X.api("user/edit_profile","post",{tel: tit},function(d){
                    console.log(d);
                    X.DATA.userinfo['tel'] = d.tel;
                    X.laytpldata("#personalsettings-bg-box-dot",X.DATA.userinfo,".personalsettings-bg-box");
                })
                $(".personalsettings-mr-tel").show();
                $(".personalsettings-binding-tel").hide();
            })

            $(document).off('click','.personalsettings-updata-password').on('click','.personalsettings-updata-password',function(){
                X.open({
                    type: 1,
                    title: false,
                    closeBtn: 0,
                    shadeClose: true,
                    skin: 'yourclass',
                    url: 'updatapassword'
                  })
            })
            

        }
    };
})();