Files
apt-nl-map/static/Magic4/Setting/HMI_Setting_FRP.html

141 lines
4.7 KiB
HTML
Raw Normal View History

2024-12-04 10:21:04 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../css/bootstrap.min.css" />
<script src="../jquery-2.1.0.min.js"></script>
<script src="../jquery.cookie.js"></script>
<script type="text/javascript" type="text/javascript">
var frp_prefix="";//Frpdate();
var frp_port="";
var frp_tokens="";//"12345678";
/*
function Frpdate(){
var date=new Date();
var year=date.getFullYear();//当前年份
var month=date.getMonth();//当前月份
var data=date.getDate();//天
var hours=date.getHours();//小时
var minute=date.getMinutes();//分
var second=date.getSeconds();//秒
var time=year+"_"+fnW((month+1))+"_"+fnW(data)+"_"+fnW(hours)+"_"+fnW(minute)+"_"+fnW(second);
return time;
}*/
function client_request(str){
//$('#output').html("");
window.parent.postMessage(
{
event_id: 'client_request',
data: {
v1: str
}
},
"*" //or "www.parentpage.com"
);
}
function receiveMessage(event){
console.log(event.data);
switch(event.data.event_id){
case "client_response":{
var data=event.data.data;
var result=data.v1;
var ROS_String_Output=data.v2;
var Rec_HMI_String_Input=data.v3;
var Client_Request_Cmd=Rec_HMI_String_Input.split(':');
//console.log(data);
switch(Client_Request_Cmd[0]){
case 'HMISettingFRPGetStatus':{
//console.log("response HMISettingGetRemoteID");
document.getElementById('output').innerText=ROS_String_Output;
}break;
default:{
document.getElementById('output').innerText=ROS_String_Output;
}break;
}
}break;
}
}
var client_sch=0;
window.addEventListener("message", receiveMessage, false);
function HMIExportFrpConfig(){
frp_prefix=document.getElementById('FrpPrefix').value;
frp_port=document.getElementById('FrpPort').value;
frp_tokens=document.getElementById('FrpToken').value;
var HMISettingFrpGetConfigStr = "HMIExportFrpConfig:"+
frp_prefix+","+
frp_port+","+
frp_tokens+"#";
client_request(HMISettingFrpGetConfigStr);
}
</script>
<title>Title</title>
</head>
<body>
<table>
<tr>
<div id="output"></div>
</tr>
<tr>
<input type=button class="btn" value="GetStatus" onclick=client_request("HMISettingFRPGetStatus")></input>
</tr>
<tr>
<input type=button class="btn" value="Restart" onclick=client_request("HMISettingFRPRestart")></input>
</tr>
<tr>
<input type=button class="btn" value="Stop" onclick=client_request("HMISettingFRPStop")></input>
</tr>
<tr>
<input type=button class="btn" value="DisableService" onclick=client_request("HMISettingFRPDisableService")></input>
</tr>
<tr>
<input type=button class="btn" value="EnableService" onclick=client_request("HMISettingFRPEnableService")></input>
</tr>
<tr>
<input type=button class="btn" value="GetFrpConfig" onclick=client_request("HMISettingFrpGetConfig")></input>
</tr>
<tr>
<td>FrpPrefix</td>
<td><input type="text" class="input form-control" name="FrpPrefix" id="FrpPrefix"></td>
</tr>
<tr>
<td>FrpPort</td>
<td><input type="text" class="input form-control" name="FrpPort" id="FrpPort"></td>
</tr>
<tr>
<td>FrpToken</td>
<td><input type="text" class="input form-control" name="FrpToken" id="FrpToken"></td>
</tr>
<tr>
<input type=button class="btn" value="HMIExportFrpConfig" onclick=HMIExportFrpConfig()></input>
</tr>
</table>
</body>
<style>
.btn{
background:#FD4F00FF;
color: whitesmoke;
font-size: 23px;
padding: 6px 20px;
margin: 4px 10px;
}
</style>
<script>
$(".input").focus(function() {
window.parent.inputDom = this;
var distance = $(parent.document).scrollTop() + 500 + "px";
$(".simple-keyboard", parent.document).css("top", distance)
$(".keyboard", parent.document).show();
window.parent.clearKeyboard();
})
</script>
</html>