|
@@ -1,12 +1,26 @@
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
+
|
|
|
import { ElMessage, ElLoading } from 'element-plus';
|
|
|
import { onMounted, onUnmounted, ref } from 'vue'
|
|
|
+import { useRoute, useRouter } from 'vue-router';
|
|
|
+import { userInfoStore } from '@/stores'
|
|
|
+import { format } from 'date-fns/format';
|
|
|
+import { saveFaceDotApi } from '@/api/plan';
|
|
|
+const userInfo = userInfoStore()
|
|
|
+const route = useRoute()
|
|
|
+const router = useRouter()
|
|
|
+const flag1 = ref<string>('')
|
|
|
+const flagName = ref<string>('')
|
|
|
+const planId = ref<string>('')
|
|
|
+const planName = ref<string>('')
|
|
|
+const startTime1 = ref<string>('')
|
|
|
+const num = ref<string>('')
|
|
|
|
|
|
const taskId = ref<string>('')
|
|
|
const subjectInfo = ref()
|
|
|
const userId = ref<string>()// 用户id
|
|
|
-const countDownStr = ref<string>("马上开始!")
|
|
|
+const countDownStr = ref<string>("")
|
|
|
const countDownTime = ref<number>(6)
|
|
|
const countDownShow = ref<boolean>(true)
|
|
|
const isDisabled = ref<boolean>(false)//开始测试按钮禁用,防止重复点击
|
|
@@ -38,6 +52,11 @@ const topImg = ref()
|
|
|
const bottomImg = ref()
|
|
|
const isLoading = ref<boolean>(false)
|
|
|
|
|
|
+//判断进来是练习测试还是正式测试
|
|
|
+const currentType = ref(0)
|
|
|
+//当前测试的轮数
|
|
|
+const turnsNumber = ref<number>(0)
|
|
|
+
|
|
|
//引入静态资源的方法
|
|
|
// vue3+vite 实现动态加载图片
|
|
|
const requireImg = (path: string) => {
|
|
@@ -45,10 +64,51 @@ const requireImg = (path: string) => {
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ countDownStr.value = '马上开始'
|
|
|
+ currentType.value = parseInt(route.params.currentType as string)
|
|
|
+
|
|
|
+ flag1.value = route.params.flag as string;
|
|
|
+ planId.value = route.params.planId as string
|
|
|
+ planName.value = route.params.planName as string
|
|
|
+ flagName.value = route.params.flagName as string
|
|
|
+ num.value = route.params.num as string
|
|
|
+ getStartTime()
|
|
|
+ // init()
|
|
|
+ // //传输1是练习测试
|
|
|
+ // //传输2是正式测试
|
|
|
+ // if (currentType.value) {
|
|
|
+ // startTest(2)
|
|
|
+ // } else {
|
|
|
+ // startTest(1)
|
|
|
+ // }
|
|
|
+ if (currentType.value) {
|
|
|
+ turnsNumber.value = 95
|
|
|
+
|
|
|
+ } else {
|
|
|
+ turnsNumber.value = 10
|
|
|
+ }
|
|
|
+ //接收到传过来的参数后
|
|
|
+ //判断是练习还是测试
|
|
|
+ // if(currentType.value=='0'){
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
init();
|
|
|
+
|
|
|
+
|
|
|
+ //判断是否是练习测试
|
|
|
+ //判断是否是正式测试
|
|
|
+
|
|
|
clickVoice.value = new Audio(requireImg("../../assets/notify.wav"));
|
|
|
banClickVoice.value = new Audio(requireImg("../../assets/ban.mp3"));
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
+const getStartTime = () => {
|
|
|
+ let date = new Date()
|
|
|
+ startTime1.value = format(date, "yyyy-MM-dd hh:mm:ss");
|
|
|
+ console.log(startTime1.value)
|
|
|
+}
|
|
|
onUnmounted(() => {
|
|
|
clearInterval(myInterval.value);
|
|
|
clearInterval(myInterval1.value);
|
|
@@ -58,6 +118,8 @@ onUnmounted(() => {
|
|
|
clearTimeout(timingThree.value);
|
|
|
clearTimeout(timingFour.value);
|
|
|
})
|
|
|
+//格式化页面
|
|
|
+
|
|
|
const init = () => {
|
|
|
taskId.value = '';
|
|
|
userId.value = '';
|
|
@@ -219,7 +281,9 @@ const recordUserResponse = () => {
|
|
|
blockList2.value[cumulation.value].responseTime = "NULL"; //反应时(ms)
|
|
|
blockList2.value[cumulation.value].correct = 0; //反应是否正确
|
|
|
|
|
|
- if (cumulation.value >= 95) {
|
|
|
+
|
|
|
+
|
|
|
+ if (cumulation.value >= turnsNumber.value) {
|
|
|
//调用接口,跳转页面
|
|
|
submitData();
|
|
|
} else {
|
|
@@ -262,7 +326,7 @@ const startTime = () => {
|
|
|
commonTime.value++;
|
|
|
}, 10);
|
|
|
}
|
|
|
-const submitData = () => {
|
|
|
+const submitData = async () => {
|
|
|
if (isLoading.value) {
|
|
|
return;
|
|
|
}
|
|
@@ -428,6 +492,84 @@ const submitData = () => {
|
|
|
neutralResponse2.map((item) => {
|
|
|
neutralAllTime2 += item.responseTime;
|
|
|
});
|
|
|
+ ElMessage({
|
|
|
+ message: `正确率为${((blockRight1.length / turnsNumber.value) * 100).toFixed(2)}%`,
|
|
|
+ type: "info"
|
|
|
+ })
|
|
|
+ if (currentType.value) {
|
|
|
+ setTimeout(() => {
|
|
|
+ router.go(-1)
|
|
|
+ }, 1500)
|
|
|
+ } else {
|
|
|
+ let result = {
|
|
|
+ block1: {
|
|
|
+ totalCorrectRate:
|
|
|
+ ((blockRight1.length / 96) * 100).toFixed(2),
|
|
|
+ posCorrectRate:
|
|
|
+ ((happyRight1.length / happy1.length) * 100).toFixed(2),
|
|
|
+ posAverageTime: (happyAllTime1 / happyResponse1.length).toFixed(
|
|
|
+ 2
|
|
|
+ ),
|
|
|
+ negCorrectRate:
|
|
|
+ ((fearRight1.length / fear1.length) * 100).toFixed(2),
|
|
|
+ negAverageTime: (fearAllTime1 / fearResponse1.length).toFixed(2),
|
|
|
+ neuCorrectRate:
|
|
|
+ ((neutralRight1.length / neutral1.length) * 100).toFixed(2)
|
|
|
+ ,
|
|
|
+ neuAverageTime: (
|
|
|
+ neutralAllTime1 / neutralResponse1.length
|
|
|
+ ).toFixed(2),
|
|
|
+ },
|
|
|
+ block2: {
|
|
|
+ totalCorrectRate:
|
|
|
+ ((blockRight2.length / 96) * 100).toFixed(2),
|
|
|
+ posCorrectRate:
|
|
|
+ ((happyRight2.length / happy2.length) * 100).toFixed(2),
|
|
|
+ posAverageTime: (happyAllTime2 / happyResponse2.length).toFixed(
|
|
|
+ 2
|
|
|
+ ),
|
|
|
+ negCorrectRate:
|
|
|
+ ((fearRight2.length / fear2.length) * 100).toFixed(2),
|
|
|
+ negAverageTime: (fearAllTime2 / fearResponse2.length).toFixed(2),
|
|
|
+ neuCorrectRate:
|
|
|
+ ((neutralRight2.length / neutral2.length) * 100).toFixed(2),
|
|
|
+ neuAverageTime: (
|
|
|
+ neutralAllTime1 / neutralResponse1.length
|
|
|
+ ).toFixed(2),
|
|
|
+ },
|
|
|
+ }
|
|
|
+ let params = {
|
|
|
+ beginTime: startTime1.value,
|
|
|
+ orgName: userInfo.userInfo.orgName,
|
|
|
+ orgNo: userInfo.userInfo.orgNo,
|
|
|
+ planId: planId.value,
|
|
|
+ planName: planName.value,
|
|
|
+ taskFlag: flag.value,
|
|
|
+ taskName: flagName.value,
|
|
|
+ // testRecord: JSON.stringify(productData()),
|
|
|
+ data: JSON.stringify(resultData),
|
|
|
+ result: JSON.stringify({ result }),
|
|
|
+ type: '1',
|
|
|
+ userName: userInfo.userInfo.userName,
|
|
|
+ // userNo: isHaveManage ? userInfo.userInfo.userNo : '20240726001',
|
|
|
+ userNo: userInfo.userInfo.userNo,
|
|
|
+ }
|
|
|
+ let res: any = await saveFaceDotApi(params)
|
|
|
+ if (res.code == 200) {
|
|
|
+ router.push({
|
|
|
+ name: 'scaleMid', params: {
|
|
|
+ planId: planId.value,
|
|
|
+ planName: planName.value,
|
|
|
+ flag: flag.value,
|
|
|
+ flagName: flagName.value,
|
|
|
+ num: num.value
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
$http.post(
|
|
|
`/cognize/FDOT`,
|
|
@@ -486,10 +628,10 @@ const submitData = () => {
|
|
|
);
|
|
|
*/
|
|
|
|
|
|
- ElMessage({
|
|
|
- message: '测试结果生成中',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
+ // ElMessage({
|
|
|
+ // message: '测试结果生成中',
|
|
|
+ // type: 'success'
|
|
|
+ // })
|
|
|
}
|
|
|
const imgListSerialize = async () => {
|
|
|
// 按情绪等级图片数组序列化
|
|
@@ -523,8 +665,10 @@ const imgsPreloader = (imgArr: any) => {
|
|
|
let count = 0;
|
|
|
let loadingInstance = ElLoading.service({ fullscreen: true, text: "0%" });
|
|
|
imgArr.forEach((item: any) => {
|
|
|
- promiseArr.push(imgPreloader(item.topImg));
|
|
|
- promiseArr.push(imgPreloader(item.bottomImg));
|
|
|
+ // promiseArr.push(imgPreloader(item.topImg));
|
|
|
+ // promiseArr.push(imgPreloader(item.bottomImg));
|
|
|
+ promiseArr.push(item.topImg);
|
|
|
+ promiseArr.push(item.bottomImg);
|
|
|
count++;
|
|
|
let point = count / imgArr.length;
|
|
|
loadingInstance.text.value = point + "%";
|
|
@@ -573,15 +717,15 @@ const initImgList = async (rank: any) => {
|
|
|
dotPos: index >= 6 ? "0" : "1", //0-上,1-下
|
|
|
topImg:
|
|
|
index % 2 == 0
|
|
|
- ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-happy-0${rank + 1}.jpg`)
|
|
|
- : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-neutral.jpg`), //图片地址
|
|
|
bottomImg:
|
|
|
index % 2 == 0
|
|
|
- ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-neutral.jpg`)
|
|
|
- : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-happy-0${rank + 1}.jpg`), //图片地址
|
|
|
});
|
|
|
//害怕-1
|
|
@@ -596,15 +740,15 @@ const initImgList = async (rank: any) => {
|
|
|
dotPos: index >= 6 ? "0" : "1", //0-上,1-下
|
|
|
topImg:
|
|
|
index % 2 == 0
|
|
|
- ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-fear-0${rank + 1}.jpg`)
|
|
|
- : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-neutral.jpg`), //图片地址
|
|
|
bottomImg:
|
|
|
index % 2 == 0
|
|
|
- ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-neutral.jpg`)
|
|
|
- : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-fear-0${rank + 1}.jpg`), //图片地址
|
|
|
});
|
|
|
//开心-2
|
|
@@ -619,15 +763,15 @@ const initImgList = async (rank: any) => {
|
|
|
dotPos: index >= 6 ? "0" : "1", //0-上,1-下
|
|
|
topImg:
|
|
|
index % 2 == 0
|
|
|
- ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-happy-0${rank + 1}-jumble.jpg`)
|
|
|
- : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-neutral.jpg`), //图片地址
|
|
|
bottomImg:
|
|
|
index % 2 == 0
|
|
|
- ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-neutral.jpg`)
|
|
|
- : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-happy-0${rank + 1}-jumble.jpg`), //图片地址
|
|
|
});
|
|
|
//害怕-2
|
|
@@ -642,15 +786,15 @@ const initImgList = async (rank: any) => {
|
|
|
dotPos: index >= 6 ? "0" : "1", //点位置0-上,1-下
|
|
|
topImg:
|
|
|
index % 2 == 0
|
|
|
- ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-fear-0${rank + 1}-jumble.jpg`)
|
|
|
- : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-neutral.jpg`), //图片地址
|
|
|
bottomImg:
|
|
|
index % 2 == 0
|
|
|
- ? requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ ? requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-neutral.jpg`)
|
|
|
- : requireImg(`../../assets/congnitiveAblitity/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
+ : requireImg(`../assets/cognize/ETBnew/${item >= "06" ? "m" + item : "f" + item
|
|
|
}-fear-0${rank + 1}-jumble.jpg`), //图片地址
|
|
|
});
|
|
|
});
|
|
@@ -706,7 +850,7 @@ const userClick = (param: any) => {
|
|
|
blockList2.value[cumulation.value].correct =
|
|
|
param == activeBlock.value.dotType ? 1 : 0; //反应是否正确
|
|
|
|
|
|
- if (cumulation.value >= 95) {
|
|
|
+ if (cumulation.value >= turnsNumber.value) {
|
|
|
//调用接口,跳转页面
|
|
|
submitData();
|
|
|
} else {
|
|
@@ -738,8 +882,125 @@ const userClick = (param: any) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+// ${cumulation.value}/${turnsNumber.value}
|
|
|
</script>
|
|
|
<template>
|
|
|
+ <div class="cognize_plu" @contextmenu.prevent="" @click.left="userClick(0)" @click.right="userClick(1)">
|
|
|
+ <el-progress class="main_progress" color="linear-gradient(to right,#48D68E,#ffffff)" :text-inside="true"
|
|
|
+ :stroke-width="48" :percentage="(cumulation / turnsNumber) * 100" style="width: 50%">
|
|
|
+ <span style="color: #000;font-size: 20px;"> {{ cumulation }}/{{ turnsNumber }}</span>
|
|
|
+ </el-progress>
|
|
|
+ <Transition name="fade">
|
|
|
+ <p :key="countDownStr" v-show="countDownShow" class="imgBox1">{{ countDownStr }}</p>
|
|
|
+ </Transition>
|
|
|
|
|
|
+ <div style="text-align: center">
|
|
|
+ <img v-show="crossShow" src="../assets/cognize/whiteFlag-new.png" alt=""
|
|
|
+ style="width: 50px; height: 50px; margin-top: 20%" />
|
|
|
+ </div>
|
|
|
+ <div class="imgBox" v-show="expressionShow">
|
|
|
+ <img class="faceImg" :src="topImg" alt="" />
|
|
|
+ <img class="faceImg mt100" :src="bottomImg" alt="" />
|
|
|
+ </div>
|
|
|
+ <div class="imgBox" v-show="dotShow">
|
|
|
+ <div class="target">
|
|
|
+ {{ activeBlock?.dotPos == "0" ? activeBlock?.dot : "" }}
|
|
|
+ </div>
|
|
|
+ <div class="target mt100">
|
|
|
+ {{ activeBlock?.dotPos == "1" ? activeBlock?.dot : "" }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
-<style lang="scss"></style>
|
|
|
+<style lang="scss">
|
|
|
+.cognize_plu {
|
|
|
+ width: 100%;
|
|
|
+ height: 100vh;
|
|
|
+ background: url(../assets/cognize/goNoGoBg.png) no-repeat center;
|
|
|
+ background-size: cover;
|
|
|
+ background-color: rgb(37, 37, 37);
|
|
|
+}
|
|
|
+
|
|
|
+.imgBox {
|
|
|
+ width: 150px;
|
|
|
+ height: 400px;
|
|
|
+ position: absolute;
|
|
|
+ top: 25%;
|
|
|
+ left: 50%;
|
|
|
+ margin-left: -75px;
|
|
|
+}
|
|
|
+
|
|
|
+.target {
|
|
|
+ width: 150px;
|
|
|
+ height: 150px;
|
|
|
+ font-size: 48px;
|
|
|
+ font-weight: 700;
|
|
|
+ color: #000000;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 150px;
|
|
|
+}
|
|
|
+
|
|
|
+.faceImg {
|
|
|
+ display: block;
|
|
|
+ width: 150px;
|
|
|
+ height: 150px;
|
|
|
+}
|
|
|
+
|
|
|
+.imgBox1 {
|
|
|
+ // text-align: center;
|
|
|
+ // position: absolute;
|
|
|
+ // top: 50%;
|
|
|
+ // left: 50%;
|
|
|
+ // transform: translate(-50%, -50%);
|
|
|
+ // color: black;
|
|
|
+ // font-size: 40px;
|
|
|
+ // text-align: center;
|
|
|
+ // line-height: 100px;
|
|
|
+ // margin: 0 auto;
|
|
|
+ width: 200px;
|
|
|
+ font-size: 50px;
|
|
|
+ font-weight: 700;
|
|
|
+ position: absolute;
|
|
|
+ // background-color: antiquewhite;
|
|
|
+ ;
|
|
|
+ height: 40px;
|
|
|
+ // background-color: aliceblue;
|
|
|
+ text-align: center;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ top: 0;
|
|
|
+ bottom: 0;
|
|
|
+ margin: auto;
|
|
|
+}
|
|
|
+
|
|
|
+.main_progress {
|
|
|
+ padding-top: 40px;
|
|
|
+ padding-left: 40px
|
|
|
+}
|
|
|
+
|
|
|
+//数字动画效果
|
|
|
+
|
|
|
+.fade-enter-active {
|
|
|
+ animation: fade-in 1s;
|
|
|
+}
|
|
|
+
|
|
|
+.fade-leave-active {
|
|
|
+ animation: fade-in 1s reverse;
|
|
|
+}
|
|
|
+
|
|
|
+@keyframes fade-in {
|
|
|
+ 0% {
|
|
|
+ transform: scale(1.5);
|
|
|
+ }
|
|
|
+
|
|
|
+ 50% {
|
|
|
+ // transform: scale(1.25);
|
|
|
+ transform: scale(1.5);
|
|
|
+ }
|
|
|
+
|
|
|
+ 100% {
|
|
|
+ // transform: scale(1);
|
|
|
+ transform: scale(0.2);
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|