|
@@ -141,8 +141,16 @@ const _sfc_main = {
|
|
// 进度条背景色
|
|
// 进度条背景色
|
|
parentQuestion: "",
|
|
parentQuestion: "",
|
|
// 添加父问题存储
|
|
// 添加父问题存储
|
|
- screenCaptureCount: 0
|
|
|
|
|
|
+ screenCaptureCount: 0,
|
|
// 添加截屏次数记录
|
|
// 添加截屏次数记录
|
|
|
|
+ personDetectionSocket: null,
|
|
|
|
+ // WebSocket对象
|
|
|
|
+ personDetectionInterval: null,
|
|
|
|
+ // 定时器对象
|
|
|
|
+ showCameraWarning: false,
|
|
|
|
+ // 添加新的数据属性
|
|
|
|
+ showPageWarning: false
|
|
|
|
+ // 添加新的数据属性
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
@@ -166,15 +174,15 @@ const _sfc_main = {
|
|
this.screenCaptureCount++;
|
|
this.screenCaptureCount++;
|
|
if (this.screenCaptureCount === 1) {
|
|
if (this.screenCaptureCount === 1) {
|
|
common_vendor.index.showModal({
|
|
common_vendor.index.showModal({
|
|
- title: "警告",
|
|
|
|
- content: "检测到屏幕截图。如果你再次捕捉屏幕,你的面试结果将无效。",
|
|
|
|
|
|
+ title: "Warning",
|
|
|
|
+ content: "Screen capture detected. If you capture the screen again, your interview will be invalid.",
|
|
showCancel: false,
|
|
showCancel: false,
|
|
confirmText: "OK"
|
|
confirmText: "OK"
|
|
});
|
|
});
|
|
} else if (this.screenCaptureCount >= 2) {
|
|
} else if (this.screenCaptureCount >= 2) {
|
|
common_vendor.index.showModal({
|
|
common_vendor.index.showModal({
|
|
- title: "面试作废",
|
|
|
|
- content: "由于您在面试过程中多次截屏,本次面试作废,如有疑问请联系企业招聘人员",
|
|
|
|
|
|
+ title: "Interview Invalid",
|
|
|
|
+ content: "Your interview has been invalidated due to multiple screen captures. Please contact the recruiter for assistance.",
|
|
showCancel: false,
|
|
showCancel: false,
|
|
confirmText: "OK",
|
|
confirmText: "OK",
|
|
success: () => {
|
|
success: () => {
|
|
@@ -183,9 +191,15 @@ const _sfc_main = {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ const systemInfo = common_vendor.index.getSystemInfoSync();
|
|
|
|
+ const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
|
|
|
|
+ if (isMiniProgram) {
|
|
|
|
+ this.initPersonDetectionWebSocket();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
common_vendor.index.offUserCaptureScreen();
|
|
common_vendor.index.offUserCaptureScreen();
|
|
|
|
+ this.cleanupPersonDetectionWebSocket();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 初始化相机
|
|
// 初始化相机
|
|
@@ -2320,6 +2334,119 @@ const _sfc_main = {
|
|
url: "/pages/index/index"
|
|
url: "/pages/index/index"
|
|
});
|
|
});
|
|
}, 500);
|
|
}, 500);
|
|
|
|
+ },
|
|
|
|
+ initPersonDetectionWebSocket() {
|
|
|
|
+ if (this.personDetectionSocket) {
|
|
|
|
+ this.cleanupPersonDetectionWebSocket();
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ this.personDetectionSocket = common_vendor.index.connectSocket({
|
|
|
|
+ url: `${common_config.personDetectionWsUrl}/ws/interview-room/room_${common_vendor.index.getStorageSync("appId")}/${common_vendor.index.getStorageSync("appId")}/`,
|
|
|
|
+ success: () => {
|
|
|
|
+ console.log("WebSocket connection initiated");
|
|
|
|
+ },
|
|
|
|
+ fail: (error) => {
|
|
|
|
+ console.error("WebSocket connection failed:", error);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ this.personDetectionSocket.onOpen(() => {
|
|
|
|
+ console.log("WebSocket connection opened");
|
|
|
|
+ this.startPersonDetectionInterval();
|
|
|
|
+ });
|
|
|
|
+ this.personDetectionSocket.onError((error) => {
|
|
|
|
+ console.error("WebSocket error:", error);
|
|
|
|
+ this.cleanupPersonDetectionWebSocket();
|
|
|
|
+ });
|
|
|
|
+ this.personDetectionSocket.onClose(() => {
|
|
|
|
+ console.log("WebSocket connection closed");
|
|
|
|
+ this.cleanupPersonDetectionWebSocket();
|
|
|
|
+ });
|
|
|
|
+ this.personDetectionSocket.onMessage((res) => {
|
|
|
|
+ try {
|
|
|
|
+ const data = JSON.parse(res.data);
|
|
|
|
+ console.log(data);
|
|
|
|
+ if (data.type === "person_detection_result") {
|
|
|
|
+ this.handlePersonDetectionResult(data);
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error("Error parsing WebSocket message:", error);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error("Error initializing WebSocket:", error);
|
|
|
|
+ this.cleanupPersonDetectionWebSocket();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ startPersonDetectionInterval() {
|
|
|
|
+ if (this.personDetectionInterval) {
|
|
|
|
+ clearInterval(this.personDetectionInterval);
|
|
|
|
+ }
|
|
|
|
+ this.personDetectionInterval = setInterval(() => {
|
|
|
|
+ if (this.personDetectionSocket && this.cameraContext) {
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ fail: (error) => {
|
|
|
|
+ console.error("Error taking photo:", error);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }, 3e3);
|
|
|
|
+ },
|
|
|
|
+ cleanupPersonDetectionWebSocket() {
|
|
|
|
+ if (this.personDetectionInterval) {
|
|
|
|
+ clearInterval(this.personDetectionInterval);
|
|
|
|
+ this.personDetectionInterval = null;
|
|
|
|
+ }
|
|
|
|
+ if (this.personDetectionSocket) {
|
|
|
|
+ try {
|
|
|
|
+ this.personDetectionSocket.close();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error("Error closing WebSocket:", error);
|
|
|
|
+ }
|
|
|
|
+ this.personDetectionSocket = null;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ handlePersonDetectionResult(data) {
|
|
|
|
+ console.log(data.data.detection.has_person);
|
|
|
|
+ console.log(data.data.identity.status);
|
|
|
|
+ if (data.data.identity.status !== "identity_verified") {
|
|
|
|
+ this.showPageWarning = true;
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
+ title: data.data.identity.message,
|
|
|
|
+ icon: "none",
|
|
|
|
+ duration: 3e3
|
|
|
|
+ });
|
|
|
|
+ common_vendor.index.vibrateLong({
|
|
|
|
+ success: function() {
|
|
|
|
+ console.log("Vibration successful");
|
|
|
|
+ },
|
|
|
|
+ fail: function(err) {
|
|
|
|
+ console.error("Vibration failed:", err);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.showPageWarning = false;
|
|
|
|
+ }, 3e3);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -2383,19 +2510,20 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
}, $data.useMiniProgramCameraComponent ? {
|
|
}, $data.useMiniProgramCameraComponent ? {
|
|
r: common_vendor.o((...args) => $options.handleCameraError && $options.handleCameraError(...args))
|
|
r: common_vendor.o((...args) => $options.handleCameraError && $options.handleCameraError(...args))
|
|
} : {}, {
|
|
} : {}, {
|
|
- s: $data.loading
|
|
|
|
|
|
+ s: $data.showPageWarning ? 1 : "",
|
|
|
|
+ t: $data.loading
|
|
}, $data.loading ? {} : {}, {
|
|
}, $data.loading ? {} : {}, {
|
|
- t: $data.showDebugInfo
|
|
|
|
|
|
+ v: $data.showDebugInfo
|
|
}, $data.showDebugInfo ? common_vendor.e({
|
|
}, $data.showDebugInfo ? common_vendor.e({
|
|
- v: $data.assistantResponse
|
|
|
|
|
|
+ w: $data.assistantResponse
|
|
}, $data.assistantResponse ? {
|
|
}, $data.assistantResponse ? {
|
|
- w: common_vendor.t($data.assistantResponse)
|
|
|
|
|
|
+ x: common_vendor.t($data.assistantResponse)
|
|
} : {}, {
|
|
} : {}, {
|
|
- x: $data.audioTranscript
|
|
|
|
|
|
+ y: $data.audioTranscript
|
|
}, $data.audioTranscript ? {
|
|
}, $data.audioTranscript ? {
|
|
- y: common_vendor.t($data.audioTranscript)
|
|
|
|
|
|
+ z: common_vendor.t($data.audioTranscript)
|
|
} : {}, {
|
|
} : {}, {
|
|
- z: common_vendor.f($data.processedResponses, (item, index, i0) => {
|
|
|
|
|
|
+ A: common_vendor.f($data.processedResponses, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
return common_vendor.e({
|
|
a: item.role
|
|
a: item.role
|
|
}, item.role ? {
|
|
}, item.role ? {
|
|
@@ -2409,31 +2537,33 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
});
|
|
});
|
|
})
|
|
})
|
|
}) : {}, {
|
|
}) : {}, {
|
|
- A: $data.showStopRecordingButton
|
|
|
|
|
|
+ B: $data.showStopRecordingButton
|
|
}, $data.showStopRecordingButton ? {
|
|
}, $data.showStopRecordingButton ? {
|
|
- B: common_vendor.o((...args) => $options.stopRecordingAnswer && $options.stopRecordingAnswer(...args))
|
|
|
|
|
|
+ C: common_vendor.o((...args) => $options.stopRecordingAnswer && $options.stopRecordingAnswer(...args))
|
|
} : {}, {
|
|
} : {}, {
|
|
- C: $data.isRecording
|
|
|
|
|
|
+ D: $data.isRecording
|
|
}, $data.isRecording ? {
|
|
}, $data.isRecording ? {
|
|
- D: common_vendor.t($data.recordingTimeDisplay),
|
|
|
|
- E: `conic-gradient(${$data.progressColor} ${$options.progressPercent}%, ${$data.progressBgColor} 0%)`
|
|
|
|
|
|
+ E: common_vendor.t($data.recordingTimeDisplay),
|
|
|
|
+ F: `conic-gradient(${$data.progressColor} ${$options.progressPercent}%, ${$data.progressBgColor} 0%)`
|
|
} : {}, {
|
|
} : {}, {
|
|
- F: $data.showStartRecordingButton
|
|
|
|
|
|
+ G: $data.showStartRecordingButton
|
|
}, $data.showStartRecordingButton ? {
|
|
}, $data.showStartRecordingButton ? {
|
|
- G: common_vendor.o((...args) => $options.handleStartRecordingClick && $options.handleStartRecordingClick(...args))
|
|
|
|
|
|
+ H: common_vendor.o((...args) => $options.handleStartRecordingClick && $options.handleStartRecordingClick(...args))
|
|
} : {}, {
|
|
} : {}, {
|
|
- H: $data.showRetryButton
|
|
|
|
|
|
+ I: $data.showRetryButton
|
|
}, $data.showRetryButton ? {
|
|
}, $data.showRetryButton ? {
|
|
- I: common_vendor.o((...args) => $options.retryVideoUpload && $options.retryVideoUpload(...args))
|
|
|
|
|
|
+ J: common_vendor.o((...args) => $options.retryVideoUpload && $options.retryVideoUpload(...args))
|
|
} : {}, {
|
|
} : {}, {
|
|
- J: $data.showCountdown
|
|
|
|
|
|
+ K: $data.showCountdown
|
|
}, $data.showCountdown ? {
|
|
}, $data.showCountdown ? {
|
|
- K: common_vendor.t($data.countdownValue)
|
|
|
|
|
|
+ L: common_vendor.t($data.countdownValue)
|
|
} : {}, {
|
|
} : {}, {
|
|
- L: $data.showRerecordButton
|
|
|
|
|
|
+ M: $data.showRerecordButton
|
|
}, $data.showRerecordButton ? {
|
|
}, $data.showRerecordButton ? {
|
|
- M: common_vendor.o((...args) => $options.handleRerecordButtonClick && $options.handleRerecordButtonClick(...args))
|
|
|
|
- } : {});
|
|
|
|
|
|
+ N: common_vendor.o((...args) => $options.handleRerecordButtonClick && $options.handleRerecordButtonClick(...args))
|
|
|
|
+ } : {}, {
|
|
|
|
+ O: $data.showPageWarning ? 1 : ""
|
|
|
|
+ });
|
|
}
|
|
}
|
|
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"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
wx.createPage(MiniProgramPage);
|