jquery_把函数当做参数传递_匿名函数传递

WIN.showModalDialog('/lims4/common/usersignpasstoken/usersignpass-token.exml', {
	        'title': '操作提示',
	        'width':360,
	        'height':230
	    }, function (record) {
	    	params_combo.userSignPass = record.userSignPass;
	    	params_combo.smsVerifiCode = record.smsVerifiCode;
	    	params_combo.userid = SESSION.userid;
	    	params_combo.usercode = SESSION.usercode;
	    	verify_token_handler(function(){   //-------匿名函数
            /************************业务*************************/
	    		//原逻辑
	    		theGrid.operateList({   
	    			url : '/lims4/business/inspectionservice/approveOrdertaskInfos',
				    opiniontype: 0,
				    loadFlag:true,
				    params:params_combo,
				    callback : function(){
				    	Ext.getCmp('grid_folderorder').store.reload();
				    }
	    		}, i18n['message.common.submit']);
	    	});
           /************************业务*************************/
	    });

 

function verify_token_handler(cbak){   //----cbak是一个匿名函数
	//不安全
	var regex = new RegExp(Co.PASSWORDCHECKTYPE);
	if (!regex.test(mytoken)) {
		SW.Msg.warn("签名密码必须包含大小写字母、数字、特殊字符、密码长度6~30位!请立即修改!");
		modify_handler(cbak);
	}else{
		if(typeof cbak == 'function'){
			cbak();
     	}
	}
}
function modify_handler(cbak){
	var flag=false;
    var formCopy = new Ext.form.FormPanel({
            id: 'pwFormCopy',
            labelWidth: 55,
            defaultType: 'textfield',
            layout: "column",
            defaults: {
                columnWidth: 0.18,
                labelWidth: 85,
                margin: '5 0 0 5'
            },
            items: [{
                    fieldLabel: i18n['password_setting_usercode'] || '用户编码',
                    columnWidth: 0.8,
                    readOnly: true,
                    fieldStyle:'background-color:#DDDDDD',
                    value:SESSION.usercode,
                    name: 'usercode'
                }, {
                    xtype: 'label',
                    disabled: true
                }, {
                    fieldLabel: '原签名密码',
                    inputType: 'password',
                    columnWidth: 0.8,
                    allowBlank: false,
                    name: 'userpass'
                }, {
                    xtype: 'label',
                    disabled: true
                }, {
                    fieldLabel: '新签名密码',
                    columnWidth: 0.8,
                    inputType: 'password',
                    id: 'password',
                    allowBlank: false,
                    name: 'password',
                }, {
                    id: 'labelid',
                    xtype: 'label',
                    width: 40,
                    text: ''
                }, {
                    fieldLabel: '确认签名密码',
                    columnWidth: 0.8,
                    inputType: 'password',
                    id: 'password2',
                    enableKeyEvents: true,
                    name: 'password2',
                    allowBlank: false,
                    vtype: 'repetition',
                    repetition: {
                        targetCmpId: 'password'
                    },
                    vtypeText: i18n['password_setting_different'] || '两次输入密码不一致',
                    listeners: {
                        keydown: function (obj, e) {
                            if (e.getKey() == e.ENTER) {
                            	let ui = formCopy.getForm().getValues();
                             	let pwdCheckType = Co.PASSWORDCHECKTYPE; //校验密码正则
                             	let pwdSensitiveWords = Co.PASSWORDSENSITIVEWORDS; //敏感词汇
                             	let verifyResult = verifyNewPassword(ui,pwdCheckType,pwdSensitiveWords);
                             	
                                if (formCopy.getForm().isValid() && verifyResult) {
                                	var vparams = {
                                         	'usercode':SESSION.usercode,
                                         	'oldusersignpass':encryData(ui.userpass).toUpperCase(),
                                         	'newusersignpass':encryData(ui.password).toUpperCase(),
                                         	'ackusersignpass':encryData(ui.password2).toUpperCase(),
                                         	'userid':SESSION.userid
                                     };
                                    Ext.Ajax.request({
                                        url: SRM_CONTEXT + '/icore/user/modifySignaturePwd',
                                        params: vparams,
                                        success: function (response, options) {
                                            SW.Msg.success( i18n.Message_AlterSuccess);
                                            if(typeof cbak == 'function'){
                                            	cbak();   //---------匿名函数执行
                                        	}
                                            winCopy.close();
                                        }
                                    });
                                }
                            }
                        }
                    }
                }, {
                    xtype: 'label',
                    disabled: true
                }, {

                    xtype: 'hidden',
                    name: 'userid'
                }
            ],
            buttons: [{
                    id: 'button_save',
                    text: i18n['button.common.save'] || '保存',
                    handler: function () {
                    	//新增--desc@密码复杂度校验  author@zs date@2019-11-10
                    	let ui = formCopy.getForm().getValues();
                    	let pwdCheckType =  Co.PASSWORDCHECKTYPE; //校验密码正则
                    	let pwdSensitiveWords = Co.PASSWORDSENSITIVEWORDS; //敏感词汇
                    	let verifyResult = verifyNewPassword(ui,pwdCheckType,pwdSensitiveWords);
                    	
                        if (formCopy.getForm().isValid() && verifyResult) {
                            var vparams = {
                            	'usercode':SESSION.usercode,
                            	'oldusersignpass':encryData(ui.userpass).toUpperCase(),
                            	'newusersignpass':encryData(ui.password).toUpperCase(),
                            	'ackusersignpass':encryData(ui.password2).toUpperCase(),
                            	'userid':SESSION.userid
                            };
                            Ext.Ajax.request({
                                url: SRM_CONTEXT + '/icore/user/modifySignaturePwd',
                                params: vparams,
                                success: function (response, options) {
                                    SW.Msg.success( i18n.Message_AlterSuccess);
                                    if(typeof cbak == 'function'){
                                    	cbak();   //---------匿名函数执行
                                	}
                                    winCopy.close();
                                }
                            });
                        }
                    }
                }, {
                    text: i18n['button.common.cancel'] || '取消',
                    handler: function () {
                        winCopy.close();
                    }
                }
            ]
        });

    var winCopy = new Ext.Window({
            title: i18n['password_setting'] || '签名密码管理',
            width: 600,
            height: 240,
            layout: 'fit',
            modal: true,
            items: [formCopy],
            x:300,   //依据W3C:允许使用容器中的XY坐标定位项目
            y:300,
            html: 'Positioned at x:300, y:300'
        });
    winCopy.show(Ext.getBody());

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值