delete 2.0
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -1,395 +0,0 @@
|
||||
/**
|
||||
* 菜单处理
|
||||
*/
|
||||
$(function() {
|
||||
// MetsiMenu
|
||||
$('#side-menu').metisMenu();
|
||||
|
||||
//固定菜单栏
|
||||
$(function() {
|
||||
$('.sidebar-collapse').slimScroll({
|
||||
height: '100%',
|
||||
railOpacity: 0.9,
|
||||
alwaysVisible: false
|
||||
});
|
||||
});
|
||||
|
||||
// 菜单切换
|
||||
$('.navbar-minimalize').click(function() {
|
||||
$("body").toggleClass("mini-navbar");
|
||||
SmoothlyMenu();
|
||||
});
|
||||
|
||||
$('#side-menu>li').click(function() {
|
||||
if ($('body').hasClass('mini-navbar')) {
|
||||
NavToggle();
|
||||
}
|
||||
});
|
||||
$('#side-menu>li li a').click(function() {
|
||||
if ($(window).width() < 769) {
|
||||
NavToggle();
|
||||
}
|
||||
});
|
||||
|
||||
$('.nav-close').click(NavToggle);
|
||||
|
||||
//ios浏览器兼容性处理
|
||||
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
|
||||
$('#content-main').css('overflow-y', 'auto');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(window).bind("load resize",
|
||||
function() {
|
||||
if ($(this).width() < 769) {
|
||||
$('body').addClass('mini-navbar');
|
||||
$('.navbar-static-side').fadeIn();
|
||||
}
|
||||
});
|
||||
|
||||
function NavToggle() {
|
||||
$('.navbar-minimalize').trigger('click');
|
||||
}
|
||||
|
||||
function SmoothlyMenu() {
|
||||
if (!$('body').hasClass('mini-navbar')) {
|
||||
$('#side-menu').hide();
|
||||
setTimeout(function() {
|
||||
$('#side-menu').fadeIn(500);
|
||||
},
|
||||
100);
|
||||
} else if ($('body').hasClass('fixed-sidebar')) {
|
||||
$('#side-menu').hide();
|
||||
setTimeout(function() {
|
||||
$('#side-menu').fadeIn(500);
|
||||
},
|
||||
300);
|
||||
} else {
|
||||
$('#side-menu').removeAttr('style');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* iframe处理
|
||||
*/
|
||||
$(function() {
|
||||
//计算元素集合的总宽度
|
||||
function calSumWidth(elements) {
|
||||
var width = 0;
|
||||
$(elements).each(function() {
|
||||
width += $(this).outerWidth(true);
|
||||
});
|
||||
return width;
|
||||
}
|
||||
|
||||
//滚动到指定选项卡
|
||||
function scrollToTab(element) {
|
||||
var marginLeftVal = calSumWidth($(element).prevAll()),
|
||||
marginRightVal = calSumWidth($(element).nextAll());
|
||||
// 可视区域非tab宽度
|
||||
var tabOuterWidth = calSumWidth($(".content-tabs").children().not(".menuTabs"));
|
||||
//可视区域tab宽度
|
||||
var visibleWidth = $(".content-tabs").outerWidth(true) - tabOuterWidth;
|
||||
//实际滚动宽度
|
||||
var scrollVal = 0;
|
||||
if ($(".page-tabs-content").outerWidth() < visibleWidth) {
|
||||
scrollVal = 0;
|
||||
} else if (marginRightVal <= (visibleWidth - $(element).outerWidth(true) - $(element).next().outerWidth(true))) {
|
||||
if ((visibleWidth - $(element).next().outerWidth(true)) > marginRightVal) {
|
||||
scrollVal = marginLeftVal;
|
||||
var tabElement = element;
|
||||
while ((scrollVal - $(tabElement).outerWidth()) > ($(".page-tabs-content").outerWidth() - visibleWidth)) {
|
||||
scrollVal -= $(tabElement).prev().outerWidth();
|
||||
tabElement = $(tabElement).prev();
|
||||
}
|
||||
}
|
||||
} else if (marginLeftVal > (visibleWidth - $(element).outerWidth(true) - $(element).prev().outerWidth(true))) {
|
||||
scrollVal = marginLeftVal - $(element).prev().outerWidth(true);
|
||||
}
|
||||
$('.page-tabs-content').animate({
|
||||
marginLeft: 0 - scrollVal + 'px'
|
||||
},
|
||||
"fast");
|
||||
}
|
||||
|
||||
//查看左侧隐藏的选项卡
|
||||
function scrollTabLeft() {
|
||||
var marginLeftVal = Math.abs(parseInt($('.page-tabs-content').css('margin-left')));
|
||||
// 可视区域非tab宽度
|
||||
var tabOuterWidth = calSumWidth($(".content-tabs").children().not(".menuTabs"));
|
||||
//可视区域tab宽度
|
||||
var visibleWidth = $(".content-tabs").outerWidth(true) - tabOuterWidth;
|
||||
//实际滚动宽度
|
||||
var scrollVal = 0;
|
||||
if ($(".page-tabs-content").width() < visibleWidth) {
|
||||
return false;
|
||||
} else {
|
||||
var tabElement = $(".menuTab:first");
|
||||
var offsetVal = 0;
|
||||
while ((offsetVal + $(tabElement).outerWidth(true)) <= marginLeftVal) { //找到离当前tab最近的元素
|
||||
offsetVal += $(tabElement).outerWidth(true);
|
||||
tabElement = $(tabElement).next();
|
||||
}
|
||||
offsetVal = 0;
|
||||
if (calSumWidth($(tabElement).prevAll()) > visibleWidth) {
|
||||
while ((offsetVal + $(tabElement).outerWidth(true)) < (visibleWidth) && tabElement.length > 0) {
|
||||
offsetVal += $(tabElement).outerWidth(true);
|
||||
tabElement = $(tabElement).prev();
|
||||
}
|
||||
scrollVal = calSumWidth($(tabElement).prevAll());
|
||||
}
|
||||
}
|
||||
$('.page-tabs-content').animate({
|
||||
marginLeft: 0 - scrollVal + 'px'
|
||||
},
|
||||
"fast");
|
||||
}
|
||||
|
||||
//查看右侧隐藏的选项卡
|
||||
function scrollTabRight() {
|
||||
var marginLeftVal = Math.abs(parseInt($('.page-tabs-content').css('margin-left')));
|
||||
// 可视区域非tab宽度
|
||||
var tabOuterWidth = calSumWidth($(".content-tabs").children().not(".menuTabs"));
|
||||
//可视区域tab宽度
|
||||
var visibleWidth = $(".content-tabs").outerWidth(true) - tabOuterWidth;
|
||||
//实际滚动宽度
|
||||
var scrollVal = 0;
|
||||
if ($(".page-tabs-content").width() < visibleWidth) {
|
||||
return false;
|
||||
} else {
|
||||
var tabElement = $(".menuTab:first");
|
||||
var offsetVal = 0;
|
||||
while ((offsetVal + $(tabElement).outerWidth(true)) <= marginLeftVal) { //找到离当前tab最近的元素
|
||||
offsetVal += $(tabElement).outerWidth(true);
|
||||
tabElement = $(tabElement).next();
|
||||
}
|
||||
offsetVal = 0;
|
||||
while ((offsetVal + $(tabElement).outerWidth(true)) < (visibleWidth) && tabElement.length > 0) {
|
||||
offsetVal += $(tabElement).outerWidth(true);
|
||||
tabElement = $(tabElement).next();
|
||||
}
|
||||
scrollVal = calSumWidth($(tabElement).prevAll());
|
||||
if (scrollVal > 0) {
|
||||
$('.page-tabs-content').animate({
|
||||
marginLeft: 0 - scrollVal + 'px'
|
||||
},
|
||||
"fast");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//通过遍历给菜单项加上data-index属性
|
||||
$(".menuItem").each(function(index) {
|
||||
if (!$(this).attr('data-index')) {
|
||||
$(this).attr('data-index', index);
|
||||
}
|
||||
});
|
||||
|
||||
function menuItem() {
|
||||
$.modal.loading("数据加载中,请稍后...");
|
||||
// 获取标识数据
|
||||
var dataUrl = $(this).attr('href'),
|
||||
dataIndex = $(this).data('index'),
|
||||
menuName = $.trim($(this).text()),
|
||||
flag = true;
|
||||
if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false;
|
||||
|
||||
// 选项卡菜单已存在
|
||||
$('.menuTab').each(function() {
|
||||
if ($(this).data('id') == dataUrl) {
|
||||
if (!$(this).hasClass('active')) {
|
||||
$(this).addClass('active').siblings('.menuTab').removeClass('active');
|
||||
scrollToTab(this);
|
||||
// 显示tab对应的内容区
|
||||
$('.mainContent .RuoYi_iframe').each(function() {
|
||||
if ($(this).data('id') == dataUrl) {
|
||||
$(this).show().siblings('.RuoYi_iframe').hide();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
flag = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// 选项卡菜单不存在
|
||||
if (flag) {
|
||||
var str = '<a href="javascript:;" class="active menuTab" data-id="' + dataUrl + '">' + menuName + ' <i class="fa fa-times-circle"></i></a>';
|
||||
$('.menuTab').removeClass('active');
|
||||
|
||||
// 添加选项卡对应的iframe
|
||||
var str1 = '<iframe class="RuoYi_iframe" name="iframe' + dataIndex + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>';
|
||||
$('.mainContent').find('iframe.RuoYi_iframe').hide().parents('.mainContent').append(str1);
|
||||
|
||||
// 添加选项卡
|
||||
$('.menuTabs .page-tabs-content').append(str);
|
||||
scrollToTab($('.menuTab.active'));
|
||||
}
|
||||
$.modal.closeLoading();
|
||||
return false;
|
||||
}
|
||||
|
||||
$('.menuItem').on('click', menuItem);
|
||||
|
||||
// 关闭选项卡菜单
|
||||
function closeTab() {
|
||||
var closeTabId = $(this).parents('.menuTab').data('id');
|
||||
var currentWidth = $(this).parents('.menuTab').width();
|
||||
|
||||
// 当前元素处于活动状态
|
||||
if ($(this).parents('.menuTab').hasClass('active')) {
|
||||
|
||||
// 当前元素后面有同辈元素,使后面的一个元素处于活动状态
|
||||
if ($(this).parents('.menuTab').next('.menuTab').size()) {
|
||||
|
||||
var activeId = $(this).parents('.menuTab').next('.menuTab:eq(0)').data('id');
|
||||
$(this).parents('.menuTab').next('.menuTab:eq(0)').addClass('active');
|
||||
|
||||
$('.mainContent .RuoYi_iframe').each(function() {
|
||||
if ($(this).data('id') == activeId) {
|
||||
$(this).show().siblings('.RuoYi_iframe').hide();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var marginLeftVal = parseInt($('.page-tabs-content').css('margin-left'));
|
||||
if (marginLeftVal < 0) {
|
||||
$('.page-tabs-content').animate({
|
||||
marginLeft: (marginLeftVal + currentWidth) + 'px'
|
||||
},
|
||||
"fast");
|
||||
}
|
||||
|
||||
// 移除当前选项卡
|
||||
$(this).parents('.menuTab').remove();
|
||||
|
||||
// 移除tab对应的内容区
|
||||
$('.mainContent .RuoYi_iframe').each(function() {
|
||||
if ($(this).data('id') == closeTabId) {
|
||||
$(this).remove();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 当前元素后面没有同辈元素,使当前元素的上一个元素处于活动状态
|
||||
if ($(this).parents('.menuTab').prev('.menuTab').size()) {
|
||||
var activeId = $(this).parents('.menuTab').prev('.menuTab:last').data('id');
|
||||
$(this).parents('.menuTab').prev('.menuTab:last').addClass('active');
|
||||
$('.mainContent .RuoYi_iframe').each(function() {
|
||||
if ($(this).data('id') == activeId) {
|
||||
$(this).show().siblings('.RuoYi_iframe').hide();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// 移除当前选项卡
|
||||
$(this).parents('.menuTab').remove();
|
||||
|
||||
// 移除tab对应的内容区
|
||||
$('.mainContent .RuoYi_iframe').each(function() {
|
||||
if ($(this).data('id') == closeTabId) {
|
||||
$(this).remove();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 当前元素不处于活动状态
|
||||
else {
|
||||
// 移除当前选项卡
|
||||
$(this).parents('.menuTab').remove();
|
||||
|
||||
// 移除相应tab对应的内容区
|
||||
$('.mainContent .RuoYi_iframe').each(function() {
|
||||
if ($(this).data('id') == closeTabId) {
|
||||
$(this).remove();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
scrollToTab($('.menuTab.active'));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$('.menuTabs').on('click', '.menuTab i', closeTab);
|
||||
|
||||
//关闭其他选项卡
|
||||
function closeOtherTabs() {
|
||||
$('.page-tabs-content').children("[data-id]").not(":first").not(".active").each(function() {
|
||||
$('.RuoYi_iframe[data-id="' + $(this).data('id') + '"]').remove();
|
||||
$(this).remove();
|
||||
});
|
||||
$('.page-tabs-content').css("margin-left", "0");
|
||||
}
|
||||
$('.tabCloseOther').on('click', closeOtherTabs);
|
||||
|
||||
//滚动到已激活的选项卡
|
||||
function showActiveTab() {
|
||||
scrollToTab($('.menuTab.active'));
|
||||
}
|
||||
$('.tabShowActive').on('click', showActiveTab);
|
||||
|
||||
// 点击选项卡菜单
|
||||
function activeTab() {
|
||||
if (!$(this).hasClass('active')) {
|
||||
var currentId = $(this).data('id');
|
||||
// 显示tab对应的内容区
|
||||
$('.mainContent .RuoYi_iframe').each(function() {
|
||||
if ($(this).data('id') == currentId) {
|
||||
$(this).show().siblings('.RuoYi_iframe').hide();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$(this).addClass('active').siblings('.menuTab').removeClass('active');
|
||||
scrollToTab(this);
|
||||
}
|
||||
}
|
||||
|
||||
// 点击选项卡菜单
|
||||
$('.menuTabs').on('click', '.menuTab', activeTab);
|
||||
|
||||
//刷新iframe
|
||||
function refreshTab() {
|
||||
var currentId = $('.page-tabs-content').find('.active').attr('data-id');
|
||||
var target = $('.RuoYi_iframe[data-id="' + currentId + '"]');
|
||||
var url = target.attr('src');
|
||||
target.attr('src', url).ready();
|
||||
}
|
||||
|
||||
// 全屏显示
|
||||
$('#fullScreen').on('click', function () {
|
||||
$('#wrapper').fullScreen();
|
||||
});
|
||||
|
||||
// 刷新按钮
|
||||
$('.tabReload').on('click', refreshTab);
|
||||
|
||||
$('.menuTabs').on('dblclick', '.menuTab', refreshTab);
|
||||
|
||||
// 左移按扭
|
||||
$('.tabLeft').on('click', scrollTabLeft);
|
||||
|
||||
// 右移按扭
|
||||
$('.tabRight').on('click', scrollTabRight);
|
||||
|
||||
// 关闭当前
|
||||
$('.tabCloseCurrent').on('click', function () {
|
||||
$('.page-tabs-content').find('.active i').trigger("click");
|
||||
});
|
||||
|
||||
// 关闭全部
|
||||
$('.tabCloseAll').on('click', function() {
|
||||
$('.page-tabs-content').children("[data-id]").not(":first").each(function() {
|
||||
$('.RuoYi_iframe[data-id="' + $(this).data('id') + '"]').remove();
|
||||
$(this).remove();
|
||||
});
|
||||
$('.page-tabs-content').children("[data-id]:first").each(function() {
|
||||
$('.RuoYi_iframe[data-id="' + $(this).data('id') + '"]').show();
|
||||
$(this).addClass("active");
|
||||
});
|
||||
$('.page-tabs-content').css("margin-left", "0");
|
||||
});
|
||||
|
||||
});
|
@ -1,71 +0,0 @@
|
||||
/**
|
||||
* 通用方法封装处理
|
||||
* Copyright (c) 2018 ruoyi
|
||||
*/
|
||||
|
||||
$(function(){
|
||||
// 复选框事件绑定
|
||||
if ($.fn.select2 !== undefined) {
|
||||
$("select.form-control:not(.noselect2)").each(function () {
|
||||
$(this).select2().on("change", function () {
|
||||
$(this).valid();
|
||||
})
|
||||
})
|
||||
}
|
||||
if ($(".i-checks").length > 0) {
|
||||
$(".i-checks").iCheck({
|
||||
checkboxClass: "icheckbox_square-green",
|
||||
radioClass: "iradio_square-green",
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
/** 创建选项卡 */
|
||||
function createMenuItem(dataUrl, menuName) {
|
||||
dataIndex = $.common.random(1,100),
|
||||
flag = true;
|
||||
if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false;
|
||||
var topWindow = $(window.parent.document);
|
||||
// 选项卡菜单已存在
|
||||
$('.menuTab', topWindow).each(function() {
|
||||
if ($(this).data('id') == dataUrl) {
|
||||
if (!$(this).hasClass('active')) {
|
||||
$(this).addClass('active').siblings('.menuTab').removeClass('active');
|
||||
$('.page-tabs-content').animate({ marginLeft: ""}, "fast");
|
||||
// 显示tab对应的内容区
|
||||
$('.mainContent .RuoYi_iframe', topWindow).each(function() {
|
||||
if ($(this).data('id') == dataUrl) {
|
||||
$(this).show().siblings('.RuoYi_iframe').hide();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
flag = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// 选项卡菜单不存在
|
||||
if (flag) {
|
||||
var str = '<a href="javascript:;" class="active menuTab" data-id="' + dataUrl + '">' + menuName + ' <i class="fa fa-times-circle"></i></a>';
|
||||
$('.menuTab', topWindow).removeClass('active');
|
||||
|
||||
// 添加选项卡对应的iframe
|
||||
var str1 = '<iframe class="RuoYi_iframe" name="iframe' + dataIndex + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>';
|
||||
$('.mainContent', topWindow).find('iframe.RuoYi_iframe').hide().parents('.mainContent').append(str1);
|
||||
|
||||
// 添加选项卡
|
||||
$('.menuTabs .page-tabs-content', topWindow).append(str);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** 设置全局ajax超时处理 */
|
||||
$.ajaxSetup({
|
||||
complete: function(XMLHttpRequest, textStatus) {
|
||||
if (textStatus == "parsererror") {
|
||||
$.modal.confirm("登陆超时!请重新登陆!", function() {
|
||||
window.location.href = ctx + "login";
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
File diff suppressed because one or more lines are too long
@ -1,64 +0,0 @@
|
||||
|
||||
$(function() {
|
||||
validateRule();
|
||||
$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green-login"});
|
||||
$('.imgcode').click(function() {
|
||||
var url = ctx + "captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
|
||||
$(".imgcode").attr("src", url);
|
||||
});
|
||||
});
|
||||
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function() {
|
||||
login();
|
||||
}
|
||||
});
|
||||
|
||||
function login() {
|
||||
$.modal.loading($("#btnSubmit").data("loading"));
|
||||
var username = $("input[name='username']").val().trim();
|
||||
var password = $("input[name='password']").val().trim();
|
||||
var validateCode = $("input[name='validateCode']").val();
|
||||
var rememberMe = $("input[name='rememberme']").is(':checked');
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: ctx + "login",
|
||||
data: {
|
||||
"username": username,
|
||||
"password": password,
|
||||
"validateCode" : validateCode,
|
||||
"rememberMe": rememberMe
|
||||
},
|
||||
success: function(r) {
|
||||
if (r.code == 0) {
|
||||
location.href = ctx + 'index';
|
||||
} else {
|
||||
$.modal.closeLoading();
|
||||
$('.imgcode').click();
|
||||
$.modal.msg(r.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateRule() {
|
||||
var icon = "<i class='fa fa-times-circle'></i> ";
|
||||
$("#signupForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true
|
||||
},
|
||||
password: {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
username: {
|
||||
required: icon + "请输入您的用户名",
|
||||
},
|
||||
password: {
|
||||
required: icon + "请输入您的密码",
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user