|
@@ -63,15 +63,16 @@ const _sfc_main = {
|
|
|
questions: [],
|
|
|
// 添加新属性存储API返回的问题数据
|
|
|
introVideoUrl: (() => {
|
|
|
+ const DEFAULT_VIDEO_URL = "https://data.qicai321.com/minlong/ee4d9cce-c3d5-4350-8c6e-684283827897.mp4";
|
|
|
try {
|
|
|
const configStr = common_vendor.index.getStorageSync("configData");
|
|
|
- if (configStr && configStr.trim()) {
|
|
|
- return JSON.parse(configStr).digital_human_opening_video_url || "https://data.qicai321.com/minlong/ee4d9cce-c3d5-4350-8c6e-684283827897.mp4";
|
|
|
- }
|
|
|
- return "https://data.qicai321.com/minlong/ee4d9cce-c3d5-4350-8c6e-684283827897.mp4";
|
|
|
+ if (!configStr)
|
|
|
+ return DEFAULT_VIDEO_URL;
|
|
|
+ const config = JSON.parse(configStr);
|
|
|
+ return config.digital_human_opening_video_url || DEFAULT_VIDEO_URL;
|
|
|
} catch (error) {
|
|
|
console.warn("解析配置数据失败:", error);
|
|
|
- return {};
|
|
|
+ return DEFAULT_VIDEO_URL;
|
|
|
}
|
|
|
})(),
|
|
|
//'https://data.qicai321.com/minlong/ee4d9cce-c3d5-4350-8c6e-684283827897.mp4', // 保留介绍视频
|
|
@@ -123,8 +124,21 @@ const _sfc_main = {
|
|
|
// GIF图片的URL
|
|
|
globalSocketTask: null,
|
|
|
// 添加全局 WebSocket 连接对象
|
|
|
- lowScoreVideoUrl: "https://data.qicai321.com/minlong/latentsync/0530e7f5-1957-422d-8f34-ba4a92608081_result.mp4",
|
|
|
- // 低分提示视频URL
|
|
|
+ lowScoreVideoUrl: (() => {
|
|
|
+ var _a;
|
|
|
+ const DEFAULT_VIDEO_URL = "https://data.qicai321.com/minlong/latentsync/0530e7f5-1957-422d-8f34-ba4a92608081_result.mp4";
|
|
|
+ try {
|
|
|
+ const configStr = common_vendor.index.getStorageSync("configData");
|
|
|
+ if (!configStr)
|
|
|
+ return DEFAULT_VIDEO_URL;
|
|
|
+ const config = JSON.parse(configStr);
|
|
|
+ return ((_a = config.digital_human) == null ? void 0 : _a.middle_video_url) || DEFAULT_VIDEO_URL;
|
|
|
+ } catch (error) {
|
|
|
+ console.warn("解析配置数据失败:", error);
|
|
|
+ return DEFAULT_VIDEO_URL;
|
|
|
+ }
|
|
|
+ })(),
|
|
|
+ //'https://data.qicai321.com/minlong/latentsync/0530e7f5-1957-422d-8f34-ba4a92608081_result.mp4', // 低分提示视频URL
|
|
|
showRerecordButton: false,
|
|
|
// 控制重新录制按钮显示
|
|
|
isPlayingLowScoreVideo: false,
|
|
@@ -205,8 +219,12 @@ const _sfc_main = {
|
|
|
// 添加父问题的job_position_question_id
|
|
|
isFollowUpMode: false,
|
|
|
// 是否处于追问模式
|
|
|
- mainQuestionIndex: 0
|
|
|
+ mainQuestionIndex: 0,
|
|
|
// 当前主问题的索引
|
|
|
+ isVideoSwitching: false,
|
|
|
+ // 添加视频切换状态锁
|
|
|
+ originalQuestionSubtitle: null
|
|
|
+ // 保存原始字幕信息
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -374,10 +392,6 @@ const _sfc_main = {
|
|
|
await this.handleFollowUpQuestion(res.data);
|
|
|
} else {
|
|
|
console.error("面试互动接口返回错误:", res.data);
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "获取追问失败",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error("调用面试互动接口失败:", error);
|
|
@@ -389,10 +403,6 @@ const _sfc_main = {
|
|
|
console.log("开始播放追问音频, URL:", this.followUpAudioUrl);
|
|
|
if (!this.followUpAudioUrl) {
|
|
|
console.error("没有音频URL");
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "音频URL无效",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
reject(new Error("没有音频URL"));
|
|
|
return;
|
|
|
}
|
|
@@ -410,11 +420,6 @@ const _sfc_main = {
|
|
|
console.log("音频可以播放");
|
|
|
common_vendor.index.hideLoading();
|
|
|
this.isAudioPlaying = true;
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "正在播放追问",
|
|
|
- icon: "none",
|
|
|
- duration: 2e3
|
|
|
- });
|
|
|
});
|
|
|
innerAudioContext.onEnded(() => {
|
|
|
console.log("追问音频播放完成");
|
|
@@ -429,10 +434,6 @@ const _sfc_main = {
|
|
|
console.error("音频播放错误:", res);
|
|
|
this.isAudioPlaying = false;
|
|
|
common_vendor.index.hideLoading();
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "音频播放失败",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
reject(res);
|
|
|
this.stopAndDestroyAudio();
|
|
|
});
|
|
@@ -442,10 +443,6 @@ const _sfc_main = {
|
|
|
console.error("创建或播放音频失败:", error);
|
|
|
this.isAudioPlaying = false;
|
|
|
common_vendor.index.hideLoading();
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "音频播放失败",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
this.stopAndDestroyAudio();
|
|
|
reject(error);
|
|
|
}
|
|
@@ -476,11 +473,6 @@ const _sfc_main = {
|
|
|
bindAudioEvents(audioContext, resolve, reject) {
|
|
|
audioContext.onCanplay(() => {
|
|
|
console.log("音频可以播放");
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "正在播放追问",
|
|
|
- icon: "none",
|
|
|
- duration: 2e3
|
|
|
- });
|
|
|
});
|
|
|
audioContext.onTimeUpdate(() => {
|
|
|
console.log("音频播放进度:", audioContext.currentTime);
|
|
@@ -492,10 +484,6 @@ const _sfc_main = {
|
|
|
});
|
|
|
audioContext.onError((res) => {
|
|
|
console.error("音频播放错误:", res);
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "音频播放失败",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
this.cleanupAudioContext();
|
|
|
reject(res);
|
|
|
});
|
|
@@ -904,10 +892,6 @@ const _sfc_main = {
|
|
|
},
|
|
|
fail: () => {
|
|
|
this.videoPlaying = false;
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "无法加载视频,显示静态图片",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -942,6 +926,8 @@ const _sfc_main = {
|
|
|
this.showRerecordButton = true;
|
|
|
if (this.isFollowUpQuestion && this.currentFollowUpQuestion) {
|
|
|
this.currentSubtitle = this.currentFollowUpQuestion.digital_human_video_subtitle || this.currentFollowUpQuestion.question;
|
|
|
+ } else if (this.originalQuestionSubtitle) {
|
|
|
+ this.currentSubtitle = this.originalQuestionSubtitle;
|
|
|
}
|
|
|
} else {
|
|
|
console.log("已达到最大重试次数,继续下一题");
|
|
@@ -949,6 +935,7 @@ const _sfc_main = {
|
|
|
this.proceedToNextQuestion();
|
|
|
}
|
|
|
this.isPlayingLowScoreVideo = false;
|
|
|
+ this.originalQuestionSubtitle = null;
|
|
|
return;
|
|
|
}
|
|
|
if (this.isFollowUpQuestion) {
|
|
@@ -1017,11 +1004,12 @@ const _sfc_main = {
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- this.completeRecordingStop();
|
|
|
if (recordingDuration < lowScoreDuration) {
|
|
|
console.log(`录制时间 ${recordingDuration} 秒,少于 ${lowScoreDuration} 秒,将播放低分提示视频`);
|
|
|
- this.needPlayLowScoreVideo = true;
|
|
|
+ this.completeRecordingStop(false);
|
|
|
+ this.playLowScoreVideo();
|
|
|
} else {
|
|
|
+ this.completeRecordingStop(true);
|
|
|
this.needPlayLowScoreVideo = false;
|
|
|
}
|
|
|
},
|
|
@@ -1203,10 +1191,6 @@ const _sfc_main = {
|
|
|
startBrowserRecording() {
|
|
|
if (!this.cameraStream) {
|
|
|
console.error("没有可用的摄像头流");
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "录制失败,摄像头未就绪",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
this.proceedToNextQuestion();
|
|
|
return;
|
|
|
}
|
|
@@ -1306,10 +1290,6 @@ const _sfc_main = {
|
|
|
console.log("MediaRecorder停止,数据块数量:", this.recordedChunks.length);
|
|
|
if (this.recordedChunks.length === 0) {
|
|
|
console.error("没有录制到数据");
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "录制失败,未捕获到数据",
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
this.proceedToNextQuestion();
|
|
|
return;
|
|
|
}
|
|
@@ -1350,34 +1330,6 @@ const _sfc_main = {
|
|
|
console.error("开始录制失败:", e);
|
|
|
}
|
|
|
},
|
|
|
- // 添加新方法:停止录制用户回答
|
|
|
- stopRecordingAnswer() {
|
|
|
- console.log("停止录制用户回答");
|
|
|
- if (this.countdownTimer) {
|
|
|
- clearInterval(this.countdownTimer);
|
|
|
- this.countdownTimer = null;
|
|
|
- this.showCountdown = false;
|
|
|
- }
|
|
|
- this.isWaitingForAnswer = false;
|
|
|
- const recordingDuration = this.getRecordingDuration();
|
|
|
- const minimumDuration = 3;
|
|
|
- const lowScoreDuration = 7;
|
|
|
- if (recordingDuration < minimumDuration) {
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "录制时间过短,请至少录制3秒",
|
|
|
- icon: "none",
|
|
|
- duration: 2e3
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- this.completeRecordingStop();
|
|
|
- if (recordingDuration < lowScoreDuration) {
|
|
|
- console.log(`录制时间 ${recordingDuration} 秒,少于 ${lowScoreDuration} 秒,将播放低分提示视频`);
|
|
|
- this.needPlayLowScoreVideo = true;
|
|
|
- } else {
|
|
|
- this.needPlayLowScoreVideo = false;
|
|
|
- }
|
|
|
- },
|
|
|
// 添加新方法:获取录制时长
|
|
|
getRecordingDuration() {
|
|
|
if (this.recordingStartTime) {
|
|
@@ -1414,14 +1366,9 @@ const _sfc_main = {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "请重新开始回答",
|
|
|
- icon: "none",
|
|
|
- duration: 2e3
|
|
|
- });
|
|
|
},
|
|
|
// 修改 completeRecordingStop 方法,确保正确处理追问问题ID
|
|
|
- completeRecordingStop() {
|
|
|
+ completeRecordingStop(uploadVideo = true) {
|
|
|
console.log("完成录制停止");
|
|
|
if (this.recordingTimer) {
|
|
|
clearInterval(this.recordingTimer);
|
|
@@ -1433,9 +1380,29 @@ const _sfc_main = {
|
|
|
const systemInfo = common_vendor.index.getSystemInfoSync();
|
|
|
const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
|
|
|
if (isMiniProgram) {
|
|
|
- this.stopMiniProgramRecording();
|
|
|
+ if (uploadVideo) {
|
|
|
+ this.stopMiniProgramRecording();
|
|
|
+ } else {
|
|
|
+ if (this.cameraContext) {
|
|
|
+ this.cameraContext.stopRecord({
|
|
|
+ success: () => {
|
|
|
+ console.log("相机录制已停止,不上传视频");
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.error("停止相机录制失败:", err);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.stopBrowserRecording();
|
|
|
+ if (uploadVideo) {
|
|
|
+ this.stopBrowserRecording();
|
|
|
+ } else {
|
|
|
+ if (this.mediaRecorder && this.mediaRecorder.state !== "inactive") {
|
|
|
+ this.mediaRecorder.stop();
|
|
|
+ this.recordedChunks = [];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (this.isFollowUpQuestion && this.currentFollowUpQuestion) {
|
|
|
console.log("当前是追问问题,记录追问问题ID:", this.currentFollowUpQuestion.id);
|
|
@@ -1536,11 +1503,6 @@ const _sfc_main = {
|
|
|
this.uploadQueue.push(uploadTask);
|
|
|
this.uploadProgress[uploadTask.id] = 0;
|
|
|
this.uploadStatus[uploadTask.id] = "pending";
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "正在上传回答...",
|
|
|
- icon: "loading",
|
|
|
- duration: 1500
|
|
|
- });
|
|
|
this.updateUploadStatusText();
|
|
|
return new Promise((resolve) => {
|
|
|
const checkUploadStatus = () => {
|
|
@@ -1713,11 +1675,6 @@ const _sfc_main = {
|
|
|
}, 5e3);
|
|
|
} else {
|
|
|
console.log("超过最大重试次数,放弃上传");
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "视频上传失败,请稍后重试",
|
|
|
- icon: "none",
|
|
|
- duration: 2e3
|
|
|
- });
|
|
|
this.uploadQueue.shift();
|
|
|
this.processUploadQueue();
|
|
|
}
|
|
@@ -1756,14 +1713,16 @@ const _sfc_main = {
|
|
|
success: async (res) => {
|
|
|
try {
|
|
|
if (res.data.code === 200 || res.data.code === 2e3) {
|
|
|
+ if (res.data.data && res.data.data.transcription_status === "pending") {
|
|
|
+ console.log("视频转写进行中,5秒后重试");
|
|
|
+ setTimeout(() => {
|
|
|
+ this.checkTranscriptionStatus(task, followUpRequestData);
|
|
|
+ }, 5e3);
|
|
|
+ return;
|
|
|
+ }
|
|
|
console.log("追问视频提交成功");
|
|
|
this.isFollowUpMode = false;
|
|
|
this.currentVideoIndex = this.mainQuestionIndex;
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "回答已提交",
|
|
|
- icon: "success",
|
|
|
- duration: 1500
|
|
|
- });
|
|
|
this.uploadQueue.shift();
|
|
|
this.processUploadQueue();
|
|
|
this.$nextTick(() => {
|
|
@@ -1785,6 +1744,7 @@ const _sfc_main = {
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
console.error("提交视频失败:", err);
|
|
|
+ this.handleSubmitFailure(task, "提交失败: " + err.errMsg);
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
@@ -1807,11 +1767,6 @@ const _sfc_main = {
|
|
|
console.error("面试互动接口调用失败:", error);
|
|
|
this.proceedToNextQuestion();
|
|
|
}
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "回答已提交",
|
|
|
- icon: "success",
|
|
|
- duration: 1500
|
|
|
- });
|
|
|
this.uploadQueue.shift();
|
|
|
this.processUploadQueue();
|
|
|
} else {
|
|
@@ -1837,15 +1792,75 @@ const _sfc_main = {
|
|
|
}, 5e3);
|
|
|
} else {
|
|
|
console.log("超过最大重试次数,放弃提交");
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "视频提交失败,请稍后重试",
|
|
|
- icon: "none",
|
|
|
- duration: 2e3
|
|
|
- });
|
|
|
this.uploadQueue.shift();
|
|
|
this.processUploadQueue();
|
|
|
}
|
|
|
},
|
|
|
+ // 添加检查转写状态的方法
|
|
|
+ checkTranscriptionStatus(task, requestData, retryCount = 0) {
|
|
|
+ const maxRetries = 24;
|
|
|
+ const retryInterval = 5e3;
|
|
|
+ if (retryCount >= maxRetries) {
|
|
|
+ console.log("转写超时,继续下一个问题");
|
|
|
+ this.isFollowUpMode = false;
|
|
|
+ this.currentVideoIndex = this.mainQuestionIndex;
|
|
|
+ this.uploadQueue.shift();
|
|
|
+ this.processUploadQueue();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ common_vendor.index.request({
|
|
|
+ url: `${common_config.apiBaseUrl}/voice_interview/check_transcription_status/`,
|
|
|
+ method: "POST",
|
|
|
+ data: {
|
|
|
+ application_id: requestData.application_id,
|
|
|
+ original_question_id: requestData.original_question_id,
|
|
|
+ video_url: requestData.video_url
|
|
|
+ },
|
|
|
+ header: {
|
|
|
+ "content-type": "application/x-www-form-urlencoded"
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200 || res.data.code === 2e3) {
|
|
|
+ if (res.data.data && res.data.data.status === "completed") {
|
|
|
+ console.log("视频转写完成");
|
|
|
+ this.isFollowUpMode = false;
|
|
|
+ this.currentVideoIndex = this.mainQuestionIndex;
|
|
|
+ this.uploadQueue.shift();
|
|
|
+ this.processUploadQueue();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.currentVideoIndex < this.videoList.length) {
|
|
|
+ this.videoUrl = this.videoList[this.currentVideoIndex];
|
|
|
+ this.videoPlaying = true;
|
|
|
+ const videoContext = common_vendor.index.createVideoContext("myVideo", this);
|
|
|
+ if (videoContext) {
|
|
|
+ videoContext.play();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log(`转写进行中,${retryInterval / 1e3}秒后重试 (${retryCount + 1}/${maxRetries})`);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.checkTranscriptionStatus(task, requestData, retryCount + 1);
|
|
|
+ }, retryInterval);
|
|
|
+ }
|
|
|
+ } else if (res.data.message === "面试视频尚未完成转写" || res.data.success === false) {
|
|
|
+ console.log(`转写未完成,${retryInterval / 1e3}秒后重试 (${retryCount + 1}/${maxRetries})`);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.checkTranscriptionStatus(task, requestData, retryCount + 1);
|
|
|
+ }, retryInterval);
|
|
|
+ } else {
|
|
|
+ this.handleSubmitFailure(task, "检查转写状态失败: " + (res.data.msg || "未知错误"));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.error("检查转写状态失败:", err);
|
|
|
+ console.log(`网络请求失败,${retryInterval / 1e3}秒后重试 (${retryCount + 1}/${maxRetries})`);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.checkTranscriptionStatus(task, requestData, retryCount + 1);
|
|
|
+ }, retryInterval);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 添加新方法:更新上传状态文本
|
|
|
updateUploadStatusText() {
|
|
|
if (this.uploadQueue.length === 0) {
|
|
@@ -1879,18 +1894,29 @@ const _sfc_main = {
|
|
|
},
|
|
|
// 修改 proceedToNextQuestion 方法,确保在切换视频时重置历史时间
|
|
|
proceedToNextQuestion() {
|
|
|
+ if (this.isVideoSwitching) {
|
|
|
+ console.log("正在切换视频中,请等待...");
|
|
|
+ return;
|
|
|
+ }
|
|
|
console.log("继续下一个问题");
|
|
|
+ this.isVideoSwitching = true;
|
|
|
+ const currentVideo = common_vendor.index.createVideoContext("myVideo", this);
|
|
|
+ if (currentVideo) {
|
|
|
+ currentVideo.stop();
|
|
|
+ this.videoPlaying = false;
|
|
|
+ }
|
|
|
this.currentVideoIndex++;
|
|
|
this.historyTime = 0;
|
|
|
if (this.currentVideoIndex < this.videoList.length) {
|
|
|
this.videoUrl = this.videoList[this.currentVideoIndex];
|
|
|
- this.videoPlaying = true;
|
|
|
- this.$nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.videoPlaying = true;
|
|
|
const videoContext = common_vendor.index.createVideoContext("myVideo", this);
|
|
|
if (videoContext) {
|
|
|
videoContext.play();
|
|
|
}
|
|
|
- });
|
|
|
+ this.isVideoSwitching = false;
|
|
|
+ }, 100);
|
|
|
} else {
|
|
|
console.log("所有视频已播放完毕");
|
|
|
this.stopUserCamera();
|
|
@@ -1900,6 +1926,7 @@ const _sfc_main = {
|
|
|
const jobId = currentJobDetail ? currentJobDetail.id : null;
|
|
|
console.log("当前职位ID:", jobId);
|
|
|
setTimeout(() => {
|
|
|
+ this.isVideoSwitching = false;
|
|
|
if (jobId === 9) {
|
|
|
common_vendor.index.navigateTo({
|
|
|
url: "/pages/interview-question/interview-question",
|
|
@@ -2542,7 +2569,8 @@ const _sfc_main = {
|
|
|
this.showRerecordButton = false;
|
|
|
this.videoUrl = this.lowScoreVideoUrl;
|
|
|
this.videoPlaying = true;
|
|
|
- const originalSubtitle = this.currentSubtitle;
|
|
|
+ const currentQuestion = this.getCurrentQuestionByIndex(this.currentVideoIndex);
|
|
|
+ const originalSubtitle = currentQuestion ? currentQuestion.digital_human_video_subtitle || currentQuestion.question : this.currentSubtitle;
|
|
|
this.currentSubtitle = "";
|
|
|
this.$nextTick(() => {
|
|
|
const videoContext = common_vendor.index.createVideoContext("myVideo", this);
|
|
@@ -2558,16 +2586,10 @@ const _sfc_main = {
|
|
|
translation: "I didn't quite catch what you said, could you please repeat it?"
|
|
|
}
|
|
|
];
|
|
|
- setTimeout(() => {
|
|
|
- if (this.isFollowUpQuestion && this.currentFollowUpQuestion) {
|
|
|
- this.currentSubtitle = this.currentFollowUpQuestion.digital_human_video_subtitle || this.currentFollowUpQuestion.question;
|
|
|
- } else {
|
|
|
- this.currentSubtitle = originalSubtitle;
|
|
|
- }
|
|
|
- }, 3e3);
|
|
|
}, 500);
|
|
|
}
|
|
|
});
|
|
|
+ this.originalQuestionSubtitle = originalSubtitle;
|
|
|
},
|
|
|
// 添加新方法:处理重新录制按钮点击
|
|
|
handleRerecordButtonClick() {
|
|
@@ -2715,8 +2737,10 @@ const _sfc_main = {
|
|
|
console.log("找到追问问题:", followUpQuestion);
|
|
|
const recordingDuration = this.getRecordingDuration();
|
|
|
const lowScoreDuration = 7;
|
|
|
+ const minDuration = 3;
|
|
|
if (recordingDuration < lowScoreDuration) {
|
|
|
- console.log(`录制时间 ${recordingDuration} 秒,少于 ${lowScoreDuration} 秒,将播放低分提示视频`);
|
|
|
+ let message = recordingDuration < minDuration ? `录制时间 ${recordingDuration} 秒,少于最小时长 ${minDuration} 秒` : `录制时间 ${recordingDuration} 秒,少于标准时长 ${lowScoreDuration} 秒`;
|
|
|
+ console.log(message + ",将播放低分提示视频");
|
|
|
this.retryCount++;
|
|
|
this.needPlayLowScoreVideo = true;
|
|
|
this.playLowScoreVideo();
|
|
@@ -2821,32 +2845,54 @@ const _sfc_main = {
|
|
|
clearInterval(this.personDetectionInterval);
|
|
|
}
|
|
|
this.personDetectionInterval = setInterval(() => {
|
|
|
- if (this.personDetectionSocket && this.cameraContext) {
|
|
|
+ try {
|
|
|
+ if (!this.personDetectionSocket || !this.cameraContext) {
|
|
|
+ console.warn("人脸检测:相机上下文或WebSocket连接未就绪");
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.cameraContext.takePhoto({
|
|
|
quality: "low",
|
|
|
success: (res) => {
|
|
|
- const tempFilePath = res.tempImagePath;
|
|
|
- common_vendor.index.getFileSystemManager().readFile({
|
|
|
- filePath: tempFilePath,
|
|
|
- encoding: "base64",
|
|
|
- success: (res2) => {
|
|
|
- const base64Image = res2.data;
|
|
|
- this.personDetectionSocket.send({
|
|
|
- data: JSON.stringify({
|
|
|
- type: "person_detection",
|
|
|
- image_data: base64Image
|
|
|
- })
|
|
|
- });
|
|
|
- },
|
|
|
- fail: (error) => {
|
|
|
- console.error("Error reading image file:", error);
|
|
|
+ try {
|
|
|
+ const tempFilePath = res.tempImagePath;
|
|
|
+ if (!tempFilePath) {
|
|
|
+ console.warn("人脸检测:未获取到有效的图片路径");
|
|
|
+ return;
|
|
|
}
|
|
|
- });
|
|
|
+ common_vendor.index.getFileSystemManager().readFile({
|
|
|
+ filePath: tempFilePath,
|
|
|
+ encoding: "base64",
|
|
|
+ success: (res2) => {
|
|
|
+ try {
|
|
|
+ const base64Image = res2.data;
|
|
|
+ if (!this.personDetectionSocket || this.personDetectionSocket.readyState !== 1) {
|
|
|
+ console.warn("人脸检测:WebSocket连接已断开或未就绪");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.personDetectionSocket.send({
|
|
|
+ data: JSON.stringify({
|
|
|
+ type: "person_detection",
|
|
|
+ image_data: base64Image
|
|
|
+ })
|
|
|
+ });
|
|
|
+ } catch (wsError) {
|
|
|
+ console.error("人脸检测:发送WebSocket数据时出错:", wsError);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (error) => {
|
|
|
+ console.error("人脸检测:读取图片文件失败:", error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } catch (fileError) {
|
|
|
+ console.error("人脸检测:处理图片文件时出错:", fileError);
|
|
|
+ }
|
|
|
},
|
|
|
fail: (error) => {
|
|
|
- console.error("Error taking photo:", error);
|
|
|
+ console.error("人脸检测:拍照失败:", error);
|
|
|
}
|
|
|
});
|
|
|
+ } catch (mainError) {
|
|
|
+ console.error("人脸检测:主流程执行出错:", mainError);
|
|
|
}
|
|
|
}, 3e3);
|
|
|
},
|
|
@@ -2963,11 +3009,6 @@ const _sfc_main = {
|
|
|
console.log("音频可以播放");
|
|
|
common_vendor.index.hideLoading();
|
|
|
this.isAudioPlaying = true;
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "正在播放追问",
|
|
|
- icon: "none",
|
|
|
- duration: 2e3
|
|
|
- });
|
|
|
});
|
|
|
innerAudioContext.onEnded(() => {
|
|
|
console.log("追问音频播放完成");
|