|
@@ -97,6 +97,8 @@ const _sfc_main = {
|
|
// 添加上传队列相关数据
|
|
// 添加上传队列相关数据
|
|
uploadQueue: [],
|
|
uploadQueue: [],
|
|
// 存储待上传的视频
|
|
// 存储待上传的视频
|
|
|
|
+ backgroundUploadQueue: [],
|
|
|
|
+ // 存储后台上传的视频
|
|
isUploading: false,
|
|
isUploading: false,
|
|
// 标记是否正在上传
|
|
// 标记是否正在上传
|
|
uploadProgress: {},
|
|
uploadProgress: {},
|
|
@@ -975,7 +977,7 @@ const _sfc_main = {
|
|
console.log(`显示重新录制按钮 (重试次数: ${this.retryCount + 1}/${this.maxRetryAttempts})`);
|
|
console.log(`显示重新录制按钮 (重试次数: ${this.retryCount + 1}/${this.maxRetryAttempts})`);
|
|
this.showRerecordButton = true;
|
|
this.showRerecordButton = true;
|
|
if (this.isFollowUpQuestion && this.currentFollowUpQuestion) {
|
|
if (this.isFollowUpQuestion && this.currentFollowUpQuestion) {
|
|
- this.currentSubtitle = this.currentFollowUpQuestion.digital_human_video_subtitle || this.currentFollowUpQuestion.question;
|
|
|
|
|
|
+ this.currentSubtitle = this.currentFollowUpQuestion.question || this.currentFollowUpQuestion.question;
|
|
} else if (this.originalQuestionSubtitle) {
|
|
} else if (this.originalQuestionSubtitle) {
|
|
this.currentSubtitle = this.originalQuestionSubtitle;
|
|
this.currentSubtitle = this.originalQuestionSubtitle;
|
|
}
|
|
}
|
|
@@ -1070,14 +1072,15 @@ const _sfc_main = {
|
|
this.isRecording = true;
|
|
this.isRecording = true;
|
|
this.recordingStartTime = Date.now();
|
|
this.recordingStartTime = Date.now();
|
|
this.recordingTimerCount = 0;
|
|
this.recordingTimerCount = 0;
|
|
|
|
+ this.maxRecordingTime = this.getCurrentQuestionRecommendedDuration();
|
|
this.remainingTime = this.maxRecordingTime;
|
|
this.remainingTime = this.maxRecordingTime;
|
|
this.recordingTimer = setInterval(() => {
|
|
this.recordingTimer = setInterval(() => {
|
|
this.recordingTimerCount++;
|
|
this.recordingTimerCount++;
|
|
this.remainingTime = Math.max(0, this.maxRecordingTime - this.recordingTimerCount);
|
|
this.remainingTime = Math.max(0, this.maxRecordingTime - this.recordingTimerCount);
|
|
this.recordingTimeDisplay = this.formatTime(this.recordingTimerCount);
|
|
this.recordingTimeDisplay = this.formatTime(this.recordingTimerCount);
|
|
- this.progressPercent = this.recordingTimerCount / this.maxRecordingTime * 100;
|
|
|
|
|
|
+ this.progressPercent = Math.min(this.recordingTimerCount / this.maxRecordingTime * 100, 100);
|
|
if (this.recordingTimerCount >= this.maxRecordingTime) {
|
|
if (this.recordingTimerCount >= this.maxRecordingTime) {
|
|
- console.log("已达到最大录制时间(5分钟),自动停止录制");
|
|
|
|
|
|
+ console.log(`已达到最大录制时间(${this.maxRecordingTime}秒),自动停止录制`);
|
|
this.stopRecordingAnswer();
|
|
this.stopRecordingAnswer();
|
|
}
|
|
}
|
|
}, 1e3);
|
|
}, 1e3);
|
|
@@ -1136,9 +1139,10 @@ const _sfc_main = {
|
|
}
|
|
}
|
|
if (isIOS) {
|
|
if (isIOS) {
|
|
console.log("iOS: 检查相机状态");
|
|
console.log("iOS: 检查相机状态");
|
|
|
|
+ const maxDuration = this.getCurrentQuestionRecommendedDuration() * 1e3;
|
|
const options = {
|
|
const options = {
|
|
- timeout: 3e5,
|
|
|
|
- // 300秒超时 (5分钟)
|
|
|
|
|
|
+ timeout: maxDuration,
|
|
|
|
+ // 使用当前问题的推荐时长
|
|
quality: "low",
|
|
quality: "low",
|
|
// 降低质量
|
|
// 降低质量
|
|
compressed: true,
|
|
compressed: true,
|
|
@@ -1158,9 +1162,10 @@ const _sfc_main = {
|
|
this.useAlternativeRecordingMethod();
|
|
this.useAlternativeRecordingMethod();
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
|
|
+ const maxDuration = this.getCurrentQuestionRecommendedDuration() * 1e3;
|
|
const options = {
|
|
const options = {
|
|
- timeout: 3e5,
|
|
|
|
- // 300秒超时 (5分钟)
|
|
|
|
|
|
+ timeout: maxDuration,
|
|
|
|
+ // 使用当前问题的推荐时长
|
|
quality: "medium",
|
|
quality: "medium",
|
|
compressed: true,
|
|
compressed: true,
|
|
success: () => {
|
|
success: () => {
|
|
@@ -1189,8 +1194,8 @@ const _sfc_main = {
|
|
if (res.tapIndex === 0) {
|
|
if (res.tapIndex === 0) {
|
|
common_vendor.index.chooseVideo({
|
|
common_vendor.index.chooseVideo({
|
|
sourceType: ["album"],
|
|
sourceType: ["album"],
|
|
- maxDuration: 300,
|
|
|
|
- // 从60秒改为300秒
|
|
|
|
|
|
+ maxDuration: this.getCurrentQuestionRecommendedDuration(),
|
|
|
|
+ // 使用当前问题的推荐时长
|
|
camera: "front",
|
|
camera: "front",
|
|
success: (res2) => {
|
|
success: (res2) => {
|
|
console.log("选择视频成功:", res2.tempFilePath);
|
|
console.log("选择视频成功:", res2.tempFilePath);
|
|
@@ -1556,21 +1561,243 @@ const _sfc_main = {
|
|
this.uploadProgress[uploadTask.id] = 0;
|
|
this.uploadProgress[uploadTask.id] = 0;
|
|
this.uploadStatus[uploadTask.id] = "pending";
|
|
this.uploadStatus[uploadTask.id] = "pending";
|
|
this.updateUploadStatusText();
|
|
this.updateUploadStatusText();
|
|
- return new Promise((resolve) => {
|
|
|
|
- const checkUploadStatus = () => {
|
|
|
|
- if (!this.isUploading && this.uploadQueue.length === 0) {
|
|
|
|
- this.handlePostUploadActions(uploadTask);
|
|
|
|
- resolve();
|
|
|
|
|
|
+ if (isFollowUpQuestionUpload) {
|
|
|
|
+ console.log("追问问题使用后台上传,不阻塞流程");
|
|
|
|
+ this.handlePostUploadActions(uploadTask);
|
|
|
|
+ this.startBackgroundUpload(uploadTask);
|
|
|
|
+ return Promise.resolve();
|
|
|
|
+ } else {
|
|
|
|
+ return new Promise((resolve) => {
|
|
|
|
+ const checkUploadStatus = () => {
|
|
|
|
+ if (!this.isUploading && this.uploadQueue.length === 0) {
|
|
|
|
+ this.handlePostUploadActions(uploadTask);
|
|
|
|
+ resolve();
|
|
|
|
+ } else {
|
|
|
|
+ setTimeout(checkUploadStatus, 100);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ if (!this.isUploading) {
|
|
|
|
+ this.processUploadQueue();
|
|
|
|
+ }
|
|
|
|
+ checkUploadStatus();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:启动后台上传
|
|
|
|
+ startBackgroundUpload(task) {
|
|
|
|
+ console.log("启动后台上传任务:", task.id);
|
|
|
|
+ task.isBackgroundUpload = true;
|
|
|
|
+ const taskIndex = this.uploadQueue.findIndex((t) => t.id === task.id);
|
|
|
|
+ if (taskIndex !== -1) {
|
|
|
|
+ this.uploadQueue.splice(taskIndex, 1);
|
|
|
|
+ }
|
|
|
|
+ if (!this.backgroundUploadQueue) {
|
|
|
|
+ this.backgroundUploadQueue = [];
|
|
|
|
+ }
|
|
|
|
+ this.backgroundUploadQueue.push(task);
|
|
|
|
+ this.processBackgroundUploadQueue();
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:处理后台上传队列
|
|
|
|
+ processBackgroundUploadQueue() {
|
|
|
|
+ if (!this.backgroundUploadQueue || this.backgroundUploadQueue.length === 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const task = this.backgroundUploadQueue[0];
|
|
|
|
+ console.log("开始后台上传:", task.id);
|
|
|
|
+ this.uploadStatus[task.id] = "uploading";
|
|
|
|
+ this.updateUploadStatusText();
|
|
|
|
+ task.attempts++;
|
|
|
|
+ if (typeof task.file === "string") {
|
|
|
|
+ this.uploadFileWithUniBackground(task);
|
|
|
|
+ } else {
|
|
|
|
+ this.uploadFileWithXHRBackground(task);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:使用XMLHttpRequest后台上传文件
|
|
|
|
+ uploadFileWithXHRBackground(task) {
|
|
|
|
+ const userInfo = common_vendor.index.getStorageSync("userInfo");
|
|
|
|
+ const openid = userInfo ? JSON.parse(userInfo).openid || "" : "";
|
|
|
|
+ const tenant_id = JSON.parse(common_vendor.index.getStorageSync("userInfo")).tenant_id || "1";
|
|
|
|
+ const formData = new FormData();
|
|
|
|
+ formData.append("file", task.file);
|
|
|
|
+ formData.append("openid", openid);
|
|
|
|
+ formData.append("tenant_id", tenant_id);
|
|
|
|
+ formData.append("application_id", common_vendor.index.getStorageSync("appId"));
|
|
|
|
+ formData.append("question_id", task.questionId);
|
|
|
|
+ formData.append("video_duration", task.videoDuration || 0);
|
|
|
|
+ formData.append("has_audio", "true");
|
|
|
|
+ const xhr = new XMLHttpRequest();
|
|
|
|
+ xhr.upload.onprogress = (event) => {
|
|
|
|
+ if (event.lengthComputable) {
|
|
|
|
+ const progress = Math.round(event.loaded / event.total * 100);
|
|
|
|
+ this.uploadProgress[task.id] = progress;
|
|
|
|
+ this.updateUploadStatusText();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ xhr.onload = () => {
|
|
|
|
+ if (xhr.status === 200) {
|
|
|
|
+ try {
|
|
|
|
+ const res = JSON.parse(xhr.responseText);
|
|
|
|
+ console.log("后台上传响应:", res);
|
|
|
|
+ if (res.code === 2e3) {
|
|
|
|
+ const videoUrl = res.data.url || res.data.photoUrl || "";
|
|
|
|
+ if (videoUrl) {
|
|
|
|
+ this.uploadStatus[task.id] = "success";
|
|
|
|
+ this.updateUploadStatusText();
|
|
|
|
+ this.submitVideoToInterviewBackground(videoUrl, task);
|
|
|
|
+ } else {
|
|
|
|
+ this.handleBackgroundUploadFailure(task, "视频URL获取失败");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.handleBackgroundUploadFailure(task, res.msg || "上传失败");
|
|
|
|
+ }
|
|
|
|
+ } catch (e) {
|
|
|
|
+ this.handleBackgroundUploadFailure(task, "解析响应失败");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.handleBackgroundUploadFailure(task, "HTTP状态: " + xhr.status);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ xhr.onerror = () => {
|
|
|
|
+ this.handleBackgroundUploadFailure(task, "网络错误");
|
|
|
|
+ };
|
|
|
|
+ xhr.ontimeout = () => {
|
|
|
|
+ this.handleBackgroundUploadFailure(task, "上传超时");
|
|
|
|
+ };
|
|
|
|
+ xhr.open("POST", `${common_config.apiBaseUrl}/api/upload/`);
|
|
|
|
+ xhr.send(formData);
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:使用uni.uploadFile后台上传文件
|
|
|
|
+ uploadFileWithUniBackground(task) {
|
|
|
|
+ const userInfo = common_vendor.index.getStorageSync("userInfo");
|
|
|
|
+ const openid = userInfo ? JSON.parse(userInfo).openid || "" : "";
|
|
|
|
+ const tenant_id = JSON.parse(common_vendor.index.getStorageSync("userInfo")).tenant_id || "1";
|
|
|
|
+ const uploadTask = common_vendor.index.uploadFile({
|
|
|
|
+ url: `${common_config.apiBaseUrl}/api/upload/`,
|
|
|
|
+ filePath: task.file,
|
|
|
|
+ name: "file",
|
|
|
|
+ formData: {
|
|
|
|
+ openid,
|
|
|
|
+ tenant_id,
|
|
|
|
+ application_id: common_vendor.index.getStorageSync("appId"),
|
|
|
|
+ question_id: task.questionId,
|
|
|
|
+ video_duration: task.videoDuration || 0,
|
|
|
|
+ has_audio: "true"
|
|
|
|
+ },
|
|
|
|
+ success: (uploadRes) => {
|
|
|
|
+ try {
|
|
|
|
+ const res = JSON.parse(uploadRes.data);
|
|
|
|
+ console.log("后台上传响应:", res);
|
|
|
|
+ if (res.code === 2e3) {
|
|
|
|
+ const videoUrl = res.data.permanent_link || res.data.url || "";
|
|
|
|
+ if (videoUrl) {
|
|
|
|
+ this.uploadStatus[task.id] = "success";
|
|
|
|
+ this.updateUploadStatusText();
|
|
|
|
+ this.submitVideoToInterviewBackground(videoUrl, task);
|
|
|
|
+ } else {
|
|
|
|
+ this.handleBackgroundUploadFailure(task, "视频URL获取失败");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.handleBackgroundUploadFailure(task, res.msg || "上传失败");
|
|
|
|
+ }
|
|
|
|
+ } catch (e) {
|
|
|
|
+ this.handleBackgroundUploadFailure(task, "解析响应失败");
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ fail: (err) => {
|
|
|
|
+ this.handleBackgroundUploadFailure(task, err.errMsg || "上传失败");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ uploadTask.onProgressUpdate((res) => {
|
|
|
|
+ this.uploadProgress[task.id] = res.progress;
|
|
|
|
+ this.updateUploadStatusText();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:处理后台上传失败
|
|
|
|
+ handleBackgroundUploadFailure(task, errorMsg) {
|
|
|
|
+ console.error("后台上传失败:", errorMsg);
|
|
|
|
+ this.uploadStatus[task.id] = "failed";
|
|
|
|
+ this.updateUploadStatusText();
|
|
|
|
+ if (task.attempts < task.maxAttempts) {
|
|
|
|
+ console.log(`将在5秒后重试后台上传,当前尝试次数: ${task.attempts}/${task.maxAttempts}`);
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.uploadProgress[task.id] = 0;
|
|
|
|
+ if (typeof task.file !== "string") {
|
|
|
|
+ this.uploadFileWithXHRBackground(task);
|
|
} else {
|
|
} else {
|
|
- setTimeout(checkUploadStatus, 100);
|
|
|
|
|
|
+ this.uploadFileWithUniBackground(task);
|
|
}
|
|
}
|
|
- };
|
|
|
|
- if (!this.isUploading) {
|
|
|
|
- this.processUploadQueue();
|
|
|
|
|
|
+ }, 5e3);
|
|
|
|
+ } else {
|
|
|
|
+ console.log("超过最大重试次数,放弃后台上传");
|
|
|
|
+ if (this.backgroundUploadQueue) {
|
|
|
|
+ const taskIndex = this.backgroundUploadQueue.findIndex((t) => t.id === task.id);
|
|
|
|
+ if (taskIndex !== -1) {
|
|
|
|
+ this.backgroundUploadQueue.splice(taskIndex, 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.processBackgroundUploadQueue();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:后台上传提交到面试接口
|
|
|
|
+ submitVideoToInterviewBackground(videoUrl, task) {
|
|
|
|
+ const followUpRequestData = {
|
|
|
|
+ application_id: common_vendor.index.getStorageSync("appId"),
|
|
|
|
+ tenant_id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).tenant_id || "1",
|
|
|
|
+ video_url: videoUrl,
|
|
|
|
+ original_question_id: this.parentJobPositionQuestionId,
|
|
|
|
+ // 使用保存的job_position_question_id
|
|
|
|
+ follow_up_question: task.questionText,
|
|
|
|
+ video_duration: task.videoDuration,
|
|
|
|
+ openid: JSON.parse(common_vendor.index.getStorageSync("userInfo")).openid || ""
|
|
|
|
+ };
|
|
|
|
+ console.log("后台上传提交追问视频:", followUpRequestData);
|
|
|
|
+ common_vendor.index.request({
|
|
|
|
+ url: `${common_config.apiBaseUrl}/voice_interview/upload_follow_up_video/`,
|
|
|
|
+ method: "POST",
|
|
|
|
+ data: followUpRequestData,
|
|
|
|
+ header: {
|
|
|
|
+ "content-type": "application/x-www-form-urlencoded"
|
|
|
|
+ },
|
|
|
|
+ success: (res) => {
|
|
|
|
+ if (res.data.code === 200 || res.data.code === 2e3) {
|
|
|
|
+ console.log("后台上传追问视频提交成功");
|
|
|
|
+ if (this.backgroundUploadQueue) {
|
|
|
|
+ const taskIndex = this.backgroundUploadQueue.findIndex((t) => t.id === task.id);
|
|
|
|
+ if (taskIndex !== -1) {
|
|
|
|
+ this.backgroundUploadQueue.splice(taskIndex, 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.processBackgroundUploadQueue();
|
|
|
|
+ } else {
|
|
|
|
+ this.handleBackgroundSubmitFailure(task, "提交失败: " + (res.data.msg || "未知错误"));
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ fail: (err) => {
|
|
|
|
+ console.error("后台上传提交失败:", err);
|
|
|
|
+ this.handleBackgroundSubmitFailure(task, "提交失败: " + err.errMsg);
|
|
}
|
|
}
|
|
- checkUploadStatus();
|
|
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ // 添加新方法:处理后台上传提交失败
|
|
|
|
+ handleBackgroundSubmitFailure(task, errorMsg) {
|
|
|
|
+ console.error("后台上传提交失败:", errorMsg);
|
|
|
|
+ if (task.attempts < task.maxAttempts) {
|
|
|
|
+ console.log(`将在5秒后重试后台上传提交,当前尝试次数: ${task.attempts}/${task.maxAttempts}`);
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.submitVideoToInterviewBackground(task.videoUrl, task);
|
|
|
|
+ }, 5e3);
|
|
|
|
+ } else {
|
|
|
|
+ console.log("超过最大重试次数,放弃后台上传提交");
|
|
|
|
+ if (this.backgroundUploadQueue) {
|
|
|
|
+ const taskIndex = this.backgroundUploadQueue.findIndex((t) => t.id === task.id);
|
|
|
|
+ if (taskIndex !== -1) {
|
|
|
|
+ this.backgroundUploadQueue.splice(taskIndex, 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.processBackgroundUploadQueue();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 添加新方法:处理上传后的逻辑
|
|
// 添加新方法:处理上传后的逻辑
|
|
handlePostUploadActions(task) {
|
|
handlePostUploadActions(task) {
|
|
this.hideThinkingLoading();
|
|
this.hideThinkingLoading();
|
|
@@ -1918,33 +2145,67 @@ const _sfc_main = {
|
|
},
|
|
},
|
|
// 添加新方法:更新上传状态文本
|
|
// 添加新方法:更新上传状态文本
|
|
updateUploadStatusText() {
|
|
updateUploadStatusText() {
|
|
- if (this.uploadQueue.length === 0) {
|
|
|
|
|
|
+ let mainQueueText = "";
|
|
|
|
+ if (this.uploadQueue.length > 0) {
|
|
|
|
+ const currentTask = this.uploadQueue[0];
|
|
|
|
+ const progress = this.uploadProgress[currentTask.id] || 0;
|
|
|
|
+ const status = this.uploadStatus[currentTask.id] || "pending";
|
|
|
|
+ let statusText = "";
|
|
|
|
+ switch (status) {
|
|
|
|
+ case "pending":
|
|
|
|
+ statusText = "等待上传";
|
|
|
|
+ break;
|
|
|
|
+ case "uploading":
|
|
|
|
+ statusText = `上传中 ${progress}%`;
|
|
|
|
+ break;
|
|
|
|
+ case "success":
|
|
|
|
+ statusText = "上传成功,提交中...";
|
|
|
|
+ break;
|
|
|
|
+ case "failed":
|
|
|
|
+ statusText = `上传失败,${currentTask.attempts < currentTask.maxAttempts ? "即将重试" : "已放弃"}`;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ const questionTypeText = currentTask.isFollowUp ? "追问" : "问题";
|
|
|
|
+ const questionShortText = currentTask.questionText ? currentTask.questionText.length > 10 ? currentTask.questionText.substring(0, 10) + "..." : currentTask.questionText : `${questionTypeText}${currentTask.questionId}`;
|
|
|
|
+ mainQueueText = `${questionTypeText}「${questionShortText}」:${statusText}`;
|
|
|
|
+ if (this.uploadQueue.length > 1) {
|
|
|
|
+ mainQueueText += ` (${this.uploadQueue.length}个视频待处理)`;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let backgroundQueueText = "";
|
|
|
|
+ if (this.backgroundUploadQueue && this.backgroundUploadQueue.length > 0) {
|
|
|
|
+ const currentTask = this.backgroundUploadQueue[0];
|
|
|
|
+ const progress = this.uploadProgress[currentTask.id] || 0;
|
|
|
|
+ const status = this.uploadStatus[currentTask.id] || "pending";
|
|
|
|
+ let statusText = "";
|
|
|
|
+ switch (status) {
|
|
|
|
+ case "pending":
|
|
|
|
+ statusText = "等待后台上传";
|
|
|
|
+ break;
|
|
|
|
+ case "uploading":
|
|
|
|
+ statusText = `后台上传中 ${progress}%`;
|
|
|
|
+ break;
|
|
|
|
+ case "success":
|
|
|
|
+ statusText = "后台上传成功,提交中...";
|
|
|
|
+ break;
|
|
|
|
+ case "failed":
|
|
|
|
+ statusText = `后台上传失败,${currentTask.attempts < currentTask.maxAttempts ? "即将重试" : "已放弃"}`;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ const questionShortText = currentTask.questionText ? currentTask.questionText.length > 10 ? currentTask.questionText.substring(0, 10) + "..." : currentTask.questionText : `追问${currentTask.questionId}`;
|
|
|
|
+ backgroundQueueText = `追问「${questionShortText}」:${statusText}`;
|
|
|
|
+ if (this.backgroundUploadQueue.length > 1) {
|
|
|
|
+ backgroundQueueText += ` (${this.backgroundUploadQueue.length}个追问待后台上传)`;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (mainQueueText && backgroundQueueText) {
|
|
|
|
+ this.uploadStatusText = `${mainQueueText} | ${backgroundQueueText}`;
|
|
|
|
+ } else if (mainQueueText) {
|
|
|
|
+ this.uploadStatusText = mainQueueText;
|
|
|
|
+ } else if (backgroundQueueText) {
|
|
|
|
+ this.uploadStatusText = backgroundQueueText;
|
|
|
|
+ } else {
|
|
this.uploadStatusText = "";
|
|
this.uploadStatusText = "";
|
|
- return;
|
|
|
|
- }
|
|
|
|
- const currentTask = this.uploadQueue[0];
|
|
|
|
- const progress = this.uploadProgress[currentTask.id] || 0;
|
|
|
|
- const status = this.uploadStatus[currentTask.id] || "pending";
|
|
|
|
- let statusText = "";
|
|
|
|
- switch (status) {
|
|
|
|
- case "pending":
|
|
|
|
- statusText = "等待上传";
|
|
|
|
- break;
|
|
|
|
- case "uploading":
|
|
|
|
- statusText = `上传中 ${progress}%`;
|
|
|
|
- break;
|
|
|
|
- case "success":
|
|
|
|
- statusText = "上传成功,提交中...";
|
|
|
|
- break;
|
|
|
|
- case "failed":
|
|
|
|
- statusText = `上传失败,${currentTask.attempts < currentTask.maxAttempts ? "即将重试" : "已放弃"}`;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- 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) {
|
|
|
|
- this.uploadStatusText += ` (${this.uploadQueue.length}个视频待处理)`;
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 修改 proceedToNextQuestion 方法,确保在切换视频时重置历史时间
|
|
// 修改 proceedToNextQuestion 方法,确保在切换视频时重置历史时间
|
|
@@ -2037,7 +2298,7 @@ const _sfc_main = {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- }, 200);
|
|
|
|
|
|
+ }, 0);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 修改 handleAnswerButtonClick 方法,确保在切换视频时重置历史时间
|
|
// 修改 handleAnswerButtonClick 方法,确保在切换视频时重置历史时间
|
|
@@ -2130,7 +2391,7 @@ const _sfc_main = {
|
|
currentSubtitles = this[subtitleKey] || [{
|
|
currentSubtitles = this[subtitleKey] || [{
|
|
startTime: 0,
|
|
startTime: 0,
|
|
endTime: 30,
|
|
endTime: 30,
|
|
- text: this.currentFollowUpQuestion.digital_human_video_subtitle || this.currentFollowUpQuestion.question
|
|
|
|
|
|
+ text: this.currentFollowUpQuestion.question || this.currentFollowUpQuestion.question
|
|
}];
|
|
}];
|
|
} else {
|
|
} else {
|
|
if (this.currentVideoIndex === 0) {
|
|
if (this.currentVideoIndex === 0) {
|
|
@@ -2526,7 +2787,7 @@ const _sfc_main = {
|
|
startTime: 0,
|
|
startTime: 0,
|
|
endTime: 30,
|
|
endTime: 30,
|
|
// 延长字幕显示时间到30秒
|
|
// 延长字幕显示时间到30秒
|
|
- text: question.digital_human_video_subtitle || question.question
|
|
|
|
|
|
+ text: question.question || question.question
|
|
}];
|
|
}];
|
|
const videoIndex = this.videoList.length - 1;
|
|
const videoIndex = this.videoList.length - 1;
|
|
this[`question${videoIndex}Subtitles`] = subtitleArray;
|
|
this[`question${videoIndex}Subtitles`] = subtitleArray;
|
|
@@ -2654,6 +2915,17 @@ const _sfc_main = {
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
},
|
|
},
|
|
|
|
+ // 添加新方法:获取当前问题的推荐录制时长
|
|
|
|
+ getCurrentQuestionRecommendedDuration() {
|
|
|
|
+ const currentQuestion = this.getCurrentQuestionByIndex(this.currentVideoIndex);
|
|
|
|
+ if (currentQuestion && currentQuestion.recommended_duration) {
|
|
|
|
+ const recommendedDuration = parseInt(currentQuestion.recommended_duration);
|
|
|
|
+ console.log(`使用问题推荐时长: ${recommendedDuration}秒`);
|
|
|
|
+ return recommendedDuration;
|
|
|
|
+ }
|
|
|
|
+ console.log("使用默认录制时长: 300秒");
|
|
|
|
+ return 300;
|
|
|
|
+ },
|
|
// 添加新方法:重置录制状态,准备重新回答
|
|
// 添加新方法:重置录制状态,准备重新回答
|
|
resetForRerecording() {
|
|
resetForRerecording() {
|
|
console.log("重置录制状态,准备重新回答");
|
|
console.log("重置录制状态,准备重新回答");
|
|
@@ -2667,6 +2939,7 @@ const _sfc_main = {
|
|
}
|
|
}
|
|
this.recordingTimerCount = 0;
|
|
this.recordingTimerCount = 0;
|
|
this.recordingTimeDisplay = "00:00 ";
|
|
this.recordingTimeDisplay = "00:00 ";
|
|
|
|
+ this.maxRecordingTime = this.getCurrentQuestionRecommendedDuration();
|
|
this.remainingTime = this.maxRecordingTime;
|
|
this.remainingTime = this.maxRecordingTime;
|
|
if (this.mediaRecorder && this.mediaRecorder.state !== "inactive") {
|
|
if (this.mediaRecorder && this.mediaRecorder.state !== "inactive") {
|
|
this.mediaRecorder.stop();
|
|
this.mediaRecorder.stop();
|
|
@@ -2709,7 +2982,7 @@ const _sfc_main = {
|
|
if (this.currentVideoIndex < this.videoList.length) {
|
|
if (this.currentVideoIndex < this.videoList.length) {
|
|
const nextQuestion = this.getCurrentQuestionByIndex(this.currentVideoIndex);
|
|
const nextQuestion = this.getCurrentQuestionByIndex(this.currentVideoIndex);
|
|
if (nextQuestion) {
|
|
if (nextQuestion) {
|
|
- this.currentSubtitle = nextQuestion.digital_human_video_subtitle || nextQuestion.question;
|
|
|
|
|
|
+ this.currentSubtitle = nextQuestion.question || nextQuestion.question;
|
|
}
|
|
}
|
|
this.videoUrl = this.videoList[this.currentVideoIndex];
|
|
this.videoUrl = this.videoList[this.currentVideoIndex];
|
|
this.videoPlaying = true;
|
|
this.videoPlaying = true;
|
|
@@ -2731,7 +3004,7 @@ const _sfc_main = {
|
|
this.videoUrl = this.lowScoreVideoUrl;
|
|
this.videoUrl = this.lowScoreVideoUrl;
|
|
this.videoPlaying = true;
|
|
this.videoPlaying = true;
|
|
const currentQuestion = this.getCurrentQuestionByIndex(this.currentVideoIndex);
|
|
const currentQuestion = this.getCurrentQuestionByIndex(this.currentVideoIndex);
|
|
- const originalSubtitle = currentQuestion ? currentQuestion.digital_human_video_subtitle || currentQuestion.question : this.currentSubtitle;
|
|
|
|
|
|
+ const originalSubtitle = currentQuestion ? currentQuestion.question || currentQuestion.question : this.currentSubtitle;
|
|
this.currentSubtitle = "";
|
|
this.currentSubtitle = "";
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
const videoContext = common_vendor.index.createVideoContext("myVideo", this);
|
|
const videoContext = common_vendor.index.createVideoContext("myVideo", this);
|
|
@@ -2932,7 +3205,7 @@ const _sfc_main = {
|
|
startTime: 0,
|
|
startTime: 0,
|
|
endTime: 60,
|
|
endTime: 60,
|
|
// 延长显示时间到60秒
|
|
// 延长显示时间到60秒
|
|
- text: followUpQuestion.digital_human_video_subtitle || followUpQuestion.question
|
|
|
|
|
|
+ text: followUpQuestion.question || followUpQuestion.question
|
|
}];
|
|
}];
|
|
const subtitleKey = `followUpSubtitles_${followUpQuestion.id}`;
|
|
const subtitleKey = `followUpSubtitles_${followUpQuestion.id}`;
|
|
this[subtitleKey] = followUpSubtitles;
|
|
this[subtitleKey] = followUpSubtitles;
|