|
@@ -9,9 +9,7 @@ window.onload=function(){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- CenterSettingService.init();
|
|
|
AccessAuthService.init();
|
|
|
- HealthManagerService.init();
|
|
|
|
|
|
WebSocketBase.socket.onerror = function () {
|
|
|
logEvent("HealthManagerService startSession callback");
|
|
@@ -28,30 +26,11 @@ window.onload=function(){
|
|
|
* @return:
|
|
|
*/
|
|
|
function ModalStyle(tips,pathType){
|
|
|
- $('#modalBox').fadeIn('slow')
|
|
|
$('#loadContent').fadeOut('slow')
|
|
|
-
|
|
|
$('#errTips').html(tips);
|
|
|
let path = (pathType == 'pathY') ? './images/success.png' : './images/fail.png'
|
|
|
- $('#modalBox img').attr('src', path)
|
|
|
-}
|
|
|
-
|
|
|
-function showToast(title){
|
|
|
- $('#toastErrTips').html(title);
|
|
|
- $('#loading_mask').hide();
|
|
|
- $('#toastErrorBox').fadeIn('slow')
|
|
|
- setTimeout(()=>{
|
|
|
- $('#toastErrorBox').fadeOut('slow')
|
|
|
- },2000)
|
|
|
}
|
|
|
|
|
|
-function changeInput(obj){
|
|
|
- if(obj.value!=''){
|
|
|
- $('#btn-downLoad').removeAttr('disabled');
|
|
|
- }else{
|
|
|
- $('#btn-downLoad').attr('disabled','disabled');
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
/**
|
|
|
* @description: 输入不为null校验
|
|
@@ -73,30 +52,6 @@ function RegExpNull(vals){
|
|
|
return IsNull;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * @description: IP地址校验
|
|
|
- * @param {type}
|
|
|
- * @return:
|
|
|
- */
|
|
|
-function onblurAddr(IPType){
|
|
|
- let RegxIP = new RegExp("^((25[0-5]|2[0-4]\\d|[1]{1}\\d{1}\\d{1}|[1-9]{1}\\d{1}|\\d{1})($|(?!\\.$)\\.)){4}$");
|
|
|
- let tips,IpAddr
|
|
|
- switch(IPType)
|
|
|
- {
|
|
|
- case 'config':
|
|
|
- IpAddr = $(".config input[name='configAddr']").val();
|
|
|
- tips = '集中配置地址格式不正确'
|
|
|
- break;
|
|
|
- case 'access':
|
|
|
- IpAddr = $(".setting input[name='accessAddr']").val();
|
|
|
- tips = '准入服务地址格式不正确'
|
|
|
- break;
|
|
|
- }
|
|
|
- if(IpAddr=='')return
|
|
|
- if( !RegxIP.test(IpAddr) ){
|
|
|
- ModalStyle(tips,'pathN')
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
let timeout=60000;
|
|
|
/**
|
|
@@ -129,207 +84,6 @@ function restart(){
|
|
|
DeviceService.RebootShell();
|
|
|
}
|
|
|
|
|
|
-function downLoad(){
|
|
|
- let req = new Request(),reqIn ={};
|
|
|
- // req.downloadv2 = 1;
|
|
|
-
|
|
|
- let IsNull = RegExpNull(reqIn)
|
|
|
- if(IsNull) return false
|
|
|
- $('#loadContent').fadeIn('slow')
|
|
|
- // timeoutFn
|
|
|
- let timeoutFn= setTimeout(function(){
|
|
|
- $('#loadContent').fadeOut('slow')
|
|
|
- let tips = '请求超时'
|
|
|
- showToast(tips);
|
|
|
- },timeout)
|
|
|
-
|
|
|
- CenterSettingService.Downloadv2(req, function(ret) {
|
|
|
- logEvent("Download ret: "+JSON.stringify(ret));
|
|
|
- console.log("Download ret: "+JSON.stringify(ret));
|
|
|
-
|
|
|
- if(ret){
|
|
|
- clearTimeout(timeoutFn);
|
|
|
- $('#loadContent').fadeOut('slow')
|
|
|
- if(ret.downloadStat==2){
|
|
|
- let tips = ret.strErrMsg
|
|
|
- ModalStyle(tips,'pathN');
|
|
|
- return false
|
|
|
- }
|
|
|
- let tips = '下载集中配置成功'
|
|
|
- ModalStyle(tips,'pathY')
|
|
|
- document.getElementById("urlConfigAddr").innerHTML = ret.CenterConfigUrl;
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-function downLoadv3(value){
|
|
|
- if(value=='auto'){
|
|
|
- let req = new Request();
|
|
|
- $('#loading_mask').fadeIn('slow');
|
|
|
- let timeoutFn= setTimeout(function(){
|
|
|
- $('#loading_mask').fadeOut('slow');
|
|
|
- let tips = '请求超时'
|
|
|
- showToast(tips);
|
|
|
- },timeout)
|
|
|
-
|
|
|
- CenterSettingService.Downloadv3(req, function(ret) {
|
|
|
- logEvent("Download ret: "+JSON.stringify(ret));
|
|
|
- console.log("Download ret: "+JSON.stringify(ret));
|
|
|
-
|
|
|
- if(ret){
|
|
|
- clearInterval(timeChange);
|
|
|
- clearTimeout(timeoutFn);
|
|
|
- $('#loading_mask').fadeOut('slow');
|
|
|
- if(ret.downloadStat==1){
|
|
|
- // document.getElementById("configUrl").innerHTML = ret.retCenterConfigUrl;
|
|
|
- $('#boxRestart').fadeIn();
|
|
|
- timeChange = setInterval(clock, 1000);
|
|
|
- }else if(ret.downloadStat==3 || ret.downloadStat==2){
|
|
|
- let tips = ret.strErrMsg?ret.strErrMsg:'集中配置下载失败';
|
|
|
- showToast(tips);
|
|
|
- return false
|
|
|
- }else {
|
|
|
- let msg = ret.strErrMsg?ret.strErrMsg:'集中配置下载失败';
|
|
|
- let tips = msg + ',请联系总行信息部处理,是否进行手动下载?';
|
|
|
- $('#modalErrorBox').fadeIn('slow');
|
|
|
- $('#modalErrTips').html(tips);
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }else{
|
|
|
- $('#ManuallyDownloadError').html("");
|
|
|
- $('#ManuallyDownloadError').hide();
|
|
|
- let req = new Request(),reqIn ={};
|
|
|
- let data = document.getElementsByTagName('input');
|
|
|
- reqIn.reqCenterConfigUrl = data['centerConfigUrl'].value;
|
|
|
- req = Object.assign({},req,reqIn)
|
|
|
- $('#loading_mask').fadeIn('slow');
|
|
|
- let timeoutFn= setTimeout(function(){
|
|
|
- $('#loading_mask').fadeOut('slow');
|
|
|
- let tips = '请求超时'
|
|
|
- ModalStyle(tips,'pathN')
|
|
|
- },timeout)
|
|
|
-
|
|
|
- CenterSettingService.Downloadv3(req, function(ret) {
|
|
|
- logEvent("Download ret: "+JSON.stringify(ret));
|
|
|
- console.log("Download ret: "+JSON.stringify(ret));
|
|
|
- if(ret){
|
|
|
- clearInterval(timeChange);
|
|
|
- clearTimeout(timeoutFn);
|
|
|
- $('#loading_mask').fadeOut('slow');
|
|
|
- if(ret.downloadStat==1){
|
|
|
- exit();
|
|
|
- // document.getElementById("configUrl").innerHTML = ret.retCenterConfigUrl;
|
|
|
- $('#boxRestart').fadeIn();
|
|
|
- timeChange = setInterval(clock, 1000);
|
|
|
- }else if(ret.downloadStat==3){
|
|
|
- exit();
|
|
|
- let tips = ret.strErrMsg?ret.strErrMsg:'集中配置是最新版本';
|
|
|
- showToast(tips);
|
|
|
- return false
|
|
|
- }else {
|
|
|
- let msg = ret.strErrMsg?ret.strErrMsg:'集中配置下载失败';
|
|
|
- $('#ManuallyDownloadError').html(msg);
|
|
|
- $('#ManuallyDownloadError').show();
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-let HostUrl = "" //准入服务地址
|
|
|
-function getAccessUrl(){
|
|
|
- let req = new Request()
|
|
|
- let timeoutFn= setTimeout(function(){
|
|
|
- $('#loadContent').fadeOut('slow');
|
|
|
- let tips = '请求超时'
|
|
|
- showToast(tips);
|
|
|
- },5000)
|
|
|
-
|
|
|
- CenterSettingService.GetAccessUrl(req, function(ret) {
|
|
|
- logEvent("GetAccessUrl ret: "+JSON.stringify(ret));
|
|
|
- console.log("GetAccessUrl ret: "+JSON.stringify(ret));
|
|
|
- if(ret){
|
|
|
- clearTimeout(timeoutFn);
|
|
|
- $('#loadContent').fadeOut('slow')
|
|
|
-
|
|
|
- // let tips = '获取准入服务地址成功'
|
|
|
- // ModalStyle(tips,'pathY')
|
|
|
- HostUrl = ret.HostUrl
|
|
|
- document.getElementById("urlAccessAddr").innerHTML= ret.HostUrl;
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * @description: 读取集中配置文件,注入密钥初始化url,port
|
|
|
- * @param {type}
|
|
|
- * @return:
|
|
|
- */
|
|
|
-function ReadCenterConfig(readType,readConfig){
|
|
|
- $('#loadContent').fadeIn('slow');
|
|
|
- let timeoutFn= setTimeout(function(){
|
|
|
- $('#loadContent').fadeOut('slow')
|
|
|
- let tips = '请求超时'
|
|
|
- ModalStyle(tips,'pathN')
|
|
|
- console.log('timeoutFn--ReadCenterConfig-setTimeout222->')
|
|
|
- },timeout)
|
|
|
-
|
|
|
- let req = new Request(),reqIn ={};
|
|
|
- if(readType==='access'){
|
|
|
- req.entityName = 'AccessAuthorization'
|
|
|
- req.key = 'Server'
|
|
|
- }else{
|
|
|
- req.entityName = 'CenterSetting'
|
|
|
- req.key = 'Server'
|
|
|
- }
|
|
|
- req.reserved1 = 0
|
|
|
- req.reserved2 = 0
|
|
|
- req.reserved3 = ''
|
|
|
- req.reserved4 = ''
|
|
|
- req.timeout = 60000
|
|
|
- logEvent("HealthManagerService->ReadCenterConfigStr");
|
|
|
-
|
|
|
- HealthManagerService.ReadCenterConfigStr(req, function(ret) {
|
|
|
- logEvent("ReadCenterConfigStr ret: "+JSON.stringify(ret));
|
|
|
- console.log('ReadCenterConfigStr----',ret)
|
|
|
- if(ret){
|
|
|
- $('#loadContent').fadeOut('slow');
|
|
|
- clearTimeout(timeoutFn)
|
|
|
- }
|
|
|
-
|
|
|
- if(ret.errorCode ===0){
|
|
|
- let result = JSON.parse(ret['{e12a3dc0-3a0b-47c4-a8c3-75190a42ae68}'] )
|
|
|
- let addr = result.value.split(' ')[0]
|
|
|
- let port = result.value.split(' ')[1]
|
|
|
-
|
|
|
- if(readType==='access'){
|
|
|
- $('.setting input[name=accessAddr]').val(addr)
|
|
|
- $('.setting input[name=accessPort]').val(port)
|
|
|
- }else{
|
|
|
- $('.config input[name=configAddr]').val(addr)
|
|
|
- $('.config input[name=configPoint]').val(port)
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }else{
|
|
|
- let tips ='读取集中配置失败'+ret.errorCode.toString(16)
|
|
|
- if(readConfig==='readConfig'){
|
|
|
- ModalStyle(tips,'pathN')
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
// 扫码登录后接收code
|
|
|
window.onmessage = (event) => {
|
|
|
console.log('event----',event)
|
|
@@ -351,20 +105,9 @@ window.onmessage = (event) => {
|
|
|
* @return:
|
|
|
*/
|
|
|
function ResetRSA(code){
|
|
|
- let data = document.getElementsByTagName('input');
|
|
|
-
|
|
|
let req = new Request(),reqIn={};
|
|
|
- reqIn.strAuthServer = HostUrl;
|
|
|
- // reqIn.nAuthPort = Number( data['accessPort'].value) todo
|
|
|
- reqIn.strUserID = code //data['account'].value
|
|
|
- // let agentId = data['account'].value;
|
|
|
- // if(Number(reqIn.strUserID) ){
|
|
|
- // if (agentId.trim().length == 8) {
|
|
|
- // reqIn.strUserID = "SP" + agentId.trim();
|
|
|
- // } else {
|
|
|
- // reqIn.strUserID = "ST" + agentId.trim();
|
|
|
- // }
|
|
|
- // }
|
|
|
+ // reqIn.strAuthServer = HostUrl;
|
|
|
+ reqIn.strUserID = code
|
|
|
reqIn.strPassword = '88888888' //默认值,后台不做校验
|
|
|
|
|
|
req.timeout = 60000
|
|
@@ -374,14 +117,7 @@ function ResetRSA(code){
|
|
|
ModalStyle(tips,'pathN')
|
|
|
return;
|
|
|
}
|
|
|
- // if(reqIn.strPassword==''){
|
|
|
- // let tips = '密码不能为空'
|
|
|
- // ModalStyle(tips,'pathN')
|
|
|
- // return;
|
|
|
- // }
|
|
|
|
|
|
- let IsNull = RegExpNull(reqIn)
|
|
|
- if(IsNull) return false
|
|
|
$('#loadContent').fadeIn('slow')
|
|
|
// timeoutFn
|
|
|
let timeoutFn= setTimeout(function(){
|
|
@@ -421,33 +157,13 @@ function ResetRSA(code){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function closeModal(value){
|
|
|
- if(value=='modal'){
|
|
|
- $('#modalBox').fadeOut('slow')
|
|
|
- }else{
|
|
|
- $('#modalErrorBox').fadeOut('slow')
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function showManuallyDownloadModal(){
|
|
|
- $('#modalErrorBox').fadeOut('slow');
|
|
|
- $('#ManuallyDownload').fadeIn('slow');
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
function exit(){
|
|
|
- // document.getElementById("urlConfigAddr").innerHTML ="";
|
|
|
- // document.getElementById("urlAccessAddr").innerHTML = "";
|
|
|
- // document.getElementsByTagName('input')['centerConfigUrl'].value="";
|
|
|
- $('#ManuallyDownloadError').html("");
|
|
|
- $('#ManuallyDownloadError').hide();
|
|
|
- $('#btn-downLoad').attr('disabled','disabled');
|
|
|
// 进入的方式,决定退出的方式
|
|
|
if(window.location.href.indexOf('errPage')>-1){
|
|
|
$('.iframeDiv').fadeOut();
|
|
|
$('.iframe-box').fadeOut();
|
|
|
$('.result-wrap').fadeOut();
|
|
|
- $('#ManuallyDownload').fadeOut();
|
|
|
}else{
|
|
|
let req = {};
|
|
|
req.messageType = 0;
|