From 87ddd3667c28fa4eb935f4ecb524212f8828dde4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=94=A6=E5=BC=BA?= <1061669148@qq.com> Date: Wed, 2 Apr 2025 23:36:37 +0800 Subject: [PATCH] feat: refactor event handling and clean up TTS request parameters --- internal/http/handlers/tts.go | 1 - web/static/js/app.js | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/http/handlers/tts.go b/internal/http/handlers/tts.go index b370bfc..36f7217 100644 --- a/internal/http/handlers/tts.go +++ b/internal/http/handlers/tts.go @@ -509,7 +509,6 @@ func (h *TTSHandler) HandleReader(context *gin.Context) { func (h *TTSHandler) HandleIFreeTime(context *gin.Context) { // 从URL参数获取 req := models.TTSRequest{ - Text: context.Query("t"), Voice: context.Query("v"), Rate: context.Query("r"), Pitch: context.Query("p"), diff --git a/web/static/js/app.js b/web/static/js/app.js index fbd5964..4a8efd8 100644 --- a/web/static/js/app.js +++ b/web/static/js/app.js @@ -217,7 +217,7 @@ document.addEventListener('DOMContentLoaded', function () { }); // 添加风格选择变化事件 - styleSelect.addEventListener('change', function() { + styleSelect.addEventListener('change', function () { // 保存风格选择 localStorage.setItem('ttsStyle', this.value); }); @@ -387,11 +387,10 @@ document.addEventListener('DOMContentLoaded', function () { // 复制爱阅记链接按钮点击事件 copyIfreetimeLinkButton.addEventListener('click', function () { - const text = "{{java.encodeURI(speakText)}}"; const voice = voiceSelect.value; const displayName = voiceSelect.options[voiceSelect.selectedIndex].text; const style = styleSelect.value; - const rate = "{{speakSpeed*4}}" + const rate = rateInput.value const pitch = pitchInput.value; const apiKey = apiKeyInput.value.trim(); @@ -679,6 +678,7 @@ document.addEventListener('DOMContentLoaded', function () { }, 300); }, duration); } + // 添加自定义alert函数到全局范围 window.showCustomAlert = showCustomAlert; });