|
@@ -296,42 +296,57 @@ export default {
|
|
progressColor: '#05dc8b', // 进度条颜色
|
|
progressColor: '#05dc8b', // 进度条颜色
|
|
progressBgColor: 'rgba(0, 0, 0,0.3)', // 进度条背景色
|
|
progressBgColor: 'rgba(0, 0, 0,0.3)', // 进度条背景色
|
|
parentQuestion: '', // 添加父问题存储
|
|
parentQuestion: '', // 添加父问题存储
|
|
|
|
+ screenCaptureCount: 0, // 添加截屏次数记录
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- /* this.fetchData() */
|
|
|
|
- this.fetchQuestions(); // 添加获取问题数据的方法调用
|
|
|
|
- this.fetchFollowUpQuestions(); // 添加获取追问问题的方法调用
|
|
|
|
|
|
+ this.fetchQuestions();
|
|
|
|
+ this.fetchFollowUpQuestions();
|
|
this.checkAudioPermission();
|
|
this.checkAudioPermission();
|
|
this.initCamera();
|
|
this.initCamera();
|
|
this.checkIOSCameraRecordPermission();
|
|
this.checkIOSCameraRecordPermission();
|
|
-
|
|
|
|
- // 添加防御性检查,避免渲染错误
|
|
|
|
this.checkAndFixRenderingIssues();
|
|
this.checkAndFixRenderingIssues();
|
|
-
|
|
|
|
- // 添加音频测试
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
if (this.cameraStream && !this.useMiniProgramCameraComponent) {
|
|
if (this.cameraStream && !this.useMiniProgramCameraComponent) {
|
|
this.testAudioInput();
|
|
this.testAudioInput();
|
|
}
|
|
}
|
|
- }, 3000);
|
|
|
|
-
|
|
|
|
- // 初始化历史时间记录
|
|
|
|
|
|
+ }, 3e3);
|
|
this.historyTime = 0;
|
|
this.historyTime = 0;
|
|
-
|
|
|
|
uni.setKeepScreenOn({
|
|
uni.setKeepScreenOn({
|
|
keepScreenOn: true
|
|
keepScreenOn: true
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ // 添加截屏监听
|
|
|
|
+ uni.onUserCaptureScreen(() => {
|
|
|
|
+ console.log('User captured screen');
|
|
|
|
+ this.screenCaptureCount++;
|
|
|
|
+
|
|
|
|
+ if (this.screenCaptureCount === 1) {
|
|
|
|
+ // 第一次截屏,显示警告
|
|
|
|
+ uni.showModal({
|
|
|
|
+ title: '警告',
|
|
|
|
+ content: '检测到屏幕截图。如果你再次捕捉屏幕,你的面试结果将无效。',
|
|
|
|
+ showCancel: false,
|
|
|
|
+ confirmText: 'OK'
|
|
|
|
+ });
|
|
|
|
+ } else if (this.screenCaptureCount >= 2) {
|
|
|
|
+ // 第二次及以上截屏,作废成绩
|
|
|
|
+ uni.showModal({
|
|
|
|
+ title: '面试作废',
|
|
|
|
+ content: '由于您在面试过程中多次截屏,本次面试作废,如有疑问请联系企业招聘人员',
|
|
|
|
+ showCancel: false,
|
|
|
|
+ confirmText: 'OK',
|
|
|
|
+ success: () => {
|
|
|
|
+ // 可以在这里添加其他处理逻辑,比如记录日志或上报服务器
|
|
|
|
+ this.invalidateInterview();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
- // 组件销毁前停止摄像头
|
|
|
|
- this.stopUserCamera();
|
|
|
|
-
|
|
|
|
- // 清除倒计时定时器
|
|
|
|
- this.clearCountdown();
|
|
|
|
-
|
|
|
|
- // 移除 WebSocket 连接关闭
|
|
|
|
- // this.closeWebSocketConnection();
|
|
|
|
|
|
+ // 移除截屏监听
|
|
|
|
+ uni.offUserCaptureScreen();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 初始化相机
|
|
// 初始化相机
|
|
@@ -3311,6 +3326,38 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ // 添加作废面试的方法
|
|
|
|
+ invalidateInterview() {
|
|
|
|
+ // 停止录制(如果正在录制)
|
|
|
|
+ if (this.isRecording) {
|
|
|
|
+ this.stopRecordingAnswer();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 清除所有计时器
|
|
|
|
+ if (this.recordingTimer) {
|
|
|
|
+ clearInterval(this.recordingTimer);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 重置状态
|
|
|
|
+ this.isRecording = false;
|
|
|
|
+ this.showStopRecordingButton = false;
|
|
|
|
+ this.showStartRecordingButton = false;
|
|
|
|
+
|
|
|
|
+ // 显示作废提示
|
|
|
|
+ // uni.showToast({
|
|
|
|
+ // title: 'Interview invalidated',
|
|
|
|
+ // icon: 'none',
|
|
|
|
+ // duration: 2000
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+ // 延迟后返回上一页
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ uni.switchTab({
|
|
|
|
+ url: '/pages/index/index'
|
|
|
|
+ });
|
|
|
|
+ }, 500);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
// 计算进度比例
|
|
// 计算进度比例
|