Class(function(extend, using, self){
    extend("pages/page");
    using("lib/jquery.min.js");

    self.black_ref = null;

    self.initPage = function() {
        this.bindInputInfo();
    };
    self.bindInputInfo = function() {
        var u_name = this.black_ref.get_user_name();
        $(".member-id").text(u_name);
    };

    self.initEvent = function(){
        var that = this;

        // 确定按钮
        $(document).delegate(".btn-box button:eq(0)", "click", function () {

            var type = $("input[type='radio'][name='reason']:checked").val();

            if(type == 4) {
                var stopstring =  $("#txt").val().length;
                if(stopstring <= 0) {
                    return ;
                }
            }

            that.black_ref.btn_ok_click();
        });

        // 点击label，相邻兄弟节点checked改变状态
        $(document).delegate("label", "click", function () {
            var flag = $(this).prev().is(":checked");
            var val = $(this).prev().val();
            if(flag == false) {
                $(this).prev().prop('checked', true);
            }
            if(val == 4) {
                var legth = $("#txt").val().length;
                if(legth <= 0) {
                    $(".popup-Box .btn-box .btn:first").css("background-color", "#C0C0C0");
                } else {
                    $(".popup-Box .btn-box .btn:first").css("background-color", "#00a2ff");
                }
            } else {
                $(".popup-Box .btn-box .btn:first").css("background-color", "#00a2ff");
            }
        });

        // 点击input值改变
        $(document).delegate("#txt", "input", function () {
            var legth = $("#txt").val().length;
            if(legth > 0) {
                $(".popup-Box .btn-box .btn:first").css("background-color", "#00a2ff");
            } else {
                var val = $(this).parent().find("input[type='radio'][name='reason']").val();
                if(val == 4) {
                    $(".popup-Box .btn-box .btn:first").css("background-color", "#C0C0C0");
                }
            }
        });

        // 点击radio-box，name为reason
        $(document).delegate("input[type='radio'][name='reason']", "click", function () {
            var val = $(this).val();
            if(val == 4) {
                var legth = $("#txt").val().length;
                if(legth <= 0) {
                    $(".popup-Box .btn-box .btn:first").css("background-color", "#C0C0C0");
                }
            } else {
                $(".popup-Box .btn-box .btn:first").css("background-color", "#00a2ff");
            }
        });


        // 取消按钮
        $(document).delegate(".btn-box button:eq(1)", "click", function () {
            that.black_ref.btn_cancel_click();
        });
    }

    self.func(function(data){
        var that = this;
        that.black_ref = data;
        that.sup().constructor(data);

        this.addCall("send_kick_info", function() {
            that.log_trace(that.black_ref, that.toInt+"=========++", 0)
            var stoptype = that.toInt($("input[type='radio'][name='shot']:checked").val());
            var reason_target = $("input[type='radio'][name='reason']:checked");

            var reason_type = reason_target.val();
            var stopstring = '';
            if(reason_type == 4) {
                stopstring =  $("#txt").val();
            } else {
                stopstring = reason_target.next().text();
            }
            var text = "{ \"stopstring\":\"" + stopstring + "\",\"stoptype\":" +  stoptype + "}";

            return that.formatData(text);
        });

        that.initPage();
        that.initEvent();
    })
})