From d76dd8be0306989ad32cdb8dca8d093822995c91 Mon Sep 17 00:00:00 2001 From: yxw <17074267@qq.com> Date: Tue, 5 Dec 2023 18:31:22 +0800 Subject: [PATCH] fix --- control.html | 6 ++++++ ducking.html | 6 ++++++ eq.html | 6 ++++++ filter.html | 6 ++++++ fs.html | 6 ++++++ home.html | 6 ++++++ js/main.js | 19 +++++++++++++++++-- login.html | 28 +++++++++++++++++++++++----- network.html | 6 ++++++ security.html | 6 ++++++ system.html | 9 +++++++++ 11 files changed, 97 insertions(+), 7 deletions(-) diff --git a/control.html b/control.html index a640fa1..eccaa09 100644 --- a/control.html +++ b/control.html @@ -44,6 +44,12 @@ class="selected"> + diff --git a/ducking.html b/ducking.html index 8fb340f..27365b9 100644 --- a/ducking.html +++ b/ducking.html @@ -45,6 +45,12 @@ class="selected"> + diff --git a/eq.html b/eq.html index bf3a004..ec0bab1 100644 --- a/eq.html +++ b/eq.html @@ -43,6 +43,12 @@ class="selected"> + diff --git a/filter.html b/filter.html index 1461398..d777472 100644 --- a/filter.html +++ b/filter.html @@ -45,6 +45,12 @@ class="selected"> + diff --git a/fs.html b/fs.html index 38d5cbe..494c968 100644 --- a/fs.html +++ b/fs.html @@ -45,6 +45,12 @@ class="selected"> + diff --git a/home.html b/home.html index 592410f..45c90db 100644 --- a/home.html +++ b/home.html @@ -48,6 +48,12 @@ class="selected"> + diff --git a/js/main.js b/js/main.js index 0dcf200..1a947bd 100644 --- a/js/main.js +++ b/js/main.js @@ -1,6 +1,6 @@ $(document).ready(function () { $("#blink").on('click', function () { - console.log('click','#blink') + console.log('click', '#blink') let url = 'http://192.168.0.116/cgi-bin/test.cgi'; let postData = { action: 'blink' @@ -20,11 +20,26 @@ $(document).ready(function () { } }, error: function (res) { + } }) }) + + $("#logout").on('click', function () { + sessionStorage.clear(); + window.location.href='login.html' + }) }) $(function () { - + var data = sessionStorage.getItem('state'); + if (data != 'logined') { + if (window.location.href.indexOf('login') != -1) { + //login page + console.log('bbbb') + } + else { + window.location.href = 'login.html' + } + } }) \ No newline at end of file diff --git a/login.html b/login.html index 54cfb88..8035222 100644 --- a/login.html +++ b/login.html @@ -37,7 +37,7 @@
-
GUI V1.0.0 +
GUI V1.0.0
FIRMWARE V1.0.0
@@ -62,23 +62,36 @@ document.addEventListener("DOMContentLoaded", function () { //初始化配置 + loadData() + }) $(document).ready(function () { + console.log('ready', $("#name").val()) + window.focus() + $("#name").focus() + var alertState = sessionStorage.getItem('alert') + if (alertState == 'alert') { + sessionStorage.removeItem('alert'); + console.log('重新跳转') + window.location.href = 'login.html?t=' + new Date().getTime() + } $("#submit").on("click", function () { let name = $("#name").val() let password = $("#password").val() if (name.length == 0) { + sessionStorage.setItem('alert', 'alert'); alert('Please enter your username') return } if (password.length == 0) { + sessionStorage.setItem('alert', 'alert'); alert('Please enter the account login password') return } - let url = 'http://192.168.0.116/cgi-bin/test.cgi'; + let url = '/cgi-bin/test.cgi'; let postData = { action: 'login_set', name: name, @@ -92,14 +105,19 @@ //contentType: "application/json; charset=utf-8", success: function (res) { if (res.success) { - alert('Login successful') - window.location.href="/home.html" + // alert('Login successful') + window.location.href = "/home.html" } else { alert(res.message) + sessionStorage.setItem('alert', 'alert'); + return } }, error: function (res) { + alert('error') + // sessionStorage.setItem('state', 'logined'); + // window.location.href = "home.html" } }) }) @@ -134,7 +152,7 @@ $("#hostName").text(`${data.hostname}`) } - + \ No newline at end of file diff --git a/network.html b/network.html index 6a9eced..8369366 100644 --- a/network.html +++ b/network.html @@ -42,6 +42,12 @@ class="selected"> +
diff --git a/security.html b/security.html index 3f33178..31d93b7 100644 --- a/security.html +++ b/security.html @@ -42,6 +42,12 @@ class="selected"> + diff --git a/system.html b/system.html index 35575d3..81fcbc0 100644 --- a/system.html +++ b/system.html @@ -44,6 +44,15 @@ class="selected"> +