xxl-job

common.1.js 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. $(function(){
  2. // logout
  3. $("#logoutBtn").click(function(){
  4. layer.confirm('确认注销登录?', {icon: 3, title:'系统提示'}, function(index){
  5. layer.close(index);
  6. $.post(base_url + "/logout", function(data, status) {
  7. if (data.code == "200") {
  8. layer.msg('注销成功');
  9. setTimeout(function(){
  10. window.location.href = base_url + "/";
  11. }, 500);
  12. /*layer.open({
  13. title: '系统提示',
  14. content: '注销成功',
  15. icon: '1',
  16. end: function(layero, index){
  17. window.location.href = base_url + "/";
  18. }
  19. });*/
  20. } else {
  21. layer.open({
  22. title: '系统提示',
  23. content: (data.msg || "操作失败"),
  24. icon: '2'
  25. });
  26. }
  27. });
  28. });
  29. });
  30. // slideToTop
  31. var slideToTop = $("<div />");
  32. slideToTop.html('<i class="fa fa-chevron-up"></i>');
  33. slideToTop.css({
  34. position: 'fixed',
  35. bottom: '20px',
  36. right: '25px',
  37. width: '40px',
  38. height: '40px',
  39. color: '#eee',
  40. 'font-size': '',
  41. 'line-height': '40px',
  42. 'text-align': 'center',
  43. 'background-color': '#222d32',
  44. cursor: 'pointer',
  45. 'border-radius': '5px',
  46. 'z-index': '99999',
  47. opacity: '.7',
  48. 'display': 'none'
  49. });
  50. slideToTop.on('mouseenter', function () {
  51. $(this).css('opacity', '1');
  52. });
  53. slideToTop.on('mouseout', function () {
  54. $(this).css('opacity', '.7');
  55. });
  56. $('.wrapper').append(slideToTop);
  57. $(window).scroll(function () {
  58. if ($(window).scrollTop() >= 150) {
  59. if (!$(slideToTop).is(':visible')) {
  60. $(slideToTop).fadeIn(500);
  61. }
  62. } else {
  63. $(slideToTop).fadeOut(500);
  64. }
  65. });
  66. $(slideToTop).click(function () {
  67. $("body").animate({
  68. scrollTop: 0
  69. }, 100);
  70. });
  71. // 左侧菜单状态,js + 后端 + cookie方式(新)
  72. $('.sidebar-toggle').click(function(){
  73. var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings'); // 左侧菜单展开状态[xxljob_adminlte_settings]:on=展开,off=折叠
  74. if ('off' == xxljob_adminlte_settings) {
  75. xxljob_adminlte_settings = 'on';
  76. } else {
  77. xxljob_adminlte_settings = 'off';
  78. }
  79. $.cookie('xxljob_adminlte_settings', xxljob_adminlte_settings, { expires: 7 }); //$.cookie('the_cookie', '', { expires: -1 });
  80. });
  81. // 左侧菜单状态,js + cookie方式(遗弃)
  82. /*
  83. var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings');
  84. if (xxljob_adminlte_settings == 'off') {
  85. $('body').addClass('sidebar-collapse');
  86. }
  87. */
  88. });