后端文件更新

This commit is contained in:
2019-07-09 20:39:01 +08:00
parent 3d9aa3e742
commit 79800d9fcc
18 changed files with 976 additions and 617 deletions

View File

@@ -1,12 +1,12 @@
$(function($) {
var storage, fail, uid;
try {
uid = new Date;
(storage = window.localStorage).setItem(uid, uid);
uid = new Date; (storage = window.localStorage).setItem(uid, uid);
fail = storage.getItem(uid) != uid;
storage.removeItem(uid);
fail && (storage = false);
} catch (e) {}
} catch(e) {}
if (storage) {
try {
var usedSkin = localStorage.getItem('config-skin');
@@ -14,73 +14,44 @@ $(function($) {
$('#skin-colors .skin-changer').removeClass('active');
$('#skin-colors .skin-changer[data-skin="' + usedSkin + '"]').addClass('active');
}
var fixedHeader = localStorage.getItem('config-fixed-header');
if (fixedHeader == 'fixed-header') {
$('body').addClass(fixedHeader);
$('#config-fixed-header').prop('checked', true);
}
var fixedFooter = localStorage.getItem('config-fixed-footer');
if (fixedFooter == 'fixed-footer') {
$('body').addClass(fixedFooter);
$('#config-fixed-footer').prop('checked', true);
//固定头部、左侧菜单以及底部版权信息
$('body').addClass('fixed-header');
$('body').addClass('fixed-footer');
$('body').addClass('fixed-leftmenu');
if ($('#page-wrapper').hasClass('nav-small')) {
$('#page-wrapper').removeClass('nav-small');
}
$('.fixed-leftmenu #col-left').nanoScroller({
alwaysVisible: true,
iOSNativeScrolling: false,
preventPageScrolling: true,
contentClass: 'col-left-nano-content'
});
var boxedLayout = localStorage.getItem('config-boxed-layout');
if (boxedLayout == 'boxed-layout') {
$('body').addClass(boxedLayout);
$('#config-boxed-layout').prop('checked', true);
}
var rtlLayout = localStorage.getItem('config-rtl-layout');
if (rtlLayout == 'rtl') {
$('body').addClass(rtlLayout);
$('#config-rtl-layout').prop('checked', true);
}
var fixedLeftmenu = localStorage.getItem('config-fixed-leftmenu');
if (fixedLeftmenu == 'fixed-leftmenu') {
$('body').addClass(fixedLeftmenu);
$('#config-fixed-sidebar').prop('checked', true);
if ($('#page-wrapper').hasClass('nav-small')) {
$('#page-wrapper').removeClass('nav-small');
}
$('.fixed-leftmenu #col-left').nanoScroller({
alwaysVisible: true,
iOSNativeScrolling: false,
preventPageScrolling: true,
contentClass: 'col-left-nano-content'
});
}
} catch (e) {
var sidebarSamll = localStorage.getItem('config-sidebar-samll');
if (sidebarSamll == 'sidebar-samll') {
$('#config-sidebar-samll').prop('checked', true);
$('#page-wrapper').addClass('nav-small');
} else {
$('#page-wrapper').removeClass('nav-small');
};
} catch(e) {
console.log(e);
}
}
$('#config-tool-cog').on('click', function() {
$('#config-tool-cog').on('click',
function() {
$('#config-tool').toggleClass('closed');
});
$('#config-fixed-header').on('change', function() {
var fixedHeader = '';
if ($(this).is(':checked')) {
$('body').addClass('fixed-header');
fixedHeader = 'fixed-header';
} else {
$('body').removeClass('fixed-header');
if ($('#config-fixed-sidebar').is(':checked')) {
$('#config-fixed-sidebar').prop('checked', false);
$('#config-fixed-sidebar').trigger('change');
location.reload();
}
}
writeStorage(storage, 'config-fixed-header', fixedHeader);
});
$('#config-fixed-footer').on('change', function() {
var fixedFooter = '';
if ($(this).is(':checked')) {
$('body').addClass('fixed-footer');
fixedFooter = 'fixed-footer';
} else {
$('body').removeClass('fixed-footer');
}
writeStorage(storage, 'config-fixed-footer', fixedFooter);
});
$('#config-boxed-layout').on('change', function() {
$('#config-boxed-layout').on('change',
function() {
var boxedLayout = '';
if ($(this).is(':checked')) {
$('body').addClass('boxed-layout');
@@ -90,59 +61,42 @@ $(function($) {
}
writeStorage(storage, 'config-boxed-layout', boxedLayout);
});
$('#config-rtl-layout').on('change', function() {
var rtlLayout = '';
$('#config-sidebar-samll').on('change',function(){
var sidebarSamll = '';
if ($(this).is(':checked')) {
rtlLayout = 'rtl';
} else {}
writeStorage(storage, 'config-rtl-layout', rtlLayout);
location.reload();
});
$('#config-fixed-sidebar').on('change', function() {
var fixedSidebar = '';
if ($(this).is(':checked')) {
if (!$('#config-fixed-header').is(':checked')) {
$('#config-fixed-header').prop('checked', true);
$('#config-fixed-header').trigger('change');
}
if ($('#page-wrapper').hasClass('nav-small')) {
$('#page-wrapper').removeClass('nav-small');
}
$('body').addClass('fixed-leftmenu');
fixedSidebar = 'fixed-leftmenu';
$('.fixed-leftmenu #col-left').nanoScroller({
alwaysVisible: true,
iOSNativeScrolling: false,
preventPageScrolling: true,
contentClass: 'col-left-nano-content'
});
writeStorage(storage, 'config-fixed-leftmenu', fixedSidebar);
$('#page-wrapper').addClass('nav-small');
sidebarSamll = 'sidebar-samll';
writeStorage(storage, 'config-sidebar-samll', sidebarSamll);
} else {
$('body').removeClass('fixed-leftmenu');
writeStorage(storage, 'config-fixed-leftmenu', fixedSidebar);
$('#page-wrapper').removeClass('nav-small');
writeStorage(storage, 'config-sidebar-samll', sidebarSamll);
location.reload();
}
});
})
if (!storage) {
$('#config-fixed-header').prop('checked', false);
$('#config-fixed-footer').prop('checked', false);
$('#config-fixed-sidebar').prop('checked', false);
$('#config-boxed-layout').prop('checked', false);
$('#config-rtl-layout').prop('checked', false);
$('#config-sidebar-samll').prop('checked', false);
}
$('#skin-colors .skin-changer').on('click', function() {
$('#skin-colors .skin-changer').on('click',
function() {
$('body').removeClassPrefix('theme-');
$('body').addClass($(this).data('skin'));
$('#skin-colors .skin-changer').removeClass('active');
$(this).addClass('active');
writeStorage(storage, 'config-skin', $(this).data('skin'));
});
//合并自script.js
setTimeout(function() {
$('#content-wrapper > .row').css({
opacity: 1
});
}, 200);
$('#sidebar-nav,#nav-col-submenu').on('click', '.dropdown-toggle', function(e) {
},
200);
$('#sidebar-nav,#nav-col-submenu').on('click', '.dropdown-toggle',
function(e) {
e.preventDefault();
var $item = $(this).parent();
if (!$item.hasClass('open')) {
@@ -156,7 +110,8 @@ $(function($) {
$item.children('.submenu').slideUp('fast');
}
});
$('body').on('mouseenter', '#page-wrapper.nav-small #sidebar-nav .dropdown-toggle', function(e) {
$('body').on('mouseenter', '#page-wrapper.nav-small #sidebar-nav .dropdown-toggle',
function(e) {
if ($(document).width() >= 992) {
var $item = $(this).parent();
if ($('body').hasClass('fixed-leftmenu')) {
@@ -173,7 +128,8 @@ $(function($) {
$item.children('.submenu').slideDown('fast');
}
});
$('body').on('mouseleave', '#page-wrapper.nav-small #sidebar-nav > .nav-pills > li', function(e) {
$('body').on('mouseleave', '#page-wrapper.nav-small #sidebar-nav > .nav-pills > li',
function(e) {
if ($(document).width() >= 992) {
var $item = $(this);
if ($item.hasClass('open')) {
@@ -184,12 +140,14 @@ $(function($) {
$item.removeClass('open');
}
});
$('body').on('mouseenter', '#page-wrapper.nav-small #sidebar-nav a:not(.dropdown-toggle)', function(e) {
$('body').on('mouseenter', '#page-wrapper.nav-small #sidebar-nav a:not(.dropdown-toggle)',
function(e) {
if ($('body').hasClass('fixed-leftmenu')) {
$('#nav-col-submenu').html('');
}
});
$('body').on('mouseleave', '#page-wrapper.nav-small #nav-col', function(e) {
$('body').on('mouseleave', '#page-wrapper.nav-small #nav-col',
function(e) {
if ($('body').hasClass('fixed-leftmenu')) {
$('#nav-col-submenu').html('');
}
@@ -197,12 +155,10 @@ $(function($) {
$('#make-small-nav').click(function(e) {
$('#page-wrapper').toggleClass('nav-small');
});
setContentBody();
$(window).smartresize(function() {
if ($(document).width() <= 991) {
$('#page-wrapper').removeClass('nav-small');
}
setContentBody();
});
$('.mobile-search').click(function(e) {
e.preventDefault();
@@ -215,18 +171,30 @@ $(function($) {
container.removeClass('active');
}
});
$('.fixed-leftmenu #col-left').nanoScroller({
alwaysVisible: false,
alwaysVisible: true,
iOSNativeScrolling: false,
preventPageScrolling: true,
contentClass: 'col-left-nano-content'
});
$("[data-toggle='tooltip']").each(function(index, el) {
$(el).tooltip({
placement: $(this).data("placement") || 'top'
});
});
});
function writeStorage(storage, key, value) {
if (storage) {
try {
localStorage.setItem(key, value);
} catch(e) {
console.log(e);
}
}
}
$.fn.removeClassPrefix = function(prefix) {
this.each(function(i, el) {
var classes = el.className.split(" ").filter(function(c) {
@@ -235,14 +203,12 @@ $.fn.removeClassPrefix = function(prefix) {
el.className = classes.join(" ");
});
return this;
};
(function($, sr) {
}; (function($, sr) {
var debounce = function(func, threshold, execAsap) {
var timeout;
return function debounced() {
var obj = this,
args = arguments;
args = arguments;
function delayed() {
if (!execAsap) func.apply(obj, args);
timeout = null;
@@ -257,28 +223,46 @@ $.fn.removeClassPrefix = function(prefix) {
};
})(jQuery, 'smartresize');
function writeStorage(storage, key, value) {
if (storage) {
try {
localStorage.setItem(key, value);
} catch (e) {
console.log(e);
}
function helpIntro(){
var placementRight = 'right';
var placementLeft = 'left';
if ($('body').hasClass('rtl')) {
placementRight = 'left';
placementLeft = 'right';
}
}
$.fn.removeClassPrefix = function(prefix) {
this.each(function(i, el) {
var classes = el.className.split(" ").filter(function(c) {
return c.lastIndexOf(prefix, 0) !== 0;
});
el.className = classes.join(" ");
});
return this;
};
// Define the tour!
var tour = {
id: "Cube-intro",
steps: [
{
target: 'make-small-nav',
title: "设置小菜单按钮",
content: "点击小菜单可以把左侧菜单变成小菜单,增大右侧操作区域!",
placement: "bottom",
zindex: 999,
xOffset: -8
},
{
target: 'config-tool-options',
title: "后台配置工具",
content: "配置后台主题色彩,定制头部、左侧菜单以及底部信息",
placement: placementLeft,
zindex: 999,
fixedElement: true,
xOffset: -55
},
{
target: 'sidebar-nav',
title: "左侧导航区域",
content: "左侧功能导航区域。",
placement: placementRight
}
],
showPrevButton: true
};
function setContentBody() {
header_height = $('header#header-navbar').height();
if ($(window).height() - header_height - 50 > $('#content-wrapper').height()) {
$('#content-wrapper').height($(window).height() - header_height - 50);
}
// Start the tour!
hopscotch.startTour(tour);
}