|
@@ -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" />
|
|
@@ -133,6 +133,7 @@ const data = reactive<any>({
|
|
|
testTime: 60,//时长
|
|
|
countdownNum: 0,//计时
|
|
|
ready: 0,//预备
|
|
|
+ exit: 0,//退出倒计时
|
|
|
},
|
|
|
userInfo: {},//用户信息
|
|
|
examState: 0,//当前状态
|
|
@@ -386,7 +387,7 @@ const getAgain = async () => {
|
|
|
* 确认退出
|
|
|
*/
|
|
|
const confirmExit = () => {
|
|
|
- let abc = proxy?.$modal.confirm("确定退出吗?").then(() => {
|
|
|
+ proxy?.$modal.confirm(`确定退出吗?`).then(() => {
|
|
|
getExit();
|
|
|
}).finally(() => {
|
|
|
});
|
|
@@ -398,7 +399,8 @@ const confirmExit = () => {
|
|
|
const getExit = () => {
|
|
|
getClearTimer();//清除计时器
|
|
|
examEnds();//通知工作站关闭
|
|
|
- speckCancel()//停止播报;
|
|
|
+ speckCancel();//停止播报
|
|
|
+ closeHand();//关闭手势
|
|
|
window.onbeforeunload = null;//移除事件处理器
|
|
|
let handcontroller_id = parameter.value.handcontroller;
|
|
|
if (handcontroller_id) {
|
|
@@ -706,26 +708,42 @@ const initHand = () => {
|
|
|
}
|
|
|
//举左手
|
|
|
if (e?.data?.result == "left_hand") {
|
|
|
- getReady();
|
|
|
+ if (exit.value) {
|
|
|
+ exit.value = 0;
|
|
|
+ //确认退出
|
|
|
+ let keyEvent: any = null;
|
|
|
+ keyEvent = new KeyboardEvent('keydown', {
|
|
|
+ key: 'Enter', // 键值
|
|
|
+ code: 'Enter', // 键盘代码
|
|
|
+ keyCode: 13, // 旧的键盘代码
|
|
|
+ which: 13, // 新的键盘代码
|
|
|
+ shiftKey: false, // 是否按下Shift键
|
|
|
+ ctrlKey: false, // 是否按下Ctrl键
|
|
|
+ metaKey: false, // 是否按下Meta键(Win键或Command键)
|
|
|
+ bubbles: true, // 事件是否冒泡
|
|
|
+ cancelable: true // 是否可以取消事件的默认行为
|
|
|
+ });
|
|
|
+ document.activeElement?.dispatchEvent(keyEvent);
|
|
|
+ } else {
|
|
|
+ getReady()
|
|
|
+ }
|
|
|
}
|
|
|
//退出
|
|
|
if (e?.data?.result == "exit") {
|
|
|
- // console.log("exit.value", exit.value)
|
|
|
+ console.log("exit.value", exit.value)
|
|
|
if (exit.value == 0) {
|
|
|
- console
|
|
|
+ exit.value = 1
|
|
|
+ speckText("请5秒内举左手确认退出");
|
|
|
//第一次才弹出
|
|
|
confirmExit();
|
|
|
- setTimeout(() => {
|
|
|
- let keyEvent: any = null;
|
|
|
- let myKey = null;
|
|
|
- //如果交叉手两秒后返回超过4次就确认退出
|
|
|
- if (exit.value >= 4) {
|
|
|
- myKey = 'Enter';
|
|
|
- } else {
|
|
|
- myKey = 'Esc';
|
|
|
+ time.value.exit = 6;
|
|
|
+ timerManager.value.exitTimer = setInterval(() => {
|
|
|
+ time.value.exit--;
|
|
|
+ console.log("取消倒计时", time.value.exit)
|
|
|
+ if (time.value.exit == 0) {
|
|
|
exit.value = 0;
|
|
|
- }
|
|
|
- if (myKey == 'Esc') {
|
|
|
+ getClearTimer("exitTimer");
|
|
|
+ let keyEvent: any = null;
|
|
|
keyEvent = new KeyboardEvent('keydown', {
|
|
|
key: 'Escape', // 键值
|
|
|
code: 'Escape', // 键盘代码
|
|
@@ -737,24 +755,10 @@ const initHand = () => {
|
|
|
bubbles: true, // 事件是否冒泡
|
|
|
cancelable: true // 是否可以取消事件的默认行为
|
|
|
});
|
|
|
+ document.activeElement?.dispatchEvent(keyEvent);
|
|
|
}
|
|
|
- if (myKey == 'Enter') {
|
|
|
- keyEvent = new KeyboardEvent('keydown', {
|
|
|
- key: 'Enter', // 键值
|
|
|
- code: 'Enter', // 键盘代码
|
|
|
- keyCode: 13, // 旧的键盘代码
|
|
|
- which: 13, // 新的键盘代码
|
|
|
- shiftKey: false, // 是否按下Shift键
|
|
|
- ctrlKey: false, // 是否按下Ctrl键
|
|
|
- metaKey: false, // 是否按下Meta键(Win键或Command键)
|
|
|
- bubbles: true, // 事件是否冒泡
|
|
|
- cancelable: true // 是否可以取消事件的默认行为
|
|
|
- });
|
|
|
- }
|
|
|
- document.activeElement?.dispatchEvent(keyEvent);
|
|
|
- }, 2500)
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
- exit.value = exit.value + 1
|
|
|
}
|
|
|
});
|
|
|
};
|