|
@@ -1,21 +1,25 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <div>{{
|
|
|
+ <div v-if="needStart">{{
|
|
|
countdownNumFormat
|
|
|
}}</div>
|
|
|
<div><el-avatar :src="faceCheckStu.logo_url || faceCheckStu.face_pic" @click="getChooseStudent" /></div>
|
|
|
<div>{{ faceCheckStu.name }}</div>
|
|
|
<div>成绩:{{ currentResultObj.count }} {{ unit }}</div>
|
|
|
<div>得分:{{ currentResultObj.score }}</div>
|
|
|
- <div>中断/犯规:{{ currentResultObj.back_num }}</div>
|
|
|
+ <div>
|
|
|
+ <div v-if="['jumprope'].includes(parameter.project)">中断</div>
|
|
|
+ <div v-else>犯规</div>
|
|
|
+ <div>{{ currentResultObj.back_num }}</div>
|
|
|
+ </div>
|
|
|
<div v-if="backReason.length">
|
|
|
<div>违规项</div>
|
|
|
<div v-for="(item, index) in backReason" :key="index">{{ item }}</div>
|
|
|
</div>
|
|
|
- <div>当前状态:({{ examState == 3 ? "创建测试" : examState == 40 ? "开始识别" : examState == 41 ? "停止人脸识别"
|
|
|
+ <div>当前状态:({{ examState == 3 ? "初始化完成" : examState == 40 ? "创建测试" : examState == 41 ? "开始人脸识别"
|
|
|
:
|
|
|
examState ==
|
|
|
- 43 ? "开始测试" : examState == 42 ? "正在测试" : "请初始化" }})</div>
|
|
|
+ 43 ? "停止人脸识别" : examState == 42 ? "正在测试" : "请初始化" }})</div>
|
|
|
<!-- <div @click="getProcess">走一套流程</div> -->
|
|
|
|
|
|
<div v-if="needStart">
|
|
@@ -27,7 +31,9 @@
|
|
|
<div @click="getRetestFace" v-if="examState == 43 || examState == 42">4、重新识别</div>
|
|
|
<div @click="getRetest" v-if="(examState == 3 && faceCheckStu.student_id) || examState == 42">再测一次</div>
|
|
|
<div @click="confirmExit">退出</div>
|
|
|
- <ChooseStudent ref="chooseStudentRef" @back="backStudent" />
|
|
|
+
|
|
|
+ <FaceWindow ref="faceWindowRef" :faceCheckStu="faceCheckStu" />
|
|
|
+ <ChooseStudent ref="chooseStudentRef" @returnData="backStudent" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -37,6 +43,7 @@ import dataDictionary from "@/utils/dataDictionary"
|
|
|
const { proxy } = getCurrentInstance() as any;
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
+const faceWindowRef = ref();
|
|
|
const chooseStudentRef = ref();
|
|
|
const data = reactive<any>({
|
|
|
timerManager: {},//计时器管理
|
|
@@ -95,23 +102,13 @@ const getMessage = (e: any) => {
|
|
|
if (e.cmd === 'set_exam_state') {
|
|
|
examState.value = e.data;
|
|
|
if (e.data === 3) {
|
|
|
- //停止计时
|
|
|
- getStopCountdown();
|
|
|
- //不需要按钮的自动进入下一步
|
|
|
- if (needStart.value == false) {
|
|
|
- setTimeout(() => {
|
|
|
- //再加一个判断以免和再测一次冲突
|
|
|
- if (examState.value == 3) {
|
|
|
- getOpenOneTestAndStartFace();
|
|
|
- }
|
|
|
- }, 6000)
|
|
|
- }
|
|
|
+ initProject();
|
|
|
}
|
|
|
if (e.data === 40) {
|
|
|
cleanData();
|
|
|
}
|
|
|
if (e.data == 41) {
|
|
|
-
|
|
|
+ getFaceWindow();
|
|
|
}
|
|
|
if (e.data == 43) {
|
|
|
|
|
@@ -127,13 +124,13 @@ const getMessage = (e: any) => {
|
|
|
//人脸识别状态
|
|
|
if (e.cmd === 'face_check_result') {
|
|
|
faceCheckStu.value = e.data[0] || e.data;
|
|
|
+ //工作站识别成功后停止识别并确定人脸
|
|
|
getStopFace();
|
|
|
}
|
|
|
//测试结束结果
|
|
|
if (e.cmd === 'oneresult') {
|
|
|
if (e.data.length) {
|
|
|
let data = e.data[0];
|
|
|
- console.log("成绩", data);
|
|
|
getAchievement(data)
|
|
|
}
|
|
|
}
|
|
@@ -199,6 +196,7 @@ const getFaceConfirmOnly = () => {
|
|
|
student_id: faceCheckStu.value.student_id,
|
|
|
gender: faceCheckStu.value.gender
|
|
|
}, () => {
|
|
|
+ faceWindowRef.value.close();
|
|
|
//不需要按钮的自动进入下一步
|
|
|
if (needStart.value == false) {
|
|
|
getStartOneTest();
|
|
@@ -211,11 +209,16 @@ const getFaceConfirmOnly = () => {
|
|
|
*/
|
|
|
const getRetestFace = () => {
|
|
|
if (needStart.value == false) {
|
|
|
- //不需要手动操作的项目重新识别直接返回3
|
|
|
+ //自动流程项目重新识别直接返回3
|
|
|
closeOneTest();
|
|
|
} else {
|
|
|
- //需要手动操作的项目重新识别返回41
|
|
|
- startFace();
|
|
|
+ //手动流程项目重新识别43返回41,42返回3
|
|
|
+ if (examState.value == 43) {
|
|
|
+ cleanData();
|
|
|
+ startFace();
|
|
|
+ } else {
|
|
|
+ closeOneTest();
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -228,7 +231,10 @@ const getStartOneTest = () => {
|
|
|
return false;
|
|
|
}
|
|
|
startOneTest(() => {
|
|
|
- getCountdown();
|
|
|
+ //计时项目才开
|
|
|
+ if (needStart.value == true) {
|
|
|
+ getCountdown();
|
|
|
+ }
|
|
|
})
|
|
|
};
|
|
|
|
|
@@ -312,11 +318,12 @@ const getChooseStudent = () => {
|
|
|
*/
|
|
|
const backStudent = (data: any) => {
|
|
|
faceCheckStu.value = data;
|
|
|
+ faceWindowRef.value.open();
|
|
|
getStopFace();
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
- * 返回被选学生
|
|
|
+ * 清除历史记录
|
|
|
*/
|
|
|
const cleanData = () => {
|
|
|
countdownNum.value = testTime.value;
|
|
@@ -325,6 +332,29 @@ const cleanData = () => {
|
|
|
backReason.value = [];
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * 自动初始化项目
|
|
|
+*/
|
|
|
+const initProject = () => {
|
|
|
+ //停止计时
|
|
|
+ getStopCountdown();
|
|
|
+ //自动项目定时进入下一步
|
|
|
+ if (needStart.value == false) {
|
|
|
+ let time = 0;
|
|
|
+ if (!faceCheckStu.value.student_id) {
|
|
|
+ time = 1000;
|
|
|
+ } else {
|
|
|
+ time = 6000;
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ //再加一个判断以免和再测一次冲突
|
|
|
+ if (examState.value == 3) {
|
|
|
+ getOpenOneTestAndStartFace();
|
|
|
+ }
|
|
|
+ }, time)
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
/**
|
|
|
* 时间转换
|
|
|
*/
|
|
@@ -353,11 +383,25 @@ const getStopCountdown = () => {
|
|
|
timerManager.value.countdownTimer = null;
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * 停止人脸识别
|
|
|
+*/
|
|
|
+const getFaceWindow = () => {
|
|
|
+ faceWindowRef.value.open();
|
|
|
+ //然后定时自动关闭
|
|
|
+ setTimeout(() => {
|
|
|
+ if (examState.value == 41 && faceWindowRef.value.faceState == true) {
|
|
|
+ faceWindowRef.value.close();
|
|
|
+ }
|
|
|
+ }, 3000)
|
|
|
+
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
* 成绩
|
|
|
*/
|
|
|
const getAchievement = (data: any) => {
|
|
|
+ console.log("成绩", data);
|
|
|
let dic: any = dataDictionary;
|
|
|
let type = parameter.value.project;
|
|
|
let count =
|
|
@@ -452,6 +496,7 @@ onMounted(() => {
|
|
|
if (parameter.value.time) {
|
|
|
testTime.value = parameter.value.time
|
|
|
}
|
|
|
+ countdownNum.value = testTime.value;
|
|
|
let myInfo: any = localStorage.getItem("userInfo");
|
|
|
userInfo.value = JSON.parse(myInfo);
|
|
|
let dic: any = dataDictionary;
|
|
@@ -471,4 +516,4 @@ onUnmounted(() => {
|
|
|
})
|
|
|
</script>
|
|
|
|
|
|
-<style scoped></style>
|
|
|
+<style scoped lang="scss"></style>
|