register


//自定义Vtype验证----验证密码是否一致  
Ext.apply(Ext.form.VTypes,{  
//验证方法    
password:function(val,field){//val指这里的文本框值,field指这个文本框组件  
if(field.password.password_id){  
   //password是自定义的配置参数,一般用来保存另外的组件的id值  
   var pwd=Ext.get(field.password.password_id);//取得user_password的那个id的值  
  return (val==pwd.getValue());//验证  
  }  
  return true;  
},   
//验证提示错误提示信息(注意:方法名+Text)   
passwordText: "两次密码输入不一致!"     
});
//输入密码小窗口
zyerp.system.gerenxinxi.mimaFormPanel = new Ext.form.FormPanel({
autoWidth:true,
layout:"form",
frame:true,
labelWidth:65,
labelAlign:"right",
items:[
{
xtype:"label",
height  : 20,
text :"请输入密码:"
},{
xtype : "textfield",
inputType : "password",
height : 20,
hideLabel : true,
anchor : "95%",
allowBlank:false, 
blankText:"密码不可为空"
}], 
buttons : [
{
   text : "确定",
    handler : function(){
     if(zyerp.system.gerenxinxi.mimaFormPanel.form.isValid()){
zyerp.system.gerenxinxi.mimaFormPanel.form.submit({
     url : "/zyerp/user/user!checkUserMima",
     method : "POST",
     success : function(form, action) {
     if(action.result.success){
      zyerp.system.gerenxinxi.mimaWin.hide();
      }      
     },
     failure : function(form, action) {
     Ext.Msg.alert("提示",action.result.message);
     }
});
}
    }
   }, {
    text : "取消",
    handler : function(){
    zyerp.system.gerenxinxi.mimaWin.destroy();     
    }
}
]
});
zyerp.system.gerenxinxi.mimaWin = new Ext.Window({
title:"密码",
   modal:true,
   width:250,
   height:115,
   collapsible:false,
   resizable:false,
   closeAction:'destroy',
   items:[zyerp.system.gerenxinxi.mimaFormPanel],
   listeners : {
destroy : function() {
zyerp.system.gerenxinxi.personInfoPanel.destroy();
}
   }
});


zyerp.system.gerenxinxi.gerenxinxiweihuForm = new Ext.form.FormPanel({
fileUpload : true,
title : '个人信息维护',
width : 100,
autoHeight : true,
bodyStyle : "padding:2px",
border : false,
frame : true,
items : [{
autoHeight : true,
xtype : 'fieldset',
title : '填写注册信息',
layout : 'form',
items : [{
layout : 'column',
items : [{
width : 250,
layout : 'form',
labelAlign:"right",
items : [{
fieldLabel : '登录用户ID',
xtype : 'textfield',
name : 'user.yonghuid',
itemId : 'yonghuid'
},{
width : 140,
fieldLabel : '登录用户名',
xtype : 'textfield',
name : 'user.dengluming',
itemId : 'dengluming',
readOnly : true,
cls:'x-item-disabled',
allowBlank : false,
blankText : '登录用户名不能为空',
minLength : 4,
minLengthText : '登录用户名长度不得小于4个字符长度',
maxLength : 15,
maxLengthText : '登录用户名长度不得大于15个字符长度'
}]
}]
},{
layout : 'column',
items : [{
width : 250,
layout : 'form',
labelAlign:"right",
items : {
width : 140,
fieldLabel : '真实姓名',
xtype : 'textfield',
name : 'user.zhenshixingming',
itemId : 'zhenshixingming',
allowBlank : false,
blankText : '真实姓名不能为空',
maxLength : 5,
maxLengthText : '登录用户名长度不得大于5个字符长度'
}
}, {
width : 200,
xtype : 'label',
labelAlign:"left",
html : '<font color="red">*</font>&nbsp;长度限制为1-5字符'
}]
},{ // 密码信息
layout : 'column',
items : [{
width : 250,
layout : 'form',
labelAlign:"right",
items : {
width : 140,
id:'user_mima',
name:'user.mima', 
itemId : 'mima',
fieldLabel:'密码',
xtype:"textfield", 
inputType:'password', 
allowBlank:false, 
blankText:'密码不可为空',
minLength : 6,
minLengthText : '密码长度不得小于6个字符长度'
}
}, {
width : 200,
xtype : 'label',
labelAlign:"left",
html : '<font color="red">*</font>&nbsp;至少6位'
}]
},{// 重复密码信息
layout : 'column',
items : [{
width : 250,
layout : 'form',
labelAlign:"right",
items : {
width : 140,
fieldLabel:'确认密码', 
name:'vtype_user_cfmima',
itemId : 'querenmima',
inputType:'password',  
xtype:"textfield", 
password:{password_id:'user_mima'}, 
vtype:'password'
}
}, {
width : 200,
xtype : 'label',
labelAlign:"left",
html : '<font color="red">*</font>&nbsp;至少6位,并且和初始密码一致'
}]
}, {
layout : 'column',
items : [{
width : 250,
layout : 'form',
labelAlign:"right",
items : [{
width : 140,
fieldLabel : '所属部门(树)',
xtype : 'textfield',
name : 'user.bumenid',
itemId : 'bumenid',
},{
width : 140,
fieldLabel : '所属部门(树)',
xtype : 'textfield',
name : 'bumen',
itemId : 'suoshubumen',
allowBlank : false,
blankText : '所属部门不能为空'
}]
}, {
width : 200,
xtype : 'label',
labelAlign:"left",
html : '<font color="red">*</font>&nbsp;从树上选择'
}]
}, {
layout : 'column',
items : [{
width : 250,
layout : 'form',
labelAlign:"right",
items : {
width : 140,
fieldLabel : '内线电话',
xtype : 'textfield',
name : 'user.neixiandianhua',
itemId : 'neixiandianhua',
allowBlank : false,
blankText : '内线电话不能为空'
}
}, {
width : 200,
xtype : 'label',
labelAlign:"left",
html : '<font color="red">*</font>&nbsp;长度限制为1-5字符'
}]
},{
layout : 'column',
items : [{
width : 360,
layout : 'form',
labelAlign:"right",
items : {
width : 250,
fieldLabel : '申请原因',
xtype : 'textarea',
name : 'user.shenqingyuanyin',
itemId : 'shenqingyuanyin',
allowBlank : false,
blankText : '申请原因不能为空'
}
}, {
width : 200,
xtype : 'label',
labelAlign:"left",
html : '<font color="red">*</font>&nbsp;长度限制为1-127字符'
}]
},{// 邮箱信息
layout : 'column',
items : [{
width : 250,
layout : 'form',
labelAlign:"right",
items : {
width : 140,
name : 'user.youxiang',
itemId : 'youxiang',
fieldLabel : '邮箱',
xtype : 'textfield',
allowBlank : false,
blankText : 'email地址不能為空',
vtype : 'email',
emailText : '邮箱格式不匹配(user@domain.com)'

}
},{
width : 200,
xtype : 'label',
labelAlign:"left",
html : '<font color="red">*</font>&nbsp形如:user@domain.com'
}]
},{
layout : 'column',
items : [{
width : 100,
xtype : 'label',
labelAlign:"rigth",
html : "<font  style = 'padding:0px 0px 0px 70px;' >头像:</font>"

}, {
xtype : 'box',  
id : 'browseImage',  
layout : 'form',
autoEl : {  
width : 100,  
height : 100, 
tag : 'img',  
type : 'image',  
src : '/zyerp/user/user!touxiang?d='+Math.random(),  //加参数解决因缓存不求问题
style : 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);',  
complete : 'off',  
id : 'imageBrowse'
}
}]
},{
layout : 'column',
items : [{
width : 350,
layout : 'form',
labelAlign:"right",
items : [{
id : 'gerenxinxiweihu_upload',
    name : 'upload',
    width : 200,
    inputType : "file",
    fieldLabel : '上传头像',
    xtype : 'textfield'
}]
}]
}]
}],
listeners : { 
beforerender : function() {
mimaWin = zyerp.system.gerenxinxi.mimaWin
mimaWin.show();
},
render : function(f) {  
       this.form.findField('gerenxinxiweihu_upload').on('render', function() {  
         //通过change事件,图片也动态跟踪选择的图片变化  
          Ext.get('gerenxinxiweihu_upload').on('change',function(field, newValue, oldValue) {  
         //得到选择的图片路径  
        var url = 'file://' + Ext.get('gerenxinxiweihu_upload').dom.value;   
        //是否是规定的图片类型  
        if (img_reg.test(url)) { 
        //判断是否为IE
         if (Ext.isIE) { 
          var image = Ext.get('imageBrowse').dom;  
          image.src = Ext.BLANK_IMAGE_URL;// 覆盖原来的图片  
         image.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = url;  
         }// 支持FF  
         else {  
           Ext.get('imageBrowse').dom.src = Ext.get('gerenxinxiweihu_upload').dom.files.item(0).getAsDataURL(); 
         }  
        } else {     
        Ext.Msg.alert("注意","格式不正确,支持jpg、jpeg、gif、png、bmp格式的图片!");
        Ext.get('gerenxinxiweihu_upload').dom.value = '';
        } 
        }, this);  
}, this);  
  },
  afterrender : function () {
  zyerp.system.gerenxinxi.gerenxinxiweihuForm.form.reset();
zyerp.system.gerenxinxi.gerenxinxiweihuForm.form.load({
url:'/zyerp/user/user!loadUserBySessionName',
//params:{nodeid:node.id,nodeparentid:node.parentid},
success : function(form, action) {
zyerp.system.gerenxinxi.gerenxinxiweihuForm.form.isValid();//解决一进入表单,确认密码画红线问题
},
failure : function(form, action) {
Ext.Msg.alert('failuer','加载失败...');
}
});
  }
},
buttons : [
{
text : '提交',
scope:this,
handler:function(){
if(zyerp.system.gerenxinxi.gerenxinxiweihuForm.form.isValid()){
zyerp.system.gerenxinxi.gerenxinxiweihuForm.form.submit({
     url : "/zyerp/user/user!updateUserInfo",
     method : "POST",
     success : function(form, action) {
      Ext.Msg.alert('提示','修改成功');
     },
     failure : function(form, action) {
     }
});
}
}
},{
text : '重置',
handler:function(){
zyerp.system.gerenxinxi.gerenxinxiweihuForm.form.reset();
}
}]
});
// 上传图片类型  
var img_reg = /\.([jJ][pP][gG]){1}$|\.([jJ][pP][eE][gG]){1}$|\.([gG][iI][fF]){1}$|\.([pP][nN][gG]){1}$|\.([bB][mM][pP]){1}$/;

zyerp.system.gerenxinxi.personInfoPanel = new Ext.Panel({
id : "personInfoPanelId",
title : "个人信息维护",
layout: "fit",
closable  :  true,
autoScroll :  true,
items:[
zyerp.system.gerenxinxi.gerenxinxiweihuForm
],
listeners : {
close : function () {
Ext.getCmp("personInfoPanelId").destroy();
}
}
});

你可能感兴趣的:(html,IE,ext,Microsoft,360)