(function(){
    X.pageLogic['projectinfo'] = {
        init : function(){
            layui.form.render();


            var data;
            X.api("project/detail","get",{},function(d){
                data = d;
                X.laytpldata("#projectinfo-info-box-dot",data,".projectinfo-info-box");
                // X.laytpldata("#usersbtx-dot",data.vUserIdItems,"#usersbtx");

                // var ipWhitelistarr = data['ipWhitelist'].split(',');
                // X.laytpldata("#projectinfo-ip-tx-box-dot",ipWhitelistarr,".projectinfo-ip-tx-box");
                $(".projectinfo-ip-input").html(data['name']);
            })

            // var data = {
            //     'projectName':'内网测试1',
            //     'appid':1234545,
            //     "projectid":1546464,
            //     'totalEventNum': 19193,//已用数据总量
            //     'yuaneventtype':"8/500",
            //     'yuaneventattr':'64/1000',
            //     'userattr':"30/500",
            //     'syncInterval':30,//间隔时间
            //     'sendoutnum':30,//发送数量
            //     'vUserIdItems':[
            //         {'columnDesc':'账户ID','id':131},
            //         {'columnDesc':'app版本','id':131}
            //     ],//用户识别体系
            //     ipWhitelist:'10.0.0.5,10.0.0.7'
            // }

            $("body").on("click",".menu_dapax .item_kuvn .item_kuvn-pl",function(){
                $(".menu_dapax .item_kuvn .item_kuvn-pl").removeClass("selected___3ctlt");
                $(this).addClass("selected___3ctlt");
            })

            

            $('body').on("click",".projectinfo-info-title img",function(){
                $(".projectinfo-info-title").hide();
                $(".projectinfo-info-title-update-box").show();
            })
            
            $('body').on("click",".projectinfo-info-title-update-cha",function(){
                $(".projectinfo-info-title").show();
                $(".projectinfo-info-title-update-box").hide();
            })

            $('body').on("click",".projectinfo-info-title-update-gou",function(){
                $(".projectinfo-info-title").show();
                $(".projectinfo-info-title-update-box").hide();
                var tit = $(".projectinfo-info-title-update-box input").val();
                X.api("project/rename","post",{project_id: X.DATA.projectid,rename: tit},function(d){
                    $(".projectinfo-info-title span").html(tit)
                })
                
            })

            $('body').on("click",".projectinfo-sdkpeizhi-edit",function(){
                $(".projectinfo-sdkpeizhi").hide();
                $(".projectinfo-sdkpeizhi-update-ope").show();
                $(this).hide();
                $(".projectinfo-sdkpeizhi-img").show();
            })

            $('body').on("click",".projectinfo-sdkpeizhi-img-del",function(){
                $(".projectinfo-sdkpeizhi").show();
                $(".projectinfo-sdkpeizhi-update-ope").hide();
                $(this).hide();
                $(".projectinfo-sdkpeizhi-img").hide();
                $(".projectinfo-sdkpeizhi-edit").show();
            })

            $('body').on("click",".projectinfo-sdkpeizhi-img-update",function(){
                $(".projectinfo-sdkpeizhi").show();
                $(".projectinfo-sdkpeizhi-update-ope").hide();
                $(this).hide();
                $(".projectinfo-sdkpeizhi-img").hide();
                $(".projectinfo-sdkpeizhi-edit").show();
                var shijian = $(".projectinfo-sdkpeizhi-shijian").val();
                var num = $(".projectinfo-sdkpeizhi-num").val();
            })
            
            $('body').on("click",".projectinfo-ip-edit",function(){
                $(".projectinfo-ip-input").show();
                $(".projectinfo-ip-tx-box").hide();
                $(".projectinfo-ip-img").show();
                $(this).hide();
            })

            $('body').on("click",".projectinfo-ip-img-del",function(){
                $(".projectinfo-ip-input").hide();
                $(".projectinfo-ip-tx-box").show();
                $(".projectinfo-ip-img").hide();
                $(".projectinfo-ip-edit").show();
            })
            
            $('body').on("click",".projectinfo-ip-img-update",function(){
                $(".projectinfo-ip-input").hide();
                $(".projectinfo-ip-tx-box").show();
                $(".projectinfo-ip-img").hide();
                $(".projectinfo-ip-edit").show();
                var tit = $(".projectinfo-ip-input").html();
                //ip白名单确定按钮
                console.log(tit);
            })

            $('body').on("click",".usersattr",function(){
                X.open({
                    type: 1,
                    title: false,
                    closeBtn: 0,
                    shadeClose: true,
                    skin: 'yourclass',
                    url: 'usersbtx'
                })
            })

            $("body").on("click",".timeadmin",function(){
                X.open({
                    type: 1,
                    title: false,
                    closeBtn: 0,
                    shadeClose: true,
                    skin: 'yourclass',
                    url: 'timeadmin'
                })
            })
            

        }
    };
})();