-
-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
292 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>小爱音箱操控面板</title> | ||
<script src="/static/jquery-3.7.1.min.js"></script> | ||
<script src="/static/setting.js"></script> | ||
<link rel="stylesheet" type="text/css" href="/static/style.css"> | ||
</head> | ||
<body> | ||
<h2>小爱音箱设置面板<span id="version">(版本未知)</span></h2> | ||
<hr> | ||
<div class="rows"> | ||
<label for="mi_did">MI_DID:</label> | ||
<select id="mi_did"></select> | ||
<label for="mi_hardware">MI_HARDWARE:</label> | ||
<select id="mi_hardware"></select> | ||
<label for="xiaomusic_search">XIAOMUSIC_SEARCH:</label> | ||
<select id="xiaomusic_search"> | ||
<option value="ytsearch:">ytsearch:</option> | ||
<option value="bilisearch:">bilisearch:</option> | ||
</select> | ||
<label for="xiaomusic_proxy">XIAOMUSIC_PROXY(ytsearch需要):</label> | ||
<input id="xiaomusic_proxy" type="text" placeholder="http://192.168.2.5:8080"></input> | ||
</div> | ||
<hr> | ||
<button onclick="location.href='/';">返回首页</button> | ||
<button id="save">保存</button> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
$(function(){ | ||
// 拉取现有配置 | ||
$.get("/getsetting", function(data, status) { | ||
console.log(data, status); | ||
|
||
var mi_did_div = $("#mi_did") | ||
mi_did_div.empty(); | ||
$.each(data.mi_did_list, function(index, option){ | ||
mi_did_div.append($('<option>', { | ||
value:option, | ||
text:option, | ||
})); | ||
if (data.mi_did == option) { | ||
mi_did_div.val(option); | ||
} | ||
}); | ||
|
||
var mi_hardware_div = $("#mi_hardware") | ||
mi_hardware_div.empty(); | ||
$.each(data.mi_hardware_list, function(index, option){ | ||
mi_hardware_div.append($('<option>', { | ||
value:option, | ||
text:option, | ||
})); | ||
if (data.mi_hardware == option) { | ||
mi_hardware_div.val(option); | ||
} | ||
}); | ||
|
||
if (data.xiaomusic_search != "") { | ||
$("#xiaomusic_search").val(data.xiaomusic_search); | ||
} | ||
|
||
if (data.xiaomusic_proxy != "") { | ||
$("#xiaomusic_proxy").val(data.xiaomusic_proxy); | ||
} | ||
}); | ||
|
||
$("#save").on("click", () => { | ||
var mi_did = $("#mi_did").val(); | ||
var mi_hardware = $("#mi_hardware").val(); | ||
var xiaomusic_search = $("#xiaomusic_search").val(); | ||
var xiaomusic_proxy = $("#xiaomusic_proxy").val(); | ||
console.log("mi_did", mi_did); | ||
console.log("mi_hardware", mi_hardware); | ||
console.log("xiaomusic_search", xiaomusic_search); | ||
console.log("xiaomusic_proxy", xiaomusic_proxy); | ||
var data = { | ||
mi_did: mi_did, | ||
mi_hardware: mi_hardware, | ||
xiaomusic_search: xiaomusic_search, | ||
xiaomusic_proxy: xiaomusic_proxy, | ||
}; | ||
$.ajax({ | ||
type: "POST", | ||
url: "/savesetting", | ||
contentType: "application/json", | ||
data: JSON.stringify(data), | ||
success: (msg) => { | ||
alert(msg); | ||
}, | ||
error: (msg) => { | ||
alert(msg); | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
button { | ||
margin: 10px; | ||
width: 100px; | ||
height: 50px; | ||
border: none; | ||
color: white; | ||
text-align: center; | ||
text-decoration: none; | ||
display: inline-block; | ||
border-radius: 10px; | ||
background-color: #008CBA; | ||
} | ||
button:active { | ||
font-weight:bold; | ||
background-color: #007CBA; | ||
transform: translateY(2px); | ||
} | ||
label { | ||
margin-left: 10px; | ||
width: 300px; | ||
} | ||
input,select { | ||
margin: 10px; | ||
width: 300px; | ||
height: 40px; | ||
} | ||
|
||
.container{ | ||
width: 280px; | ||
overflow: hidden; | ||
display: inline-block; | ||
} | ||
@keyframes text-scroll { | ||
0% { | ||
left: 100%; | ||
} | ||
25% { | ||
left: 50%; | ||
} | ||
50% { | ||
left: 0%; | ||
} | ||
75% { | ||
left: -50%; | ||
} | ||
100% { | ||
left: -100%; | ||
} | ||
} | ||
.text { | ||
white-space: nowrap; | ||
font-weight: bold; | ||
position: relative; | ||
animation: text-scroll 10s linear infinite; | ||
} | ||
|
||
.rows { | ||
display: flex; | ||
flex-direction: column; | ||
margin-left: 20px; | ||
margin-right: 20px; | ||
} | ||
|
||
|
Oops, something went wrong.