lixin-web
Version:
vue and bootstrap
221 lines (211 loc) • 8.34 kB
JavaScript
// var getGlobalImgPath = function() {
// return '/img';
// }
var location = function() {
return window.location.protocol + '//' + window.location.host;
}
// var initScroll = function(el) {
// if(!el) el = '.scroller';
// $(el).each(function () {
// if($(this).attr('data-initialized')) return;
// var color = $(this).attr('data-handle-color') ? $(this).attr('data-handle-color') : '#2AC1CA';
// var distance = $(this).attr('data-handle-distance') ? $(this).attr('data-handle-distance') : '0px';
// var alwaysVisible = $(this).attr('data-always-visible') ? true : false;
// var railVisible = $(this).attr('data-rail-visible') ? true : false;
// $(this).slimScroll({
// allowPageScroll: false,
// size: '7px',
// borderRadius: '0px',
// color: color,
// wrapperClass: 'slim-scroll',
// distance: distance,
// position: 'right',
// height: 'auto',
// alwaysVisible: alwaysVisible,
// railVisible: railVisible,
// disableFadeOut: true
// });
// $(this).attr('data-initialized', 1);
// });
// }
// var destroyScroll = function(el) {
// $(el).each(function() {
// // destroy existing instance before updating the height
// if ($(this).attr("data-initialized") === "1") {
// $(this).removeAttr("data-initialized");
// $(this).removeAttr("style");
// var attrList = {};
// // store the custom attribures so later we will reassign.
// if ($(this).attr("data-handle-color")) {
// attrList["data-handle-color"] = $(this).attr("data-handle-color");
// }
// if ($(this).attr("data-handle-distance")) {
// attrList["data-handle-distance"] = $(this).attr("data-handle-distance");
// }
// if ($(this).attr("data-always-visible")) {
// attrList["data-always-visible"] = $(this).attr("data-always-visible");
// }
// if ($(this).attr("data-rail-visible")) {
// attrList["data-rail-visible"] = $(this).attr("data-rail-visible");
// }
// $(this).slimScroll({
// wrapperClass: 'slim-scroll',
// destroy: true
// });
// var the = $(this);
// // reassign custom attributes
// $.each(attrList, function(key, value) {
// the.attr(key, value);
// });
// }
// });
// }
// var blockUI = function(options) {
// options = $.extend(true, {}, options);
// options.zIndex = 5000;
// var html = '';
// if (options.animate) {
// html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '">' + '<div class="block-spinner-bar"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>' + '</div>';
// } else if (options.iconOnly) {
// html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><img src="' + getGlobalImgPath() + '/icon/loading-spinner-grey.gif" align=""></div>';
// } else if (options.textOnly) {
// html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><span> ' + (options.message ? options.message : 'LOADING...') + '</span></div>';
// } else {
// html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><img src="' + getGlobalImgPath() + '/icon/loading-spinner-grey.gif" align=""><span> ' + (options.message ? options.message : '正在加载中...') + '</span></div>';
// }
//
// if (options.target) { // element blocking
// var el = $(options.target);
// if (el.height() <= ($(window).height())) {
// options.cenrerY = true;
// }
// el.block({
// message: html,
// baseZ: options.zIndex ? options.zIndex : 1000,
// centerY: options.cenrerY !== undefined ? options.cenrerY : false,
// css: {
// top: '10%',
// border: '0',
// padding: '0',
// backgroundColor: 'none'
// },
// overlayCSS: {
// backgroundColor: options.overlayColor ? options.overlayColor : '#555',
// opacity: options.boxed ? 0.05 : 0.1,
// cursor: 'wait'
// }
// });
// } else { // page blocking
// $.blockUI({
// message: html,
// baseZ: options.zIndex ? options.zIndex : 1000,
// centerY: 0,
// css: {
// border: '0',
// padding: '0',
// backgroundColor: 'none',
// // top: '10px', left: '', right: '10px'
// },
// overlayCSS: {
// backgroundColor: options.overlayColor ? options.overlayColor : '#555',
// opacity: options.boxed ? 0 : 0,
// cursor: 'wait'
// }
// });
// }
// }
// var unblockUI = function(target) {
// if (target) {
// $(target).unblock({
// onUnblock: function() {
// $(target).css('position', '');
// $(target).css('zoom', '');
// }
// });
// } else {
// $.unblockUI();
// }
// }
var getUrl = function(key, isHash) {
var path = window.location.search;
if (isHash) path = window.location.hash;
var search = path.substring(1),
i, val, params = search.split("&");
for (i = 0; i < params.length; i++) {
val = params[i].split("=");
if (val[0] == key) {
return unescape(val[1]);
}
}
}
var getHash = function(key) {
return getUrl(key, 1);
}
// var addHash = function(map){
// $.each(function(){
// });
// }
// var notice = function(content, autoClose) {
// if(autoClose == undefined) autoClose = 3000;
// var noticeBox = new jBox('Notice', {
// content: content,
// autoClose: autoClose,
// addClass: 'common-notice'
// });
// }
// var tips = function(title, content, autoClose) {
// $('.message-tips').remove();
// var messageTips = $('<div class="message-tips">');
// messageTips.append('<div class="title">' + title + '</div>');
// messageTips.append('<div class="content">' + content + '</div>');
// $('body').append(messageTips);
// var width = messageTips.width();
// var height = messageTips.height();
// var winWidth = $(window).width();
// messageTips.css({bottom: -height, right: ((winWidth - 1050) / 2 - width) / 2}).stop().animate({bottom: 202}, 1000, 'easeOutExpo');
// if(autoClose) {
// setTimeout(function() {
// messageTips.stop().animate({bottom: -height,}, 1000, 'easeOutExpo', function() {
// messageTips.remove();
// });
// }, autoClose);
// }
// }
const App = {
loadedModal:false,
location: location,
// initScroll: initScroll,
// destroyScroll: destroyScroll,
blockUI(jqXHR){
// document.body.style.pointerEvents = 'none'
// if(jqXHR && jqXHR.promise) {
// setTimeout(() => {
// if((jqXHR.readyState != 4) && !this.loadedModal) {
// $('body').append(loadingHTML)
// this.loadedModal = jqXHR.loadedModal = true
// }
// },500)
// }
// else{
// $('body').append(loadingHTML)
// }
},
unblockUI(jqXHR){
// document.body.style.pointerEvents = 'auto'
// if (jqXHR && jqXHR.promise){
// if(jqXHR.loadedModal) {
// $('.lx-ajax-loader').remove()
// this.loadedModal = false
// }
// }
// else{
$('.ajax-loader').remove()
// }
},
getUrl: getUrl,
getHash: getHash,
// notice: notice,
// tips: tips
}
export default App
window.App = App