|
@@ -21,7 +21,7 @@
|
|
|
:leave-active-class="proxy?.animate.dialog.leave">
|
|
|
<div class="time" v-show="needStart && [42].includes(examState)">{{
|
|
|
time.countdownNum
|
|
|
- }}</div>
|
|
|
+ }}</div>
|
|
|
</Transition>
|
|
|
<div class="tips" v-if="examState == 41">
|
|
|
<img v-if="parameter.gesture" src="@/assets/images/test/ready1.png" />
|
|
@@ -146,14 +146,20 @@ const data = reactive<any>({
|
|
|
showTestAgain: false,//再测一次按钮
|
|
|
readyState: true,//倒计时按钮状态
|
|
|
exit: 0,//退出响应次数
|
|
|
+ sid: null,//WS的id
|
|
|
});
|
|
|
-const { timerManager, parameter, time, userInfo, examState, resultId, faceCheckStu, currentResultObj, unit, backReason, backReasonStr, needStart, showTestAgain, readyState, exit } = toRefs(data);
|
|
|
+const { timerManager, parameter, time, userInfo, examState, resultId, faceCheckStu, currentResultObj, unit, backReason, backReasonStr, needStart, showTestAgain, readyState, exit, sid } = toRefs(data);
|
|
|
|
|
|
/**
|
|
|
* 接收消息
|
|
|
*/
|
|
|
const getMessage = (e: any) => {
|
|
|
//console.log("WS响应:", e)
|
|
|
+ //获取sid
|
|
|
+ if (e.cmd === 'mySid') {
|
|
|
+ console.log("e.data.sid", e.data.id)
|
|
|
+ sid.value = e.data.sid;
|
|
|
+ }
|
|
|
//实时状态
|
|
|
if (e.cmd === 'exam_status') {
|
|
|
examState.value = e.data;
|
|
@@ -805,6 +811,25 @@ onBeforeMount(() => {
|
|
|
initSpeech();
|
|
|
//初始化手势
|
|
|
initHand();
|
|
|
+ //刷新关闭
|
|
|
+ window.onbeforeunload = function (e) {
|
|
|
+ var confirmationMessage = "刷新/关闭页面将会关闭页面,是否确认退出页面?";
|
|
|
+ (e || window.event).returnValue = confirmationMessage; // 兼容 Gecko + IE
|
|
|
+ let bUrl = import.meta.env.VITE_APP_BASE_API;
|
|
|
+ let classId = parameter.value.classes;
|
|
|
+ let project = parameter.value.project;
|
|
|
+ let area = parameter.value.area;
|
|
|
+ let examId = `${project}_${area}`;
|
|
|
+ let mySid = sid.value;
|
|
|
+ let token: any = localStorage.getItem("token")
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append("exam_id", examId);
|
|
|
+ formData.append("class_id", classId);
|
|
|
+ formData.append("token", token);
|
|
|
+ formData.append("sid", mySid);
|
|
|
+ navigator.sendBeacon(bUrl + "/exam/close_exam", formData)
|
|
|
+ return confirmationMessage; // 兼容 Gecko + Webkit, Safari, Chrome
|
|
|
+ };
|
|
|
})
|
|
|
|
|
|
onBeforeUnmount(() => {
|