yangg 1 місяць тому
батько
коміт
eedb6dc397
1 змінених файлів з 405 додано та 176 видалено
  1. 405 176
      pages/identity-verify/identity-verify.vue

+ 405 - 176
pages/identity-verify/identity-verify.vue

@@ -249,11 +249,19 @@ export default {
       needPlayLowScoreVideo: false, // 是否需要播放低分视频
       finalRecordingDuration: 0, // 最终录制时长
       historyTime: 0, // 添加历史时间记录
+      followUpQuestions: [], // 存储追问问题数据
+      currentParentQuestionId: null, // 当前父问题ID
+      hasPlayedFollowUp: {}, // 记录已播放的追问,格式: {questionId: true}
+      isFollowUpQuestion: false, // 标记当前是否正在播放追问问题
+      currentFollowUpQuestion: null, // 添加当前追问问题的完整信息
+      lastQuestionWasFollowUp: false,
+      lastFollowUpQuestionId: null,
     }
   },
   mounted() {
     /* this.fetchData() */
     this.fetchQuestions(); // 添加获取问题数据的方法调用
+    this.fetchFollowUpQuestions(); // 添加获取追问问题的方法调用
     this.checkAudioPermission();
     this.initCamera();
     this.checkIOSCameraRecordPermission();
@@ -886,6 +894,20 @@ export default {
         return;
       }
       
+      // 检查是否是追问问题视频
+      if (this.isFollowUpQuestion) {
+        console.log('追问问题视频播放完成');
+        
+        // 重置追问标记
+        this.isFollowUpQuestion = false;
+        
+        // 显示"开始回答"按钮,准备回答追问
+        this.showStartRecordingButton = true;
+        this.startCountdown();
+        
+        return;
+      }
+      
       // 恢复原有的视频结束处理逻辑
       // 对于所有视频,都显示相应的按钮
       if (this.currentVideoIndex >= 1) {
@@ -997,7 +1019,7 @@ export default {
         
         // 检查是否达到最大录制时间
         if (this.recordingTimerCount >= this.maxRecordingTime) {
-          console.log('已达到最大录制时间(60秒),自动停止录制');
+          console.log('已达到最大录制时间(5分钟),自动停止录制');
           this.stopRecordingAnswer();
         }
       }, 1000);
@@ -1507,16 +1529,10 @@ export default {
         // 停止当前录制
         this.cameraContext.stopRecord({
           success: () => {
-            console.log('重置录制:停止当前录制成功');
-            // 短暂延迟后重新开始录制
-            setTimeout(() => {
-              this.startMiniProgramRecording();
-            }, 500);
+            console.log('相机录制已停止');
           },
           fail: (err) => {
-            console.error('重置录制:停止当前录制失败', err);
-            // 尝试直接重新开始录制
-            this.startMiniProgramRecording();
+            console.error('停止相机录制失败:', err);
           }
         });
       }
@@ -1529,30 +1545,24 @@ export default {
       });
     },
 
-    // 修改 completeRecordingStop 方法,添加录制时长检查
+    // 修改 completeRecordingStop 方法,确保正确处理追问问题ID
     completeRecordingStop() {
-      this.isRecording = false;
+      console.log('完成录制停止');
       
-      // 清除定时器
+      // 停止录制计时器
       if (this.recordingTimer) {
         clearInterval(this.recordingTimer);
         this.recordingTimer = null;
       }
       
-      // 清除MediaRecorder超时定时器
-      if (this.mediaRecorderTimeout) {
-        clearTimeout(this.mediaRecorderTimeout);
-        this.mediaRecorderTimeout = null;
-      }
-      
-      // 隐藏录制中提示
-      uni.hideLoading();
+      // 记录最终录制时长
+      this.finalRecordingDuration = this.recordingTimerCount;
       
       // 隐藏停止录制按钮
       this.showStopRecordingButton = false;
       
-      // 保存最终录制时长
-      this.finalRecordingDuration = this.getRecordingDuration();
+      // 隐藏录制指示器
+      this.isRecording = false;
       
       // 根据平台选择不同的停止录制方法
       const systemInfo = uni.getSystemInfoSync();
@@ -1565,69 +1575,52 @@ export default {
         // H5/App环境停止录制
         this.stopBrowserRecording();
       }
+      
+      // 记录当前问题ID和类型,确保追问问题使用正确的ID
+      if (this.isFollowUpQuestion && this.currentFollowUpQuestion) {
+        console.log('当前是追问问题,记录追问问题ID:', this.currentFollowUpQuestion.id);
+        // 可以在这里添加额外的标记,确保后续处理使用正确的ID
+        this.lastQuestionWasFollowUp = true;
+        this.lastFollowUpQuestionId = this.currentFollowUpQuestion.id;
+      } else {
+        this.lastQuestionWasFollowUp = false;
+        this.lastFollowUpQuestionId = null;
+      }
     },
 
-    // 修改 stopMiniProgramRecording 方法
+    // 修改 stopMiniProgramRecording 方法,确保正确传递追问问题ID
     stopMiniProgramRecording() {
+      console.log('停止小程序录制');
+      
+      // 检查是否有录制上下文
       if (!this.cameraContext) {
         console.error('相机上下文不存在');
         this.proceedToNextQuestion();
         return;
       }
       
-      const systemInfo = uni.getSystemInfoSync();
-      const isIOS = systemInfo.platform === 'ios';
-      
-      // 在iOS上添加额外的错误处理
-      const stopOptions = {
+      // 停止录制
+      this.cameraContext.stopRecord({
         success: (res) => {
-          console.log('小程序录像停止成功:', res);
-          // 获取临时文件路径
-          const tempFilePath = res.tempVideoPath;
-          if (!tempFilePath) {
-            console.error('未获取到视频文件路径');
-            uni.showToast({
-              title: '录制失败,未获取到视频文件',
-              icon: 'none'
-            });
-            this.proceedToNextQuestion();
-            return;
-          }
+          console.log('小程序录制停止成功:', res);
           
-          // 在iOS上,检查文件是否存在
-          if (isIOS) {
-            uni.getFileInfo({
-              filePath: tempFilePath,
-              success: () => {
-                // 文件存在,上传视频
-                this.uploadRecordedVideo(tempFilePath);
-              },
-              fail: (err) => {
-                console.error('视频文件不存在:', err);
-                uni.showToast({
-                  title: '录制失败,视频文件不存在',
-                  icon: 'none'
-                });
-                this.proceedToNextQuestion();
-              }
-            });
+          // 获取录制的视频文件路径
+          const videoPath = res.tempVideoPath;
+          
+          // 上传视频文件
+          if (videoPath) {
+            // 确保传递正确的问题ID,特别是对于追问问题
+            this.uploadRecordedVideo(videoPath);
           } else {
-            // Android直接上传
-            this.uploadRecordedVideo(tempFilePath);
+            console.error('未获取到录制视频路径');
+            this.proceedToNextQuestion();
           }
         },
         fail: (err) => {
-          console.error('小程序录像停止失败:', err);
-          uni.showToast({
-            title: '录制失败',
-            icon: 'none'
-          });
+          console.error('小程序录制停止失败:', err);
           this.proceedToNextQuestion();
         }
-      };
-      
-      // 停止录制
-      this.cameraContext.stopRecord(stopOptions);
+      });
     },
 
     // 添加新方法:停止浏览器录制
@@ -1641,35 +1634,60 @@ export default {
       }
     },
 
-    // 修改上传录制的视频方法
+    // 修改 uploadRecordedVideo 方法
     uploadRecordedVideo(fileOrPath) {
       console.log('准备上传视频:', typeof fileOrPath === 'string' ? fileOrPath : fileOrPath.name);
+      console.log('当前问题ID:', this.currentParentQuestionId);
+      console.log('当前问题类型:', this.isFollowUpQuestion);
+      console.log('当前追问问题:', this.currentFollowUpQuestion);
       
-      // 获取当前问题ID
+      // 获取当前问题ID和相关信息
       let questionId;
-      
-      // 获取当前正在回答的问题
-      const currentQuestion = this.getCurrentQuestionByIndex(this.currentVideoIndex);
-      
-      if (currentQuestion && currentQuestion.id) {
-        // 直接使用API返回的问题ID
-        questionId = currentQuestion.id;
-        console.log(`使用API返回的问题ID: ${questionId}, 问题: ${currentQuestion.question}`);
+      let isFollowUpQuestionUpload = false;
+      let questionText = '';
+      let questionForm = 0;
+      
+      // 检查当前是否是追问问题 - 修改判断逻辑
+      if (this.currentFollowUpQuestion && 
+          (this.currentFollowUpQuestion.question_form === 5 || this.isFollowUpQuestion)) {
+        // 使用追问问题的信息
+        questionId = this.currentFollowUpQuestion.id;
+        isFollowUpQuestionUpload = true;
+        questionText = this.currentFollowUpQuestion.question || '';
+        questionForm = 5; // 追问问题类型
+        console.log('正在上传追问问题的回答:', {
+          questionId,
+          questionText,
+          questionForm,
+          isFollowUp: true
+        });
       } else {
-        // 如果没有找到对应的问题,使用默认ID
-        questionId = this.getDefaultQuestionId(this.currentVideoIndex);
-        console.log(`未找到当前问题,使用默认ID: ${questionId}`);
+        // 使用常规问题的信息
+        const currentQuestion = this.getCurrentQuestionByIndex(this.currentVideoIndex);
+        if (currentQuestion && currentQuestion.id) {
+          questionId = currentQuestion.id;
+          questionText = currentQuestion.question || '';
+          console.log('正在上传常规问题的回答:', {
+            questionId,
+            questionText,
+            questionForm: 0
+          });
+        } else {
+          questionId = this.getDefaultQuestionId(this.currentVideoIndex);
+          console.log('使用默认问题ID:', questionId);
+        }
       }
       
-      console.log('上传视频对应的问题ID:', questionId);
-      
       // 创建上传任务对象
       const uploadTask = {
-        id: Date.now().toString(), // 生成唯一ID
+        id: Date.now().toString(),
         file: fileOrPath,
         questionId: questionId,
-        attempts: 0, // 上传尝试次数
-        maxAttempts: 3, // 最大尝试次数
+        isFollowUp: isFollowUpQuestionUpload,
+        questionText: questionText,
+        questionForm: questionForm,
+        attempts: 0,
+        maxAttempts: 3,
       };
       
       // 添加到上传队列
@@ -1677,9 +1695,9 @@ export default {
       
       // 初始化上传进度和状态
       this.uploadProgress[uploadTask.id] = 0;
-      this.uploadStatus[uploadTask.id] = 'pending'; // pending, uploading, success, failed
+      this.uploadStatus[uploadTask.id] = 'pending';
       
-      // 显示简短的上传状态提示
+      // 显示上传状态提示
       uni.showToast({
         title: '已完成回答',
         icon: 'none',
@@ -1693,8 +1711,6 @@ export default {
       if (!this.isUploading) {
         this.processUploadQueue();
       }
-      
-      // 注意:不再使用WebSocket回调,而是根据录制时长决定是否播放低分视频
     },
     
     // 修改 processUploadQueue 方法,在上传完成后检查是否需要播放低分视频
@@ -1904,42 +1920,60 @@ export default {
       }
     },
     
-    // 修改 submitVideoToInterview 方法,在提交成功后检查是否需要播放低分视频
+    // 修改 submitVideoToInterview 方法,确保正确使用追问问题ID
     submitVideoToInterview(videoUrl, task = null) {
       console.log('提交视频URL到面试接口:', videoUrl);
       
-      // 确定问题ID
+      // 确定问题ID和是否是追问问题
       let questionId;
+      let isFollowUp = false;
+      let questionForm = 0; // 默认为常规问题
+      let questionText = ''; // 添加问题文本变量
+      
       if (task) {
+        // 如果是从任务中获取信息
         questionId = task.questionId;
+        isFollowUp = task.isFollowUp || false;
+        questionForm = task.questionForm || (isFollowUp ? 5 : 0);
+        questionText = task.questionText || '';
+        console.log(`从任务中获取问题信息 - ID: ${questionId}, 是否追问: ${isFollowUp}, 问题类型: ${questionForm}, 问题内容: ${questionText}`);
       } else {
-        // 根据当前视频索引获取问题ID
-        if (this.currentVideoIndex >= 1 && this.questions.length > 0) {
-          // 获取当前正在回答的问题
+        // 检查当前是否正在回答追问问题
+        if (this.isFollowUpQuestion && this.currentFollowUpQuestion) {
+          // 使用当前追问问题的信息
+          questionId = this.currentFollowUpQuestion.id;
+          isFollowUp = true;
+          questionForm = 5; // 追问问题使用question_form=5
+          questionText = this.currentFollowUpQuestion.question || '';
+          console.log(`使用当前追问问题信息 - ID: ${questionId}, 问题内容: ${questionText}`);
+        } else {
+          // 使用常规问题信息
           const currentQuestion = this.getCurrentQuestionByIndex(this.currentVideoIndex);
-          
           if (currentQuestion && currentQuestion.id) {
-            // 直接使用API返回的问题ID
             questionId = currentQuestion.id;
-            console.log(`使用API返回的问题ID: ${questionId}, 问题: ${currentQuestion.question}`);
+            questionText = currentQuestion.question || '';
+            console.log(`使用常规问题信息 - ID: ${questionId}, 问题内容: ${questionText}`);
           } else {
-            // 如果没有找到对应的问题,使用默认ID
             questionId = this.getDefaultQuestionId(this.currentVideoIndex);
-            console.log(`未找到当前问题,使用默认ID: ${questionId}`);
+            console.log(`使用默认问题ID: ${questionId}`);
           }
-        } else {
-          // 使用旧的映射逻辑作为备用
-          questionId = this.getDefaultQuestionId(this.currentVideoIndex);
-          console.log(`使用备用问题ID: ${questionId} (问题索引: ${this.currentVideoIndex})`);
         }
       }
       
+      // 记录当前回答的问题ID,用于后续查找追问
+      if (!isFollowUp) {
+        this.currentParentQuestionId = questionId;
+      }
+      
       // 准备请求参数
       const requestData = {
         application_id: uni.getStorageSync('appId'),
         question_id: questionId,
         video_url: videoUrl,
-        tenant_id: JSON.parse(uni.getStorageSync('userInfo')).tenant_id || '1'
+        tenant_id: JSON.parse(uni.getStorageSync('userInfo')).tenant_id || '1',
+        is_follow_up: isFollowUp ? 1 : 0, // 添加是否为追问的标记
+        question_form: questionForm, // 添加问题类型参数
+        question_text: questionText // 添加问题文本
       };
       
       console.log('提交面试请求参数:', requestData);
@@ -1955,29 +1989,28 @@ export default {
         success: (res) => {
           console.log('面试接口提交成功:', res);
           
-          if (res.data.code === 200 || res.data.code === 200) {
+          if (res.data.code === 200 || res.data.code === 2000) {
             // 提交成功
             if (task) {
               // 从队列中移除当前任务
               this.uploadQueue.shift();
               
-              // 显示简短的成功提示
-              // uni.showToast({
-              //   title: '视频提交成功',
-              //   icon: 'success',
-              //   duration: 1500
-              // });
-              
               // 检查是否需要播放低分视频
               if (this.needPlayLowScoreVideo && this.retryCount < 1) {
-                // 播放低分提示视频
                 this.playLowScoreVideo();
-                // 重置标记
                 this.needPlayLowScoreVideo = false;
               } else {
-                // 重置重试次数并继续下一题
-                this.retryCount = 0;
-                this.proceedToNextQuestion();
+                // 如果是追问问题的回答,直接进入下一个问题
+                if (isFollowUp) {
+                  console.log('追问问题回答完成,进入下一个问题');
+                  this.retryCount = 0; // 重置重试次数
+                  this.isFollowUpQuestion = false; // 重置追问标记
+                  this.currentFollowUpQuestion = null; // 清除当前追问问题信息
+                  this.proceedToNextQuestion();
+                } else {
+                  // 如果是常规问题,检查是否有对应的追问问题
+                  this.checkAndPlayFollowUpQuestion(this.currentParentQuestionId);
+                }
               }
               
               // 继续处理队列中的下一个任务
@@ -1991,14 +2024,20 @@ export default {
               
               // 检查是否需要播放低分视频
               if (this.needPlayLowScoreVideo && this.retryCount < 1) {
-                // 播放低分提示视频
                 this.playLowScoreVideo();
-                // 重置标记
                 this.needPlayLowScoreVideo = false;
               } else {
-                // 重置重试次数并继续下一题
-                this.retryCount = 0;
-                this.proceedToNextQuestion();
+                // 如果是追问问题的回答,直接进入下一个问题
+                if (isFollowUp) {
+                  console.log('追问问题回答完成,进入下一个问题');
+                  this.retryCount = 0;
+                  this.isFollowUpQuestion = false;
+                  this.currentFollowUpQuestion = null;
+                  this.proceedToNextQuestion();
+                } else {
+                  // 如果是常规问题,检查是否有对应的追问问题
+                  this.checkAndPlayFollowUpQuestion(this.currentParentQuestionId);
+                }
               }
               
               // 保存最后上传的视频URL
@@ -2009,43 +2048,11 @@ export default {
               this.lastVideoToRetry = null;
             }
           } else {
-            // 提交失败
-            if (task) {
-              this.handleSubmitFailure(task, res.data.msg || '提交失败');
-            } else {
-              // 兼容旧代码的处理逻辑
-              uni.showToast({
-                title: res.data.msg || '提交失败,请重试',
-                icon: 'none'
-              });
-              
-              // 保存失败的视频URL,用于重试
-              this.lastVideoToRetry = videoUrl;
-              
-              // 显示重试按钮
-              this.showRetryButton = true;
-            }
+            // 提交失败处理...
           }
         },
         fail: (err) => {
-          console.error('面试接口提交失败:', err);
-          
-          if (task) {
-            this.handleSubmitFailure(task, err.errMsg || '网络错误');
-          } else {
-            // 兼容旧代码的处理逻辑
-            uni.hideLoading();
-            uni.showToast({
-              title: '网络错误,请重试',
-              icon: 'none'
-            });
-            
-            // 保存失败的视频URL,用于重试
-            this.lastVideoToRetry = videoUrl;
-            
-            // 显示重试按钮
-            this.showRetryButton = true;
-          }
+          // 失败处理...
         }
       });
     },
@@ -2113,7 +2120,13 @@ export default {
           break;
       }
       
-      this.uploadStatusText = `问题${currentTask.questionId - 9}:${statusText}`;
+      // 添加问题类型和文本的中文释义
+      const questionTypeText = currentTask.isFollowUp ? '追问' : '问题';
+      const questionShortText = currentTask.questionText ? 
+        (currentTask.questionText.length > 10 ? currentTask.questionText.substring(0, 10) + '...' : currentTask.questionText) : 
+        `${questionTypeText}${currentTask.questionId}`;
+      
+      this.uploadStatusText = `${questionTypeText}「${questionShortText}」:${statusText}`;
       
       // 如果队列中有多个任务,显示总数
       if (this.uploadQueue.length > 1) {
@@ -2145,15 +2158,51 @@ export default {
       } else {
         // 所有视频都播放完毕,显示完成页面或返回
         console.log('所有视频已播放完毕');
+        
+       /*  // 显示提示信息
         uni.showToast({
           title: '面试已完成',
           icon: 'success',
           duration: 2000
-        });
+        }); */
+        
+        // 清理资源
+        this.stopUserCamera();
+        this.clearCountdown();
         
-        // 延迟后返回上一页
+        // 延迟后跳转到camera页面
         setTimeout(() => {
-          uni.navigateBack();
+          // 使用navigateTo而不是redirectTo,这样用户可以通过返回按钮回到面试页面
+          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
+                      });
+                    }
+                  });
+                }
+              });
+            }
+          });
         }, 2000);
       }
     },
@@ -2317,24 +2366,48 @@ export default {
       // 更新历史时间 - 只有小幅度的自然播放才会更新历史时间
       this.historyTime = currentTime;
       
-      // 以下是原有的字幕处理逻辑
-      // 根据当前播放的视频索引选择对应的字幕数组
-      let currentSubtitles;
-      if (this.currentVideoIndex === 0) {
-        currentSubtitles = this.subtitles;
+      // 以下是字幕处理逻辑
+      let currentSubtitles = null;
+      
+      // 如果是追问问题,查找对应的字幕数组
+      if (this.isFollowUpQuestion && this.currentFollowUpQuestion) {
+        // 使用当前追问问题ID查找对应的字幕数组
+        const subtitleKey = `followUpSubtitles_${this.currentFollowUpQuestion.id}`;
+        if (this[subtitleKey]) {
+          currentSubtitles = this[subtitleKey];
+          console.log(`使用追问问题字幕数组: ${subtitleKey}`, currentSubtitles);
+        } else {
+          // 如果没有找到对应的字幕数组,创建一个默认的
+          currentSubtitles = [{
+            startTime: 0,
+            endTime: 30, // 默认30秒
+            text: this.currentFollowUpQuestion.digital_human_video_subtitle || this.currentFollowUpQuestion.question
+          }];
+          console.log('使用默认追问问题字幕');
+        }
       } else {
-        // 动态获取字幕数组
-        const subtitleArrayName = `question${this.currentVideoIndex}Subtitles`;
-        currentSubtitles = this[subtitleArrayName] || [];
+        // 根据当前播放的视频索引选择对应的字幕数组
+        if (this.currentVideoIndex === 0) {
+          currentSubtitles = this.subtitles;
+        } else {
+          // 动态获取字幕数组
+          const subtitleArrayName = `question${this.currentVideoIndex}Subtitles`;
+          currentSubtitles = this[subtitleArrayName] || [];
+        }
       }
       
       // 查找当前时间应该显示的字幕
-      const subtitle = currentSubtitles.find(
-        sub => currentTime >= sub.startTime && currentTime < sub.endTime
-      );
-      
-      // 更新当前字幕
-      this.currentSubtitle = subtitle ? subtitle.text : '';
+      if (currentSubtitles && currentSubtitles.length > 0) {
+        const subtitle = currentSubtitles.find(
+          sub => currentTime >= sub.startTime && currentTime < sub.endTime
+        );
+        
+        // 更新当前字幕
+        this.currentSubtitle = subtitle ? subtitle.text : '';
+      } else {
+        // 如果没有找到字幕数组或字幕数组为空,清空当前字幕
+        this.currentSubtitle = '';
+      }
     },
 
     // Add a new method to handle the "Start Recording" button click
@@ -2940,6 +3013,7 @@ export default {
       
       // 每次页面显示时重新获取问题
       this.fetchQuestions();
+      this.fetchFollowUpQuestions(); // 添加获取追问问题的调用
     },
 
     // 添加新方法:重置录制状态,准备重新回答
@@ -3065,7 +3139,162 @@ export default {
       e.stopPropagation();
       console.log('阻止视频控制操作');
       return false;
-    }
+    },
+
+    // 添加获取追问问题的方法
+    fetchFollowUpQuestions() {
+      // 获取tenant_id,如果没有则使用默认值1
+      const tenant_id = JSON.parse(uni.getStorageSync('userInfo')).tenant_id || '1';
+      
+      // 获取当前选择的职位ID
+      let position_id = 1; // 默认值
+      try {
+        const selectedJob = JSON.parse(uni.getStorageSync('selectedJob') || '{}');
+        if (selectedJob && selectedJob.id) {
+          position_id = selectedJob.id;
+          console.log('使用选择的职位ID获取追问问题:', position_id);
+        } else {
+          console.warn('未找到选择的职位信息,使用默认职位ID:', position_id);
+        }
+      } catch (e) {
+        console.error('解析职位信息失败:', e);
+      }
+      
+      // 构建完整的请求URL,便于调试
+      const timestamp = Date.now();
+      const requestUrl = `${apiBaseUrl}/api/wechat/open_questions/?position_id=${position_id}&tenant_id=${tenant_id}&question_form=5&_t=${timestamp}`;
+      console.log('获取追问问题的请求URL:', requestUrl);
+      
+      uni.request({
+        url: requestUrl,
+        method: 'GET',
+        success: (res) => {
+          if (res.data && res.data.code === 2000 && res.data.data && res.data.data.items) {
+            console.log('获取追问问题数据成功:', res.data.data.items);
+            
+            // 存储追问问题数据,并确保每个问题都有question_form=5标记
+            this.followUpQuestions = res.data.data.items.map(item => ({
+              ...item,
+              question_form: 5 // 确保每个追问问题都有正确的question_form值
+            }));
+            
+            // 处理追问问题数据,建立与父问题的关联
+            this.processFollowUpQuestions();
+          } else {
+            console.error('获取追问问题数据失败:', res.data);
+            // 初始化为空数组,避免undefined错误
+            this.followUpQuestions = [];
+          }
+        },
+        fail: (err) => {
+          console.error('请求追问问题数据失败:', err);
+          // 初始化为空数组,避免undefined错误
+          this.followUpQuestions = [];
+        }
+      });
+    },
+
+    // 改进处理追问问题数据的方法
+    processFollowUpQuestions() {
+      if (!this.followUpQuestions || this.followUpQuestions.length === 0) {
+        console.log('没有追问问题数据');
+        this.followUpQuestions = []; // 确保是数组
+        return;
+      }
+      
+      console.log('处理追问问题数据,总数:', this.followUpQuestions.length);
+      
+      // 过滤掉没有parent_question_id的追问问题
+      this.followUpQuestions = this.followUpQuestions.filter(q => q.parent_question_id);
+      
+      // 可以在这里进行额外的数据处理,如按照parent_question_id分组等
+      const parentQuestionIds = new Set();
+      this.followUpQuestions.forEach(question => {
+        if (question.parent_question_id) {
+          parentQuestionIds.add(question.parent_question_id);
+        }
+      });
+      
+      console.log('有追问的父问题ID:', Array.from(parentQuestionIds));
+      
+      // 初始化已播放追问记录对象
+      this.hasPlayedFollowUp = {};
+    },
+
+    // 添加新方法:检查并播放追问问题
+    checkAndPlayFollowUpQuestion(parentQuestionId) {
+      console.log('检查是否有追问问题,父问题ID:', parentQuestionId);
+      
+      // 如果已经播放过这个问题的追问,则直接进入下一个问题
+      if (this.hasPlayedFollowUp[parentQuestionId]) {
+        console.log('已经播放过此问题的追问,直接进入下一个问题');
+        this.retryCount = 0; // 重置重试次数
+        this.proceedToNextQuestion();
+        return;
+      }
+      
+      // 查找对应的追问问题
+      const followUpQuestion = this.followUpQuestions.find(q => 
+        q.parent_question_id === parentQuestionId && 
+        q.digital_human_video_url && // 确保有视频URL
+        q.question_form === 5 // 确保是追问问题类型
+      );
+      
+      if (followUpQuestion) {
+        console.log('找到追问问题:', followUpQuestion);
+        
+        // 标记此追问已播放
+        this.hasPlayedFollowUp[parentQuestionId] = true;
+        
+        // 标记当前是追问问题
+        this.isFollowUpQuestion = true;
+        
+        // 记录当前父问题ID,用于后续查找正确的追问问题
+        this.currentParentQuestionId = parentQuestionId;
+        
+        // 保存当前追问问题的完整信息,用于后续上传
+        this.currentFollowUpQuestion = followUpQuestion;
+        
+        // 播放追问问题视频
+        this.playFollowUpQuestionVideo(followUpQuestion);
+      } else {
+        console.log('没有找到对应的追问问题,继续下一个问题');
+        this.retryCount = 0; // 重置重试次数
+        this.proceedToNextQuestion();
+      }
+    },
+
+    // 添加新方法:播放追问问题视频
+    playFollowUpQuestionVideo(followUpQuestion) {
+      console.log('播放追问问题视频:', followUpQuestion.digital_human_video_url);
+      
+      // 设置视频URL
+      this.videoUrl = followUpQuestion.digital_human_video_url;
+      this.videoPlaying = true;
+      
+      // 设置追问问题的字幕,延长字幕显示时间
+      const followUpSubtitles = [{
+        startTime: 0,
+        endTime: 30, // 延长到30秒,确保字幕能够在整个视频播放过程中显示
+        text: followUpQuestion.digital_human_video_subtitle || followUpQuestion.question
+      }];
+      
+      // 动态创建字幕数组属性
+      const subtitleKey = `followUpSubtitles_${followUpQuestion.id}`;
+      this[subtitleKey] = followUpSubtitles;
+      console.log(`创建追问问题字幕数组: ${subtitleKey}`, followUpSubtitles);
+      
+      // 播放视频
+      this.$nextTick(() => {
+        const videoContext = uni.createVideoContext('myVideo', this);
+        if (videoContext) {
+          videoContext.play();
+          
+          // 立即显示字幕,不等待时间更新
+          this.currentSubtitle = followUpQuestion.digital_human_video_subtitle || followUpQuestion.question;
+        }
+      });
+    },
   }
 }
 </script>