From ae006e956d471d78ad29db22909dd5f19ede74bb Mon Sep 17 00:00:00 2001 From: hflllll Date: Mon, 13 Oct 2025 19:48:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=97=A5=E5=BF=97=E5=B9=B6=E4=BC=98=E5=8C=96=E9=9F=B3?= =?UTF-8?q?=E9=A2=91=E6=8E=A7=E5=88=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除多个组件中的调试console.log语句,优化AudioControls组件的音频播放逻辑: 1. 实现HTML5 Audio包装器以支持跨平台倍速播放 2. 改进音频匹配策略,增加首字符匹配作为后备方案 3. 优化错误处理,减少不必要的用户提示 4. 增强音频加载状态管理,添加自动重试机制 --- subPages/home/AudioControls.vue | 307 ++++++++++++++++++++++++++++++++++------ subPages/home/book.vue | 184 ++++++++++++++++-------- subPages/home/music.vue | 4 +- subPages/home/plan.vue | 4 +- subPages/home/search.vue | 4 +- subPages/home/submit.vue | 2 +- 6 files changed, 396 insertions(+), 109 deletions(-) diff --git a/subPages/home/AudioControls.vue b/subPages/home/AudioControls.vue index f1d52ab..bc3eba8 100644 --- a/subPages/home/AudioControls.vue +++ b/subPages/home/AudioControls.vue @@ -178,14 +178,14 @@ export default { // 检查缓存的音色ID是否与当前音色匹配 if (cachedData.voiceId && cachedData.voiceId !== this.localVoiceId) { - console.warn('缓存音色不匹配:', cachedData.voiceId, '!=', this.localVoiceId); + // console.warn('缓存音色不匹配:', cachedData.voiceId, '!=', this.localVoiceId); return false; } // 检查音频URL是否有效 const firstAudio = cachedData.audios[0]; if (!firstAudio || !firstAudio.url) { - console.warn('缓存音频数据无效'); + // console.warn('缓存音频数据无效'); return false; } @@ -207,7 +207,7 @@ export default { // 如果没有缓存且正在预加载,说明当前页面可能正在预加载中 if (!hasCache) { - console.log('当前页面可能正在预加载中,页面:', this.currentPage, '缓存状态:', hasCache); + // console.log('当前页面可能正在预加载中,页面:', this.currentPage, '缓存状态:', hasCache); return true; } } @@ -219,7 +219,7 @@ export default { currentPage: { handler(newPage, oldPage) { if (newPage !== oldPage) { - console.log('页面切换:', oldPage, '->', newPage); + // console.log('页面切换:', oldPage, '->', newPage); // 设置页面切换状态 this.isPageChanging = true; @@ -249,7 +249,7 @@ export default { voiceId: { handler(newVoiceId, oldVoiceId) { if (newVoiceId !== oldVoiceId) { - console.log('🎵 音色ID变化:', oldVoiceId, '->', newVoiceId); + // console.log('🎵 音色ID变化:', oldVoiceId, '->', newVoiceId); // 更新本地音色ID this.localVoiceId = newVoiceId; } @@ -258,6 +258,129 @@ export default { } }, methods: { + // 创建HTML5 Audio实例并包装为uni-app兼容接口 + createHTML5Audio() { + const audio = new Audio(); + + // 包装为uni-app兼容的接口 + const wrappedAudio = { + // 原生HTML5 Audio实例 + _nativeAudio: audio, + + // 基本属性 + get src() { return audio.src; }, + set src(value) { audio.src = value; }, + + get duration() { return audio.duration || 0; }, + get currentTime() { return audio.currentTime || 0; }, + + get paused() { return audio.paused; }, + + // 支持倍速的关键属性 + get playbackRate() { return audio.playbackRate; }, + set playbackRate(value) { + try { + audio.playbackRate = value; + // console.log(`🎵 HTML5 Audio倍速设置成功: ${value}x`); + } catch (error) { + console.error('❌ HTML5 Audio倍速设置失败:', error); + } + }, + + // 基本方法 + play() { + return audio.play().catch(error => { + console.error('HTML5 Audio播放失败:', error); + }); + }, + + pause() { + audio.pause(); + }, + + stop() { + audio.pause(); + audio.currentTime = 0; + }, + + seek(time) { + audio.currentTime = time; + }, + + destroy() { + audio.pause(); + audio.src = ''; + audio.load(); + }, + + // 事件绑定方法 + onCanplay(callback) { + audio.addEventListener('canplay', callback); + }, + + onPlay(callback) { + audio.addEventListener('play', callback); + }, + + onPause(callback) { + audio.addEventListener('pause', callback); + }, + + onEnded(callback) { + audio.addEventListener('ended', callback); + }, + + onTimeUpdate(callback) { + audio.addEventListener('timeupdate', callback); + }, + + onError(callback) { + // 包装错误事件,过滤掉非关键错误 + const wrappedCallback = (error) => { + // 只在有src且音频正在播放时才传递错误事件 + if (audio.src && audio.src.trim() !== '' && !audio.paused) { + callback(error); + } else { + console.log('🔇 HTML5 Audio错误(已忽略):', { + hasSrc: !!audio.src, + paused: audio.paused, + errorType: error.type || 'unknown' + }); + } + }; + audio.addEventListener('error', wrappedCallback); + }, + + // 移除事件监听 + offCanplay(callback) { + audio.removeEventListener('canplay', callback); + }, + + offPlay(callback) { + audio.removeEventListener('play', callback); + }, + + offPause(callback) { + audio.removeEventListener('pause', callback); + }, + + offEnded(callback) { + audio.removeEventListener('ended', callback); + }, + + offTimeUpdate(callback) { + audio.removeEventListener('timeupdate', callback); + }, + + offError(callback) { + audio.removeEventListener('error', callback); + } + }; + + console.log('🎧 创建HTML5 Audio包装实例,支持倍速播放'); + return wrappedAudio; + }, + // 检查并自动加载预加载完成的音频 checkAndLoadPreloadedAudio() { // 只在需要加载音频的页面检查 @@ -1402,7 +1525,59 @@ export default { return true; // 成功找到并播放 } else { console.error('❌ 未找到匹配的音频段落:', textContent); - console.log('💡 尝试使用备用方案:实时生成音频'); + console.log('💡 尝试最后的匹配策略:首字符匹配'); + + // 最后的尝试:首字符匹配(针对划线重点等特殊情况) + if (normalizedTarget.length > 5) { + const firstChars = normalizedTarget.substring(0, Math.min(10, normalizedTarget.length)); + console.log('🔍 尝试首字符匹配:', firstChars); + + audioIndex = this.currentPageAudios.findIndex(audio => { + if (!audio.text) return false; + const normalizedAudio = this.normalizeText(audio.text); + return normalizedAudio.startsWith(firstChars) || firstChars.startsWith(normalizedAudio.substring(0, Math.min(10, normalizedAudio.length))); + }); + + if (audioIndex !== -1) { + console.log('✅ 首字符匹配成功,索引:', audioIndex); + + // 停止当前播放的音频 + if (this.currentAudio) { + this.currentAudio.pause(); + this.currentAudio.destroy(); + this.currentAudio = null; + } + + // 设置新的音频索引 + this.currentAudioIndex = audioIndex; + + // 重置播放状态 + this.isPlaying = false; + this.currentTime = 0; + this.sliderValue = 0; + + // 更新高亮索引 + this.currentHighlightIndex = audioIndex; + this.emitHighlightChange(audioIndex); + + // 创建新的音频实例并播放 + this.createAudioInstance(); + + // 稍等一下再播放,确保音频准备就绪 + setTimeout(() => { + if (this.currentAudio) { + this.currentAudio.play(); + console.log('🎵 开始播放首字符匹配的音频段落'); + } else { + console.error('❌ 音频实例创建失败'); + } + }, 100); + + return true; + } + } + + console.log('💡 所有匹配策略都失败,尝试使用备用方案:实时生成音频'); // 备用方案:使用 textToVoice API 实时生成音频 return this.playTextWithTTS(textContent); @@ -1423,19 +1598,19 @@ export default { // 優先使用微信原生API以支持playbackRate let audio; - if (typeof wx !== 'undefined' && wx.createInnerAudioContext) { - console.log('使用微信原生音頻API'); - audio = wx.createInnerAudioContext(); - } else { - // 在H5环境下,尝试使用原生HTML5 Audio API来支持倍速 - if (typeof window !== 'undefined' && window.Audio) { - console.log('使用原生HTML5 Audio API以支持倍速'); + // if (typeof wx !== 'undefined' && wx.createInnerAudioContext) { + // console.log('使用微信原生音頻API'); + // audio = wx.createInnerAudioContext(); + // } else { + // // 在H5环境下,尝试使用原生HTML5 Audio API来支持倍速 + // if (typeof window !== 'undefined' && window.Audio) { + // console.log('使用原生HTML5 Audio API以支持倍速'); audio = this.createHTML5Audio(); - } else { - console.log('使用uni-app音頻API'); - audio = uni.createInnerAudioContext(); - } - } + // } else { + // console.log('使用uni-app音頻API'); + // audio = uni.createInnerAudioContext(); + // } + // } const audioUrl = this.currentPageAudios[this.currentAudioIndex].url; audio.src = audioUrl; @@ -1495,12 +1670,22 @@ export default { }); audio.onError((error) => { - console.error('音频播放错误:', error); - this.isPlaying = false; - uni.showToast({ - title: '音频播放失败', - icon: 'none' - }); + // 更精确的错误判断:只在用户主动播放时出现的错误才提示 + if (audio.src && audio.src.trim() !== '' && this.isPlaying) { + console.error('音频播放错误:', error); + this.isPlaying = false; + uni.showToast({ + title: '音频播放失败', + icon: 'none' + }); + } else { + // 其他情况的错误(初始化、预加载等),只记录日志不提示用户 + console.log('🔇 音频错误(已忽略):', { + hasSrc: !!audio.src, + isPlaying: this.isPlaying, + errorType: error.type || 'unknown' + }); + } }); this.currentAudio = audio; @@ -1961,31 +2146,61 @@ export default { 音频src: audio ? audio.src : '无' }); - // 简化检测:直接尝试设置playbackRate - if (audio && typeof audio.playbackRate !== 'undefined') { - console.log('✅ 音频实例支持playbackRate属性'); + // 检测音频实例类型和倍速支持 + let isHTML5Audio = false; + let supportsPlaybackRate = false; + + if (audio) { + // 检查是否为HTML5 Audio包装实例 + if (audio._nativeAudio && audio._nativeAudio instanceof Audio) { + isHTML5Audio = true; + supportsPlaybackRate = true; + console.log('✅ 检测到HTML5 Audio包装实例,完全支持倍速播放'); + } + // 检查是否为原生HTML5 Audio + else if (audio instanceof Audio) { + isHTML5Audio = true; + supportsPlaybackRate = true; + console.log('✅ 检测到原生HTML5 Audio实例,完全支持倍速播放'); + } + // 检查uni-app音频实例的playbackRate属性 + else if (typeof audio.playbackRate !== 'undefined') { + supportsPlaybackRate = true; + console.log('✅ 音频实例支持playbackRate属性'); + } else { + console.log('⚠️ 音频实例不支持playbackRate属性'); + } - // 尝试设置当前播放速度 - try { - const currentSpeed = this.playSpeed || 1.0; - audio.playbackRate = currentSpeed; - console.log(`🔧 设置播放速度为 ${currentSpeed}x`); - - // 简单验证 - setTimeout(() => { - const actualRate = audio.playbackRate; - console.log('🔍 播放速度验证:', { - 期望值: currentSpeed, - 实际值: actualRate, - 设置成功: Math.abs(actualRate - currentSpeed) < 0.1 - }); - }, 50); - - } catch (error) { - console.log('⚠️ 设置播放速度时出现错误,但继续保持倍速功能启用:', error.message); + // console.log('🔍 音频实例分析:', { + // 是否HTML5Audio: isHTML5Audio, + // 支持倍速: supportsPlaybackRate, + // 实例类型: audio.constructor?.name || 'unknown', + // playbackRate属性: typeof audio.playbackRate + // }); + + // 如果支持倍速,尝试设置当前播放速度 + if (supportsPlaybackRate) { + try { + const currentSpeed = this.playSpeed || 1.0; + audio.playbackRate = currentSpeed; + // console.log(`🔧 设置播放速度为 ${currentSpeed}x`); + + // 验证设置结果 + // setTimeout(() => { + // const actualRate = audio.playbackRate; + // console.log('🔍 播放速度验证:', { + // 期望值: currentSpeed, + // 实际值: actualRate, + // 设置成功: Math.abs(actualRate - currentSpeed) < 0.1 + // }); + // }, 50); + + } catch (error) { + console.log('⚠️ 设置播放速度时出现错误:', error.message); + } } } else { - console.log('⚠️ 音频实例不支持playbackRate属性,但保持倍速功能启用'); + console.log('⚠️ 音频实例不存在'); } // 保持倍速功能启用状态 diff --git a/subPages/home/book.vue b/subPages/home/book.vue index 2a2c840..63ab3b1 100644 --- a/subPages/home/book.vue +++ b/subPages/home/book.vue @@ -364,36 +364,36 @@ export default { // 处理文本点击事件 handleTextClick(textContent, item, pageIndex) { - console.log('🎯 ===== 文本点击事件开始 ====='); - console.log('📝 点击文本:', textContent); - console.log('📄 textContent类型:', typeof textContent); - console.log('❓ textContent是否为undefined:', textContent === undefined); - console.log('📦 完整item对象:', item); - console.log('📝 item.content:', item ? item.content : 'item为空'); - console.log('📖 当前页面索引:', this.currentPage); - console.log('👆 点击的页面索引:', pageIndex); - console.log('📊 当前页面类型:', this.currentPageType); - console.log('📄 是否为文本页面:', this.isTextPage); - console.log('📋 当前页面数据:', this.bookPages[this.currentPage - 1]); - console.log('📏 页面数据长度:', this.bookPages[this.currentPage - 1] ? this.bookPages[this.currentPage - 1].length : '页面不存在'); + // console.log('🎯 ===== 文本点击事件开始 ====='); + // console.log('📝 点击文本:', textContent); + // console.log('📄 textContent类型:', typeof textContent); + // console.log('❓ textContent是否为undefined:', textContent === undefined); + // console.log('📦 完整item对象:', item); + // console.log('📝 item.content:', item ? item.content : 'item为空'); + // console.log('📖 当前页面索引:', this.currentPage); + // console.log('👆 点击的页面索引:', pageIndex); + // console.log('📊 当前页面类型:', this.currentPageType); + // console.log('📄 是否为文本页面:', this.isTextPage); + // console.log('📋 当前页面数据:', this.bookPages[this.currentPage - 1]); + // console.log('📏 页面数据长度:', this.bookPages[this.currentPage - 1] ? this.bookPages[this.currentPage - 1].length : '页面不存在'); // 检查音频播放状态 - console.log('🎵 ===== 音频状态检查 ====='); - console.log(' isWordAudioPlaying:', this.isWordAudioPlaying); - console.log(' currentWordAudio存在:', !!this.currentWordAudio); - console.log(' currentWordMeaning存在:', !!this.currentWordMeaning); + // console.log('🎵 ===== 音频状态检查 ====='); + // console.log(' isWordAudioPlaying:', this.isWordAudioPlaying); + // console.log(' currentWordAudio存在:', !!this.currentWordAudio); + // console.log(' currentWordMeaning存在:', !!this.currentWordMeaning); if (this.isWordAudioPlaying) { - console.log('⚠️ 检测到单词音频正在播放状态,这可能会阻止句子音频播放'); - console.log('🔄 尝试重置音频播放状态...'); + // console.log('⚠️ 检测到单词音频正在播放状态,这可能会阻止句子音频播放'); + // console.log('🔄 尝试重置音频播放状态...'); this.isWordAudioPlaying = false; - console.log('✅ 音频播放状态已重置'); + // console.log('✅ 音频播放状态已重置'); } // 检查是否点击的是当前页面 if (pageIndex !== undefined && pageIndex !== this.currentPage - 1) { console.warn('⚠️ 点击的不是当前页面,忽略点击事件'); - console.log(` 期望页面: ${this.currentPage - 1}, 点击页面: ${pageIndex}`); + // console.log(` 期望页面: ${this.currentPage - 1}, 点击页面: ${pageIndex}`); return; } @@ -410,16 +410,16 @@ export default { // 如果textContent为undefined,尝试从item中获取 if (!textContent && item && item.content) { textContent = item.content; - console.log('🔄 从item中获取到content:', textContent); + // console.log('🔄 从item中获取到content:', textContent); } // 最终验证textContent if (!textContent || typeof textContent !== 'string' || textContent.trim() === '') { console.error('❌ handleTextClick: 无效的文本内容', textContent); - console.log(' textContent:', textContent); - console.log(' 类型:', typeof textContent); - console.log(' 是否为空字符串:', textContent === ''); - console.log(' trim后是否为空:', textContent && textContent.trim() === ''); + // console.log(' textContent:', textContent); + // console.log(' 类型:', typeof textContent); + // console.log(' 是否为空字符串:', textContent === ''); + // console.log(' trim后是否为空:', textContent && textContent.trim() === ''); uni.showToast({ title: '文本内容无效', icon: 'none' @@ -427,13 +427,13 @@ export default { return; } - console.log('✅ 文本内容验证通过:', textContent); - console.log(' 文本长度:', textContent.length); - console.log(' 文本预览:', textContent.substring(0, 50) + (textContent.length > 50 ? '...' : '')); + // console.log('✅ 文本内容验证通过:', textContent); + // console.log(' 文本长度:', textContent.length); + // console.log(' 文本预览:', textContent.substring(0, 50) + (textContent.length > 50 ? '...' : '')); // 检查是否有音频控制组件的引用 - console.log('🔍 检查音频控制组件引用...'); - console.log(' customTabbar存在:', !!this.$refs.customTabbar); + // console.log('🔍 检查音频控制组件引用...'); + // console.log(' customTabbar存在:', !!this.$refs.customTabbar); if (!this.$refs.customTabbar) { console.error('❌ customTabbar引用不存在'); @@ -444,7 +444,7 @@ export default { return; } - console.log(' audioControls存在:', !!this.$refs.customTabbar.$refs.audioControls); + // console.log(' audioControls存在:', !!this.$refs.customTabbar.$refs.audioControls); if (!this.$refs.customTabbar.$refs.audioControls) { console.error('❌ audioControls引用不存在'); @@ -460,6 +460,15 @@ export default { console.log('🔍 检查页面类型支持...'); console.log(' isTextPage:', this.isTextPage); console.log(' currentPageType:', this.currentPageType); + console.log(' 当前页面索引:', this.currentPage); + console.log(' 页面类型数组:', this.pageTypes); + + // 特别针对划线重点页面的调试 + if (this.currentPageType === '1') { + console.log('📝 当前是划线重点页面,点击的文本:', textContent); + console.log('📝 文本长度:', textContent.length); + console.log('📝 文本前50字符:', textContent.substring(0, 50)); + } if (!this.isTextPage && this.currentPageType !== '1') { console.warn('⚠️ 当前页面不是文本页面或卡片页面'); @@ -475,31 +484,94 @@ export default { // 获取音频控制组件实例 const audioControls = this.$refs.customTabbar.$refs.audioControls; - console.log('🎵 音频控制组件状态:'); - console.log(' currentPageAudios存在:', !!audioControls.currentPageAudios); - console.log(' currentPageAudios长度:', audioControls.currentPageAudios ? audioControls.currentPageAudios.length : 0); - console.log(' isAudioLoading:', audioControls.isAudioLoading); - console.log(' currentAudioIndex:', audioControls.currentAudioIndex); - console.log(' isPlaying:', audioControls.isPlaying); + + // 检查音频是否正在加载中 + if (audioControls.isAudioLoading) { + console.log('⏳ 音频正在加载中,等待加载完成后再播放'); + uni.showToast({ + title: '音频正在加载中,请稍后再试', + icon: 'loading', + duration: 1500 + }); + + // 等待音频加载完成后自动播放 + const checkAndPlay = () => { + if (!audioControls.isAudioLoading && audioControls.currentPageAudios.length > 0) { + console.log('✅ 音频加载完成,开始播放指定音频'); + const success = audioControls.playSpecificAudio(textContent); + if (!success) { + console.error('❌ 音频加载完成后播放失败'); + } + } else if (!audioControls.isAudioLoading) { + console.error('❌ 音频加载完成但没有音频数据'); + uni.showToast({ + title: '当前页面没有音频内容', + icon: 'none' + }); + } else { + // 继续等待 + setTimeout(checkAndPlay, 500); + } + }; + + // 延迟检查,给音频加载一些时间 + setTimeout(checkAndPlay, 1000); + return; + } + + // 检查是否有音频数据 + if (!audioControls.currentPageAudios || audioControls.currentPageAudios.length === 0) { + console.warn('⚠️ 当前页面没有音频数据,尝试重新加载'); + uni.showToast({ + title: '正在重新加载音频...', + icon: 'loading' + }); + + // 尝试重新加载音频 + audioControls.getCurrentPageAudio(); + + // 等待重新加载完成后播放 + const retryPlay = () => { + if (!audioControls.isAudioLoading && audioControls.currentPageAudios.length > 0) { + console.log('✅ 音频重新加载完成,开始播放'); + const success = audioControls.playSpecificAudio(textContent); + if (!success) { + console.error('❌ 音频重新加载后播放失败'); + } + } else if (!audioControls.isAudioLoading) { + console.error('❌ 音频重新加载失败'); + uni.showToast({ + title: '音频加载失败,请检查网络连接', + icon: 'none' + }); + } else { + // 继续等待 + setTimeout(retryPlay, 500); + } + }; + + setTimeout(retryPlay, 1500); + return; + } // 调用AudioControls组件的播放指定音频方法 - console.log('🚀 调用 playSpecificAudio...'); + console.log('🚀 调用 playSpecificAudio,音频数据长度:', audioControls.currentPageAudios.length); const success = audioControls.playSpecificAudio(textContent); - console.log('🎵 playSpecificAudio 返回结果:', success); + // console.log('🎵 playSpecificAudio 返回结果:', success); if (success) { - console.log('✅ 成功播放指定音频段落'); + // console.log('✅ 成功播放指定音频段落'); } else { console.error('❌ 播放指定音频段落失败'); - console.log('💡 失败可能原因:'); - console.log(' 1. 文本内容与音频数据不匹配'); - console.log(' 2. 音频数据尚未加载完成'); - console.log(' 3. 音频文件路径错误或文件损坏'); - console.log(' 4. 网络连接问题'); + // console.log('💡 失败可能原因:'); + // console.log(' 1. 文本内容与音频数据不匹配'); + // console.log(' 2. 音频数据尚未加载完成'); + // console.log(' 3. 音频文件路径错误或文件损坏'); + // console.log(' 4. 网络连接问题'); } - console.log('🎯 ===== 文本点击事件结束 ====='); + // console.log('🎯 ===== 文本点击事件结束 ====='); }, onHighlightChange(highlightData) { @@ -513,13 +585,13 @@ export default { // 可以在这里处理分段音频的额外信息 if (highlightData.isSegmented) { - console.log('分段音频高亮:', { - highlightIndex: highlightData.highlightIndex, - segmentIndex: highlightData.segmentIndex, - startIndex: highlightData.startIndex, - endIndex: highlightData.endIndex, - currentText: highlightData.currentText - }); + // console.log('分段音频高亮:', { + // highlightIndex: highlightData.highlightIndex, + // segmentIndex: highlightData.segmentIndex, + // startIndex: highlightData.startIndex, + // endIndex: highlightData.endIndex, + // currentText: highlightData.currentText + // }); } } else { // 清除高亮 @@ -532,10 +604,10 @@ export default { async getVoiceList() { const voiceRes = await this.$api.music.list() if(voiceRes.code === 200){ - console.log('音色列表API返回:', voiceRes.result); - console.log('第一个音色数据:', voiceRes.result[0]); + // console.log('音色列表API返回:', voiceRes.result); + // console.log('第一个音色数据:', voiceRes.result[0]); this.voiceId = Number(voiceRes.result[0].voiceType) - console.log('获取默认音色ID:', this.voiceId, '类型:', typeof this.voiceId); + // console.log('获取默认音色ID:', this.voiceId, '类型:', typeof this.voiceId); } }, toggleNavbar() { diff --git a/subPages/home/music.vue b/subPages/home/music.vue index a3388ef..edbb78f 100644 --- a/subPages/home/music.vue +++ b/subPages/home/music.vue @@ -65,7 +65,7 @@ export default { uni.navigateBack() }, selectVoice() { - console.log('选择音色:', this.selectedVoiceId) + // console.log('选择音色:', this.selectedVoiceId) uni.$emit('selectVoice', this.selectedVoiceId) uni.navigateBack() }, @@ -82,7 +82,7 @@ export default { }, onLoad(options) { this.selectedVoiceId = Number(options.voiceId) - console.log( 'options.voiceId', options.voiceId ); + // console.log( 'options.voiceId', options.voiceId ); this.getVoice() } diff --git a/subPages/home/plan.vue b/subPages/home/plan.vue index cf41039..cd3e9fd 100644 --- a/subPages/home/plan.vue +++ b/subPages/home/plan.vue @@ -68,7 +68,7 @@ export default { }, methods: { handleSignUp() { - console.log('点击报名') + // console.log('点击报名') // 这里添加报名逻辑 uni.navigateTo({ url: '/subPages/home/submit?id=' + this.id @@ -86,7 +86,7 @@ export default { this.type = askRes.result.type } } catch (error) { - console.log('error', error) + console.error('获取链接详情失败:', error) } }, diff --git a/subPages/home/search.vue b/subPages/home/search.vue index edf1db5..3bd3916 100644 --- a/subPages/home/search.vue +++ b/subPages/home/search.vue @@ -113,7 +113,7 @@ export default { return params }, handleSearch() { - console.log('搜索:', this.searchKeyword) + // console.log('搜索:', this.searchKeyword) this.list = [] this.initPage() this.getList(true) @@ -122,7 +122,7 @@ export default { switchTab(index) { this.currentTab = index - console.log('切换分类:', this.categoryTabs[index]) + // console.log('切换分类:', this.categoryTabs[index]) this.list = [] this.initPage() this.getList(true) diff --git a/subPages/home/submit.vue b/subPages/home/submit.vue index b605235..315c4e1 100644 --- a/subPages/home/submit.vue +++ b/subPages/home/submit.vue @@ -110,7 +110,7 @@ export default { }, methods: { async handleSubmit() { - console.log('提交表单', this.formData) + // console.log('提交表单', this.formData) // 这里添加表单提交逻辑 if (!this.formData.name) { uni.showToast({