yxw 2023-12-05 18:31:22 +08:00
parent c0210dba7a
commit d76dd8be03
11 changed files with 97 additions and 7 deletions

View File

@ -44,6 +44,12 @@
class="selected"></path>
</svg>
</button>
<button class="btn btn-dark border-black ms-2" id="logout">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0z"/>
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
</svg>
</button>
</div>
</div>
</header>

View File

@ -45,6 +45,12 @@
class="selected"></path>
</svg>
</button>
<button class="btn btn-dark border-black ms-2" id="logout">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0z"/>
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
</svg>
</button>
</div>
</div>
</header>

View File

@ -43,6 +43,12 @@
class="selected"></path>
</svg>
</button>
<button class="btn btn-dark border-black ms-2" id="logout">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0z"/>
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
</svg>
</button>
</div>
</div>
</header>

View File

@ -45,6 +45,12 @@
class="selected"></path>
</svg>
</button>
<button class="btn btn-dark border-black ms-2" id="logout">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0z"/>
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
</svg>
</button>
</div>
</div>
</header>

View File

@ -45,6 +45,12 @@
class="selected"></path>
</svg>
</button>
<button class="btn btn-dark border-black ms-2" id="logout">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0z"/>
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
</svg>
</button>
</div>
</div>
</header>

View File

@ -48,6 +48,12 @@
class="selected"></path>
</svg>
</button>
<button class="btn btn-dark border-black ms-2" id="logout">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0z"/>
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
</svg>
</button>
</div>
</div>
</header>

View File

@ -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'
}
}
})

View File

@ -37,7 +37,7 @@
<button type="button" id="submit" class="btn btn-lg btn-dark border border-black">LOGIN</button>
</div>
<div class="mt-5 mb-3" style="color: #888888;">
<div >GUI <span id="guiv">V1.0.0</span>
<div>GUI <span id="guiv">V1.0.0</span>
</div>
<div>FIRMWARE <span id="firmwarev">V1.0.0</span></div>
</div>
@ -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}`)
}
</script>
<script src="js/main.js"></script>
<script src="js/main.js"></script>
</body>
</html>

View File

@ -42,6 +42,12 @@
class="selected"></path>
</svg>
</button>
<button class="btn btn-dark border-black ms-2" id="logout">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0z"/>
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
</svg>
</button>
</div>
</div>
</header>

View File

@ -42,6 +42,12 @@
class="selected"></path>
</svg>
</button>
<button class="btn btn-dark border-black ms-2" id="logout">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0z"/>
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
</svg>
</button>
</div>
</div>
</header>

View File

@ -44,6 +44,15 @@
class="selected"></path>
</svg>
</button>
<button class="btn btn-dark border-black ms-2" id="logout">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd"
d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0z" />
<path fill-rule="evenodd"
d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
</svg>
</button>
</div>
</div>
</header>