|
@@ -2112,12 +2112,6 @@ const _sfc_main = {
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
},
|
|
},
|
|
- onShow() {
|
|
|
|
- console.log("identity-verify页面onShow");
|
|
|
|
- console.log("当前本地存储中的职位信息:", common_vendor.index.getStorageSync("selectedJob"));
|
|
|
|
- this.fetchQuestions();
|
|
|
|
- this.fetchFollowUpQuestions();
|
|
|
|
- },
|
|
|
|
// 添加新方法:重置录制状态,准备重新回答
|
|
// 添加新方法:重置录制状态,准备重新回答
|
|
resetForRerecording() {
|
|
resetForRerecording() {
|
|
console.log("重置录制状态,准备重新回答");
|
|
console.log("重置录制状态,准备重新回答");
|
|
@@ -2191,13 +2185,53 @@ const _sfc_main = {
|
|
this.showRerecordButton = false;
|
|
this.showRerecordButton = false;
|
|
this.handleStartRecordingClick();
|
|
this.handleStartRecordingClick();
|
|
},
|
|
},
|
|
- // 添加 onUnload 生命周期钩子,移除 WebSocket 关闭
|
|
|
|
|
|
+ // 页面卸载时关闭WebSocket连接
|
|
onUnload() {
|
|
onUnload() {
|
|
- console.log("页面卸载");
|
|
|
|
|
|
+ console.log("页面卸载,关闭WebSocket连接");
|
|
|
|
+ this.cleanupPersonDetectionWebSocket();
|
|
|
|
+ this.stopUserCamera();
|
|
|
|
+ this.clearCountdown();
|
|
|
|
+ if (this.recordingTimer) {
|
|
|
|
+ clearInterval(this.recordingTimer);
|
|
|
|
+ this.recordingTimer = null;
|
|
|
|
+ }
|
|
|
|
+ if (this.mediaRecorder && this.mediaRecorder.state !== "inactive") {
|
|
|
|
+ this.mediaRecorder.stop();
|
|
|
|
+ }
|
|
|
|
+ common_vendor.index.setKeepScreenOn({
|
|
|
|
+ keepScreenOn: false
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- // 修改 onHide 生命周期钩子,移除 WebSocket 关闭
|
|
|
|
|
|
+ // 页面隐藏时关闭WebSocket连接
|
|
onHide() {
|
|
onHide() {
|
|
- console.log("页面隐藏");
|
|
|
|
|
|
+ console.log("页面隐藏,关闭WebSocket连接");
|
|
|
|
+ this.cleanupPersonDetectionWebSocket();
|
|
|
|
+ if (this.isRecording) {
|
|
|
|
+ console.log("页面隐藏时正在录制,录制将继续");
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
+ title: "请不要离开面试页面",
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 2e3
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 页面显示时重新初始化WebSocket连接
|
|
|
|
+ onShow() {
|
|
|
|
+ console.log("identity-verify页面onShow");
|
|
|
|
+ console.log("当前本地存储中的职位信息:", common_vendor.index.getStorageSync("selectedJob"));
|
|
|
|
+ this.fetchQuestions();
|
|
|
|
+ this.fetchFollowUpQuestions();
|
|
|
|
+ const systemInfo = common_vendor.index.getSystemInfoSync();
|
|
|
|
+ const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
|
|
|
|
+ if (isMiniProgram) {
|
|
|
|
+ if (!this.personDetectionSocket) {
|
|
|
|
+ console.log("重新初始化WebSocket连接");
|
|
|
|
+ this.initPersonDetectionWebSocket();
|
|
|
|
+ } else if (!this.personDetectionInterval) {
|
|
|
|
+ console.log("重新启动人脸检测定时器");
|
|
|
|
+ this.startPersonDetectionInterval();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 添加新方法:阻止视频控制
|
|
// 添加新方法:阻止视频控制
|
|
preventVideoControl(e) {
|
|
preventVideoControl(e) {
|