后台表单提交方式
This commit is contained in:
@@ -3,5 +3,22 @@
|
||||
@import url(../../plugins/adminlte/css/adminlte.min.css);
|
||||
@import url(../../plugins/adminlte/css/skins/_all-skins.min.css);
|
||||
|
||||
|
||||
.user-list tbody td>img {
|
||||
position:relative;
|
||||
max-width:50px;
|
||||
float:left;
|
||||
margin-right:15px;
|
||||
border-radius:18%;
|
||||
background-clip:padding-box;
|
||||
}
|
||||
.user-list tbody td .user-link {
|
||||
display:block;
|
||||
font-size:1.25em;
|
||||
padding-top:3px;
|
||||
margin-left:60px;
|
||||
}
|
||||
.user-list tbody td .user-subhead {
|
||||
font-size:0.875em;
|
||||
font-style:italic;
|
||||
}
|
||||
.tabs-wrapper .nav-tabs{margin-bottom: 15px;}
|
||||
@@ -169,19 +169,24 @@ define(['jquery', 'sent', 'adminlte'], function($, sent, AdminLTE){
|
||||
* @type Array
|
||||
*/
|
||||
mySkins: ['skin-blue', 'skin-black', 'skin-red', 'skin-yellow', 'skin-purple', 'skin-green', 'skin-blue-light', 'skin-black-light', 'skin-red-light', 'skin-yellow-light', 'skin-purple-light', 'skin-green-light'],
|
||||
|
||||
change_layout: function(cls){
|
||||
$("body").toggleClass(cls);
|
||||
AdminLTE.layout.fixSidebar();
|
||||
//Fix the problem with right sidebar and layout boxed
|
||||
if (cls == "layout-boxed")
|
||||
AdminLTE.controlSidebar._fix($(".control-sidebar-bg"));
|
||||
if ($('body').hasClass('fixed') && cls == 'fixed') {
|
||||
AdminLTE.pushMenu.expandOnHover();
|
||||
AdminLTE.layout.activate();
|
||||
|
||||
change_layout: function(){
|
||||
layout = sent.store.get({name: 'layout'}) || [{name: 'fixed', value: false}, {name: 'layout-boxed', value: false}, {name: 'sidebar-collapse', value: false}];
|
||||
if (typeof(layout) == 'string'){ return false; }
|
||||
for (i in layout) {
|
||||
var item = layout[i];
|
||||
if (item.value) {
|
||||
$("[data-layout='"+item.name+"']").attr('checked', 'checked');
|
||||
$("body").hasClass(item.name) || $("body").addClass(item.name);
|
||||
if ($('body').hasClass('fixed') && item.name == 'fixed') {
|
||||
AdminLTE.pushMenu.expandOnHover();
|
||||
AdminLTE.layout.activate();
|
||||
}
|
||||
}else{
|
||||
$("body").removeClass(item.name);
|
||||
}
|
||||
}
|
||||
AdminLTE.controlSidebar._fix($(".control-sidebar-bg"));
|
||||
AdminLTE.controlSidebar._fix($(".control-sidebar"));
|
||||
AdminLTE.layout.fixSidebar();
|
||||
},
|
||||
change_skin: function(cls){
|
||||
$.each(backend.mySkins, function (i) {
|
||||
@@ -193,9 +198,9 @@ define(['jquery', 'sent', 'adminlte'], function($, sent, AdminLTE){
|
||||
return false
|
||||
},
|
||||
init: function(){
|
||||
var tmp = sent.store.get({name:'skin'});
|
||||
if (tmp && $.inArray(tmp, backend.my_skins))
|
||||
backend.change_skin(tmp);
|
||||
var skin = sent.store.get({name:'skin'});
|
||||
if (skin && $.inArray(skin, backend.my_skins))
|
||||
backend.change_skin(skin);
|
||||
|
||||
//Add the change skin listener
|
||||
$("[data-skin]").on('click', function (e) {
|
||||
@@ -205,17 +210,15 @@ define(['jquery', 'sent', 'adminlte'], function($, sent, AdminLTE){
|
||||
backend.change_skin($(this).data('skin'));
|
||||
});
|
||||
|
||||
backend.change_layout();
|
||||
//Add the layout manager
|
||||
$("[data-layout]").on('click', function () {
|
||||
backend.change_layout($(this).data('layout'));
|
||||
});
|
||||
|
||||
$("[data-controlsidebar]").on('click', function () {
|
||||
backend.change_layout($(this).data('controlsidebar'));
|
||||
var slide = !AdminLTE.options.controlSidebarOptions.slide;
|
||||
AdminLTE.options.controlSidebarOptions.slide = slide;
|
||||
if (!slide)
|
||||
$('.control-sidebar').removeClass('control-sidebar-open');
|
||||
var layout = [];
|
||||
$("[data-layout]").each(function(i, item){
|
||||
layout.push({name:$(item).data('layout'), value: $(item).is(':checked')})
|
||||
})
|
||||
sent.store.set({name:'layout', content: layout});
|
||||
backend.change_layout();
|
||||
});
|
||||
|
||||
$("[data-sidebarskin='toggle']").on('click', function () {
|
||||
@@ -230,22 +233,11 @@ define(['jquery', 'sent', 'adminlte'], function($, sent, AdminLTE){
|
||||
});
|
||||
|
||||
$("[data-enable='expandOnHover']").on('click', function () {
|
||||
$(this).attr('disabled', true);
|
||||
AdminLTE.pushMenu.expandOnHover();
|
||||
if (!$('body').hasClass('sidebar-collapse'))
|
||||
$("[data-layout='sidebar-collapse']").click();
|
||||
$(this).attr('disabled', true);
|
||||
AdminLTE.pushMenu.expandOnHover();
|
||||
if (!$('body').hasClass('sidebar-collapse'))
|
||||
$("[data-layout='sidebar-collapse']").click();
|
||||
});
|
||||
|
||||
// Reset options
|
||||
if ($('body').hasClass('fixed')) {
|
||||
$("[data-layout='fixed']").attr('checked', 'checked');
|
||||
}
|
||||
if ($('body').hasClass('layout-boxed')) {
|
||||
$("[data-layout='layout-boxed']").attr('checked', 'checked');
|
||||
}
|
||||
if ($('body').hasClass('sidebar-collapse')) {
|
||||
$("[data-layout='sidebar-collapse']").attr('checked', 'checked');
|
||||
}
|
||||
|
||||
if ($('.editable').size() > 0) {
|
||||
require(['bootstrap-editable'], function(){
|
||||
|
||||
@@ -38,13 +38,13 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
return $msgbox;
|
||||
},
|
||||
valid: function (ret) {
|
||||
var that = this, submitBtn = $(".layer-footer [type=submit]", form);
|
||||
var that = this, submitBtn = $("button.btn[type=submit]", form);
|
||||
that.holdSubmit(true);
|
||||
submitBtn.addClass("disabled");
|
||||
submitBtn.addClass("disabled").attr('disabled', 'disabled');
|
||||
//验证通过提交表单
|
||||
var submitResult = Form.api.submit($(ret), function (data, ret) {
|
||||
that.holdSubmit(false);
|
||||
submitBtn.removeClass("disabled");
|
||||
// submitBtn.removeClass("disabled");
|
||||
if (false === $(this).triggerHandler("success.form", [data, ret])) {
|
||||
return false;
|
||||
}
|
||||
@@ -56,6 +56,11 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
//提示及关闭当前窗口
|
||||
var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
|
||||
sent.msg(msg, 'success');
|
||||
if (ret.url !== '') {
|
||||
setTimeout(function(){
|
||||
window.location.href = ret.url;
|
||||
}, 3000);
|
||||
}
|
||||
parent.$(".btn-refresh").trigger("click");
|
||||
return false;
|
||||
}, function (data, ret) {
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
define(['jquery', 'layer', 'form', 'message'], function($, layer, form) {
|
||||
define(['jquery', 'layer', 'message'], function($, layer) {
|
||||
var sent = {
|
||||
config: {
|
||||
keyName: 'sent_'
|
||||
},
|
||||
init: function(){
|
||||
form.api.bindevent($("form[role=form]"));
|
||||
if ($("form[role=form]").length > 0) {
|
||||
require(['form'], function(form){
|
||||
form.api.bindevent($("form[role=form]"));
|
||||
})
|
||||
}
|
||||
},
|
||||
msg: function(text, type){
|
||||
if (typeof type != 'undefined') {
|
||||
|
||||
Reference in New Issue
Block a user