|
@@ -111,8 +111,21 @@ const _sfc_main = {
|
|
// 录制开始时间
|
|
// 录制开始时间
|
|
recordingTimerCount: 0,
|
|
recordingTimerCount: 0,
|
|
// 录制计时器计数
|
|
// 录制计时器计数
|
|
- recordingTimeDisplay: "00:00"
|
|
|
|
|
|
+ recordingTimeDisplay: "00:00",
|
|
// 格式化的录制时间显示
|
|
// 格式化的录制时间显示
|
|
|
|
+ // 添加上传队列相关数据
|
|
|
|
+ uploadQueue: [],
|
|
|
|
+ // 存储待上传的视频
|
|
|
|
+ isUploading: false,
|
|
|
|
+ // 标记是否正在上传
|
|
|
|
+ uploadProgress: {},
|
|
|
|
+ // 存储每个视频的上传进度
|
|
|
|
+ uploadStatus: {},
|
|
|
|
+ // 存储每个视频的上传状态
|
|
|
|
+ showUploadStatus: false,
|
|
|
|
+ // 是否显示上传状态指示器
|
|
|
|
+ uploadStatusText: ""
|
|
|
|
+ // 上传状态文本
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
@@ -999,13 +1012,6 @@ const _sfc_main = {
|
|
// 修改上传录制的视频方法
|
|
// 修改上传录制的视频方法
|
|
uploadRecordedVideo(fileOrPath) {
|
|
uploadRecordedVideo(fileOrPath) {
|
|
console.log("准备上传视频:", typeof fileOrPath === "string" ? fileOrPath : fileOrPath.name);
|
|
console.log("准备上传视频:", typeof fileOrPath === "string" ? fileOrPath : fileOrPath.name);
|
|
- common_vendor.index.showLoading({
|
|
|
|
- title: "正在上传...",
|
|
|
|
- mask: true
|
|
|
|
- });
|
|
|
|
- const userInfo = common_vendor.index.getStorageSync("userInfo");
|
|
|
|
- const openid = userInfo ? JSON.parse(userInfo).openid || "" : "";
|
|
|
|
- const tenant_id = common_vendor.index.getStorageSync("tenant_id") || "1";
|
|
|
|
let questionId;
|
|
let questionId;
|
|
switch (this.currentVideoIndex) {
|
|
switch (this.currentVideoIndex) {
|
|
case 1:
|
|
case 1:
|
|
@@ -1023,83 +1029,120 @@ const _sfc_main = {
|
|
default:
|
|
default:
|
|
questionId = 10;
|
|
questionId = 10;
|
|
}
|
|
}
|
|
- if (typeof fileOrPath !== "string") {
|
|
|
|
- const formData = new FormData();
|
|
|
|
- formData.append("file", fileOrPath);
|
|
|
|
- formData.append("openid", openid);
|
|
|
|
- formData.append("tenant_id", tenant_id);
|
|
|
|
- formData.append("application_id", common_vendor.index.getStorageSync("appId"));
|
|
|
|
- formData.append("question_id", questionId);
|
|
|
|
- formData.append("video_duration", 0);
|
|
|
|
- formData.append("has_audio", "true");
|
|
|
|
- const xhr = new XMLHttpRequest();
|
|
|
|
- xhr.open("POST", `${common_config.apiBaseUrl}/api/system/upload/`, true);
|
|
|
|
- xhr.timeout = 12e4;
|
|
|
|
- xhr.onload = () => {
|
|
|
|
- common_vendor.index.hideLoading();
|
|
|
|
- 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.submitVideoToInterview(videoUrl);
|
|
|
|
- } else {
|
|
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "视频URL获取失败",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ const uploadTask = {
|
|
|
|
+ id: Date.now().toString(),
|
|
|
|
+ // 生成唯一ID
|
|
|
|
+ file: fileOrPath,
|
|
|
|
+ questionId,
|
|
|
|
+ attempts: 0,
|
|
|
|
+ // 上传尝试次数
|
|
|
|
+ maxAttempts: 3
|
|
|
|
+ // 最大尝试次数
|
|
|
|
+ };
|
|
|
|
+ this.uploadQueue.push(uploadTask);
|
|
|
|
+ this.uploadProgress[uploadTask.id] = 0;
|
|
|
|
+ this.uploadStatus[uploadTask.id] = "pending";
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
+ title: "视频已加入上传队列",
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 1500
|
|
|
|
+ });
|
|
|
|
+ this.updateUploadStatusText();
|
|
|
|
+ if (!this.isUploading) {
|
|
|
|
+ this.processUploadQueue();
|
|
|
|
+ }
|
|
|
|
+ this.proceedToNextQuestion();
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:处理上传队列
|
|
|
|
+ processUploadQueue() {
|
|
|
|
+ if (this.uploadQueue.length === 0) {
|
|
|
|
+ this.isUploading = false;
|
|
|
|
+ this.showUploadStatus = false;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.isUploading = true;
|
|
|
|
+ this.showUploadStatus = true;
|
|
|
|
+ const task = this.uploadQueue[0];
|
|
|
|
+ this.uploadStatus[task.id] = "uploading";
|
|
|
|
+ this.updateUploadStatusText();
|
|
|
|
+ task.attempts++;
|
|
|
|
+ if (typeof task.file !== "string") {
|
|
|
|
+ this.uploadFileWithXHR(task);
|
|
|
|
+ } else {
|
|
|
|
+ this.uploadFileWithUni(task);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:使用XMLHttpRequest上传文件
|
|
|
|
+ uploadFileWithXHR(task) {
|
|
|
|
+ const userInfo = common_vendor.index.getStorageSync("userInfo");
|
|
|
|
+ const openid = userInfo ? JSON.parse(userInfo).openid || "" : "";
|
|
|
|
+ const tenant_id = common_vendor.index.getStorageSync("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", 0);
|
|
|
|
+ formData.append("has_audio", "true");
|
|
|
|
+ const xhr = new XMLHttpRequest();
|
|
|
|
+ xhr.open("POST", `${common_config.apiBaseUrl}/api/upload/`, true);
|
|
|
|
+ xhr.timeout = 12e4;
|
|
|
|
+ xhr.upload.onprogress = (event) => {
|
|
|
|
+ if (event.lengthComputable) {
|
|
|
|
+ const percentComplete = Math.round(event.loaded / event.total * 100);
|
|
|
|
+ this.uploadProgress[task.id] = percentComplete;
|
|
|
|
+ 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.submitVideoToInterview(videoUrl, task);
|
|
} else {
|
|
} else {
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: res.msg || "上传失败,请重试",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
|
|
+ this.handleUploadFailure(task, "视频URL获取失败");
|
|
}
|
|
}
|
|
- } catch (e) {
|
|
|
|
- console.error("解析响应失败:", e);
|
|
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "解析响应失败",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
|
|
+ } else {
|
|
|
|
+ this.handleUploadFailure(task, res.msg || "上传失败");
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "上传失败,HTTP状态: " + xhr.status,
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- xhr.onerror = () => {
|
|
|
|
- common_vendor.index.hideLoading();
|
|
|
|
- console.error("上传网络错误");
|
|
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "网络错误,请重试",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
- xhr.upload.onprogress = (event) => {
|
|
|
|
- if (event.lengthComputable) {
|
|
|
|
- const percentComplete = Math.round(event.loaded / event.total * 100);
|
|
|
|
- console.log("上传进度:", percentComplete + "%");
|
|
|
|
|
|
+ } catch (e) {
|
|
|
|
+ this.handleUploadFailure(task, "解析响应失败");
|
|
}
|
|
}
|
|
- };
|
|
|
|
- xhr.send(formData);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- common_vendor.index.uploadFile({
|
|
|
|
- url: `${common_config.apiBaseUrl}/api/system/upload/`,
|
|
|
|
- filePath: fileOrPath,
|
|
|
|
|
|
+ } else {
|
|
|
|
+ this.handleUploadFailure(task, "HTTP状态: " + xhr.status);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ xhr.onerror = () => {
|
|
|
|
+ this.handleUploadFailure(task, "网络错误");
|
|
|
|
+ };
|
|
|
|
+ xhr.ontimeout = () => {
|
|
|
|
+ this.handleUploadFailure(task, "上传超时");
|
|
|
|
+ };
|
|
|
|
+ xhr.send(formData);
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:使用uni.uploadFile上传文件
|
|
|
|
+ uploadFileWithUni(task) {
|
|
|
|
+ const userInfo = common_vendor.index.getStorageSync("userInfo");
|
|
|
|
+ const openid = userInfo ? JSON.parse(userInfo).openid || "" : "";
|
|
|
|
+ const tenant_id = common_vendor.index.getStorageSync("tenant_id") || "1";
|
|
|
|
+ const uploadTask = common_vendor.index.uploadFile({
|
|
|
|
+ url: `${common_config.apiBaseUrl}/api/upload/`,
|
|
|
|
+ filePath: task.file,
|
|
name: "file",
|
|
name: "file",
|
|
formData: {
|
|
formData: {
|
|
openid,
|
|
openid,
|
|
tenant_id,
|
|
tenant_id,
|
|
application_id: common_vendor.index.getStorageSync("appId"),
|
|
application_id: common_vendor.index.getStorageSync("appId"),
|
|
- question_id: questionId,
|
|
|
|
|
|
+ question_id: task.questionId,
|
|
video_duration: 0,
|
|
video_duration: 0,
|
|
has_audio: "true"
|
|
has_audio: "true"
|
|
- // 明确标记视频包含音频
|
|
|
|
},
|
|
},
|
|
success: (uploadRes) => {
|
|
success: (uploadRes) => {
|
|
try {
|
|
try {
|
|
@@ -1108,62 +1151,77 @@ const _sfc_main = {
|
|
if (res.code === 2e3) {
|
|
if (res.code === 2e3) {
|
|
const videoUrl = res.data.permanent_link || res.data.url || "";
|
|
const videoUrl = res.data.permanent_link || res.data.url || "";
|
|
if (videoUrl) {
|
|
if (videoUrl) {
|
|
- this.submitVideoToInterview(videoUrl);
|
|
|
|
|
|
+ this.uploadStatus[task.id] = "success";
|
|
|
|
+ this.updateUploadStatusText();
|
|
|
|
+ this.submitVideoToInterview(videoUrl, task);
|
|
} else {
|
|
} else {
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "视频URL获取失败",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
|
|
+ this.handleUploadFailure(task, "视频URL获取失败");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: res.msg || "上传失败,请重试",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
|
|
+ this.handleUploadFailure(task, res.msg || "上传失败");
|
|
}
|
|
}
|
|
} catch (e) {
|
|
} catch (e) {
|
|
- console.error("解析响应失败:", e);
|
|
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "解析响应失败",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
|
|
+ this.handleUploadFailure(task, "解析响应失败");
|
|
}
|
|
}
|
|
},
|
|
},
|
|
fail: (err) => {
|
|
fail: (err) => {
|
|
- console.error("上传失败:", err);
|
|
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "上传失败,请重试",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- complete: () => {
|
|
|
|
- common_vendor.index.hideLoading();
|
|
|
|
|
|
+ this.handleUploadFailure(task, err.errMsg || "上传失败");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ uploadTask.onProgressUpdate((res) => {
|
|
|
|
+ this.uploadProgress[task.id] = res.progress;
|
|
|
|
+ this.updateUploadStatusText();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:处理上传失败
|
|
|
|
+ handleUploadFailure(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.uploadFileWithXHR(task);
|
|
|
|
+ } else {
|
|
|
|
+ this.uploadFileWithUni(task);
|
|
|
|
+ }
|
|
|
|
+ }, 5e3);
|
|
|
|
+ } else {
|
|
|
|
+ console.log("超过最大重试次数,放弃上传");
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
+ title: "视频上传失败,请稍后重试",
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2e3
|
|
|
|
+ });
|
|
|
|
+ this.uploadQueue.shift();
|
|
|
|
+ this.processUploadQueue();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 修改 submitVideoToInterview 方法
|
|
// 修改 submitVideoToInterview 方法
|
|
- submitVideoToInterview(videoUrl) {
|
|
|
|
|
|
+ submitVideoToInterview(videoUrl, task = null) {
|
|
console.log("提交视频URL到面试接口:", videoUrl);
|
|
console.log("提交视频URL到面试接口:", videoUrl);
|
|
- common_vendor.index.showLoading({
|
|
|
|
- title: "正在提交...",
|
|
|
|
- mask: true
|
|
|
|
- });
|
|
|
|
let questionId;
|
|
let questionId;
|
|
- switch (this.currentVideoIndex) {
|
|
|
|
- case 1:
|
|
|
|
- questionId = 10;
|
|
|
|
- break;
|
|
|
|
- case 2:
|
|
|
|
- questionId = 11;
|
|
|
|
- break;
|
|
|
|
- case 3:
|
|
|
|
- questionId = 12;
|
|
|
|
- break;
|
|
|
|
- case 4:
|
|
|
|
- questionId = 13;
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- questionId = 10;
|
|
|
|
|
|
+ if (task) {
|
|
|
|
+ questionId = task.questionId;
|
|
|
|
+ } else {
|
|
|
|
+ switch (this.currentVideoIndex) {
|
|
|
|
+ case 1:
|
|
|
|
+ questionId = 10;
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ questionId = 11;
|
|
|
|
+ break;
|
|
|
|
+ case 3:
|
|
|
|
+ questionId = 12;
|
|
|
|
+ break;
|
|
|
|
+ case 4:
|
|
|
|
+ questionId = 13;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ questionId = 10;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
const requestData = {
|
|
const requestData = {
|
|
application_id: common_vendor.index.getStorageSync("appId"),
|
|
application_id: common_vendor.index.getStorageSync("appId"),
|
|
@@ -1172,56 +1230,112 @@ const _sfc_main = {
|
|
tenant_id: common_vendor.index.getStorageSync("tenant_id") || "1"
|
|
tenant_id: common_vendor.index.getStorageSync("tenant_id") || "1"
|
|
};
|
|
};
|
|
common_vendor.index.request({
|
|
common_vendor.index.request({
|
|
- url: `${common_config.apiBaseUrl}/api/job/upload_question_video`,
|
|
|
|
|
|
+ url: `${common_config.apiBaseUrl}/api/job/upload_video`,
|
|
method: "POST",
|
|
method: "POST",
|
|
data: requestData,
|
|
data: requestData,
|
|
- // 使用data而不是formData
|
|
|
|
header: {
|
|
header: {
|
|
"content-type": "application/x-www-form-urlencoded"
|
|
"content-type": "application/x-www-form-urlencoded"
|
|
- // 修改为form-data格式的content-type
|
|
|
|
},
|
|
},
|
|
success: (res) => {
|
|
success: (res) => {
|
|
console.log("面试接口提交成功:", res);
|
|
console.log("面试接口提交成功:", res);
|
|
- common_vendor.index.hideLoading();
|
|
|
|
if (res.data.code === 0 || res.data.code === 2e3) {
|
|
if (res.data.code === 0 || res.data.code === 2e3) {
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "回答已提交",
|
|
|
|
- icon: "success"
|
|
|
|
- });
|
|
|
|
- this.lastUploadedVideoUrl = videoUrl;
|
|
|
|
- this.showRetryButton = false;
|
|
|
|
- this.lastVideoToRetry = null;
|
|
|
|
- setTimeout(() => {
|
|
|
|
- if (this.currentVideoIndex === 4) {
|
|
|
|
- common_vendor.index.navigateTo({
|
|
|
|
- url: "/pages/camera/camera"
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- this.proceedToNextQuestion();
|
|
|
|
- }
|
|
|
|
- }, 1500);
|
|
|
|
|
|
+ if (task) {
|
|
|
|
+ this.uploadQueue.shift();
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
+ title: "视频提交成功",
|
|
|
|
+ icon: "success",
|
|
|
|
+ duration: 1500
|
|
|
|
+ });
|
|
|
|
+ this.processUploadQueue();
|
|
|
|
+ } else {
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
+ title: "回答已提交",
|
|
|
|
+ icon: "success"
|
|
|
|
+ });
|
|
|
|
+ this.lastUploadedVideoUrl = videoUrl;
|
|
|
|
+ this.showRetryButton = false;
|
|
|
|
+ this.lastVideoToRetry = null;
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
|
|
+ if (task) {
|
|
|
|
+ this.handleSubmitFailure(task, res.data.msg || "提交失败");
|
|
|
|
+ } else {
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
+ title: res.data.msg || "提交失败,请重试",
|
|
|
|
+ icon: "none"
|
|
|
|
+ });
|
|
|
|
+ this.lastVideoToRetry = videoUrl;
|
|
|
|
+ this.showRetryButton = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ fail: (err) => {
|
|
|
|
+ console.error("面试接口提交失败:", err);
|
|
|
|
+ if (task) {
|
|
|
|
+ this.handleSubmitFailure(task, err.errMsg || "网络错误");
|
|
|
|
+ } else {
|
|
|
|
+ common_vendor.index.hideLoading();
|
|
common_vendor.index.showToast({
|
|
common_vendor.index.showToast({
|
|
- title: res.data.msg || "提交失败,请重试",
|
|
|
|
|
|
+ title: "网络错误,请重试",
|
|
icon: "none"
|
|
icon: "none"
|
|
});
|
|
});
|
|
this.lastVideoToRetry = videoUrl;
|
|
this.lastVideoToRetry = videoUrl;
|
|
this.showRetryButton = true;
|
|
this.showRetryButton = true;
|
|
}
|
|
}
|
|
- },
|
|
|
|
- fail: (err) => {
|
|
|
|
- console.error("面试接口提交失败:", err);
|
|
|
|
- common_vendor.index.hideLoading();
|
|
|
|
- common_vendor.index.showToast({
|
|
|
|
- title: "网络错误,请重试",
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
- this.lastVideoToRetry = videoUrl;
|
|
|
|
- this.showRetryButton = true;
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- // 修改 proceedToNextQuestion 方法
|
|
|
|
|
|
+ // 添加新方法:处理提交失败
|
|
|
|
+ handleSubmitFailure(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.submitVideoToInterview(task.videoUrl, task);
|
|
|
|
+ }, 5e3);
|
|
|
|
+ } else {
|
|
|
|
+ console.log("超过最大重试次数,放弃提交");
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
+ title: "视频提交失败,请稍后重试",
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2e3
|
|
|
|
+ });
|
|
|
|
+ this.uploadQueue.shift();
|
|
|
|
+ this.processUploadQueue();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 添加新方法:更新上传状态文本
|
|
|
|
+ updateUploadStatusText() {
|
|
|
|
+ if (this.uploadQueue.length === 0) {
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ this.uploadStatusText = `问题${currentTask.questionId - 9}:${statusText}`;
|
|
|
|
+ if (this.uploadQueue.length > 1) {
|
|
|
|
+ this.uploadStatusText += ` (${this.uploadQueue.length}个视频待处理)`;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 修改 proceedToNextQuestion 方法,不再等待上传完成
|
|
proceedToNextQuestion() {
|
|
proceedToNextQuestion() {
|
|
if (this.currentVideoIndex === 4) {
|
|
if (this.currentVideoIndex === 4) {
|
|
common_vendor.index.navigateTo({
|
|
common_vendor.index.navigateTo({
|
|
@@ -1666,6 +1780,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
x: $data.showRetryButton
|
|
x: $data.showRetryButton
|
|
}, $data.showRetryButton ? {
|
|
}, $data.showRetryButton ? {
|
|
y: common_vendor.o((...args) => $options.retryVideoUpload && $options.retryVideoUpload(...args))
|
|
y: common_vendor.o((...args) => $options.retryVideoUpload && $options.retryVideoUpload(...args))
|
|
|
|
+ } : {}, {
|
|
|
|
+ z: $data.showUploadStatus && $data.uploadStatusText
|
|
|
|
+ }, $data.showUploadStatus && $data.uploadStatusText ? {
|
|
|
|
+ A: $data.isUploading ? 1 : "",
|
|
|
|
+ B: common_vendor.t($data.uploadStatusText)
|
|
} : {});
|
|
} : {});
|
|
}
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-464e78c6"]]);
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-464e78c6"]]);
|