mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-09-08 00:59:45 +08:00
[更新]修改后台管理js
This commit is contained in:
parent
30729d6ea2
commit
6454207b0a
@ -253,45 +253,15 @@ $(function () {
|
|||||||
$cur.data('input').value = tmp.join('|');
|
$cur.data('input').value = tmp.join('|');
|
||||||
$cur.remove(), $.msg.close(dialogIndex);
|
$cur.remove(), $.msg.close(dialogIndex);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
$(this).before($tpl);
|
$(this).before($tpl);
|
||||||
}
|
}
|
||||||
}).trigger('change');
|
}).trigger('change');
|
||||||
};
|
};
|
||||||
|
|
||||||
// 注册对象到JqFn
|
|
||||||
$.fn.validate = function (callback, options) {
|
|
||||||
return (new validate()).check(this, callback, options);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 注册对象到Jq
|
// 注册对象到Jq
|
||||||
$.validate = function (form, callback, options) {
|
$.validate = function (form, callback, options) {
|
||||||
return (new validate()).check(form, callback, options);
|
return (new function () {
|
||||||
};
|
|
||||||
|
|
||||||
// 自动监听规则内表单
|
|
||||||
$.validate.listen = function () {
|
|
||||||
$('form[data-auto]').map(function () {
|
|
||||||
if ($(this).attr('data-listen') !== 'true') {
|
|
||||||
var callbackname = $(this).attr('data-callback');
|
|
||||||
$(this).attr('data-listen', 'true').validate(function (data) {
|
|
||||||
var method = this.getAttribute('method') || 'POST';
|
|
||||||
var tips = this.getAttribute('data-tips') || undefined;
|
|
||||||
var url = this.getAttribute('action') || window.location.href;
|
|
||||||
var callback = window[callbackname || '_default_callback'] || undefined;
|
|
||||||
var time = this.getAttribute('data-time') || undefined;
|
|
||||||
$.form.load(url, data, method, callback, true, tips, time);
|
|
||||||
});
|
|
||||||
$(this).find('[data-form-loaded]').map(function () {
|
|
||||||
$(this).html(this.getAttribute('data-form-loaded') || this.innerHTML);
|
|
||||||
$(this).removeAttr('data-form-loaded').removeClass('layui-disabled');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 表单验证
|
|
||||||
function validate() {
|
|
||||||
var self = this;
|
var self = this;
|
||||||
// 表单元素
|
// 表单元素
|
||||||
this.tags = 'input,textarea,select';
|
this.tags = 'input,textarea,select';
|
||||||
@ -427,7 +397,35 @@ $(function () {
|
|||||||
});
|
});
|
||||||
return $(form).data('validate', this);
|
return $(form).data('validate', this);
|
||||||
};
|
};
|
||||||
|
}).check(form, callback, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 注册对象到JqFn
|
||||||
|
$.fn.validate = function (callback, options) {
|
||||||
|
return $.validate(this, callback, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 自动监听规则内表单
|
||||||
|
$.validate.listen = function () {
|
||||||
|
$('form[data-auto]').map(function () {
|
||||||
|
if ($(this).attr('data-listen') !== 'true') {
|
||||||
|
var callbackname = $(this).attr('data-callback');
|
||||||
|
$(this).attr('data-listen', 'true').validate(function (data) {
|
||||||
|
var method = this.getAttribute('method') || 'POST';
|
||||||
|
var tips = this.getAttribute('data-tips') || undefined;
|
||||||
|
var url = this.getAttribute('action') || window.location.href;
|
||||||
|
var callback = window[callbackname || '_default_callback'] || undefined;
|
||||||
|
var time = this.getAttribute('data-time') || undefined;
|
||||||
|
$.form.load(url, data, method, callback, true, tips, time);
|
||||||
|
});
|
||||||
|
$(this).find('[data-form-loaded]').map(function () {
|
||||||
|
$(this).html(this.getAttribute('data-form-loaded') || this.innerHTML);
|
||||||
|
$(this).removeAttr('data-form-loaded').removeClass('layui-disabled');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*! 后台菜单辅助插件 */
|
/*! 后台菜单辅助插件 */
|
||||||
$.menu = new function () {
|
$.menu = new function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user