/**
* post根據不同的請求,獲取進度條或者提示框舉例屏幕左側的位置
* 一個進度條或者是信息提示框的寬度大概爲260,所以爲了多個進度條或者多個滾動條之間不重疊,
* 這裏設置基礎寬度爲260
* @param title
* @param message
* @param postType
* @returns
*/
function getShowTop(postType){
var showTop = 0 ;
if(postType == 1){
showTop = 260*0 ;
}else if(postType == 2){
showTop = 260*1 ;
}else if(postType == 3){
showTop = 260*2 ;
}else if(postType == 4){
showTop = 260*3 ;
}else if(postType == 5){
showTop = 260*4 ;
}
return showTop;
}
/**
* post請求完成後提示框位置
* @param title
* @param message
* @param postType
* @returns
*/
function showMessagerPosition(message,postType){
var showTop = getShowTop(postType) ;
//放一排顯示,各個提示框位置不重疊
$.messager.alert({ title:'提示',msg:message,icon:'info',left : showTop});
}
/**
* 推送數據請求的時候進度條位置
* @param message
* @param postType
* @returns
*/
function showProcessPotions(message,postType){
var showTop = getShowTop(postType) ;
var curWin = $.messager.progress({
title:'請稍候...',
text:message,
});
curWin.window("window").css( {
left : showTop,
});
//因爲進度條是有遮蓋層的,把進度條框元素移走了,但是遮蓋層還在,這裏把遮蓋層移除
curWin.parent().next().hide();
return curWin;
}
/**
* 關閉進度條
* @param title
* @param message
* @param postType
* @returns
*/
function closeWin(curWin){
curWin.parent().remove();
}
下面只顯示兩個post請求
var win1 = showProcessPotions("正在推送項目信息,請耐心等待...",1);
$.ajax({
type:"post",
data: {'dataType': 1},
url:"../review/push/dataPush?"+ids,
success:function(data){
closeWin(win1);
var message = '項目信息推送失敗!';
showMessagerPosition(message,1);
}
});
var win2 = showProcessPotions("正在推送分段信息,請耐心等待...",2);
$.ajax({
type:"post",
data: {'dataType': 2},
url:"../review/push/dataPush?"+ids,
success:function(data){
closeWin(win2);
var message = '項目信息推送失敗!';
showMessagerPosition(message,2);
}
});