{
    template:'${tmpl}',
    data:function(){
        return {
            ldms:[],
            showAggree: false,
            isAggree : false,
        }
    },
    mounted:function(){
        this.$root.hidetabs();
        this.ldms=[
            {
                "title":"",
                "colnum":1,
                 "ctls":[
                   {"type":"input","label":"用户名","prop":"userName","placeHolder":"请输入用户名","style":"","rules": [{ "required": true, "message": '请输入用户名', "trigger": 'blur' },{ "validator":"validatex","trigger": 'blur' }]},
                   {"type":"input","label":"用户密码","prop":"password","placeHolder":"请输入用户密码","style":"","rules": [{ "required": true, "message": '请输入用户密码', "trigger": 'blur' }],},
                 ]
              },
        ];

    },
    created:function(){

    },
    methods:{
        validmethod:function (rule,value,callback) { 
            console.log("code validdate");
            var self=this;
            if(rule.field=="userName"){
                self.patnerValid();
            }
            return callback();
        },
        patnerValid() {
            var self = this;
            var fm=this.$refs.loginFrm.getFormModel();
            this.$root.postReq("/web/userCtl/patnerValid", {
                userName : fm.userName
            }).then(rd => {
                self.showAggree = false;
                if (rd.status == 0) {
                    if(rd.data == "1") {
                        self.showAggree = true;
                    }
                }
            });
        },
        sbhandler:function () {  
            console.log(this.showAggree, this.isAggree, "------------------------------- ");
            var self=this;
            var fm=this.$refs.loginFrm.getFormModel();
            fm.aggree = this.showAggree && this.isAggree;
            this.$refs.loginFrm.validate(function(v){
                if(v){
                    self.$root.postReq("/web/userCtl/login",{u:fm}).then(function(d){
                        if(d.status==0){
                            console.log(d.data);
                            location.reload();
                        }  else {
                            self.$message.warning(d.msg || "登录失败, 请稍候重试");
                        }
                      });
                }
            });
         },
     
    },
    vname:"gsb-login"
}
