jquery扩展



$(function () {
var dialog = null;
var password = null;
$("#userInfo").click(function () {
dialog = App.dialog({
title: Msg.user.userTitle,
action: 'modifyUser',
resizable: false,
width: 650,
height: 'auto'
});
var option = {
header: [Msg.user.userInfo, Msg.user.aInfo],
listURL: 'groupUser/getUserInfo',
submitURL: 'groupUser/modifyUserInfo',
fnListSuccess: listSuccess,
fnListError: listError,
fnSubmitSuccess: submitSuccess,
fnSubmitError: submitError,
fnModifyData: modifyData,
config: "status,name",
type: 'view',
model: [
[
[
{
input: 'input',
type: 'text',
show: Msg.user.name,
name: 'username',
rule: {required: true, stringCheck: true, maxlength: 20, nullCheck: true}
},
{
input: 'select',
type: 'select',
show: Msg.user.sex,
name: 'sex',
rule: {},
options: [{value: ''}, {value: 1, text: Msg.user.boy}, {value: 2, text: Msg.user.girl}],
fnInit: changeSex
}
],
[
{
input: 'input',
type: 'text',
show: Msg.user.mobile,
name: 'tel',
rule: {mobile: true, space: true, maxlength: 30}
},
{
input: 'input',
type: 'text',
show: Msg.user.email,
name: 'mail',
rule: {email: true, space: true, maxlength: 30}
}
],
[
{
input: 'input',
type: 'text',
show: Msg.user.qq,
name: 'qq',
rule: {qq: true, space: true, maxlength: 30}
}
]
],
[
[
{
input: 'input',
type: 'text',
show: Msg.user.acountName,
name: 'name',
rule: {space: true, maxlength: 30},
fnInit: canNotFocus
},
{
input: 'select',
type: 'select',
show: Msg.user.status,
name: 'status',
rule: {},
options: [{value: ''}, {value: 'ACTIVE'}, {value: 'LOCKED'}],
fnInit: changeStatus
}
],
[
{
input: 'textarea',
type: 'textarea',
show: Msg.user.description,
name: 'description',
rule: {maxlength: 200},
width: 453,
height: 70
},
{
input: 'input',
type: 'image-form',
name: 'electrPic',
show: Msg.user.elecSingal,
fnInit: addElecSingal
}
],
[
{
input: 'input',
type: 'password',
show: Msg.user.curPassword,
name: 'curPassword',
rule: {required: true, space: true, maxlength: 128}
}
]
]
]
};
option.type = 'modify';
dialog.ValidateForm('modifyuser', option);

});

function listSuccess(data) {
}

function listError(data) {
$.omcConfirm(Msg.user.listError, mac.exeLogout, function (data) {
dialog.remove();
});
}

function changeSex(selector, value) {
if (value) {
$(selector).val(value);
} else {
$(selector).val('');
}
}


});
================================================================================
define(['jquery'], function ($) {


App.dialog = function (c, f, cb) {
debugger
var b = c.action;
var a = $('<div id="' + b + '"></div>');
a.callback = f;
a.dialog({
appendTo: '#main_view',
title: c.title,
width: c.width,
height: c.height,
resizable: c.resizable,
draggable: c.draggable,
autoOpen: true,
closeText: Msg.close,
modal: true,
close: function () {
$(this).remove();
}
});
return a;
};

/**
* 消息提示框
* @param p {Object} 参数设置
* @param c {Function} 点击OK回调方法
* @param r {Function} 点击关闭按钮回调方法
* <pre>
* 例如: App.alert({id: id, title: "title", message: "Content", ……});
* </pre>
* @returns {*}
*/
App.alert = function (p, c, r) {
var a;
if (p.id) {
a = $('<div id="' + p.id + '"></div>');
} else {
a = $('<div></div>');
}

var co = p.content
|| $('<p style="margin: 0;">' + p.message + '</p>');

a.append(co);
var setting = {
appendTo: '#main_view',
modal: true,
resizable: false,
closeText: Msg.close,
buttons: p.btns || [
{
id: 'okId',
text: Msg.sure || 'OK',
click: function () {
$(this).dialog("close");
if (c)
c();
}
}
],
close: function () {
if (r)
r();
$(this).remove();
}
};
$.extend(setting, p);
a.dialog(setting);
return a;
};

定制组件
对应cookie中的全局变量
jquery扩展方法及对验证规则的扩展


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值