优化:拆分test_page.html,把一部分document操作的代码提取出来,减少单个文件大小,且把logger.js和xiaoZhiConnect.js也提取出来

This commit is contained in:
JianYu Zheng
2025-08-11 17:44:01 +08:00
parent 1c19046442
commit c7392dcf5a
3 changed files with 35 additions and 5 deletions
+28
View File
@@ -0,0 +1,28 @@
// DOM元素
const connectButton = document.getElementById('connectButton');
const serverUrlInput = document.getElementById('serverUrl');
const connectionStatus = document.getElementById('connectionStatus');
const messageInput = document.getElementById('messageInput');
const sendTextButton = document.getElementById('sendTextButton');
const recordButton = document.getElementById('recordButton');
const stopButton = document.getElementById('stopButton');
const conversationDiv = document.getElementById('conversation');
const logContainer = document.getElementById('logContainer');
let visualizerCanvas = document.getElementById('audioVisualizer');
// ota 是否连接成功,修改成对应的样式
export function otaStatusStyle (flan) {
if(flan){
document.getElementById('otaStatus').textContent = 'ota已连接';
document.getElementById('otaStatus').style.color = 'green';
}else{
document.getElementById('otaStatus').textContent = 'ota未连接';
document.getElementById('otaStatus').style.color = 'red';
}
}
// ota 是否连接成功,修改成对应的样式
export function getLogContainer (flan) {
return logContainer;
}