AudioHTML/network.html

236 lines
11 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/app.css" rel="stylesheet">
<script src="js/config.js"></script>
<script src="js/jquery-3.7.1.js"></script>
</head>
<body class="h-100 text-center text-bg-dark content-warp">
<div class="d-flex w-100 h-100 mx-auto flex-column">
<header class="mb-auto pb-5">
<div class="dotblock d-flex justify-content-between px-5 py-4">
<div class="fs-3">GEAZAN</div>
<div></div>
</div>
<div class="fw-bold border-black nav-bar" style="position:relative;">
<div class="d-flex nav justify-content-center">
<div class="">
<a href="home.html">HOME</a>
</div>
<div class=""><a href="filter.html">FILTER</a></div>
<div class=""><a href="fs.html">FS</div>
<div class=""><a href="eq.html">EQ</a></div>
<div class=""><a href="ducking.html">DUCKING</a></div>
<div class="active"><a href="network.html">NETWORK</a></div>
<div class=""><a href="security.html">SECURITY</a></div>
<div class=""><a href="control.html">CONTROL</a></div>
<div class="last "><a href="system.html">SYSTEM</a></div>
</div>
<div class="d-flex float-end ps-5 align-items-center" style="position:absolute; right: 10px;top: 3px;">
<button class="btn btn-dark border-black" id="blink">
<svg t="1699500251819" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="4301" xmlns:xlink="http://www.w3.org/1999/xlink"
width="20" height="20">
<path
d="M513.3 239.9c-73.5 0-142.6 28.6-194.6 80.6-52 52-80.6 121.1-80.6 194.6s28.6 142.6 80.6 194.6c52 52 121.1 80.6 194.6 80.6s142.6-28.6 194.6-80.6c52-52 80.6-121.1 80.6-194.6s-28.6-142.6-80.6-194.6c-52-52-121.1-80.6-194.6-80.6z m0 482.3c-114.2 0-207.2-92.9-207.2-207.2S399 307.8 513.3 307.8c114.2 0 207.2 92.9 207.2 207.2s-92.9 207.2-207.2 207.2zM637.9 803.6H388.7c-18.8 0-34 15.2-34 34s15.2 34 34 34h249.2c18.8 0 34-15.2 34-34s-15.2-34-34-34zM588.1 885H438.6c-18.8 0-34 15.2-34 34s15.2 34 34 34h149.5c18.8 0 34-15.2 34-34s-15.2-34-34-34zM513.3 227.5c18.8 0 34-15.2 34-34V97c0-18.8-15.2-34-34-34s-34 15.2-34 34v96.5c0 18.7 15.2 34 34 34zM701.3 276.9c5.9 4.2 12.7 6.2 19.5 6.2 10.7 0 21.3-5.1 27.9-14.5l55.3-79c10.8-15.4 7-36.6-8.3-47.4-15.4-10.8-36.6-7-47.4 8.3l-55.3 79c-10.8 15.4-7.1 36.6 8.3 47.4zM938 357.6c-6.6-17.6-26.2-26.5-43.8-19.9l-90.4 33.8c-17.6 6.6-26.5 26.2-19.9 43.8 5.1 13.7 18.1 22.1 31.9 22.1 4 0 8-0.7 11.9-2.2l90.4-33.8c17.6-6.6 26.5-26.2 19.9-43.8zM283.4 252.5c6.6 9.4 17.2 14.5 27.9 14.5 6.7 0 13.5-2 19.5-6.2 15.4-10.8 19.1-32 8.3-47.4l-55.3-79c-10.8-15.4-32-19.1-47.4-8.3-15.4 10.8-19.1 32-8.3 47.4l55.3 79zM248.1 399.1c6.6-17.6-2.4-37.2-19.9-43.8l-90.4-33.8c-17.6-6.6-37.2 2.4-43.8 19.9-6.6 17.6 2.4 37.2 19.9 43.8l90.4 33.8c3.9 1.5 7.9 2.2 11.9 2.2 13.8 0 26.8-8.4 31.9-22.1z"
fill="#ffffff" p-id="4302" data-spm-anchor-id="a313x.search_index.0.i3.5b953a811enFNb"
class="selected"></path>
</svg>
</button>
</div>
</div>
</header>
<main class="px-3 d-flex justify-content-center">
<div class="form">
<div class="border border-black m-6 password-form">
<div class=" m-5 mx-auto form" style="width: 500px;">
<div class="mb-3 row">
<label for="staticEmail" class="col-sm-5 col-form-label">IP Configuration</label>
<div class="col-sm-7 text-start py-2">
<div class="form-check form-check-inline">
<input class="form-check-input" checked type="radio" name="type" id="type-dhcp"
value="dhcp">
<label class="form-check-label" for="type-dhcp">DHCP</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="type" id="type-static"
value="static">
<label class="form-check-label" for="type-static">Static IP</label>
</div>
</div>
</div>
<div class="mb-3 row">
<label for="staticEmail" class="col-sm-5 col-form-label">Mac Address</label>
<div class="col-sm-7 text-start py-2" id="mac">
10-A6-56-EF-23-D6
</div>
</div>
<div class="mb-3 row">
<label for="ipaddress" class="col-sm-5 col-form-label">IP Address</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="ipaddress">
</div>
</div>
<div class="mb-3 row">
<label for="subnet" class="col-sm-5 col-form-label">Subnet Mask</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="subnet">
</div>
</div>
<div class="mb-3 row">
<label for="gateway" class="col-sm-5 col-form-label">Gateway</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="gateway">
</div>
</div>
<div class="mb-3 row">
<label for="hostName" class="col-sm-5 col-form-label">Host Name</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="hostName">
</div>
</div>
</div>
</div>
<div class="mt-5 pb-5">
<button type="button" class="btn btn-dark border border-black px-5" id="submit">Confirm</button>
</div>
</div>
</main>
<footer class="mt-auto text-white-50">
<div class="dotblock d-flex justify-content-between px-5 py-4">
<div class="">Geazan</div>
<div>www.geazan.com</div>
</div>
</footer>
</div>
<script>
var data = {}
document.addEventListener("DOMContentLoaded", function () {
//初始化配置
loadData()
})
$(document).ready(function () {
$("input[name='type']").on('change', function () {
console.log($("input[name=type]:checked").val())
checkDisable();
})
$("#submit").on('click', function () {
if (isValidIP($("#ipaddress").val()) == false) {
alert('The ip address format is incorrect')
return
}
if (isValidIP($('#subnet').val()) == false) {
alert('The subnet address format is incorrect')
return
}
if (isValidIP($('#gateway').val()) == false) {
alert('The gateway address format is incorrect')
return
}
if ($('#hostName').val().length > 32) {
alert('The host name contains a maximum of 32 characters')
return
}
let url = 'http://192.168.0.116/cgi-bin/test.cgi?action=network_set';
let postData = {
config: $("input[name=type]:checked").val(),
mac: '',
address: $("#ipaddress").val(),
subnet: $('#subnet').val(),
gateway: $('#gateway').val(),
hostname:$('#hostName').val(),
action:"network_set"
}
$.ajax({
type: 'POST',
url: url,
data: postData,
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (res) {
if (res.success) {
data = res.content
bindData()
}
else {
alert(res.message)
}
},
error: function (res) {
}
})
})
})
function checkDisable() {
var type = $("input[name='type']:checked").val()
if (type == 'dhcp') {
$("#ipaddress").attr('disabled', "disabled");
$('#subnet').attr('disabled', "disabled");
$('#gateway').attr('disabled', "disabled");
}
else {
$("#ipaddress").removeAttr("disabled");
$('#subnet').removeAttr("disabled");
$('#gateway').removeAttr("disabled");
}
}
function loadData() {
let url = 'http://192.168.0.116/cgi-bin/test.cgi?action=network_get';
$.ajax({
type: "GET",
url: url,
success: function (res) {
data = res.content
bindData()
},
error: function () {
data = {
config: "static",
mac: '00-2F-33-7X-3B',
address: '127.0.0.10',
subnet: '255.255.255.0',
gateway: '127.0.0.1',
hostname: 'test-name'
}
bindData()
}
})
}
function bindData() {
console.log(data)
$('#mac').text(`${data.mac}`)
$("#ipaddress").val(`${data.address}`)
$('#subnet').val(`${data.subnet}`)
$('#gateway').val(`${data.gateway}`)
$('#hostName').val(`${data.hostname}`)
checkDisable();
}
function isValidIP(ip) {
var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
return reg.test(ip);
}
</script>
<script src="js/main.js"></script>
</body>
</html>