|
|
@@ -115,12 +115,12 @@
|
|
|
<div style="background: white; padding: 20px; border-radius: 10px; border: 1px solid #eee; margin-bottom: 20px;">
|
|
|
<h4 style="margin-bottom: 15px; color: #4ecdc4; border-left: 4px solid #4ecdc4; padding-left: 10px;">音量控制</h4>
|
|
|
<div class="control-row">
|
|
|
- <div class="control-group">
|
|
|
- <label for="globalVolume">全局音量 (0-100)</label>
|
|
|
- <input type="number" id="globalVolume" min="0" max="100" value="65">
|
|
|
- </div>
|
|
|
- <div class="control-group" style="flex: 0 0 auto;">
|
|
|
- <button class="btn btn-info" onclick="setGlobalVolume()">设置音量</button>
|
|
|
+ <div class="control-group" style="width: 100%;">
|
|
|
+ <div style="display: flex; justify-content: space-between; margin-bottom: 5px;">
|
|
|
+ <label for="globalVolume">全局音量</label>
|
|
|
+ <span id="volumeValue" style="font-weight: bold; color: #4ecdc4;">65</span>
|
|
|
+ </div>
|
|
|
+ <input type="range" id="globalVolume" min="0" max="100" value="65" style="width: 100%; cursor: pointer;" onchange="setGlobalVolume()" oninput="updateVolumeDisplay(this.value)">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -223,6 +223,7 @@
|
|
|
getKodiClients();
|
|
|
getVideoList();
|
|
|
getFreeTimePlayStatus();
|
|
|
+ getGlobalVolume();
|
|
|
|
|
|
window.onclick = function(event) {
|
|
|
const modal = document.getElementById('tvConfigModal');
|
|
|
@@ -337,6 +338,24 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function updateVolumeDisplay(val) {
|
|
|
+ document.getElementById('volumeValue').textContent = val;
|
|
|
+ }
|
|
|
+
|
|
|
+ async function getGlobalVolume() {
|
|
|
+ try {
|
|
|
+ const response = await fetch('/api/kodi/get_volume');
|
|
|
+ const result = await response.json();
|
|
|
+ if (result.success) {
|
|
|
+ const vol = result.data.volume;
|
|
|
+ document.getElementById('globalVolume').value = vol;
|
|
|
+ updateVolumeDisplay(vol);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取音量失败', error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
async function setGlobalVolume() {
|
|
|
const volume = parseInt(document.getElementById('globalVolume').value);
|
|
|
if (isNaN(volume) || volume < 0 || volume > 100) {
|
|
|
@@ -344,7 +363,7 @@
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
- showLoading(true);
|
|
|
+ // 滑动条体验优化:不显示全屏loading
|
|
|
const response = await fetch('/api/kodi/set_volume', {
|
|
|
method: 'POST',
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
@@ -358,8 +377,6 @@
|
|
|
}
|
|
|
} catch (error) {
|
|
|
showMessage('网络错误: ' + error.message, 'error');
|
|
|
- } finally {
|
|
|
- showLoading(false);
|
|
|
}
|
|
|
}
|
|
|
|