mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-29 01:13:52 +08:00
Merge pull request #1373 from Minamiyama/ENH/test-page-localstorage
refactor(test_page.html): 优化UI布局和输入提示,增加本地存储功能
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
max-width: 800px;
|
max-width: 1000px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
@@ -482,9 +482,10 @@
|
|||||||
</span>
|
</span>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="connection-controls">
|
<div class="connection-controls">
|
||||||
<input type="text" id="otaUrl" value="http://127.0.0.1:8002/xiaozhi/ota/" placeholder="OTA服务器地址" />
|
<input type="text" id="otaUrl" value="http://127.0.0.1:8002/xiaozhi/ota/"
|
||||||
|
placeholder="OTA服务器地址,如:http://127.0.0.1:8002/xiaozhi/ota/" />
|
||||||
<input type="text" id="serverUrl" value="ws://127.0.0.1:8000/xiaozhi/v1/"
|
<input type="text" id="serverUrl" value="ws://127.0.0.1:8000/xiaozhi/v1/"
|
||||||
placeholder="WebSocket服务器地址" />
|
placeholder="WebSocket服务器地址,如:ws://127.0.0.1:8000/xiaozhi/v1/" />
|
||||||
<button id="connectButton">连接</button>
|
<button id="connectButton">连接</button>
|
||||||
<button id="authTestButton">测试认证</button>
|
<button id="authTestButton">测试认证</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -1306,7 +1307,8 @@
|
|||||||
// 先检查OTA状态
|
// 先检查OTA状态
|
||||||
log('正在检查OTA状态...', 'info');
|
log('正在检查OTA状态...', 'info');
|
||||||
const otaUrl = document.getElementById('otaUrl').value.trim();
|
const otaUrl = document.getElementById('otaUrl').value.trim();
|
||||||
|
localStorage.setItem('otaUrl', otaUrl);
|
||||||
|
localStorage.setItem('wsUrl', url);
|
||||||
try {
|
try {
|
||||||
const otaResponse = await fetch(otaUrl, {
|
const otaResponse = await fetch(otaUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -1633,6 +1635,16 @@
|
|||||||
// 初始更新显示值
|
// 初始更新显示值
|
||||||
updateDisplayValues();
|
updateDisplayValues();
|
||||||
|
|
||||||
|
const savedOtaUrl = localStorage.getItem('otaUrl');
|
||||||
|
if (savedOtaUrl) {
|
||||||
|
document.getElementById('otaUrl').value = savedOtaUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const savedWsUrl = localStorage.getItem('wsUrl');
|
||||||
|
if (savedWsUrl) {
|
||||||
|
document.getElementById('serverUrl').value = savedWsUrl;
|
||||||
|
}
|
||||||
|
|
||||||
// 切换面板显示
|
// 切换面板显示
|
||||||
toggleButton.addEventListener('click', () => {
|
toggleButton.addEventListener('click', () => {
|
||||||
const isExpanded = configPanel.classList.contains('expanded');
|
const isExpanded = configPanel.classList.contains('expanded');
|
||||||
|
|||||||
Reference in New Issue
Block a user