yangg 5 өдөр өмнө
parent
commit
bdbbb610bc

+ 88 - 4
pages/identity-verify/identity-verify.vue

@@ -1528,6 +1528,7 @@ export default {
         // 录制时长足够,正常停止录制并上传
         this.completeRecordingStop(true);
         this.needPlayLowScoreVideo = false;
+        this.recordingTimeDisplay='00:00'
       }
     },
 
@@ -2244,7 +2245,7 @@ export default {
             resolve();
           } else {
             // 如果还在上传,继续检查
-            setTimeout(checkUploadStatus, 500);
+            setTimeout(checkUploadStatus, 100);
           }
         };
         
@@ -2274,6 +2275,7 @@ export default {
           this.retryCount = 0; // 重置重试次数
           this.isFollowUpQuestion = false; // 重置追问标记
           this.currentFollowUpQuestion = null; // 清除当前追问问题信息
+          this.videoUrl=''
           this.proceedToNextQuestion();
         } else {
           // 如果是常规问题,记录父问题ID并检查追问问题
@@ -2790,6 +2792,24 @@ export default {
         this.videoPlaying = false;
       }
       
+      // 检查是否已经是最后一个视频
+      if (this.currentVideoIndex + 1 >= this.videoList.length) {
+        // 所有视频都播放完毕,显示完成页面或返回
+        console.log('所有视频已播放完毕');
+        
+        // 清理资源
+        this.stopUserCamera();
+        this.clearCountdown();
+        
+        // 获取当前职位ID
+        const currentJobDetail = JSON.parse(uni.getStorageSync('selectedJob'));
+        console.log('当前职位ID:', currentJobDetail);
+        const jobId = currentJobDetail ? currentJobDetail.id : null;
+        
+        this.handleVideoCompletion(jobId);
+        return;
+      }
+      
       // 增加当前视频索引,切换到下一个视频
       this.currentVideoIndex++;
       
@@ -2802,14 +2822,14 @@ export default {
         this.videoUrl = this.videoList[this.currentVideoIndex];
         
         // 使用setTimeout确保DOM更新完成
-        setTimeout(() => {
+        this.$nextTick(() => {
           this.videoPlaying = true;
           const videoContext = uni.createVideoContext('myVideo', this);
           if (videoContext) {
             videoContext.play();
           }
           this.isVideoSwitching = false; // 重置切换状态锁
-        }, 100);
+        });
       } else {
         // 所有视频都播放完毕,显示完成页面或返回
         console.log('所有视频已播放完毕');
@@ -4179,7 +4199,7 @@ export default {
                 const tempFilePath = res.tempImagePath;
                 if (!tempFilePath) {
                   console.warn('人脸检测:未获取到有效的图片路径');
-                  return;
+                 
                 }
                 uni.getFileSystemManager().readFile({
                   filePath: tempFilePath,
@@ -4523,6 +4543,70 @@ export default {
         this.thinkingTimer = null;
       }
     },
+
+    // 处理视频完成
+    handleVideoCompletion(jobId) {
+      this.isVideoSwitching = false; // 重置切换状态锁
+      
+      // 延迟执行跳转,确保资源清理完成
+      setTimeout(() => {
+        // 如果职位ID为9,跳转到interview-question页面
+        if (jobId === 9) {
+          uni.navigateTo({
+            url: '/pages/interview-question/interview-question',
+            success: () => {
+              console.log('成功跳转到interview-question页面');
+            },
+            fail: (err) => {
+              console.error('跳转到interview-question页面失败:', err);
+              // 如果跳转失败,尝试使用redirectTo
+              uni.redirectTo({
+                url: '/pages/interview-question/interview-question',
+                fail: (redirectErr) => {
+                  console.error('重定向到interview-question页面也失败:', redirectErr);
+                  // 如果所有跳转方式都失败,尝试返回上一页
+                  uni.navigateBack({
+                    delta: 1
+                  });
+                }
+              });
+            }
+          });
+        } else {
+          // 其他职位ID跳转到camera页面
+          uni.navigateTo({
+            url: '/pages/camera/camera',
+            success: () => {
+              console.log('成功跳转到camera页面');
+            },
+            fail: (err) => {
+              console.error('跳转到camera页面失败:', err);
+              
+              // 如果跳转失败,尝试使用redirectTo
+              uni.redirectTo({
+                url: '/pages/camera/camera',
+                fail: (redirectErr) => {
+                  console.error('重定向到camera页面也失败:', redirectErr);
+                  
+                  // 最后尝试使用switchTab(如果camera是tabBar页面)
+                  uni.switchTab({
+                    url: '/pages/camera/camera',
+                    fail: (switchErr) => {
+                      console.error('所有跳转方式都失败:', switchErr);
+                      
+                      // 如果所有跳转方式都失败,尝试返回上一页
+                      uni.navigateBack({
+                        delta: 1
+                      });
+                    }
+                  });
+                }
+              });
+            }
+          });
+        }
+      }, 200);
+    },
   },
   computed: {
     // 计算进度比例

+ 473 - 222
pages/interview-question/interview-question.vue

@@ -42,6 +42,7 @@
         <!-- 添加字幕覆盖层 :data-time="formatTime(recordingTimerCount) || '03:30'"-->
         <div class="subtitle-overlay" v-if="currentSubtitle" >
           {{ currentSubtitle }}
+          <!-- <button v-if="showNextButton" class="next-button" @click="handleNextButtonClick">我已阅读完成,继续</button> -->
         </div>
         
         <!-- 添加答题按钮 -->
@@ -307,6 +308,7 @@ export default {
       pendingAutoNavigation: false, // 标记是否有待处理的自动跳转
       hasTriedFallbackMethod: false, // 标记是否尝试过备选方法播放音频
       hasShownTextFallbackToast: false, // 标记是否已显示文本回退提示
+      showNextButton: false, // 添加一个变量控制按钮显示
     }
   },
   onLoad(options) {
@@ -2267,52 +2269,29 @@ export default {
     
     // 修改 navigateToNextPage 方法
     navigateToNextPage() {
-      console.log('准备导航到下一个页面');
+      console.log('执行页面跳转');
       
-      // 如果正在播放AI语音,不立即跳转
-      if (this.isPlayingAiVoice) {
-        console.log('AI语音正在播放,等待播放完成后再跳转');
-        return;
-      }
-      
-      console.log('导航到下一个页面');
-
-      // 检查 selectedJob 的 id
-      try {
-        const currentJobDetail = uni.getStorageSync('selectedJob');
-        const jobId = currentJobDetail ? JSON.parse(currentJobDetail).id : null;
-        
-        // 如果 id 为 9 或 10,直接跳转到 success 页面
-        if (jobId === 9 || jobId === 10) {
-          uni.navigateTo({
-            url: '/pages/success/success',
-            success: () => {
-              console.log('成功跳转到成功页面');
-            },
-            fail: (err) => {
-              console.error('跳转失败:', err);
-              // 如果跳转失败,尝试其他页面
-              this.handleNavigationFailure();
-            }
-          });
-          return; // 提前返回,不执行后续代码
-        }
-      } catch (e) {
-        console.error('解析 selectedJob 失败:', e);
-        // 解析失败时继续默认跳转逻辑
-      }
+      // 确保清理音频相关状态
+      this.isPlayingAiVoice = false;
+      this.currentSubtitle = '';
       
-      // 原有的跳转逻辑
-      uni.navigateTo({
-        url: '/pages/success/success',//'/pages/posture-guide/posture-guide?uploading=' + (this.uploadQueue.length > 0 ? 'true' : 'false'),
-        success: () => {
-          console.log('成功跳转到结果页面');
-        },
-        fail: (err) => {
-          console.error('跳转失败:', err);
-          this.handleNavigationFailure();
-        }
-      });
+      // 添加延迟确保状态已更新
+      setTimeout(() => {
+        uni.navigateTo({
+          url: '/pages/success/success',
+          success: () => {
+            console.log('页面跳转成功');
+          },
+          fail: (err) => {
+            console.error('页面跳转失败:', err);
+            uni.showToast({
+              title: '页面跳转失败',
+              icon: 'none',
+              duration: 2000
+            });
+          }
+        });
+      }, 100);
     },
 
     // 添加处理导航失败的方法
@@ -3031,7 +3010,7 @@ export default {
     },
 
     // 添加新方法:播放AI语音
-    playAiVoice() {
+    async playAiVoice() {
       console.log('开始播放AI语音:', this.aiVoiceUrl);
       
       // 重置错误提示标记
@@ -3054,22 +3033,30 @@ export default {
         return;
       }
       
+      try {
       // 获取系统信息
       const systemInfo = uni.getSystemInfoSync();
       const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith('mp-');
       const isIOS = systemInfo.platform === 'ios';
       
-      // 根据平台选择播放方式
+        // 根据平台选择播放方式并等待播放完成
       if (isMiniProgram) {
         if (isIOS) {
-          this.playIOSMiniProgramAudio();
+            await this.playIOSMiniProgramAudio();
         } else {
-          this.playMiniProgramAudio();
+            await this.playMiniProgramAudio();
         }
       } else if (isIOS) {
-        this.playAiVoiceForIOS();
+          await this.playAiVoiceForIOS();
       } else {
-        this.playAiVoiceForAndroid();
+          await this.playAiVoiceForAndroid();
+        }
+        
+        // 音频播放完成后再跳转
+        this.navigateToNextPage();
+      } catch (error) {
+        console.error('音频播放失败:', error);
+        this.useTextFallbackAndNavigate();
       }
     },
 
@@ -3125,143 +3112,212 @@ export default {
 
     // 修改 playMiniProgramAudio 方法
     playMiniProgramAudio() {
-      console.log('使用小程序原生音频API播放:', this.aiVoiceUrl);
-      
-      try {
-        const audioContext = wx.createInnerAudioContext();
-        
-        audioContext.autoplay = true;
-        audioContext.src = this.aiVoiceUrl;
-        
-        audioContext.onPlay(() => {
-          console.log('AI语音开始播放');
-          this.currentSubtitle = this.aiText;
-        });
-        
-        audioContext.onEnded(() => {
-          console.log('AI语音播放结束');
-          this.isPlayingAiVoice = false;
-          this.currentSubtitle = '';
-          audioContext.destroy();
+      return new Promise(async (resolve, reject) => {
+        try {
+          // 显示加载提示
+          uni.showLoading({
+            title: '音频加载中...',
+            mask: true
+          });
+
+          // 先下载音频文件
+          const localAudioPath = await this.preloadAudio(this.aiVoiceUrl);
           
-          // 播放结束后直接导航
-          this.navigateToNextPage();
-        });
-        
-        audioContext.onError((err) => {
-          console.error('AI语音播放错误:', err);
-          audioContext.destroy();
-          this.useTextFallbackAndNavigate();
-        });
-        
-        // 设置超时处理
-        setTimeout(() => {
-          if (this.isPlayingAiVoice) {
-            console.warn('音频播放超时,使用文本回退');
-            this.useTextFallbackAndNavigate();
-          }
-        }, 5000);
-        
-      } catch (e) {
-        console.error('小程序播放AI语音失败:', e);
-        this.useTextFallbackAndNavigate();
-      }
+          // 隐藏加载提示
+          uni.hideLoading();
+
+          const audioContext = wx.createInnerAudioContext();
+          audioContext.src = localAudioPath; // 使用本地文件路径
+          audioContext.autoplay = true;
+
+          // 设置音频缓冲大小
+          audioContext.bufferSize = 4096;
+
+          let hasStarted = false;
+          let hasError = false;
+
+          audioContext.onPlay(() => {
+            console.log('AI语音开始播放');
+            hasStarted = true;
+            this.currentSubtitle = this.aiText;
+          });
+
+          audioContext.onEnded(() => {
+            console.log('AI语音播放结束');
+            this.isPlayingAiVoice = false;
+            this.currentSubtitle = '';
+            audioContext.destroy();
+            
+            // 确保在播放完成后立即解析Promise并跳转
+            if (!hasError) {
+              console.log('准备跳转到下一页');
+              this.navigateToNextPage(); // 添加这行
+              resolve();
+            }
+          });
+
+          audioContext.onStop(() => {
+            console.log('AI语音播放停止');
+            this.isPlayingAiVoice = false;
+            this.currentSubtitle = '';
+            audioContext.destroy();
+            
+            // 如果是正常停止(非错误导致),也要触发跳转
+            if (!hasError) {
+              console.log('播放停止,准备跳转到下一页');
+              this.navigateToNextPage(); // 添加这行
+              resolve();
+            }
+          });
+
+          audioContext.onError((err) => {
+            hasError = true;
+            console.error('AI语音播放错误:', err);
+            audioContext.destroy();
+            
+            // 显示错误提示
+            uni.showToast({
+              title: '音频播放异常,将显示文字',
+              icon: 'none',
+              duration: 2000
+            });
+
+            // 尝试使用备选音频格式
+            if (this.aiVoiceUrl.endsWith('.mp3')) {
+              const wavUrl = this.aiVoiceUrl.replace('.mp3', '.wav');
+              console.log('尝试使用WAV格式:', wavUrl);
+              this.aiVoiceUrl = wavUrl;
+              this.playMiniProgramAudio()
+                .then(resolve)
+                .catch(reject);
+            } else {
+              reject(err);
+            }
+          });
+
+          // 设置超时检测
+          setTimeout(() => {
+            if (!hasStarted && !hasError) {
+              console.error('音频播放启动超时');
+              audioContext.destroy();
+              reject(new Error('音频播放启动超时'));
+            }
+          }, 5000);
+
+        } catch (error) {
+          uni.hideLoading();
+          console.error('音频播放初始化失败:', error);
+          reject(error);
+        }
+      });
     },
 
     // 新增方法:导航到下一页
     navigateToNextPage() {
-      // 这里添加导航逻辑
-      console.log('准备导航到下一页');
+      console.log('执行页面跳转');
       
-      // 根据实际需求设置导航目标
-      uni.navigateTo({
-        url: '/pages/success/success',//'/pages/posture-guide/posture-guide',
-        fail: (err) => {
-          console.error('导航失败:', err);
-          // 导航失败时的处理
-          uni.showToast({
-            title: '页面跳转失败',
-            icon: 'none',
-            duration: 2000
-          });
-        }
-      });
+      // 确保清理音频相关状态
+      this.isPlayingAiVoice = false;
+      this.currentSubtitle = '';
+      
+      // 添加延迟确保状态已更新
+      setTimeout(() => {
+        uni.navigateTo({
+          url: '/pages/success/success',
+          success: () => {
+            console.log('页面跳转成功');
+          },
+          fail: (err) => {
+            console.error('页面跳转失败:', err);
+            uni.showToast({
+              title: '页面跳转失败',
+              icon: 'none',
+              duration: 2000
+            });
+          }
+        });
+      }, 100);
     },
 
     // 新增方法:专门处理iOS小程序音频播放
     playIOSMiniProgramAudio() {
-      console.log('iOS小程序环境:使用增强的音频处理方法');
-      
-      // 重置错误标记
-      this.hasShownTextFallbackToast = false;
-      
-      try {
-        // 创建音频上下文,使用wx API确保兼容性
+      return new Promise((resolve, reject) => {
+        try {
         const audioContext = wx.createInnerAudioContext();
-        
-        // iOS小程序优化配置
-        audioContext.autoplay = false;
-        audioContext.obeyMuteSwitch = true; // iOS遵循静音开关
-        audioContext.volume = 1.0;
-        
-        // 设置播放成功事件
+          audioContext.src = this.aiVoiceUrl;
+          audioContext.autoplay = true;
+          
         audioContext.onPlay(() => {
           console.log('iOS小程序音频开始播放');
-          this.currentSubtitle = this.aiText;
+          });
           
-          // uni.showToast({
-          //   title: '正在播放AI回复',
-          //   icon: 'none',
-          //   duration: 1500
-          // });
-        });
-        
-        // 设置播放结束事件
         audioContext.onEnded(() => {
-          console.log('iOS小程序音频播放结束');
-          this.handleIOSAudioComplete(audioContext);
-        });
-        
-        // 设置播放停止事件
-        audioContext.onStop(() => {
-          console.log('iOS小程序音频播放停止');
-          this.handleIOSAudioComplete(audioContext);
-        });
-        
-        // 重点:增强的iOS错误处理
+            console.log('iOS小程序音频播放完成');
+            audioContext.destroy();
+            resolve();
+          });
+          
         audioContext.onError((err) => {
           console.error('iOS小程序音频播放错误:', err);
-          this.handleIOSMiniProgramError(audioContext, err);
-        });
-        
-        // 先尝试预下载音频文件(iOS小程序推荐做法)
-        this.preloadIOSMiniProgramAudio(this.aiVoiceUrl)
-          .then((localPath) => {
-            console.log('iOS小程序音频预下载成功:', localPath);
-            audioContext.src = localPath;
-            
-          /*   // 设置播放超时
-            const playTimeout = setTimeout(() => {
-              if (this.isPlayingAiVoice) {
-                console.log('iOS小程序音频播放超时,使用文本回退');
-                clearTimeout(playTimeout);
-                this.handleIOSPlaybackTimeout(audioContext);
-              }
-            }, 5000);
-            */
-            // 尝试播放
-            audioContext.play(); 
-          })
-          .catch((error) => {
-            console.error('iOS小程序音频预下载失败:', error);
-            // 预下载失败,尝试直接播放
-            this.fallbackIOSMiniProgramPlay(audioContext);
+            audioContext.destroy();
+            reject(err);
           });
-        
-      } catch (e) {
-        console.error('iOS小程序音频初始化失败:', e);
-        this.useIOSTextFallback();
-      }
+        } catch (error) {
+          reject(error);
+        }
+      });
+    },
+    
+    playAiVoiceForIOS() {
+      return new Promise((resolve, reject) => {
+        try {
+          const audioContext = new Audio();
+          audioContext.src = this.aiVoiceUrl;
+          audioContext.autoplay = true;
+          
+          audioContext.addEventListener('play', () => {
+            console.log('iOS音频开始播放');
+          });
+          
+          audioContext.addEventListener('ended', () => {
+            console.log('iOS音频播放完成');
+            resolve();
+          });
+          
+          audioContext.addEventListener('error', (err) => {
+            console.error('iOS音频播放错误:', err);
+            reject(err);
+          });
+        } catch (error) {
+          reject(error);
+        }
+      });
+    },
+    
+    playAiVoiceForAndroid() {
+      return new Promise((resolve, reject) => {
+        try {
+          const audioContext = new Audio();
+          audioContext.src = this.aiVoiceUrl;
+          audioContext.autoplay = true;
+          
+          audioContext.addEventListener('play', () => {
+            console.log('Android音频开始播放');
+          });
+          
+          audioContext.addEventListener('ended', () => {
+            console.log('Android音频播放完成');
+            resolve();
+          });
+          
+          audioContext.addEventListener('error', (err) => {
+            console.error('Android音频播放错误:', err);
+            reject(err);
+          });
+        } catch (error) {
+          reject(error);
+        }
+      });
     },
 
     // 新增方法:iOS小程序音频预下载
@@ -3424,25 +3480,17 @@ export default {
       // 显示友好提示(如果还没有显示过)
       if (!this.hasShownTextFallbackToast) {
         this.hasShownTextFallbackToast = true;
-       /* uni.showToast({
-          title: '为您显示文字回复',
-          icon: 'none',
-          duration: 2000
-        }); */
       }
       
-      // 显示完整文本
+      // 显示完整文本和继续按钮
       this.currentSubtitle = this.aiText || '抱歉,AI回复内容加载失败';
-      
-      // 根据文本长度计算合适的阅读时间
-      const textLength = this.aiText ? this.aiText.length : 20;
-      const readingTime = Math.max(5000, Math.min(textLength * 100, 15000)); // 最少5秒,最多15秒
-      
-      console.log(`文本长度: ${textLength}, 预计阅读时间: ${readingTime}ms`);
-      
-      setTimeout(() => {
-        this.handleIOSAudioComplete(null);
-      }, readingTime);
+      this.showNextButton = true; // 添加一个变量控制按钮显示
+    },
+
+    // 添加处理继续按钮点击的方法
+    handleNextButtonClick() {
+      this.showNextButton = false;
+      this.handleIOSAudioComplete(null);
     },
 
     // 添加新方法:iOS音频播放完成处理
@@ -3568,7 +3616,7 @@ export default {
     },
 
     // 修改 playMiniProgramAudio 方法,添加iOS特殊处理
-    playMiniProgramAudio() {
+/*     playMiniProgramAudio() {
       console.log('使用小程序原生音频API播放:', this.aiVoiceUrl);
       
       // 标记正在播放AI语音
@@ -3609,11 +3657,6 @@ export default {
           console.log('AI语音开始播放');
           
           // 显示正在播放提示
-          /* uni.showToast({
-            title: '正在播放AI回复',
-            icon: 'none',
-            duration: 2000
-          }); */
         });
         
         // 监听播放结束事件
@@ -3674,16 +3717,12 @@ export default {
         this.isPlayingAiVoice = false;
         
         // 显示错误提示
-       /* uni.showToast({
-          title: '音频播放失败,请查看文字回复',
-          icon: 'none',
-          duration: 2000
-        }); */
+   
         
         // 使用文本显示方式作为备选方案
         this.handleAudioPlaybackFailure();
       }
-    },
+    }, */
 
     // 添加新方法:iOS小程序音频播放
     playMiniProgramAudioForIOS() {
@@ -4059,7 +4098,7 @@ export default {
     },
 
     // 添加一个新方法:使用小程序原生音频API
-    playMiniProgramAudio() {
+  /*   playMiniProgramAudio() {
       console.log('使用小程序原生音频API播放:', this.aiVoiceUrl);
       
       // 标记正在播放AI语音
@@ -4073,11 +4112,6 @@ export default {
       if (!this.aiVoiceUrl || this.aiVoiceUrl.trim() === '') {
         console.error('无效的音频URL');
         // 显示错误提示
-        /* uni.showToast({
-          title: '音频加载失败',
-          icon: 'none',
-          duration: 2000
-        }); */
         
         // 标记播放结束
         this.isPlayingAiVoice = false;
@@ -4099,12 +4133,7 @@ export default {
         audioContext.onPlay(() => {
           console.log('AI语音开始播放');
           
-          // 显示正在播放提示
-         /* uni.showToast({
-            title: '正在播放AI回复',
-            icon: 'none',
-            duration: 2000
-          }); */
+          // 显示正在播放提
         });
         
         // 监听播放结束事件
@@ -4165,16 +4194,11 @@ export default {
         this.isPlayingAiVoice = false;
         
         // 显示错误提示
-        /* uni.showToast({
-          title: '音频播放失败,请查看文字回复',
-          icon: 'none',
-          duration: 2000
-        }); */
         
         // 使用文本显示方式作为备选方案
         this.handleAudioPlaybackFailure();
       }
-    },
+    }, */
 
     // 添加新方法:小程序环境的备选音频播放方法
     tryMiniProgramFallbackAudioPlay() {
@@ -4510,11 +4534,6 @@ export default {
       
       if (!this.hasShownTextFallbackToast) {
         this.hasShownTextFallbackToast = true;
-        /* uni.showToast({
-          title: '已切换为文字显示',
-          icon: 'none',
-          duration: 2000
-        }); */
       }
       
       // 显示AI回复文本
@@ -4530,7 +4549,204 @@ export default {
       setTimeout(() => {
         this.navigateToNextPage();
       }, readingTime);
-    }
+    },
+
+    // 添加音频预加载方法
+    preloadAudio(audioUrl) {
+      return new Promise((resolve, reject) => {
+        console.log('开始预加载音频:', audioUrl);
+        
+        // 使用wx.downloadFile下载音频文件
+        const downloadTask = wx.downloadFile({
+          url: audioUrl,
+          success: (res) => {
+            if (res.statusCode === 200) {
+              console.log('音频文件下载成功,临时路径:', res.tempFilePath);
+              resolve(res.tempFilePath);
+            } else {
+              console.error('音频文件下载失败,状态码:', res.statusCode);
+              reject(new Error(`下载失败,状态码: ${res.statusCode}`));
+            }
+          },
+          fail: (error) => {
+            console.error('音频文件下载失败:', error);
+            reject(error);
+          }
+        });
+
+        // 监听下载进度
+        downloadTask.onProgressUpdate((res) => {
+          console.log('音频下载进度:', res.progress);
+        });
+      });
+    },
+
+    // 修改音频播放方法
+    playMiniProgramAudio() {
+      return new Promise(async (resolve, reject) => {
+        try {
+          // 显示加载提示
+          uni.showLoading({
+            title: '音频加载中...',
+            mask: true
+          });
+
+          // 先下载音频文件
+          const localAudioPath = await this.preloadAudio(this.aiVoiceUrl);
+          
+          // 隐藏加载提示
+          uni.hideLoading();
+
+          const audioContext = wx.createInnerAudioContext();
+          audioContext.src = localAudioPath; // 使用本地文件路径
+          audioContext.autoplay = true;
+
+          // 设置音频缓冲大小
+          audioContext.bufferSize = 4096;
+
+          let hasStarted = false;
+          let hasError = false;
+
+          audioContext.onPlay(() => {
+            console.log('AI语音开始播放');
+            hasStarted = true;
+            this.currentSubtitle = this.aiText;
+          });
+
+          audioContext.onEnded(() => {
+            console.log('AI语音播放结束');
+            this.isPlayingAiVoice = false;
+            this.currentSubtitle = '';
+            audioContext.destroy();
+            
+            // 确保在播放完成后立即解析Promise并跳转
+            if (!hasError) {
+              console.log('准备跳转到下一页');
+              this.navigateToNextPage(); // 添加这行
+              resolve();
+            }
+          });
+
+          audioContext.onStop(() => {
+            console.log('AI语音播放停止');
+            this.isPlayingAiVoice = false;
+            this.currentSubtitle = '';
+            audioContext.destroy();
+            
+            // 如果是正常停止(非错误导致),也要触发跳转
+            if (!hasError) {
+              console.log('播放停止,准备跳转到下一页');
+              this.navigateToNextPage(); // 添加这行
+              resolve();
+            }
+          });
+
+          audioContext.onError((err) => {
+            hasError = true;
+            console.error('AI语音播放错误:', err);
+            audioContext.destroy();
+            
+            // 显示错误提示
+            uni.showToast({
+              title: '音频播放异常,将显示文字',
+              icon: 'none',
+              duration: 2000
+            });
+
+            // 尝试使用备选音频格式
+            if (this.aiVoiceUrl.endsWith('.mp3')) {
+              const wavUrl = this.aiVoiceUrl.replace('.mp3', '.wav');
+              console.log('尝试使用WAV格式:', wavUrl);
+              this.aiVoiceUrl = wavUrl;
+              this.playMiniProgramAudio()
+                .then(resolve)
+                .catch(reject);
+            } else {
+              reject(err);
+            }
+          });
+
+          // 设置超时检测
+          setTimeout(() => {
+            if (!hasStarted && !hasError) {
+              console.error('音频播放启动超时');
+              audioContext.destroy();
+              reject(new Error('音频播放启动超时'));
+            }
+          }, 5000);
+
+        } catch (error) {
+          uni.hideLoading();
+          console.error('音频播放初始化失败:', error);
+          reject(error);
+        }
+      });
+    },
+
+    // 添加备选的音频播放方法
+    async playFallbackAudio() {
+      return new Promise((resolve, reject) => {
+        try {
+          const audio = wx.createInnerAudioContext();
+          
+          // 尝试使用较低质量的音频设置
+          audio.volume = 1.0;
+          audio.playbackRate = 1.0;
+          
+          audio.src = this.aiVoiceUrl;
+          audio.autoplay = true;
+
+          audio.onPlay(() => {
+            console.log('备选音频开始播放');
+          });
+
+          audio.onEnded(() => {
+            console.log('备选音频播放完成');
+            audio.destroy();
+            resolve();
+          });
+
+          audio.onError((err) => {
+            console.error('备选音频播放失败:', err);
+            audio.destroy();
+            reject(err);
+          });
+
+        } catch (error) {
+          reject(error);
+        }
+      });
+    },
+
+    // 修改主音频播放方法
+    async playAiVoice() {
+      console.log('开始播放AI语音:', this.aiVoiceUrl);
+      
+      this.isPlayingAiVoice = true;
+      this.currentSubtitle = this.aiText;
+      
+      try {
+        // 首先尝试主要播放方法
+        await this.playMiniProgramAudio();
+        console.log('音频播放完成,准备跳转');
+        
+        // 确保在音频播放完成后立即跳转
+        this.navigateToNextPage();
+      } catch (error) {
+        console.error('主要播放方法失败,尝试备选方法:', error);
+        
+        try {
+          // 尝试备选播放方法
+          await this.playFallbackAudio();
+          console.log('备选音频播放完成,准备跳转');
+          this.navigateToNextPage();
+        } catch (fallbackError) {
+          console.error('备选播放方法也失败:', fallbackError);
+          // 如果所有播放方法都失败,回退到文本显示
+          this.useTextFallbackAndNavigate();
+        }
+      }
+    },
   }
 }
 </script>
@@ -4648,7 +4864,7 @@ video::-webkit-media-controls-fullscreen-button {
 /* 修改字幕覆盖层样式,使其与图片中的样式一致 */
 .subtitle-overlay {
   position: absolute;
-  bottom: 180px; /* 调整位置,使其更靠近底部 */
+  bottom: 100px; /* 调整位置,使其更靠近底部 */
   left: 5%; /* 从左侧留出5%的空间 */
   width: 80%; /* 宽度设为90%,两侧各留5%实现居中 */
   padding: 15px 20px; /* 增加左右内边距 */
@@ -4661,6 +4877,41 @@ video::-webkit-media-controls-fullscreen-button {
   z-index: 10;
   margin: 0 auto; /* 添加自动边距实现居中 */
   box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 添加轻微阴影 */
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  gap: 10px;
+}
+
+/* 继续按钮样式 */
+.next-button {
+  background-color: #0039b3;
+  color: white;
+  border: none;
+  padding: 8px 20px;
+  border-radius: 20px;
+  cursor: pointer;
+  font-size: 14px;
+  margin-top: 10px;
+  transition: all 0.3s;
+  width: 140px;
+  height: 36px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
+}
+
+.next-button:hover {
+  background-color: #002b8f;
+  transform: translateY(-1px);
+  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
+}
+
+.next-button:active {
+  background-color: #001d66;
+  transform: translateY(1px);
+  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
 }
 
 /* 添加计时器样式,右侧显示橙色圆点和时间 */

+ 6 - 6
pages/interview/interview.vue

@@ -146,12 +146,12 @@ import { apiBaseUrl } from '@/common/config.js'; // Import the base URL from a c
 				cameraMode: 'normal', // 添加相机模式
 				cameraInitRetries: 0, // 添加重试计数器
 				gestureOverlays: [
-					'http://data.qicai321.com/minlong/18590378-6792-4a26-be18-ad9f2bcc4159.png',
-					'http://data.qicai321.com/minlong/e08cff2b-3b1d-478f-a62b-766b38445a16.png',
-					'http://data.qicai321.com/minlong/d30ccab7-9cfe-4386-bf0e-ac1f0045bd76.png',
-					'http://data.qicai321.com/minlong/8068a698-ac40-4a5d-a737-54dba47a668d.png',
-					'http://data.qicai321.com/minlong/f04a1f7e-4f79-49c7-9a02-bbad296672ea.png',
-					'http://data.qicai321.com/minlong/1d9bbc36-2fb8-4489-bff6-c36e7a31bd37.png'
+					'https://data.qicai321.com/minlong/18590378-6792-4a26-be18-ad9f2bcc4159.png',
+					'https://data.qicai321.com/minlong/e08cff2b-3b1d-478f-a62b-766b38445a16.png',
+					'https://data.qicai321.com/minlong/d30ccab7-9cfe-4386-bf0e-ac1f0045bd76.png',
+					'https://data.qicai321.com/minlong/8068a698-ac40-4a5d-a737-54dba47a668d.png',
+					'https://data.qicai321.com/minlong/f04a1f7e-4f79-49c7-9a02-bbad296672ea.png',
+					'https://data.qicai321.com/minlong/1d9bbc36-2fb8-4489-bff6-c36e7a31bd37.png'
 					/* '/static/images/palm_overlay.png',  // 手掌正面引导图
 					'/static/images/back_overlay.png',  // 手掌反面引导图
 					'/static/images/fist_overlay.png'   // 握拳引导图 */

+ 6 - 6
pages/interview_retake/interview_retake.vue

@@ -72,12 +72,12 @@ export default {
 			cameraInitRetries: 0,
 			// 添加手势引导图片
 			gestureOverlays: {
-				left_palm: 'http://data.qicai321.com/minlong/18590378-6792-4a26-be18-ad9f2bcc4159.png',
-				left_back: 'http://data.qicai321.com/minlong/e08cff2b-3b1d-478f-a62b-766b38445a16.png',
-				left_fist: 'http://data.qicai321.com/minlong/d30ccab7-9cfe-4386-bf0e-ac1f0045bd76.png',
-				right_palm: 'http://data.qicai321.com/minlong/8068a698-ac40-4a5d-a737-54dba47a668d.png',
-				right_back: 'http://data.qicai321.com/minlong/f04a1f7e-4f79-49c7-9a02-bbad296672ea.png',
-				right_fist: 'http://data.qicai321.com/minlong/1d9bbc36-2fb8-4489-bff6-c36e7a31bd37.png'
+				left_palm: 'https://data.qicai321.com/minlong/18590378-6792-4a26-be18-ad9f2bcc4159.png',
+				left_back: 'https://data.qicai321.com/minlong/e08cff2b-3b1d-478f-a62b-766b38445a16.png',
+				left_fist: 'https://data.qicai321.com/minlong/d30ccab7-9cfe-4386-bf0e-ac1f0045bd76.png',
+				right_palm: 'https://data.qicai321.com/minlong/8068a698-ac40-4a5d-a737-54dba47a668d.png',
+				right_back: 'https://data.qicai321.com/minlong/f04a1f7e-4f79-49c7-9a02-bbad296672ea.png',
+				right_fist: 'https://data.qicai321.com/minlong/1d9bbc36-2fb8-4489-bff6-c36e7a31bd37.png'
 			},
 			// 添加引导视频
 			guideVideos: {

+ 66 - 4
unpackage/dist/dev/mp-weixin/pages/identity-verify/identity-verify.js

@@ -1056,6 +1056,7 @@ const _sfc_main = {
       } else {
         this.completeRecordingStop(true);
         this.needPlayLowScoreVideo = false;
+        this.recordingTimeDisplay = "00:00";
       }
     },
     // 添加新方法:开始录制用户回答
@@ -1556,7 +1557,7 @@ const _sfc_main = {
             this.handlePostUploadActions(uploadTask);
             resolve();
           } else {
-            setTimeout(checkUploadStatus, 500);
+            setTimeout(checkUploadStatus, 100);
           }
         };
         if (!this.isUploading) {
@@ -1577,6 +1578,7 @@ const _sfc_main = {
           this.retryCount = 0;
           this.isFollowUpQuestion = false;
           this.currentFollowUpQuestion = null;
+          this.videoUrl = "";
           this.proceedToNextQuestion();
         } else {
           this.currentParentQuestionId = task.questionId;
@@ -1953,18 +1955,28 @@ const _sfc_main = {
         currentVideo.stop();
         this.videoPlaying = false;
       }
+      if (this.currentVideoIndex + 1 >= this.videoList.length) {
+        console.log("所有视频已播放完毕");
+        this.stopUserCamera();
+        this.clearCountdown();
+        const currentJobDetail = JSON.parse(common_vendor.index.getStorageSync("selectedJob"));
+        console.log("当前职位ID:", currentJobDetail);
+        const jobId = currentJobDetail ? currentJobDetail.id : null;
+        this.handleVideoCompletion(jobId);
+        return;
+      }
       this.currentVideoIndex++;
       this.historyTime = 0;
       if (this.currentVideoIndex < this.videoList.length) {
         this.videoUrl = this.videoList[this.currentVideoIndex];
-        setTimeout(() => {
+        this.$nextTick(() => {
           this.videoPlaying = true;
           const videoContext = common_vendor.index.createVideoContext("myVideo", this);
           if (videoContext) {
             videoContext.play();
           }
           this.isVideoSwitching = false;
-        }, 100);
+        });
       } else {
         console.log("所有视频已播放完毕");
         this.stopUserCamera();
@@ -2943,7 +2955,6 @@ const _sfc_main = {
                 const tempFilePath = res.tempImagePath;
                 if (!tempFilePath) {
                   console.warn("人脸检测:未获取到有效的图片路径");
-                  return;
                 }
                 common_vendor.index.getFileSystemManager().readFile({
                   filePath: tempFilePath,
@@ -3193,6 +3204,57 @@ const _sfc_main = {
         clearTimeout(this.thinkingTimer);
         this.thinkingTimer = null;
       }
+    },
+    // 处理视频完成
+    handleVideoCompletion(jobId) {
+      this.isVideoSwitching = false;
+      setTimeout(() => {
+        if (jobId === 9) {
+          common_vendor.index.navigateTo({
+            url: "/pages/interview-question/interview-question",
+            success: () => {
+              console.log("成功跳转到interview-question页面");
+            },
+            fail: (err) => {
+              console.error("跳转到interview-question页面失败:", err);
+              common_vendor.index.redirectTo({
+                url: "/pages/interview-question/interview-question",
+                fail: (redirectErr) => {
+                  console.error("重定向到interview-question页面也失败:", redirectErr);
+                  common_vendor.index.navigateBack({
+                    delta: 1
+                  });
+                }
+              });
+            }
+          });
+        } else {
+          common_vendor.index.navigateTo({
+            url: "/pages/camera/camera",
+            success: () => {
+              console.log("成功跳转到camera页面");
+            },
+            fail: (err) => {
+              console.error("跳转到camera页面失败:", err);
+              common_vendor.index.redirectTo({
+                url: "/pages/camera/camera",
+                fail: (redirectErr) => {
+                  console.error("重定向到camera页面也失败:", redirectErr);
+                  common_vendor.index.switchTab({
+                    url: "/pages/camera/camera",
+                    fail: (switchErr) => {
+                      console.error("所有跳转方式都失败:", switchErr);
+                      common_vendor.index.navigateBack({
+                        delta: 1
+                      });
+                    }
+                  });
+                }
+              });
+            }
+          });
+        }
+      }, 200);
     }
   },
   computed: {

+ 554 - 232
unpackage/dist/dev/mp-weixin/pages/interview-question/interview-question.js

@@ -152,8 +152,10 @@ const _sfc_main = {
       // 标记是否有待处理的自动跳转
       hasTriedFallbackMethod: false,
       // 标记是否尝试过备选方法播放音频
-      hasShownTextFallbackToast: false
+      hasShownTextFallbackToast: false,
       // 标记是否已显示文本回退提示
+      showNextButton: false
+      // 添加一个变量控制按钮显示
     };
   },
   onLoad(options) {
@@ -1496,42 +1498,25 @@ const _sfc_main = {
     },
     // 修改 navigateToNextPage 方法
     navigateToNextPage() {
-      console.log("准备导航到下一个页面");
-      if (this.isPlayingAiVoice) {
-        console.log("AI语音正在播放,等待播放完成后再跳转");
-        return;
-      }
-      console.log("导航到下一个页面");
-      try {
-        const currentJobDetail = common_vendor.index.getStorageSync("selectedJob");
-        const jobId = currentJobDetail ? JSON.parse(currentJobDetail).id : null;
-        if (jobId === 9 || jobId === 10) {
-          common_vendor.index.navigateTo({
-            url: "/pages/success/success",
-            success: () => {
-              console.log("成功跳转到成功页面");
-            },
-            fail: (err) => {
-              console.error("跳转失败:", err);
-              this.handleNavigationFailure();
-            }
-          });
-          return;
-        }
-      } catch (e) {
-        console.error("解析 selectedJob 失败:", e);
-      }
-      common_vendor.index.navigateTo({
-        url: "/pages/success/success",
-        //'/pages/posture-guide/posture-guide?uploading=' + (this.uploadQueue.length > 0 ? 'true' : 'false'),
-        success: () => {
-          console.log("成功跳转到结果页面");
-        },
-        fail: (err) => {
-          console.error("跳转失败:", err);
-          this.handleNavigationFailure();
-        }
-      });
+      console.log("执行页面跳转");
+      this.isPlayingAiVoice = false;
+      this.currentSubtitle = "";
+      setTimeout(() => {
+        common_vendor.index.navigateTo({
+          url: "/pages/success/success",
+          success: () => {
+            console.log("页面跳转成功");
+          },
+          fail: (err) => {
+            console.error("页面跳转失败:", err);
+            common_vendor.index.showToast({
+              title: "页面跳转失败",
+              icon: "none",
+              duration: 2e3
+            });
+          }
+        });
+      }, 100);
     },
     // 添加处理导航失败的方法
     handleNavigationFailure() {
@@ -2065,7 +2050,7 @@ const _sfc_main = {
       this.showContinueQuestionOptions();
     },
     // 添加新方法:播放AI语音
-    playAiVoice() {
+    async playAiVoice() {
       console.log("开始播放AI语音:", this.aiVoiceUrl);
       this.hasShownTextFallbackToast = false;
       this.isPlayingAiVoice = true;
@@ -2077,19 +2062,25 @@ const _sfc_main = {
         this.useTextFallbackAndNavigate();
         return;
       }
-      const systemInfo = common_vendor.index.getSystemInfoSync();
-      const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
-      const isIOS = systemInfo.platform === "ios";
-      if (isMiniProgram) {
-        if (isIOS) {
-          this.playIOSMiniProgramAudio();
+      try {
+        const systemInfo = common_vendor.index.getSystemInfoSync();
+        const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
+        const isIOS = systemInfo.platform === "ios";
+        if (isMiniProgram) {
+          if (isIOS) {
+            await this.playIOSMiniProgramAudio();
+          } else {
+            await this.playMiniProgramAudio();
+          }
+        } else if (isIOS) {
+          await this.playAiVoiceForIOS();
         } else {
-          this.playMiniProgramAudio();
+          await this.playAiVoiceForAndroid();
         }
-      } else if (isIOS) {
-        this.playAiVoiceForIOS();
-      } else {
-        this.playAiVoiceForAndroid();
+        this.navigateToNextPage();
+      } catch (error) {
+        console.error("音频播放失败:", error);
+        this.useTextFallbackAndNavigate();
       }
     },
     // 新增方法:文本回退并导航
@@ -2127,91 +2118,169 @@ const _sfc_main = {
     },
     // 修改 playMiniProgramAudio 方法
     playMiniProgramAudio() {
-      console.log("使用小程序原生音频API播放:", this.aiVoiceUrl);
-      try {
-        const audioContext = common_vendor.wx$1.createInnerAudioContext();
-        audioContext.autoplay = true;
-        audioContext.src = this.aiVoiceUrl;
-        audioContext.onPlay(() => {
-          console.log("AI语音开始播放");
-          this.currentSubtitle = this.aiText;
-        });
-        audioContext.onEnded(() => {
-          console.log("AI语音播放结束");
-          this.isPlayingAiVoice = false;
-          this.currentSubtitle = "";
-          audioContext.destroy();
-          this.navigateToNextPage();
-        });
-        audioContext.onError((err) => {
-          console.error("AI语音播放错误:", err);
-          audioContext.destroy();
-          this.useTextFallbackAndNavigate();
-        });
-        setTimeout(() => {
-          if (this.isPlayingAiVoice) {
-            console.warn("音频播放超时,使用文本回退");
-            this.useTextFallbackAndNavigate();
-          }
-        }, 5e3);
-      } catch (e) {
-        console.error("小程序播放AI语音失败:", e);
-        this.useTextFallbackAndNavigate();
-      }
+      return new Promise(async (resolve, reject) => {
+        try {
+          common_vendor.index.showLoading({
+            title: "音频加载中...",
+            mask: true
+          });
+          const localAudioPath = await this.preloadAudio(this.aiVoiceUrl);
+          common_vendor.index.hideLoading();
+          const audioContext = common_vendor.wx$1.createInnerAudioContext();
+          audioContext.src = localAudioPath;
+          audioContext.autoplay = true;
+          audioContext.bufferSize = 4096;
+          let hasStarted = false;
+          let hasError = false;
+          audioContext.onPlay(() => {
+            console.log("AI语音开始播放");
+            hasStarted = true;
+            this.currentSubtitle = this.aiText;
+          });
+          audioContext.onEnded(() => {
+            console.log("AI语音播放结束");
+            this.isPlayingAiVoice = false;
+            this.currentSubtitle = "";
+            audioContext.destroy();
+            if (!hasError) {
+              console.log("准备跳转到下一页");
+              this.navigateToNextPage();
+              resolve();
+            }
+          });
+          audioContext.onStop(() => {
+            console.log("AI语音播放停止");
+            this.isPlayingAiVoice = false;
+            this.currentSubtitle = "";
+            audioContext.destroy();
+            if (!hasError) {
+              console.log("播放停止,准备跳转到下一页");
+              this.navigateToNextPage();
+              resolve();
+            }
+          });
+          audioContext.onError((err) => {
+            hasError = true;
+            console.error("AI语音播放错误:", err);
+            audioContext.destroy();
+            common_vendor.index.showToast({
+              title: "音频播放异常,将显示文字",
+              icon: "none",
+              duration: 2e3
+            });
+            if (this.aiVoiceUrl.endsWith(".mp3")) {
+              const wavUrl = this.aiVoiceUrl.replace(".mp3", ".wav");
+              console.log("尝试使用WAV格式:", wavUrl);
+              this.aiVoiceUrl = wavUrl;
+              this.playMiniProgramAudio().then(resolve).catch(reject);
+            } else {
+              reject(err);
+            }
+          });
+          setTimeout(() => {
+            if (!hasStarted && !hasError) {
+              console.error("音频播放启动超时");
+              audioContext.destroy();
+              reject(new Error("音频播放启动超时"));
+            }
+          }, 5e3);
+        } catch (error) {
+          common_vendor.index.hideLoading();
+          console.error("音频播放初始化失败:", error);
+          reject(error);
+        }
+      });
     },
     // 新增方法:导航到下一页
     navigateToNextPage() {
-      console.log("准备导航到下一页");
-      common_vendor.index.navigateTo({
-        url: "/pages/success/success",
-        //'/pages/posture-guide/posture-guide',
-        fail: (err) => {
-          console.error("导航失败:", err);
-          common_vendor.index.showToast({
-            title: "页面跳转失败",
-            icon: "none",
-            duration: 2e3
+      console.log("执行页面跳转");
+      this.isPlayingAiVoice = false;
+      this.currentSubtitle = "";
+      setTimeout(() => {
+        common_vendor.index.navigateTo({
+          url: "/pages/success/success",
+          success: () => {
+            console.log("页面跳转成功");
+          },
+          fail: (err) => {
+            console.error("页面跳转失败:", err);
+            common_vendor.index.showToast({
+              title: "页面跳转失败",
+              icon: "none",
+              duration: 2e3
+            });
+          }
+        });
+      }, 100);
+    },
+    // 新增方法:专门处理iOS小程序音频播放
+    playIOSMiniProgramAudio() {
+      return new Promise((resolve, reject) => {
+        try {
+          const audioContext = common_vendor.wx$1.createInnerAudioContext();
+          audioContext.src = this.aiVoiceUrl;
+          audioContext.autoplay = true;
+          audioContext.onPlay(() => {
+            console.log("iOS小程序音频开始播放");
           });
+          audioContext.onEnded(() => {
+            console.log("iOS小程序音频播放完成");
+            audioContext.destroy();
+            resolve();
+          });
+          audioContext.onError((err) => {
+            console.error("iOS小程序音频播放错误:", err);
+            audioContext.destroy();
+            reject(err);
+          });
+        } catch (error) {
+          reject(error);
         }
       });
     },
-    // 新增方法:专门处理iOS小程序音频播放
-    playIOSMiniProgramAudio() {
-      console.log("iOS小程序环境:使用增强的音频处理方法");
-      this.hasShownTextFallbackToast = false;
-      try {
-        const audioContext = common_vendor.wx$1.createInnerAudioContext();
-        audioContext.autoplay = false;
-        audioContext.obeyMuteSwitch = true;
-        audioContext.volume = 1;
-        audioContext.onPlay(() => {
-          console.log("iOS小程序音频开始播放");
-          this.currentSubtitle = this.aiText;
-        });
-        audioContext.onEnded(() => {
-          console.log("iOS小程序音频播放结束");
-          this.handleIOSAudioComplete(audioContext);
-        });
-        audioContext.onStop(() => {
-          console.log("iOS小程序音频播放停止");
-          this.handleIOSAudioComplete(audioContext);
-        });
-        audioContext.onError((err) => {
-          console.error("iOS小程序音频播放错误:", err);
-          this.handleIOSMiniProgramError(audioContext, err);
-        });
-        this.preloadIOSMiniProgramAudio(this.aiVoiceUrl).then((localPath) => {
-          console.log("iOS小程序音频预下载成功:", localPath);
-          audioContext.src = localPath;
-          audioContext.play();
-        }).catch((error) => {
-          console.error("iOS小程序音频预下载失败:", error);
-          this.fallbackIOSMiniProgramPlay(audioContext);
-        });
-      } catch (e) {
-        console.error("iOS小程序音频初始化失败:", e);
-        this.useIOSTextFallback();
-      }
+    playAiVoiceForIOS() {
+      return new Promise((resolve, reject) => {
+        try {
+          const audioContext = new Audio();
+          audioContext.src = this.aiVoiceUrl;
+          audioContext.autoplay = true;
+          audioContext.addEventListener("play", () => {
+            console.log("iOS音频开始播放");
+          });
+          audioContext.addEventListener("ended", () => {
+            console.log("iOS音频播放完成");
+            resolve();
+          });
+          audioContext.addEventListener("error", (err) => {
+            console.error("iOS音频播放错误:", err);
+            reject(err);
+          });
+        } catch (error) {
+          reject(error);
+        }
+      });
+    },
+    playAiVoiceForAndroid() {
+      return new Promise((resolve, reject) => {
+        try {
+          const audioContext = new Audio();
+          audioContext.src = this.aiVoiceUrl;
+          audioContext.autoplay = true;
+          audioContext.addEventListener("play", () => {
+            console.log("Android音频开始播放");
+          });
+          audioContext.addEventListener("ended", () => {
+            console.log("Android音频播放完成");
+            resolve();
+          });
+          audioContext.addEventListener("error", (err) => {
+            console.error("Android音频播放错误:", err);
+            reject(err);
+          });
+        } catch (error) {
+          reject(error);
+        }
+      });
     },
     // 新增方法:iOS小程序音频预下载
     preloadIOSMiniProgramAudio(audioUrl) {
@@ -2328,12 +2397,12 @@ const _sfc_main = {
         this.hasShownTextFallbackToast = true;
       }
       this.currentSubtitle = this.aiText || "抱歉,AI回复内容加载失败";
-      const textLength = this.aiText ? this.aiText.length : 20;
-      const readingTime = Math.max(5e3, Math.min(textLength * 100, 15e3));
-      console.log(`文本长度: ${textLength}, 预计阅读时间: ${readingTime}ms`);
-      setTimeout(() => {
-        this.handleIOSAudioComplete(null);
-      }, readingTime);
+      this.showNextButton = true;
+    },
+    // 添加处理继续按钮点击的方法
+    handleNextButtonClick() {
+      this.showNextButton = false;
+      this.handleIOSAudioComplete(null);
     },
     // 添加新方法:iOS音频播放完成处理
     handleIOSAudioPlaybackComplete() {
@@ -2426,60 +2495,113 @@ const _sfc_main = {
       }
     },
     // 修改 playMiniProgramAudio 方法,添加iOS特殊处理
-    playMiniProgramAudio() {
-      console.log("使用小程序原生音频API播放:", this.aiVoiceUrl);
-      this.isPlayingAiVoice = true;
-      this.showContinueQuestionButton = false;
-      this.showEndInterviewButton = false;
-      if (!this.aiVoiceUrl || this.aiVoiceUrl.trim() === "") {
-        console.error("无效的音频URL");
-        this.handleAudioPlaybackFailure();
-        return;
-      }
-      const systemInfo = common_vendor.index.getSystemInfoSync();
-      const isIOS = systemInfo.platform === "ios";
-      if (isIOS) {
-        this.playMiniProgramAudioForIOS();
-        return;
-      }
-      try {
-        const audioContext = common_vendor.wx$1.createInnerAudioContext();
-        audioContext.autoplay = false;
-        audioContext.obeyMuteSwitch = false;
-        audioContext.onPlay(() => {
-          console.log("AI语音开始播放");
-        });
-        audioContext.onEnded(() => {
-          console.log("AI语音播放结束");
-          this.isPlayingAiVoice = false;
-          this.currentSubtitle = "";
-          audioContext.destroy();
-          this.showContinueQuestionOptions();
-        });
-        audioContext.onError((err) => {
-          console.error("AI语音播放错误:", err);
-          this.isPlayingAiVoice = false;
-          this.currentSubtitle = "";
-          audioContext.destroy();
-          this.showContinueQuestionOptions();
-        });
-        audioContext.src = this.aiVoiceUrl;
-        const playTimeout = setTimeout(() => {
-          if (this.isPlayingAiVoice) {
-            console.warn("小程序音频播放超时,尝试备选方法");
-            this.tryMiniProgramFallbackAudioPlay();
+    /*     playMiniProgramAudio() {
+          console.log('使用小程序原生音频API播放:', this.aiVoiceUrl);
+          
+          // 标记正在播放AI语音
+          this.isPlayingAiVoice = true;
+          
+          // 确保在播放期间不显示继续提问按钮
+          this.showContinueQuestionButton = false;
+          this.showEndInterviewButton = false;
+          
+          // 检查音频URL是否有效
+          if (!this.aiVoiceUrl || this.aiVoiceUrl.trim() === '') {
+            console.error('无效的音频URL');
+            this.handleAudioPlaybackFailure();
+            return;
           }
-        }, 5e3);
-        setTimeout(() => {
-          audioContext.play();
-          clearTimeout(playTimeout);
-        }, 300);
-      } catch (e) {
-        console.error("小程序播放AI语音时发生错误:", e);
-        this.isPlayingAiVoice = false;
-        this.handleAudioPlaybackFailure();
-      }
-    },
+          
+          // 检查平台
+          const systemInfo = uni.getSystemInfoSync();
+          const isIOS = systemInfo.platform === 'ios';
+          
+          // iOS小程序特殊处理
+          if (isIOS) {
+            this.playMiniProgramAudioForIOS();
+            return;
+          }
+          
+          // 非iOS平台的原有逻辑
+          try {
+            // 使用wx.createInnerAudioContext API (微信小程序)
+            const audioContext = wx.createInnerAudioContext();
+            
+            // 设置音频属性
+            audioContext.autoplay = false;
+            audioContext.obeyMuteSwitch = false; // 忽略静音开关
+            
+            // 监听播放开始事件
+            audioContext.onPlay(() => {
+              console.log('AI语音开始播放');
+              
+              // 显示正在播放提示
+            });
+            
+            // 监听播放结束事件
+            audioContext.onEnded(() => {
+              console.log('AI语音播放结束');
+              
+              // 标记播放结束
+              this.isPlayingAiVoice = false;
+              
+              // 清空字幕
+              this.currentSubtitle = '';
+              
+              // 销毁音频播放器
+              audioContext.destroy();
+              
+              // 播放结束后显示继续提问选项,而不是直接跳转
+              this.showContinueQuestionOptions();
+            });
+            
+            // 监听播放错误事件
+            audioContext.onError((err) => {
+              console.error('AI语音播放错误:', err);
+              
+              // 标记播放结束
+              this.isPlayingAiVoice = false;
+              
+              // 清空字幕
+              this.currentSubtitle = '';
+              
+              // 销毁音频播放器
+              audioContext.destroy();
+              
+              // 播放错误时也显示继续提问选项
+              this.showContinueQuestionOptions();
+            });
+            
+            // 设置音频源
+            audioContext.src = this.aiVoiceUrl;
+            
+            // 添加超时处理,如果5秒内没有开始播放,则认为出错
+            const playTimeout = setTimeout(() => {
+              if (this.isPlayingAiVoice) {
+                console.warn('小程序音频播放超时,尝试备选方法');
+                this.tryMiniProgramFallbackAudioPlay();
+              }
+            }, 5000);
+            
+            // 延迟一小段时间再播放,确保src已经设置完成
+            setTimeout(() => {
+              audioContext.play();
+              // 播放开始后清除超时
+              clearTimeout(playTimeout);
+            }, 300);
+          } catch (e) {
+            console.error('小程序播放AI语音时发生错误:', e);
+            
+            // 标记播放结束
+            this.isPlayingAiVoice = false;
+            
+            // 显示错误提示
+       
+            
+            // 使用文本显示方式作为备选方案
+            this.handleAudioPlaybackFailure();
+          }
+        }, */
     // 添加新方法:iOS小程序音频播放
     playMiniProgramAudioForIOS() {
       console.log("iOS小程序环境:开始播放AI语音");
@@ -2722,55 +2844,107 @@ const _sfc_main = {
       });
     },
     // 添加一个新方法:使用小程序原生音频API
-    playMiniProgramAudio() {
-      console.log("使用小程序原生音频API播放:", this.aiVoiceUrl);
-      this.isPlayingAiVoice = true;
-      this.showContinueQuestionButton = false;
-      this.showEndInterviewButton = false;
-      if (!this.aiVoiceUrl || this.aiVoiceUrl.trim() === "") {
-        console.error("无效的音频URL");
-        this.isPlayingAiVoice = false;
-        this.showContinueQuestionOptions();
-        return;
-      }
-      try {
-        const audioContext = common_vendor.wx$1.createInnerAudioContext();
-        audioContext.autoplay = false;
-        audioContext.obeyMuteSwitch = false;
-        audioContext.onPlay(() => {
-          console.log("AI语音开始播放");
-        });
-        audioContext.onEnded(() => {
-          console.log("AI语音播放结束");
+    /*   playMiniProgramAudio() {
+        console.log('使用小程序原生音频API播放:', this.aiVoiceUrl);
+        
+        // 标记正在播放AI语音
+        this.isPlayingAiVoice = true;
+        
+        // 确保在播放期间不显示继续提问按钮
+        this.showContinueQuestionButton = false;
+        this.showEndInterviewButton = false;
+        
+        // 检查音频URL是否有效
+        if (!this.aiVoiceUrl || this.aiVoiceUrl.trim() === '') {
+          console.error('无效的音频URL');
+          // 显示错误提示
+          
+          // 标记播放结束
           this.isPlayingAiVoice = false;
-          this.currentSubtitle = "";
-          audioContext.destroy();
+          
+          // 显示继续提问选项
           this.showContinueQuestionOptions();
-        });
-        audioContext.onError((err) => {
-          console.error("AI语音播放错误:", err);
+          return;
+        }
+        
+        try {
+          // 使用wx.createInnerAudioContext API (微信小程序)
+          const audioContext = wx.createInnerAudioContext();
+          
+          // 设置音频属性
+          audioContext.autoplay = false;
+          audioContext.obeyMuteSwitch = false; // 忽略静音开关
+          
+          // 监听播放开始事件
+          audioContext.onPlay(() => {
+            console.log('AI语音开始播放');
+            
+            // 显示正在播放提
+          });
+          
+          // 监听播放结束事件
+          audioContext.onEnded(() => {
+            console.log('AI语音播放结束');
+            
+            // 标记播放结束
+            this.isPlayingAiVoice = false;
+            
+            // 清空字幕
+            this.currentSubtitle = '';
+            
+            // 销毁音频播放器
+            audioContext.destroy();
+            
+            // 播放结束后显示继续提问选项,而不是直接跳转
+            this.showContinueQuestionOptions();
+          });
+          
+          // 监听播放错误事件
+          audioContext.onError((err) => {
+            console.error('AI语音播放错误:', err);
+            
+            // 标记播放结束
+            this.isPlayingAiVoice = false;
+            
+            // 清空字幕
+            this.currentSubtitle = '';
+            
+            // 销毁音频播放器
+            audioContext.destroy();
+            
+            // 播放错误时也显示继续提问选项
+            this.showContinueQuestionOptions();
+          });
+          
+          // 设置音频源
+          audioContext.src = this.aiVoiceUrl;
+          
+          // 添加超时处理,如果5秒内没有开始播放,则认为出错
+          const playTimeout = setTimeout(() => {
+            if (this.isPlayingAiVoice) {
+              console.warn('小程序音频播放超时,尝试备选方法');
+              this.tryMiniProgramFallbackAudioPlay();
+            }
+          }, 5000);
+          
+          // 延迟一小段时间再播放,确保src已经设置完成
+          setTimeout(() => {
+            audioContext.play();
+            // 播放开始后清除超时
+            clearTimeout(playTimeout);
+          }, 300);
+        } catch (e) {
+          console.error('小程序播放AI语音时发生错误:', e);
+          
+          // 标记播放结束
           this.isPlayingAiVoice = false;
-          this.currentSubtitle = "";
-          audioContext.destroy();
-          this.showContinueQuestionOptions();
-        });
-        audioContext.src = this.aiVoiceUrl;
-        const playTimeout = setTimeout(() => {
-          if (this.isPlayingAiVoice) {
-            console.warn("小程序音频播放超时,尝试备选方法");
-            this.tryMiniProgramFallbackAudioPlay();
-          }
-        }, 5e3);
-        setTimeout(() => {
-          audioContext.play();
-          clearTimeout(playTimeout);
-        }, 300);
-      } catch (e) {
-        console.error("小程序播放AI语音时发生错误:", e);
-        this.isPlayingAiVoice = false;
-        this.handleAudioPlaybackFailure();
-      }
-    },
+          
+          // 显示错误提示
+          
+          // 使用文本显示方式作为备选方案
+          this.handleAudioPlaybackFailure();
+        }
+      }, */
     // 添加新方法:小程序环境的备选音频播放方法
     tryMiniProgramFallbackAudioPlay() {
       console.log("使用小程序备选方法播放音频:", this.aiVoiceUrl);
@@ -2980,6 +3154,154 @@ const _sfc_main = {
       setTimeout(() => {
         this.navigateToNextPage();
       }, readingTime);
+    },
+    // 添加音频预加载方法
+    preloadAudio(audioUrl) {
+      return new Promise((resolve, reject) => {
+        console.log("开始预加载音频:", audioUrl);
+        const downloadTask = common_vendor.wx$1.downloadFile({
+          url: audioUrl,
+          success: (res) => {
+            if (res.statusCode === 200) {
+              console.log("音频文件下载成功,临时路径:", res.tempFilePath);
+              resolve(res.tempFilePath);
+            } else {
+              console.error("音频文件下载失败,状态码:", res.statusCode);
+              reject(new Error(`下载失败,状态码: ${res.statusCode}`));
+            }
+          },
+          fail: (error) => {
+            console.error("音频文件下载失败:", error);
+            reject(error);
+          }
+        });
+        downloadTask.onProgressUpdate((res) => {
+          console.log("音频下载进度:", res.progress);
+        });
+      });
+    },
+    // 修改音频播放方法
+    playMiniProgramAudio() {
+      return new Promise(async (resolve, reject) => {
+        try {
+          common_vendor.index.showLoading({
+            title: "音频加载中...",
+            mask: true
+          });
+          const localAudioPath = await this.preloadAudio(this.aiVoiceUrl);
+          common_vendor.index.hideLoading();
+          const audioContext = common_vendor.wx$1.createInnerAudioContext();
+          audioContext.src = localAudioPath;
+          audioContext.autoplay = true;
+          audioContext.bufferSize = 4096;
+          let hasStarted = false;
+          let hasError = false;
+          audioContext.onPlay(() => {
+            console.log("AI语音开始播放");
+            hasStarted = true;
+            this.currentSubtitle = this.aiText;
+          });
+          audioContext.onEnded(() => {
+            console.log("AI语音播放结束");
+            this.isPlayingAiVoice = false;
+            this.currentSubtitle = "";
+            audioContext.destroy();
+            if (!hasError) {
+              console.log("准备跳转到下一页");
+              this.navigateToNextPage();
+              resolve();
+            }
+          });
+          audioContext.onStop(() => {
+            console.log("AI语音播放停止");
+            this.isPlayingAiVoice = false;
+            this.currentSubtitle = "";
+            audioContext.destroy();
+            if (!hasError) {
+              console.log("播放停止,准备跳转到下一页");
+              this.navigateToNextPage();
+              resolve();
+            }
+          });
+          audioContext.onError((err) => {
+            hasError = true;
+            console.error("AI语音播放错误:", err);
+            audioContext.destroy();
+            common_vendor.index.showToast({
+              title: "音频播放异常,将显示文字",
+              icon: "none",
+              duration: 2e3
+            });
+            if (this.aiVoiceUrl.endsWith(".mp3")) {
+              const wavUrl = this.aiVoiceUrl.replace(".mp3", ".wav");
+              console.log("尝试使用WAV格式:", wavUrl);
+              this.aiVoiceUrl = wavUrl;
+              this.playMiniProgramAudio().then(resolve).catch(reject);
+            } else {
+              reject(err);
+            }
+          });
+          setTimeout(() => {
+            if (!hasStarted && !hasError) {
+              console.error("音频播放启动超时");
+              audioContext.destroy();
+              reject(new Error("音频播放启动超时"));
+            }
+          }, 5e3);
+        } catch (error) {
+          common_vendor.index.hideLoading();
+          console.error("音频播放初始化失败:", error);
+          reject(error);
+        }
+      });
+    },
+    // 添加备选的音频播放方法
+    async playFallbackAudio() {
+      return new Promise((resolve, reject) => {
+        try {
+          const audio = common_vendor.wx$1.createInnerAudioContext();
+          audio.volume = 1;
+          audio.playbackRate = 1;
+          audio.src = this.aiVoiceUrl;
+          audio.autoplay = true;
+          audio.onPlay(() => {
+            console.log("备选音频开始播放");
+          });
+          audio.onEnded(() => {
+            console.log("备选音频播放完成");
+            audio.destroy();
+            resolve();
+          });
+          audio.onError((err) => {
+            console.error("备选音频播放失败:", err);
+            audio.destroy();
+            reject(err);
+          });
+        } catch (error) {
+          reject(error);
+        }
+      });
+    },
+    // 修改主音频播放方法
+    async playAiVoice() {
+      console.log("开始播放AI语音:", this.aiVoiceUrl);
+      this.isPlayingAiVoice = true;
+      this.currentSubtitle = this.aiText;
+      try {
+        await this.playMiniProgramAudio();
+        console.log("音频播放完成,准备跳转");
+        this.navigateToNextPage();
+      } catch (error) {
+        console.error("主要播放方法失败,尝试备选方法:", error);
+        try {
+          await this.playFallbackAudio();
+          console.log("备选音频播放完成,准备跳转");
+          this.navigateToNextPage();
+        } catch (fallbackError) {
+          console.error("备选播放方法也失败:", fallbackError);
+          this.useTextFallbackAndNavigate();
+        }
+      }
     }
   }
 };

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/interview-question/interview-question.wxml


+ 34 - 1
unpackage/dist/dev/mp-weixin/pages/interview-question/interview-question.wxss

@@ -98,7 +98,7 @@ video.data-v-2a02c54e::-webkit-media-controls-fullscreen-button {
 /* 修改字幕覆盖层样式,使其与图片中的样式一致 */
 .subtitle-overlay.data-v-2a02c54e {
   position: absolute;
-  bottom: 180px; /* 调整位置,使其更靠近底部 */
+  bottom: 100px; /* 调整位置,使其更靠近底部 */
   left: 5%; /* 从左侧留出5%的空间 */
   width: 80%; /* 宽度设为90%,两侧各留5%实现居中 */
   padding: 15px 20px; /* 增加左右内边距 */
@@ -111,6 +111,39 @@ video.data-v-2a02c54e::-webkit-media-controls-fullscreen-button {
   z-index: 10;
   margin: 0 auto; /* 添加自动边距实现居中 */
   box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 添加轻微阴影 */
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  gap: 10px;
+}
+
+/* 继续按钮样式 */
+.next-button.data-v-2a02c54e {
+  background-color: #0039b3;
+  color: white;
+  border: none;
+  padding: 8px 20px;
+  border-radius: 20px;
+  cursor: pointer;
+  font-size: 14px;
+  margin-top: 10px;
+  transition: all 0.3s;
+  width: 140px;
+  height: 36px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
+}
+.next-button.data-v-2a02c54e:hover {
+  background-color: #002b8f;
+  transform: translateY(-1px);
+  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
+}
+.next-button.data-v-2a02c54e:active {
+  background-color: #001d66;
+  transform: translateY(1px);
+  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
 }
 
 /* 添加计时器样式,右侧显示橙色圆点和时间 */

+ 6 - 6
unpackage/dist/dev/mp-weixin/pages/interview/interview.js

@@ -34,12 +34,12 @@ const _sfc_main = {
       cameraInitRetries: 0,
       // 添加重试计数器
       gestureOverlays: [
-        "http://data.qicai321.com/minlong/18590378-6792-4a26-be18-ad9f2bcc4159.png",
-        "http://data.qicai321.com/minlong/e08cff2b-3b1d-478f-a62b-766b38445a16.png",
-        "http://data.qicai321.com/minlong/d30ccab7-9cfe-4386-bf0e-ac1f0045bd76.png",
-        "http://data.qicai321.com/minlong/8068a698-ac40-4a5d-a737-54dba47a668d.png",
-        "http://data.qicai321.com/minlong/f04a1f7e-4f79-49c7-9a02-bbad296672ea.png",
-        "http://data.qicai321.com/minlong/1d9bbc36-2fb8-4489-bff6-c36e7a31bd37.png"
+        "https://data.qicai321.com/minlong/18590378-6792-4a26-be18-ad9f2bcc4159.png",
+        "https://data.qicai321.com/minlong/e08cff2b-3b1d-478f-a62b-766b38445a16.png",
+        "https://data.qicai321.com/minlong/d30ccab7-9cfe-4386-bf0e-ac1f0045bd76.png",
+        "https://data.qicai321.com/minlong/8068a698-ac40-4a5d-a737-54dba47a668d.png",
+        "https://data.qicai321.com/minlong/f04a1f7e-4f79-49c7-9a02-bbad296672ea.png",
+        "https://data.qicai321.com/minlong/1d9bbc36-2fb8-4489-bff6-c36e7a31bd37.png"
         /* '/static/images/palm_overlay.png',  // 手掌正面引导图
         '/static/images/back_overlay.png',  // 手掌反面引导图
         '/static/images/fist_overlay.png'   // 握拳引导图 */

+ 6 - 6
unpackage/dist/dev/mp-weixin/pages/interview_retake/interview_retake.js

@@ -16,12 +16,12 @@ const _sfc_main = {
       cameraInitRetries: 0,
       // 添加手势引导图片
       gestureOverlays: {
-        left_palm: "http://data.qicai321.com/minlong/18590378-6792-4a26-be18-ad9f2bcc4159.png",
-        left_back: "http://data.qicai321.com/minlong/e08cff2b-3b1d-478f-a62b-766b38445a16.png",
-        left_fist: "http://data.qicai321.com/minlong/d30ccab7-9cfe-4386-bf0e-ac1f0045bd76.png",
-        right_palm: "http://data.qicai321.com/minlong/8068a698-ac40-4a5d-a737-54dba47a668d.png",
-        right_back: "http://data.qicai321.com/minlong/f04a1f7e-4f79-49c7-9a02-bbad296672ea.png",
-        right_fist: "http://data.qicai321.com/minlong/1d9bbc36-2fb8-4489-bff6-c36e7a31bd37.png"
+        left_palm: "https://data.qicai321.com/minlong/18590378-6792-4a26-be18-ad9f2bcc4159.png",
+        left_back: "https://data.qicai321.com/minlong/e08cff2b-3b1d-478f-a62b-766b38445a16.png",
+        left_fist: "https://data.qicai321.com/minlong/d30ccab7-9cfe-4386-bf0e-ac1f0045bd76.png",
+        right_palm: "https://data.qicai321.com/minlong/8068a698-ac40-4a5d-a737-54dba47a668d.png",
+        right_back: "https://data.qicai321.com/minlong/f04a1f7e-4f79-49c7-9a02-bbad296672ea.png",
+        right_fist: "https://data.qicai321.com/minlong/1d9bbc36-2fb8-4489-bff6-c36e7a31bd37.png"
       },
       // 添加引导视频
       guideVideos: {

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно