若依 2.1
This commit is contained in:
323
src/main/resources/static/ruoyi/css/ry-ui.css
Normal file
323
src/main/resources/static/ruoyi/css/ry-ui.css
Normal file
@ -0,0 +1,323 @@
|
||||
/*!
|
||||
* ruoyi.css
|
||||
* Author: Ruoyi
|
||||
*/
|
||||
|
||||
/** <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD> <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD> */
|
||||
|
||||
.box {
|
||||
position: relative;
|
||||
border-radius: 3px;
|
||||
background: #ffffff;
|
||||
border-top: 3px solid #d2d6de;
|
||||
margin-bottom: 20px;
|
||||
width: 100%;
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,0.1)
|
||||
}
|
||||
|
||||
.box-header:before,.box-body:before,.box-footer:before,.box-header:after,.box-body:after,.box-footer:after {
|
||||
content: " ";
|
||||
display: table
|
||||
}
|
||||
|
||||
.box-header:after,.box-body:after,.box-footer:after {
|
||||
clear: both
|
||||
}
|
||||
|
||||
.btn-box-tool {
|
||||
padding: 5px;
|
||||
font-size: 12px;
|
||||
background: transparent;
|
||||
color: #97a0b3;
|
||||
}
|
||||
|
||||
.open .btn-box-tool,
|
||||
.btn-box-tool:hover {
|
||||
color: #606c84;
|
||||
}
|
||||
|
||||
.box-main {
|
||||
margin: 0;
|
||||
border: 0;
|
||||
padding-top: 2px;
|
||||
border-radius: 0;
|
||||
box-shadow: none
|
||||
}
|
||||
|
||||
.box-main>.box-header {
|
||||
border-bottom: 1px solid #eee;
|
||||
padding: 12px 10px 2px 15px
|
||||
}
|
||||
|
||||
.box-header .box-title {
|
||||
display: inline-block;
|
||||
font-size: 18px;
|
||||
margin: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.box-main>.box-header .box-title {
|
||||
font-size: 16px;
|
||||
margin-bottom: 13px;
|
||||
float: left
|
||||
}
|
||||
|
||||
.box-main>.box-header .box-title .fa {
|
||||
font-size: 14px;
|
||||
padding-right: 3px;
|
||||
margin-top: -2px
|
||||
}
|
||||
|
||||
.box-main>.box-header .box-tools {
|
||||
position: relative;
|
||||
top: -5px;
|
||||
right: 0
|
||||
}
|
||||
|
||||
.box-main>.box-header .box-tools .btn {
|
||||
padding: 3px 10px 5px 10px;
|
||||
font-size: 14px;
|
||||
margin-bottom: 2px
|
||||
}
|
||||
|
||||
.box-main>.box-header .box-tools .btn-box-tool {
|
||||
padding: 4px 2px
|
||||
}
|
||||
|
||||
.box-main form>.box-footer,.nav-main form>.box-footer {
|
||||
background: #fafafa
|
||||
}
|
||||
|
||||
.box-main form>.box-footer .row,.nav-main form>.box-footer .row {
|
||||
margin: 5px 0 5px -25px
|
||||
}
|
||||
|
||||
/** select2 <20><>ʽ<EFBFBD><EFBFBD> */
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #1AB394;
|
||||
border-color: #1AB394;
|
||||
padding: 1px 10px;
|
||||
color: #fff
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-right: 5px;
|
||||
color: rgba(255,255,255,0.7)
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: #fff
|
||||
}
|
||||
|
||||
.select2-container .select2-selection--single .select2-selection__rendered {
|
||||
padding-right: 10px
|
||||
}
|
||||
|
||||
/** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤ <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD> */
|
||||
label.error {
|
||||
position: absolute;
|
||||
right: 18px;
|
||||
top: 5px;
|
||||
color: #ef392b;
|
||||
font-size: 12px
|
||||
}
|
||||
|
||||
.Validform_error,input.error,select.error {
|
||||
background-color: #fbe2e2;
|
||||
border-color: #c66161;
|
||||
color: #c00
|
||||
}
|
||||
|
||||
.Validform_wrong,.Validform_right,.Validform_warning {
|
||||
display: inline-block;
|
||||
height: 20px;
|
||||
font-size: 12px;
|
||||
vertical-align: middle;
|
||||
padding-left: 25px
|
||||
}
|
||||
|
||||
/** <20><><EFBFBD>ֲ<EFBFBD> */
|
||||
.loaderbox {
|
||||
display: inline-block;
|
||||
min-width: 125px;
|
||||
padding: 10px;
|
||||
margin: 0 auto;
|
||||
color: #000 !important;
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #eee;
|
||||
-webkit-border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-ms-border-radius: 2px;
|
||||
-o-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
-webkit-box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.loaderbox .loading-activity {
|
||||
float: left;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: solid 2px transparent;
|
||||
border-top-color: #000;
|
||||
border-left-color: #000;
|
||||
border-radius: 10px;
|
||||
-webkit-animation: pace-spinner 400ms linear infinite;
|
||||
-moz-animation: pace-spinner 400ms linear infinite;
|
||||
-ms-animation: pace-spinner 400ms linear infinite;
|
||||
-o-animation: pace-spinner 400ms linear infinite;
|
||||
animation: pace-spinner 400ms linear infinite;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.loading-activity {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
@-ms-keyframes pace-spinner {
|
||||
0% {
|
||||
-ms-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-ms-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@keyframes pace-spinner {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD> */
|
||||
.container-div{
|
||||
padding:20px 45px;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.container-div .row{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.select-info{
|
||||
width:100%;
|
||||
background: #fff;
|
||||
border-radius: 6px;
|
||||
margin-top:10px;
|
||||
padding-bottom: 13px;
|
||||
box-shadow: 1px 1px 3px rgba(0,0,0,.2);
|
||||
}
|
||||
|
||||
.select-info{
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.select-info .save-btn,.select-info .close-btn{
|
||||
width: 20px;
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
top: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select-info .save-btn{
|
||||
right: 50px;
|
||||
}
|
||||
|
||||
.select-info .col-sm-6 .control-label{
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.select-list li{
|
||||
float:left;
|
||||
color:#333;
|
||||
margin: 5px 15px 5px 0px;
|
||||
}
|
||||
.select-list li input{
|
||||
border:1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
height: 30px;
|
||||
width:280px;
|
||||
}
|
||||
.select-list li .submit-btn{
|
||||
border:0px;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
width: 40px;
|
||||
height: 23px;
|
||||
}
|
||||
.select-list li select{
|
||||
border:1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
height: 30px;
|
||||
width:280px;
|
||||
}
|
||||
|
||||
.select-list .time input{
|
||||
width:133px;
|
||||
}
|
||||
|
||||
.time label,.time span,.time input{
|
||||
float:left;
|
||||
}
|
||||
.time label{
|
||||
margin-top: 5px;
|
||||
}
|
||||
.time span{
|
||||
display: block;
|
||||
margin: 5px 5px;
|
||||
}
|
||||
.search-btn{
|
||||
background-color: #1ab394;
|
||||
border-color: #1ab394;
|
||||
color: #FFF;
|
||||
margin-bottom: 5px;
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
border-radius: 3px;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD> */
|
||||
.order-table{
|
||||
min-height:75%;
|
||||
}
|
||||
.order-table .bootstrap-table{
|
||||
border:0px!important;
|
||||
}
|
||||
.order-table .table, .fixed-table-container, .order-table .table, .order-table .table, .order-table .table>thead>tr>th, .order-table .table>tbody>tr>th, .order-table .table>tfoot>tr>th, .order-table .table>thead>tr>td, .order-table .table>tbody>tr>td, .order-table .table>tfoot>tr>td{
|
||||
/* border-bottom: 0px!important; */
|
||||
background-color: transparent!important;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.order-table .table>thead>tr>th, .order-table .table>tbody>tr>th{
|
||||
border-bottom: 1px solid #ccc!important;
|
||||
border-top: 0px!important;
|
||||
}
|
||||
.order-table .table>thead:first-child>tr:first-child>th{
|
||||
color:#333;
|
||||
}
|
5
src/main/resources/static/ruoyi/css/ry-ui.min.css
vendored
Normal file
5
src/main/resources/static/ruoyi/css/ry-ui.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
395
src/main/resources/static/ruoyi/index.js
Normal file
395
src/main/resources/static/ruoyi/index.js
Normal file
@ -0,0 +1,395 @@
|
||||
/**
|
||||
* 菜单处理
|
||||
*/
|
||||
$(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");
|
||||
});
|
||||
|
||||
});
|
71
src/main/resources/static/ruoyi/js/common.js
Normal file
71
src/main/resources/static/ruoyi/js/common.js
Normal file
@ -0,0 +1,71 @@
|
||||
/**
|
||||
* 通用方法封装处理
|
||||
* 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";
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
435
src/main/resources/static/ruoyi/js/ry-ui.js
Normal file
435
src/main/resources/static/ruoyi/js/ry-ui.js
Normal file
@ -0,0 +1,435 @@
|
||||
/**
|
||||
* 通用方法封装处理
|
||||
* Copyright (c) 2018 ruoyi
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend({
|
||||
// 表格封装处理
|
||||
table: {
|
||||
_option: {},
|
||||
_params: {},
|
||||
// 初始化表格
|
||||
init: function(options) {
|
||||
$.table._option = options;
|
||||
$.table._params = $.common.isEmpty(options.queryParams) ? $.table.queryParams : options.queryParams;
|
||||
_sortOrder = $.common.isEmpty(options.sortOrder) ? "asc" : options.sortOrder;
|
||||
_sortName = $.common.isEmpty(options.sortName) ? "" : options.sortName;
|
||||
$('#bootstrap-table').bootstrapTable({
|
||||
url: options.url, // 请求后台的URL(*)
|
||||
contentType: "application/x-www-form-urlencoded", // 编码类型
|
||||
method: 'post', // 请求方式(*)
|
||||
cache: false, // 是否使用缓存
|
||||
sortable: true, // 是否启用排序
|
||||
sortStable: true, // 设置为 true 将获得稳定的排序
|
||||
sortName: _sortName, // 排序列名称
|
||||
sortOrder: _sortOrder, // 排序方式 asc 或者 desc
|
||||
pagination: true, // 是否显示分页(*)
|
||||
pageNumber: 1, // 初始化加载第一页,默认第一页
|
||||
pageSize: 10, // 每页的记录行数(*)
|
||||
pageList: [10, 25, 50], // 可供选择的每页的行数(*)
|
||||
iconSize: 'outline', // 图标大小:undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮
|
||||
toolbar: '#toolbar', // 指定工作栏
|
||||
sidePagination: "server", // 启用服务端分页
|
||||
search: $.common.visible(options.search), // 是否显示搜索框功能
|
||||
showRefresh: $.common.visible(options.showRefresh), // 是否显示刷新按钮
|
||||
showColumns: $.common.visible(options.showColumns), // 是否显示隐藏某列下拉框
|
||||
showToggle: $.common.visible(options.showToggle), // 是否显示详细视图和列表视图的切换按钮
|
||||
showExport: $.common.visible(options.showExport), // 是否支持导出文件
|
||||
queryParams: $.table._params, // 传递参数(*)
|
||||
columns: options.columns // 显示列信息(*)
|
||||
});
|
||||
},
|
||||
// 查询条件
|
||||
queryParams: function(params) {
|
||||
return {
|
||||
// 传递参数查询参数
|
||||
pageSize: params.limit,
|
||||
pageNum: params.offset / params.limit + 1,
|
||||
searchValue: params.search,
|
||||
orderByColumn: params.sort,
|
||||
isAsc: params.order
|
||||
};
|
||||
},
|
||||
// 搜索
|
||||
search: function(form) {
|
||||
var params = $("#bootstrap-table").bootstrapTable('getOptions');
|
||||
params.queryParams = function(params) {
|
||||
var search = {};
|
||||
$.each($("#" + form).serializeArray(), function(i, field) {
|
||||
search[field.name] = field.value;
|
||||
});
|
||||
search.pageSize = params.limit;
|
||||
search.pageNum = params.offset / params.limit + 1;
|
||||
search.searchValue = params.search;
|
||||
search.orderByColumn = params.sort;
|
||||
search.isAsc = params.order;
|
||||
return search;
|
||||
}
|
||||
$("#bootstrap-table").bootstrapTable('refresh', params);
|
||||
},
|
||||
// 下载
|
||||
exportExcel: function(form) {
|
||||
$.post($.table._option.exportUrl, $("#" + form).serializeArray(), function(result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
window.location.href = ctx + "common/download?fileName=" + result.msg + "&delete=" + true;
|
||||
} else {
|
||||
$.modal.alertError(result.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 刷新
|
||||
refresh: function() {
|
||||
$("#bootstrap-table").bootstrapTable('refresh', {
|
||||
url: $.table._option.url,
|
||||
silent: true
|
||||
});
|
||||
},
|
||||
// 查询选中列值
|
||||
selectColumns: function(column) {
|
||||
return $.map($('#bootstrap-table').bootstrapTable('getSelections'), function (row) {
|
||||
return row[column];
|
||||
});
|
||||
},
|
||||
// 查询选中首列值
|
||||
selectFirstColumns: function() {
|
||||
return $.map($('#bootstrap-table').bootstrapTable('getSelections'), function (row) {
|
||||
return row[$.table._option.columns[1].field];
|
||||
});
|
||||
}
|
||||
},
|
||||
// 表格树封装处理
|
||||
treeTable: {
|
||||
_option: {},
|
||||
// 初始化表格
|
||||
init: function(options) {
|
||||
$.table._option = options;
|
||||
$('#bootstrap-table').bootstrapTreeTable({
|
||||
code : options.id, // 用于设置父子关系
|
||||
parentCode : options.parentId, // 用于设置父子关系
|
||||
type: 'get', // 请求方式(*)
|
||||
url: options.url, // 请求后台的URL(*)
|
||||
ajaxParams : {}, // 请求数据的ajax的data属性
|
||||
expandColumn : '0', // 在哪一列上面显示展开按钮
|
||||
striped : false, // 是否各行渐变色
|
||||
bordered : true, // 是否显示边框
|
||||
expandAll : $.common.visible(options.expandAll), // 是否全部展开
|
||||
columns: options.columns
|
||||
});
|
||||
}
|
||||
},
|
||||
// 表单封装处理
|
||||
form: {
|
||||
// 获取选中复选框项
|
||||
selectCheckeds: function(name) {
|
||||
var checkeds = "";
|
||||
$('input:checkbox[name="' + name + '"]:checked').each(function(i) {
|
||||
if (0 == i) {
|
||||
checkeds = $(this).val();
|
||||
} else {
|
||||
checkeds += ("," + $(this).val());
|
||||
}
|
||||
});
|
||||
return checkeds;
|
||||
},
|
||||
// 获取选中复选框项
|
||||
selectSelects: function(name) {
|
||||
var selects = "";
|
||||
$('#' + name + ' option:selected').each(function (i) {
|
||||
if (0 == i) {
|
||||
selects = $(this).val();
|
||||
} else {
|
||||
selects += ("," + $(this).val());
|
||||
}
|
||||
});
|
||||
return selects;
|
||||
}
|
||||
},
|
||||
// 弹出层封装处理
|
||||
modal: {
|
||||
// 显示图标
|
||||
icon: function(type) {
|
||||
var icon = "";
|
||||
if (type == modal_status.WARNING) {
|
||||
icon = 0;
|
||||
} else if (type == modal_status.SUCCESS) {
|
||||
icon = 1;
|
||||
} else if (type == modal_status.FAIL) {
|
||||
icon = 2;
|
||||
} else {
|
||||
icon = 3;
|
||||
}
|
||||
return icon;
|
||||
},
|
||||
// 消息提示
|
||||
msg: function(content, type) {
|
||||
if (type != undefined) {
|
||||
layer.msg(content, { icon: $.modal.icon(type), time: 1000, shift: 5 });
|
||||
} else {
|
||||
layer.msg(content);
|
||||
}
|
||||
},
|
||||
// 错误消息
|
||||
msgError: function(content) {
|
||||
$.modal.msg(content, modal_status.FAIL);
|
||||
},
|
||||
// 成功消息
|
||||
msgSuccess: function(content) {
|
||||
$.modal.msg(content, modal_status.SUCCESS);
|
||||
},
|
||||
// 警告消息
|
||||
msgWarning: function(content) {
|
||||
$.modal.msg(content, modal_status.WARNING);
|
||||
},
|
||||
// 弹出提示
|
||||
alert: function(content, type) {
|
||||
layer.alert(content, {
|
||||
icon: $.modal.icon(type),
|
||||
title: "系统提示",
|
||||
btn: ['确认'],
|
||||
btnclass: ['btn btn-primary'],
|
||||
});
|
||||
},
|
||||
// 消息提示并刷新父窗体
|
||||
msgReload: function(msg, type) {
|
||||
layer.msg(msg, {
|
||||
icon: $.modal.icon(type),
|
||||
time: 500,
|
||||
shade: [0.1, '#8F8F8F']
|
||||
},
|
||||
function() {
|
||||
$.modal.reload();
|
||||
});
|
||||
},
|
||||
// 错误提示
|
||||
alertError: function(content) {
|
||||
$.modal.alert(content, modal_status.FAIL);
|
||||
},
|
||||
// 成功提示
|
||||
alertSuccess: function(content) {
|
||||
$.modal.alert(content, modal_status.SUCCESS);
|
||||
},
|
||||
// 警告提示
|
||||
alertWarning: function(content) {
|
||||
$.modal.alert(content, modal_status.WARNING);
|
||||
},
|
||||
// 关闭窗体
|
||||
close: function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
},
|
||||
// 确认窗体
|
||||
confirm: function (content, callBack) {
|
||||
layer.confirm(content, {
|
||||
icon: 3,
|
||||
title: "系统提示",
|
||||
btn: ['确认', '取消'],
|
||||
btnclass: ['btn btn-primary', 'btn btn-danger'],
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
callBack(true);
|
||||
});
|
||||
},
|
||||
// 弹出层指定宽度
|
||||
open: function (title, url, width, height) {
|
||||
if ($.common.isEmpty(title)) {
|
||||
title = false;
|
||||
};
|
||||
if ($.common.isEmpty(url)) {
|
||||
url = "404.html";
|
||||
};
|
||||
if ($.common.isEmpty(width)) {
|
||||
width = 800;
|
||||
};
|
||||
if ($.common.isEmpty(height)) {
|
||||
height = ($(window).height() - 50);
|
||||
};
|
||||
layer.open({
|
||||
type: 2,
|
||||
area: [width + 'px', height + 'px'],
|
||||
fix: false,
|
||||
//不固定
|
||||
maxmin: true,
|
||||
shade: 0.3,
|
||||
title: title,
|
||||
content: url
|
||||
});
|
||||
},
|
||||
// 弹出层全屏
|
||||
openFull: function (title, url, width, height) {
|
||||
if ($.common.isEmpty(title)) {
|
||||
title = false;
|
||||
};
|
||||
if ($.common.isEmpty(url)) {
|
||||
url = "404.html";
|
||||
};
|
||||
if ($.common.isEmpty(width)) {
|
||||
width = 800;
|
||||
};
|
||||
if ($.common.isEmpty(height)) {
|
||||
height = ($(window).height() - 50);
|
||||
};
|
||||
var index = layer.open({
|
||||
type: 2,
|
||||
area: [width + 'px', height + 'px'],
|
||||
fix: false,
|
||||
//不固定
|
||||
maxmin: true,
|
||||
shade: 0.3,
|
||||
title: title,
|
||||
content: url
|
||||
});
|
||||
layer.full(index);
|
||||
},
|
||||
// 打开遮罩层
|
||||
loading: function (message) {
|
||||
$.blockUI({ message: '<div class="loaderbox"><div class="loading-activity"></div> ' + message + '</div>' });
|
||||
},
|
||||
// 关闭遮罩层
|
||||
closeLoading: function () {
|
||||
setTimeout(function(){
|
||||
$.unblockUI();
|
||||
}, 50);
|
||||
},
|
||||
// 重新加载
|
||||
reload: function () {
|
||||
parent.location.reload();
|
||||
}
|
||||
},
|
||||
// 操作封装处理
|
||||
operate: {
|
||||
// 提交数据
|
||||
submit: function(url, type, dataType, data) {
|
||||
$.modal.loading("正在处理中,请稍后...");
|
||||
var config = {
|
||||
url: url,
|
||||
type: type,
|
||||
dataType: dataType,
|
||||
data: data,
|
||||
success: function(result) {
|
||||
$.operate.ajaxSuccess(result);
|
||||
}
|
||||
};
|
||||
$.ajax(config)
|
||||
},
|
||||
// post请求传输
|
||||
post: function(url, data) {
|
||||
$.operate.submit(url, "post", "json", data);
|
||||
},
|
||||
// 删除信息
|
||||
remove: function(id) {
|
||||
$.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
|
||||
var url = $.common.isEmpty(id) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{id}", id);
|
||||
var data = { "ids": id };
|
||||
$.operate.submit(url, "post", "json", data);
|
||||
});
|
||||
},
|
||||
// 批量删除信息
|
||||
batRemove: function() {
|
||||
var rows = $.common.isEmpty($.table._option.id) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.id);
|
||||
if (rows.length == 0) {
|
||||
$.modal.alertWarning("请至少选择一条记录");
|
||||
return;
|
||||
}
|
||||
$.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
|
||||
var url = $.table._option.removeUrl;
|
||||
var data = { "ids": rows.join() };
|
||||
$.operate.submit(url, "post", "json", data);
|
||||
});
|
||||
},
|
||||
// 添加信息
|
||||
add: function(id) {
|
||||
var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id);
|
||||
$.modal.open("添加" + $.table._option.modalName, url);
|
||||
},
|
||||
// 修改信息
|
||||
edit: function(id) {
|
||||
var url = $.table._option.updateUrl.replace("{id}", id);
|
||||
$.modal.open("修改" + $.table._option.modalName, url);
|
||||
},
|
||||
// 添加信息 全屏
|
||||
addFull: function(id) {
|
||||
var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id);
|
||||
$.modal.openFull("添加" + $.table._option.modalName, url);
|
||||
},
|
||||
// 修改信息 全屏
|
||||
editFull: function(id) {
|
||||
var url = $.table._option.updateUrl.replace("{id}", id);
|
||||
$.modal.openFull("修改" + $.table._option.modalName, url);
|
||||
},
|
||||
// 保存信息
|
||||
save: function(url, data) {
|
||||
$.modal.loading("正在处理中,请稍后...");
|
||||
var config = {
|
||||
url: url,
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: data,
|
||||
success: function(result) {
|
||||
$.operate.saveSuccess(result);
|
||||
}
|
||||
};
|
||||
$.ajax(config)
|
||||
},
|
||||
// 保存结果弹出msg刷新table表格
|
||||
ajaxSuccess: function (result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
$.modal.msgSuccess(result.msg);
|
||||
$.table.refresh();
|
||||
} else {
|
||||
$.modal.alertError(result.msg);
|
||||
}
|
||||
$.modal.closeLoading();
|
||||
},
|
||||
// 保存结果提示msg
|
||||
saveSuccess: function (result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
$.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS);
|
||||
} else {
|
||||
$.modal.alertError(result.msg);
|
||||
}
|
||||
$.modal.closeLoading();
|
||||
}
|
||||
},
|
||||
// 通用方法封装处理
|
||||
common: {
|
||||
// 判断字符串是否为空
|
||||
isEmpty: function (value) {
|
||||
if (value == null || this.trim(value) == "") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// 是否显示数据 为空默认为显示
|
||||
visible: function (value) {
|
||||
if ($.common.isEmpty(value) || value == true) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// 空格截取
|
||||
trim: function (value) {
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g, "");
|
||||
},
|
||||
// 指定随机数返回
|
||||
random: function (min, max) {
|
||||
return Math.floor((Math.random() * max) + min);
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
/** 消息状态码 */
|
||||
web_status = {
|
||||
SUCCESS: 0,
|
||||
FAIL: 500
|
||||
};
|
||||
|
||||
/** 弹窗状态码 */
|
||||
modal_status = {
|
||||
SUCCESS: "success",
|
||||
FAIL: "error",
|
||||
WARNING: "warning"
|
||||
};
|
1
src/main/resources/static/ruoyi/js/ry-ui.min.js
vendored
Normal file
1
src/main/resources/static/ruoyi/js/ry-ui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
64
src/main/resources/static/ruoyi/login.js
Normal file
64
src/main/resources/static/ruoyi/login.js
Normal file
@ -0,0 +1,64 @@
|
||||
|
||||
$(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