You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
excel_handle/public/static/js/default.js

69 lines
1.8 KiB

4 years ago
$.fn.serializeObject = function() {
var obj = {};
var arr = this.serializeArray();
$.each(arr, function() {
if (obj[this.name]) {
if (!obj[this.name].push) {
obj[this.name] = [ obj[this.name] ];
}
obj[this.name].push(this.value || '');
} else {
obj[this.name] = this.value || '';
}
});
return obj;
};
$.ajaxSetup({
async : false,
global: true,
complete: function (xhr,status) {
if(xhr.responseJSON.code == -1){
$('#lock-screen').css('display','flex');
}
}
});
function login(event){
$.post('/index/login', {password: $('#password').val()}, function (ret) {
if(ret.code <= 0){
layer.msg(ret.msg);
}else {
layer.msg(ret['msg'],function(){
location.reload();
});
}
})
}
function getUrlParam(type){
var url = location.href;
var urlStrArr = url.slice((url.indexOf('?') + 1));
var ret;
if(type === 'String'){
return urlStrArr;
}
if(type === 'Array'){
ret = [];
}else if(type === 'Object'){
ret = {};
}
$.each(urlStrArr.split('&'), function (i, d) {
var temp = d.split('=');
ret[temp[0]] = temp[1];
});
return ret;
}
$(function(){
$('.layui-nav-item a').each(function(i,elem){
console.log(elem.href);
if(location.href.indexOf(elem.href) != -1){
$(elem).closest('.layui-nav-item').addClass('layui-this');
}
if(location.href == 'http://www.excelhandle.com/' && elem.href == 'http://www.excelhandle.com/index/index.html'){
$(elem).closest('.layui-nav-item').addClass('layui-this');
}
});
$('#layui-content').height($(window).height() - 140);
});