You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
6.6 KiB
JavaScript

10 months ago

var clientAjaxRequestUrl = "../../";
//var clientAjaxRequestUrl = "http://localhost:12646";
//var clientAjaxRequestUrl = "http://hmw028167.chinaw3.com";
function $(id)
{
return document.getElementById(id);
}
function initCombos()
{
getlbGG();
}
//-------------------------------------------------------------------------------------------------------------------------------
function getlbGG()
{
var uid = $("hid_id").value;
if(uid=="")
{
document.getElementById('lbGG').style.visibility = "hidden";
document.getElementById('divGG').style.visibility = "hidden";
//document.getElementById('lbGG').setAttribute('disabled','disabled');
//document.getElementById('divGG').setAttribute('disabled','disabled');
}
else
{
var url3 = clientAjaxRequestUrl+"/Message/SysAnnounceClientGridSource.aspx?handle=getlbgg&uid="+newGuid()+"&clientgid="+uid;
var loader3 = dhtmlxAjax.getSync(url3);
var strAnnounce = loader3.xmlDoc.responseText;
//strAnnounce=strAnnounce.replace("/公告/ig","我的信息");
strAnnounce=strAnnounce.substr(2);
$("lbGG").value+=strAnnounce;
//
url3 = clientAjaxRequestUrl+"/Message/SysAnnounceClientGridSource.aspx?handle=getconfig&uid="+newGuid()+"&clientgid="+uid;
loader3 = dhtmlxAjax.getSync(url3);
strAnnounce = loader3.xmlDoc.responseText;
$("hdtimeCount").value=strAnnounce;
//
recycleCountAnnounceEB($("hdtimeCount").value);
}
}
function ShowDetailGG()
{
var uid = $("hid_id").value;
//如果已打开
var url2 = clientAjaxRequestUrl+"/Message/SysAnnounceClientGridSource.aspx?handle=isclose&uid="+newGuid()+"&clientgid="+uid;
var loader2 = dhtmlxAjax.getSync(url2);
var strISDELETE = loader2.xmlDoc.responseText;
//
window.open(clientAjaxRequestUrl+"/Message/SysAnnounceClient.aspx?clientgid="+uid,"_blank","height=500, width=900, center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=0,location=no,status=no");
}
function newGuid()
{
var guid = "";
for (var i = 1; i <= 32; i++)
{
var n = Math.floor(Math.random()*16.0).toString(16);
guid += n;
if((i==8)||(i==12)||(i==16)||(i==20))
guid += "-";
}
return guid.toUpperCase();
}
function recycleCountAnnounceEB(timeCountEB)
{
var uid = $("hid_id").value;
var startTimesEB = new Date();
var isShowEB = 0;
setInterval(function()
{
//var frameObjEB = null;
//frameObjEB = parent.document.getElementById("FormEBPL").contentWindow;
//frameObjEB = document.getElementById("FormEBPL").contentWindow;
if(document.getElementById("scrAnnounceEB") == null)
{
var urlEB0 = "js/popAnnounceEB.js?uid="+newGuid();
var loaderEB = dhtmlxAjax.getSync(urlEB0);
var jsValEB = loaderEB.xmlDoc.responseText;
var oHeadEB = document.getElementsByTagName('HEAD').item(0);
var oScriptEB = document.createElement( "script" );
oScriptEB.language = "javascript";
oScriptEB.type = "text/javascript";
oScriptEB.id = "scrAnnounceEB";
oScriptEB.defer = true;
oScriptEB.text = jsValEB;
oHeadEB.appendChild(oScriptEB);
}
var AnnounceCountObjEB = null;
var urlEB = clientAjaxRequestUrl+"/Message/SysAnnounceClientGridSource.aspx?handle=getannouncetotal&uid="+newGuid()+"&clientgid="+uid;
var loaderEB = dhtmlxAjax.getSync(urlEB);
var AnnounceValEB = loaderEB.xmlDoc.responseText;
if(AnnounceValEB != "")
{
AnnounceCountObjEB = eval('(' + AnnounceValEB + ')');
if(AnnounceCountObjEB!=null)
{
var msgIntervalEB = 3;//AnnounceCountObjEB.totals[0].interval;
if(isShowEB==0)
{
msgIntervalEB = 0;
}
//
if(AnnounceCountObjEB.totals[0].total != 0)
{
//var oldUrlEB = parent.document.getElementById("FormEBPL").contentWindow.location.href;
var oldUrlEB =window.location.href;
var doubleUrlEB = 0;
if(oldUrlEB.indexOf("//") >= 0)
{
doubleUrlEB = oldUrlEB.indexOf("//")+2;
}
var tempUrlEB = oldUrlEB.substring(doubleUrlEB,oldUrlEB.substring(doubleUrlEB,oldUrlEB.length).indexOf("/")+doubleUrlEB);
//var newUrlEB = oldUrlEB.substring(0,doubleUrlEB)+tempUrlEB+"/"+"Message/SysAnnounceClient.aspx";
var newUrlEB = clientAjaxRequestUrl+"/Message/SysAnnounceClient.aspx";
//alert(newUrlEB);
//$("dvAnnounce").innerText = "公告("+AnnounceCountObjEB.totals[0].total+")";
var currentTimesEB = new Date();
var spaceTimesEB = currentTimesEB.getTime() - startTimesEB.getTime();
var daysEB = Math.floor(spaceTimesEB/(24*3600*1000));
//计算小时
var leaveEB1 = spaceTimesEB%(24*3600*1000);
var hoursEB= Math.floor(leaveEB1/(3600*1000));
//计算分钟
var leaveEB2= leaveEB1%(3600*1000);
var minutesEB=Math.floor(leaveEB2/(60*1000));
//计算秒数
var leaveEB3=leaveEB2%(60*1000);
var secondsEB=Math.round(leaveEB3/1000);
//alert(minutesEB+"+"+msgIntervalEB)
if(msgIntervalEB > 0)
{
if(minutesEB >= msgIntervalEB)
{
startTimesEB = new Date();
isShowEB=1;
openPopEB("公告("+AnnounceCountObjEB.totals[0].total+")",AnnounceCountObjEB,AnnounceCountObjEB.totals[0].total,newUrlEB);
}
}
else
{
isShowEB=1;
openPopEB("公告("+AnnounceCountObjEB.totals[0].total+")",AnnounceCountObjEB,AnnounceCountObjEB.totals[0].total,newUrlEB);
}
}
else
{
//$("dvAnnounce").innerText = "公告("+AnnounceCountObjEB.totals[0].total+")";
}
}
}
},timeCountEB);
}