|
@@ -11,6 +11,15 @@ window.onload=function(){
|
|
|
DeviceControlService.init();
|
|
|
CenterSettingService.init();
|
|
|
InitializerService.init();
|
|
|
+
|
|
|
+ WebSocketBase.socket.onerror = function () {
|
|
|
+ logEvent("DeviceControlService startSession callback");
|
|
|
+ let tips = "终端链接失败"
|
|
|
+ ModalStyle(tips, 'pathN')
|
|
|
+ };
|
|
|
+
|
|
|
+ ReadCenterConfig('centerSetting')
|
|
|
+
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -64,7 +73,7 @@ function onblurAddr(IPType){
|
|
|
tips = '准入服务地址格式不正确'
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+ if(IpAddr=='')return
|
|
|
if( !RegxIP.test(IpAddr) ){
|
|
|
ModalStyle(tips,'pathN')
|
|
|
}
|
|
@@ -79,6 +88,8 @@ function downLoad(){
|
|
|
let req = new Request(),reqIn ={};
|
|
|
let data = document.getElementsByTagName('input');
|
|
|
|
|
|
+ // reqIn.sSettingServer = data['configAddr'].value;
|
|
|
+ // reqIn.nSettingPort = Number( data['configPoint'].value)
|
|
|
reqIn.strAddr = data['configAddr'].value;
|
|
|
reqIn.nPort = Number( data['configPoint'].value)
|
|
|
req.timeout = 60000
|
|
@@ -88,8 +99,10 @@ function downLoad(){
|
|
|
if(IsNull) return false
|
|
|
$('#loadContent').fadeIn('slow')
|
|
|
|
|
|
+ // InitializerService.DownloadCenterSetting(req, (ret)=> {
|
|
|
CenterSettingService.Download(req, (ret)=> {
|
|
|
logEvent("Download ret: "+JSON.stringify(ret));
|
|
|
+
|
|
|
if(ret){
|
|
|
$('#loadContent').fadeOut('slow')
|
|
|
if(ret.errorCode !==0){
|
|
@@ -97,12 +110,21 @@ function downLoad(){
|
|
|
ModalStyle(tips,'pathN');
|
|
|
return false
|
|
|
}
|
|
|
-
|
|
|
let tips = '下载集中配置成功'
|
|
|
- ModalStyle(tips,'pathY')
|
|
|
- // 读取配置文件
|
|
|
- ReadCenterConfig()
|
|
|
+ ModalStyle(tips,'pathY')
|
|
|
+ // 读取配置文件
|
|
|
+ ReadCenterConfig('access')
|
|
|
|
|
|
+ // if(ret.Errcode !== 0)
|
|
|
+ // {
|
|
|
+ // let tips = `[${ret.Errcode.toString(16)}]`+ ret.ErrMsg
|
|
|
+ // ModalStyle(tips,'pathN');
|
|
|
+ // }else{
|
|
|
+ // let tips = '下载集中配置成功'
|
|
|
+ // ModalStyle(tips,'pathY')
|
|
|
+ // // 读取配置文件
|
|
|
+ // ReadCenterConfig()
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
})
|
|
@@ -113,10 +135,16 @@ function downLoad(){
|
|
|
* @param {type}
|
|
|
* @return:
|
|
|
*/
|
|
|
-function ReadCenterConfig(){
|
|
|
+function ReadCenterConfig(readType){
|
|
|
let req = new Request(),reqIn ={};
|
|
|
- req.entityName = 'AccessAuthorization'
|
|
|
- req.key = 'Server'
|
|
|
+ if(readType==='access'){
|
|
|
+ req.entityName = 'AccessAuthorization'
|
|
|
+ req.key = 'Server'
|
|
|
+ }else{
|
|
|
+ req.entityName = 'CenterSetting'
|
|
|
+ req.key = 'Server'
|
|
|
+ }
|
|
|
+
|
|
|
req.reserved1 = 0
|
|
|
req.reserved2 = 0
|
|
|
req.reserved3 = ''
|
|
@@ -125,14 +153,21 @@ function ReadCenterConfig(){
|
|
|
|
|
|
DeviceControlService.ReadCenterConfigStr(req, (ret)=> {
|
|
|
logEvent("ReadCenterConfigStr ret: "+JSON.stringify(ret));
|
|
|
- console.log('ReadCenterConfigStr-ret-->', ret,ret.value)
|
|
|
|
|
|
$('#loadContent').fadeOut('slow');
|
|
|
if(ret.errorCode ===0){
|
|
|
- let addr = ret.value.split(' ')[0]
|
|
|
- let port = ret.value.split(' ')[1]
|
|
|
- $('.setting input[name=accessAddr]').val(addr)
|
|
|
- $('.setting input[name=accessPort]').val(port)
|
|
|
+ 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 = '读取集中配置失败'
|
|
@@ -164,6 +199,7 @@ function ResetRSA(){
|
|
|
//重置密钥
|
|
|
InitializerService.InitializeNew(req, (ret)=> {
|
|
|
logEvent("InitializeNew ret: "+JSON.stringify(ret));
|
|
|
+ console.log("InitializeNew ret: "+JSON.stringify(ret));
|
|
|
|
|
|
if(ret){
|
|
|
$('#loadContent').fadeOut('slow')
|
|
@@ -192,10 +228,10 @@ function closeModal(){
|
|
|
|
|
|
|
|
|
function exit(){
|
|
|
- console.log('window.location---',history.state)
|
|
|
// 进入的方式,决定退出的方式
|
|
|
- if(history.state&&history.state.init == 1){
|
|
|
- window.location.href = 'errPage.html'
|
|
|
+ console.log('window.location',window.location,window.location.href.indexOf('errPage'))
|
|
|
+ if(window.location.href.indexOf('errPage')>-1){
|
|
|
+ $('.iframeDiv').fadeOut();
|
|
|
|
|
|
}else{
|
|
|
let req = {};
|