|
@@ -1,897 +1,1035 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <van-nav-bar
|
|
|
- :title="subjectInfo.name"
|
|
|
- left-text="返回"
|
|
|
- left-arrow
|
|
|
- @click-left="goBack"
|
|
|
+ <div>
|
|
|
+ <van-nav-bar
|
|
|
+ :title="subjectInfo.name"
|
|
|
+ left-arrow
|
|
|
+ left-text="返回"
|
|
|
+ @click-left="goBack"
|
|
|
+ />
|
|
|
+ <!--<div v-show="!showCatain" class="explan">-->
|
|
|
+ <!--<!– LOGO –>-->
|
|
|
+ <!--<h1>FDOT</h1>-->
|
|
|
+ <!--<div>-->
|
|
|
+ <!--<p>-->
|
|
|
+ <!--请你注视眼前屏幕,注视点“+”过后,屏幕上方和下方将随机出现两张面孔图片,面孔图片消失后将在屏幕上方或下方出现“:”或“..”符号,“:”按鼠标左键,“..”按鼠标右键,请尽快和尽可能准确的按下相应按键。-->
|
|
|
+ <!--</p>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--<div class="btnArea">-->
|
|
|
+ <!--<van-button round block type="info" :disabled="isDisabled" @click="startTest()">开始测试</van-button>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--</div>-->
|
|
|
+
|
|
|
+ <div v-show="showCatain" class="activeTask">
|
|
|
+ <div class="progress-content">
|
|
|
+ <van-progress
|
|
|
+ :percentage="((cumulation + 1) * 100) / 96"
|
|
|
+ color="#f2826a"
|
|
|
+ pivot-text="任务进度"
|
|
|
/>
|
|
|
- <!--<div v-show="!showCatain" class="explan">-->
|
|
|
- <!--<!– LOGO –>-->
|
|
|
- <!--<h1>FDOT</h1>-->
|
|
|
- <!--<div>-->
|
|
|
- <!--<p>-->
|
|
|
- <!--请你注视眼前屏幕,注视点“+”过后,屏幕上方和下方将随机出现两张面孔图片,面孔图片消失后将在屏幕上方或下方出现“:”或“..”符号,“:”按鼠标左键,“..”按鼠标右键,请尽快和尽可能准确的按下相应按键。-->
|
|
|
- <!--</p>-->
|
|
|
- <!--</div>-->
|
|
|
- <!--<div class="btnArea">-->
|
|
|
- <!--<van-button round block type="info" :disabled="isDisabled" @click="startTest()">开始测试</van-button>-->
|
|
|
- <!--</div>-->
|
|
|
- <!--</div>-->
|
|
|
-
|
|
|
- <div class="activeTask" v-show="showCatain">
|
|
|
-
|
|
|
- <div class="progress-content">
|
|
|
- <van-progress
|
|
|
- :percentage="((cumulation + 1) * 100) / 96"
|
|
|
- pivot-text="任务进度"
|
|
|
- color="#f2826a"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <p v-show="countDownShow" class="timingBox">{{ countDownStr }}</p>
|
|
|
-
|
|
|
- <div class="look-point">
|
|
|
- <img
|
|
|
- v-show="crossShow"
|
|
|
- src="../../assets/congnitiveAblitity/whiteFlag-new.png"
|
|
|
- alt=""
|
|
|
- style="width: 50px; height: 50px; margin-top: 20%;"
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="active-img" v-show="expressionShow">
|
|
|
- <img
|
|
|
- class="faceImg"
|
|
|
- :src="topImg"
|
|
|
- alt=""
|
|
|
- />
|
|
|
- <img
|
|
|
- class="faceImg mt46"
|
|
|
- :src="bottomImg"
|
|
|
- alt=""
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="active-img" v-show="dotShow">
|
|
|
- <div class="target">
|
|
|
- {{activeBlock.dotPos == '0' ? activeBlock.dot : ''}}
|
|
|
- </div>
|
|
|
- <div class="target mt46">
|
|
|
- {{activeBlock.dotPos == '1' ? activeBlock.dot : ''}}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="btn-content" v-show="!disableClick">
|
|
|
- <div class="btn-item">
|
|
|
- <van-button size="small" round block type="info" @click="userClick(0)"><van-icon name="arrow-left" /></van-button>
|
|
|
- </div>
|
|
|
- <div class="btn-item">
|
|
|
- <van-button size="small" round block type="info" @click="userClick(1)"><van-icon name="arrow" /></van-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <p v-show="countDownShow" class="timingBox">{{ countDownStr }}</p>
|
|
|
|
|
|
+ <div class="look-point">
|
|
|
+ <img
|
|
|
+ v-show="crossShow"
|
|
|
+ alt=""
|
|
|
+ src="../../assets/congnitiveAblitity/whiteFlag-new.png"
|
|
|
+ style="width: 50px; height: 50px; margin-top: 20%;"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
|
|
|
+ <div v-show="expressionShow" class="active-img">
|
|
|
+ <img :src="topImg" alt="" class="faceImg" />
|
|
|
+ <img :src="bottomImg" alt="" class="faceImg mt46" />
|
|
|
+ </div>
|
|
|
+ <div v-show="dotShow" class="active-img">
|
|
|
+ <div class="target">
|
|
|
+ {{ activeBlock.dotPos == "0" ? activeBlock.dot : "" }}
|
|
|
</div>
|
|
|
+ <div class="target mt46">
|
|
|
+ {{ activeBlock.dotPos == "1" ? activeBlock.dot : "" }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
+ <div v-show="!disableClick" class="btn-content">
|
|
|
+ <div class="btn-item">
|
|
|
+ <van-button
|
|
|
+ block
|
|
|
+ round
|
|
|
+ size="small"
|
|
|
+ type="info"
|
|
|
+ @click="userClick(0)"
|
|
|
+ >
|
|
|
+ <van-icon name="arrow-left" />
|
|
|
+ </van-button>
|
|
|
+ </div>
|
|
|
+ <div class="btn-item">
|
|
|
+ <van-button
|
|
|
+ block
|
|
|
+ round
|
|
|
+ size="small"
|
|
|
+ type="info"
|
|
|
+ @click="userClick(1)"
|
|
|
+ >
|
|
|
+ <van-icon name="arrow" />
|
|
|
+ </van-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { Toast } from 'vant';
|
|
|
- export default {
|
|
|
- name: "face_dot",
|
|
|
- data() {
|
|
|
- return {
|
|
|
- userId: "", // 用户id
|
|
|
- countDownStr: "马上开始!",
|
|
|
- countDownTime: 6,
|
|
|
- countDownShow: true,
|
|
|
- isDisabled: false, //开始测试按钮禁用,防止重复点击
|
|
|
- clickVoice: {},
|
|
|
- banClickVoice: {},
|
|
|
- disableClick: true, // 点击锁
|
|
|
- showCatain: false,
|
|
|
- crossShow: false, //注释点+显示
|
|
|
- expressionShow: false, //表情图片对显示
|
|
|
- dotShow: false, //选项点显示
|
|
|
- arrList: ['01','02','03','04','05','06','07','08','09','10'], //取样数组
|
|
|
- randomArr: [], //十个人全取加2个随机人
|
|
|
- blockList1: [], //block数据1
|
|
|
- blockList2: [], //block数据2
|
|
|
- currentIndex: 0, //当前需要显示的图片点索引值
|
|
|
- activeBlock: {}, //当前需要显示的图片点对象
|
|
|
- stopIndex: 0, //停顿索引值记录
|
|
|
- cumulation: 0, //图片序列当前索引值
|
|
|
- result: [], //测试结果
|
|
|
- myInterval: null, //测试开始倒计时
|
|
|
- myInterval1: null, //测试间隔倒计时
|
|
|
- flag: null, //记录反应时计时器
|
|
|
- timingOne: null, //倒计时1
|
|
|
- timingTwo: null, //倒计时2
|
|
|
- timingThree: null, //倒计时3
|
|
|
- timingFour: null, //倒计时4
|
|
|
- commonTime: 0, //反应时间记录
|
|
|
- topImg: '', //上边图片
|
|
|
- bottomImg: '', //下边图片
|
|
|
- testPlanId: '',//测试计划ID
|
|
|
- taskId: '', //任务ID
|
|
|
- subjectInfo: "", //认知任务详情
|
|
|
- };
|
|
|
- },
|
|
|
- // 页面初始化函数
|
|
|
- created() {
|
|
|
- this.testPlanId = this.$route.query.testPlanId || '';
|
|
|
- this.userId = JSON.parse(sessionStorage.getItem("userInfo")).id;
|
|
|
- this.subjectInfo = JSON.parse(sessionStorage.getItem('subjectInfo'))
|
|
|
- this.clickVoice = new Audio(require("../../assets/notify.wav"));
|
|
|
- this.banClickVoice = new Audio(require("../../assets/ban.mp3"));
|
|
|
+import { Toast } from "vant";
|
|
|
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- this.startTest();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- goBack() {
|
|
|
- if(this.testPlanId) {
|
|
|
- //来自测试计划列表
|
|
|
- this.$router.push({
|
|
|
- name: "testPlanClassify",
|
|
|
- params: {
|
|
|
- testPlanId: this.testPlanId,
|
|
|
- },
|
|
|
- });
|
|
|
- }else {
|
|
|
- this.$router.push("/index/cognitionTask");
|
|
|
- }
|
|
|
- },
|
|
|
- countDown() {
|
|
|
- // 测试时间倒计时
|
|
|
- //显示测试主页面
|
|
|
- this.showCatain = true;
|
|
|
- //显示倒计时界面
|
|
|
- this.countDownShow = true;
|
|
|
- // 关闭所有测试显示模块
|
|
|
- this.crossShow = false;
|
|
|
- this.expressionShow = false;
|
|
|
- this.dotShow = false;
|
|
|
-
|
|
|
- this.myInterval = setInterval(() => {
|
|
|
- this.countDownTime--;
|
|
|
- this.countDownStr = this.countDownTime;
|
|
|
- if (this.countDownTime == 0) {
|
|
|
- //隐藏倒计时界面
|
|
|
- this.countDownShow = false;
|
|
|
- // //图片赋值开始测试
|
|
|
- // this.activeBlock = this.blockList1[this.cumulation];
|
|
|
- // this.changeImg('1',this.cumulation);
|
|
|
- // this.showCross();
|
|
|
-
|
|
|
- // 图片预加载
|
|
|
- this.imgListSerialize();
|
|
|
-
|
|
|
- // 清除定时器
|
|
|
- clearInterval(this.myInterval);
|
|
|
- //倒计时重置为6秒
|
|
|
- this.countDownTime = 6;
|
|
|
- }
|
|
|
- }, 1000);
|
|
|
- },
|
|
|
- countDown1() {
|
|
|
- // 测试间隔倒计时
|
|
|
- //显示测试主页面
|
|
|
- this.showCatain = true;
|
|
|
- //显示倒计时界面
|
|
|
- this.countDownShow = true;
|
|
|
- // 关闭所有测试显示模块
|
|
|
- this.crossShow = false;
|
|
|
- this.expressionShow = false;
|
|
|
- this.dotShow = false;
|
|
|
-
|
|
|
- this.myInterval1 = setInterval(() => {
|
|
|
- this.countDownTime--;
|
|
|
- this.countDownStr = this.countDownTime;
|
|
|
- if (this.countDownTime == 0) {
|
|
|
- //隐藏倒计时界面
|
|
|
- this.countDownShow = false;
|
|
|
- //图片赋值开始测试
|
|
|
- this.activeBlock = this.blockList1[this.cumulation];
|
|
|
- this.changeImg('1',this.cumulation);
|
|
|
- this.showCross();
|
|
|
- // 清除定时器
|
|
|
- clearInterval(this.myInterval1);
|
|
|
- //倒计时重置为6秒
|
|
|
- this.countDownTime = 6;
|
|
|
- }
|
|
|
- }, 1000);
|
|
|
- },
|
|
|
- //图片预加载
|
|
|
- imgPreloader (url){
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- let image = new Image();
|
|
|
- image.onload = () => {
|
|
|
- resolve();
|
|
|
- };
|
|
|
- image.onerror = () => {
|
|
|
- reject();
|
|
|
- };
|
|
|
- image.src = url;
|
|
|
- });
|
|
|
- },
|
|
|
- imgsPreloader (imgArr){
|
|
|
- let promiseArr = [];
|
|
|
- let count = 0;
|
|
|
- let loadingInstance = Toast({
|
|
|
- type: 'loading',
|
|
|
- message: '加载中...',
|
|
|
- forbidClick: true,
|
|
|
- });
|
|
|
- imgArr.forEach(item => {
|
|
|
- promiseArr.push(this.imgPreloader(item.topImg));
|
|
|
- promiseArr.push(this.imgPreloader(item.bottomImg));
|
|
|
- count++;
|
|
|
- let point = parseInt((count / imgArr.length));
|
|
|
- loadingInstance.message = point + '%';
|
|
|
- if (count >= imgArr.length) {
|
|
|
- loadingInstance.message = '100%';
|
|
|
- Toast.clear();
|
|
|
- }
|
|
|
- });
|
|
|
- return Promise.all(promiseArr);
|
|
|
- },
|
|
|
- randomList(){
|
|
|
- // 从十个人中随机获取两个不同的人
|
|
|
- this.randomArr = [];
|
|
|
+export default {
|
|
|
+ name: "face_dot",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ userId: "", // 用户id
|
|
|
+ countDownStr: "马上开始!",
|
|
|
+ countDownTime: 6,
|
|
|
+ countDownShow: true,
|
|
|
+ isDisabled: false, //开始测试按钮禁用,防止重复点击
|
|
|
+ clickVoice: {},
|
|
|
+ banClickVoice: {},
|
|
|
+ disableClick: true, // 点击锁
|
|
|
+ showCatain: false,
|
|
|
+ crossShow: false, //注释点+显示
|
|
|
+ expressionShow: false, //表情图片对显示
|
|
|
+ dotShow: false, //选项点显示
|
|
|
+ arrList: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10"], //取样数组
|
|
|
+ randomArr: [], //十个人全取加2个随机人
|
|
|
+ blockList1: [], //block数据1
|
|
|
+ blockList2: [], //block数据2
|
|
|
+ currentIndex: 0, //当前需要显示的图片点索引值
|
|
|
+ activeBlock: {}, //当前需要显示的图片点对象
|
|
|
+ stopIndex: 0, //停顿索引值记录
|
|
|
+ cumulation: 0, //图片序列当前索引值
|
|
|
+ result: [], //测试结果
|
|
|
+ myInterval: null, //测试开始倒计时
|
|
|
+ myInterval1: null, //测试间隔倒计时
|
|
|
+ flag: null, //记录反应时计时器
|
|
|
+ timingOne: null, //倒计时1
|
|
|
+ timingTwo: null, //倒计时2
|
|
|
+ timingThree: null, //倒计时3
|
|
|
+ timingFour: null, //倒计时4
|
|
|
+ commonTime: 0, //反应时间记录
|
|
|
+ topImg: "", //上边图片
|
|
|
+ bottomImg: "", //下边图片
|
|
|
+ testPlanId: "", //测试计划ID
|
|
|
+ taskId: "", //任务ID
|
|
|
+ subjectInfo: "" //认知任务详情
|
|
|
+ };
|
|
|
+ },
|
|
|
+ // 页面初始化函数
|
|
|
+ created() {
|
|
|
+ this.testPlanId = this.$route.query.testPlanId || "";
|
|
|
+ this.userId = JSON.parse(sessionStorage.getItem("userInfo")).id;
|
|
|
+ this.subjectInfo = JSON.parse(sessionStorage.getItem("subjectInfo"));
|
|
|
+ this.clickVoice = new Audio(require("../../assets/notify.wav"));
|
|
|
+ this.banClickVoice = new Audio(require("../../assets/ban.mp3"));
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.startTest();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ goBack() {
|
|
|
+ if (this.testPlanId) {
|
|
|
+ //来自测试计划列表
|
|
|
+ this.$router.push({
|
|
|
+ name: "testPlanClassify",
|
|
|
+ params: {
|
|
|
+ testPlanId: this.testPlanId
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$router.push("/index/cognitionTask");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ countDown() {
|
|
|
+ // 测试时间倒计时
|
|
|
+ //显示测试主页面
|
|
|
+ this.showCatain = true;
|
|
|
+ //显示倒计时界面
|
|
|
+ this.countDownShow = true;
|
|
|
+ // 关闭所有测试显示模块
|
|
|
+ this.crossShow = false;
|
|
|
+ this.expressionShow = false;
|
|
|
+ this.dotShow = false;
|
|
|
|
|
|
- for( let k = 0; k < 2; k ++ ){
|
|
|
+ this.myInterval = setInterval(() => {
|
|
|
+ this.countDownTime--;
|
|
|
+ this.countDownStr = this.countDownTime;
|
|
|
+ if (this.countDownTime == 0) {
|
|
|
+ //隐藏倒计时界面
|
|
|
+ this.countDownShow = false;
|
|
|
+ // //图片赋值开始测试
|
|
|
+ // this.activeBlock = this.blockList1[this.cumulation];
|
|
|
+ // this.changeImg('1',this.cumulation);
|
|
|
+ // this.showCross();
|
|
|
|
|
|
- let id = Math.floor(Math.random() * 10);
|
|
|
+ // 图片预加载
|
|
|
+ this.imgListSerialize();
|
|
|
|
|
|
- if(k < 10){
|
|
|
+ // 清除定时器
|
|
|
+ clearInterval(this.myInterval);
|
|
|
+ //倒计时重置为6秒
|
|
|
+ this.countDownTime = 6;
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ countDown1() {
|
|
|
+ // 测试间隔倒计时
|
|
|
+ //显示测试主页面
|
|
|
+ this.showCatain = true;
|
|
|
+ //显示倒计时界面
|
|
|
+ this.countDownShow = true;
|
|
|
+ // 关闭所有测试显示模块
|
|
|
+ this.crossShow = false;
|
|
|
+ this.expressionShow = false;
|
|
|
+ this.dotShow = false;
|
|
|
|
|
|
- if(this.randomArr.indexOf(this.arrList[id]) === -1){
|
|
|
- this.randomArr.push(this.arrList[id]);
|
|
|
- }else{
|
|
|
- k= k - 1;
|
|
|
- continue;
|
|
|
- }
|
|
|
+ this.myInterval1 = setInterval(() => {
|
|
|
+ this.countDownTime--;
|
|
|
+ this.countDownStr = this.countDownTime;
|
|
|
+ if (this.countDownTime == 0) {
|
|
|
+ //隐藏倒计时界面
|
|
|
+ this.countDownShow = false;
|
|
|
+ //图片赋值开始测试
|
|
|
+ this.activeBlock = this.blockList1[this.cumulation];
|
|
|
+ this.changeImg("1", this.cumulation);
|
|
|
+ this.showCross();
|
|
|
+ // 清除定时器
|
|
|
+ clearInterval(this.myInterval1);
|
|
|
+ //倒计时重置为6秒
|
|
|
+ this.countDownTime = 6;
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ //图片预加载
|
|
|
+ imgPreloader(url) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let image = new Image();
|
|
|
+ image.onload = () => {
|
|
|
+ resolve();
|
|
|
+ };
|
|
|
+ image.onerror = () => {
|
|
|
+ reject();
|
|
|
+ };
|
|
|
+ image.src = url;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ imgsPreloader(imgArr) {
|
|
|
+ let promiseArr = [];
|
|
|
+ let count = 0;
|
|
|
+ let loadingInstance = Toast({
|
|
|
+ type: "loading",
|
|
|
+ message: "加载中...",
|
|
|
+ forbidClick: true
|
|
|
+ });
|
|
|
+ imgArr.forEach(item => {
|
|
|
+ promiseArr.push(this.imgPreloader(item.topImg));
|
|
|
+ promiseArr.push(this.imgPreloader(item.bottomImg));
|
|
|
+ count++;
|
|
|
+ let point = parseInt(count / imgArr.length);
|
|
|
+ loadingInstance.message = point + "%";
|
|
|
+ if (count >= imgArr.length) {
|
|
|
+ loadingInstance.message = "100%";
|
|
|
+ Toast.clear();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return Promise.all(promiseArr);
|
|
|
+ },
|
|
|
+ randomList() {
|
|
|
+ // 从十个人中随机获取两个不同的人
|
|
|
+ this.randomArr = [];
|
|
|
|
|
|
- }else {
|
|
|
- this.randomArr.push(this.arrList[id])
|
|
|
- }
|
|
|
- }
|
|
|
- //获取12个人,随机重复两个人
|
|
|
- this.randomArr = this.randomArr.concat(this.arrList);
|
|
|
+ for (let k = 0; k < 2; k++) {
|
|
|
+ let id = Math.floor(Math.random() * 10);
|
|
|
|
|
|
- },
|
|
|
- async shuffle(arr) {
|
|
|
- for (let i = 1; i < arr.length; i++) {
|
|
|
- const random = Math.floor(Math.random() * (i + 1));
|
|
|
- [arr[i], arr[random]] = [arr[random], arr[i]];
|
|
|
- }
|
|
|
- return arr;
|
|
|
- },
|
|
|
- async initImgList(rank){
|
|
|
- //动态初始化图片序列数组
|
|
|
- //随机挑选12个人
|
|
|
- await this.randomList();
|
|
|
- //根据情绪等级初始化数组
|
|
|
- this.randomArr.map((item,index)=>{
|
|
|
- //开心-1
|
|
|
- this.blockList1.push({
|
|
|
- type: 0, //0-block1,1-block2 数据类型
|
|
|
- emoType: "happy",// 情绪类型
|
|
|
- // emoAmp: rank,// 整数0,1,2...
|
|
|
- responseTime: "",//反应时(ms)
|
|
|
- correct: "",//用户反映正确性 1-正确, 0-错误
|
|
|
- dotType: ((index % 2) == 0) ? "0" : "1", //0-鼠标左击:,1-鼠标右击..
|
|
|
- dot: ((index % 2) == 0) ? ":" : "..", //:-鼠标左击,..-鼠标右击
|
|
|
- dotPos: (index >= 6) ? "0" : "1", //0-上,1-下
|
|
|
- topImg: ((index % 2) == 0) ? require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-happy-0${rank + 1}.jpg`)
|
|
|
- : require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-neutral.jpg`), //图片地址
|
|
|
- bottomImg: ((index % 2) == 0) ? require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-neutral.jpg`)
|
|
|
- : require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-happy-0${rank + 1}.jpg`), //图片地址
|
|
|
- });
|
|
|
- //害怕-1
|
|
|
- this.blockList1.push({
|
|
|
- type: 0, //0-block1,1-block2 数据类型
|
|
|
- emoType: "fear",// 情绪类型
|
|
|
- // emoAmp: rank,// 整数0,1,2...
|
|
|
- responseTime: "",//反应时(ms)
|
|
|
- correct: "",//用户反映正确性 1-正确, 0-错误
|
|
|
- dotType: ((index % 2) == 0) ? "0" : "1", //0-鼠标左击:,1-鼠标右击..
|
|
|
- dot: ((index % 2) == 0) ? ":" : "..", //:-鼠标左击,..-鼠标右击
|
|
|
- dotPos: (index >= 6) ? "0" : "1", //0-上,1-下
|
|
|
- topImg: ((index % 2) == 0) ? require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-fear-0${rank + 1}.jpg`)
|
|
|
- : require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-neutral.jpg`), //图片地址
|
|
|
- bottomImg: ((index % 2) == 0) ? require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-neutral.jpg`)
|
|
|
- : require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-fear-0${rank + 1}.jpg`), //图片地址
|
|
|
- });
|
|
|
- //开心-2
|
|
|
- this.blockList2.push({
|
|
|
- type: 1, //0-block1,1-block2 数据类型
|
|
|
- emoType: "happy",// 情绪类型
|
|
|
- // emoAmp: rank,// 整数0,1,2...
|
|
|
- responseTime: "",//反应时(ms)
|
|
|
- correct: "",//用户反映正确性 1-正确, 0-错误
|
|
|
- dotType: ((index % 2) == 0) == 0 ? "0" : "1", //0-鼠标左击:,1-鼠标右击..
|
|
|
- dot: ((index % 2) == 0) ? ":" : "..", //:-鼠标左击,..-鼠标右击
|
|
|
- dotPos: (index >= 6) ? "0" : "1", //0-上,1-下
|
|
|
- topImg: ((index % 2) == 0) ? require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-happy-0${rank + 1}-jumble.jpg`)
|
|
|
- : require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-neutral.jpg`), //图片地址
|
|
|
- bottomImg:((index % 2) == 0) ? require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-neutral.jpg`)
|
|
|
- : require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-happy-0${rank + 1}-jumble.jpg`), //图片地址
|
|
|
- });
|
|
|
- //害怕-2
|
|
|
- this.blockList2.push({
|
|
|
- type: 1, //0-block1,1-block2 数据类型
|
|
|
- emoType: "fear",// 情绪类型
|
|
|
- // emoAmp: rank,// 整数0,1,2...
|
|
|
- responseTime: "",//反应时(ms)
|
|
|
- correct: "",//用户反映正确性 1-正确, 0-错误
|
|
|
- dotType: ((index % 2) == 0) ? "0" : "1", //0-鼠标左击:,1-鼠标右击..
|
|
|
- dot: ((index % 2) == 0) ? ":" : "..", //:-鼠标左击,..-鼠标右击
|
|
|
- dotPos: (index >= 6) ? "0" : "1", //点位置0-上,1-下
|
|
|
- topImg: ((index % 2) == 0) ? require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-fear-0${rank + 1}-jumble.jpg`)
|
|
|
- : require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-neutral.jpg`), //图片地址
|
|
|
- bottomImg: ((index % 2) == 0) ? require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-neutral.jpg`)
|
|
|
- : require(`../../assets/congnitiveAblitity/ETBnew/${item >= '06'? 'm' + item: 'f' + item}-fear-0${rank + 1}-jumble.jpg`), //图片地址
|
|
|
- });
|
|
|
-
|
|
|
- })
|
|
|
+ if (k < 10) {
|
|
|
+ if (this.randomArr.indexOf(this.arrList[id]) === -1) {
|
|
|
+ this.randomArr.push(this.arrList[id]);
|
|
|
+ } else {
|
|
|
+ k = k - 1;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.randomArr.push(this.arrList[id]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //获取12个人,随机重复两个人
|
|
|
+ this.randomArr = this.randomArr.concat(this.arrList);
|
|
|
+ },
|
|
|
+ async shuffle(arr) {
|
|
|
+ for (let i = 1; i < arr.length; i++) {
|
|
|
+ const random = Math.floor(Math.random() * (i + 1));
|
|
|
+ [arr[i], arr[random]] = [arr[random], arr[i]];
|
|
|
+ }
|
|
|
+ return arr;
|
|
|
+ },
|
|
|
+ async initImgList(rank) {
|
|
|
+ //动态初始化图片序列数组
|
|
|
+ //随机挑选12个人
|
|
|
+ await this.randomList();
|
|
|
+ //根据情绪等级初始化数组
|
|
|
+ //根据情绪等级初始化数组
|
|
|
+ let randomArrList = [...new Set(this.randomArr)].concat(["02", "06"]);
|
|
|
+ console.log(randomArrList, "randomArrList");
|
|
|
+ randomArrList.map((item, index) => {
|
|
|
+ //开心-1
|
|
|
+ this.blockList1.push({
|
|
|
+ type: 0, //0-block1,1-block2 数据类型
|
|
|
+ emoType: "happy", // 情绪类型
|
|
|
+ // emoAmp: rank,// 整数0,1,2...
|
|
|
+ responseTime: "", //反应时(ms)
|
|
|
+ correct: "", //用户反映正确性 1-正确, 0-错误
|
|
|
+ dotType: index % 2 == 0 ? "0" : "1", //0-鼠标左击:,1-鼠标右击..
|
|
|
+ dot: index % 2 == 0 ? ":" : "..", //:-鼠标左击,..-鼠标右击
|
|
|
+ dotPos: index >= 6 ? "0" : "1", //0-上,1-下
|
|
|
+ topImg:
|
|
|
+ index % 2 == 0
|
|
|
+ ? require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-happy-0${rank + 1}.jpg`)
|
|
|
+ : require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-neutral.jpg`), //图片地址
|
|
|
+ bottomImg:
|
|
|
+ index % 2 == 0
|
|
|
+ ? require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-neutral.jpg`)
|
|
|
+ : require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-happy-0${rank + 1}.jpg`) //图片地址
|
|
|
+ });
|
|
|
+ //害怕-1
|
|
|
+ this.blockList1.push({
|
|
|
+ type: 0, //0-block1,1-block2 数据类型
|
|
|
+ emoType: "fear", // 情绪类型
|
|
|
+ // emoAmp: rank,// 整数0,1,2...
|
|
|
+ responseTime: "", //反应时(ms)
|
|
|
+ correct: "", //用户反映正确性 1-正确, 0-错误
|
|
|
+ dotType: index % 2 == 0 ? "0" : "1", //0-鼠标左击:,1-鼠标右击..
|
|
|
+ dot: index % 2 == 0 ? ":" : "..", //:-鼠标左击,..-鼠标右击
|
|
|
+ dotPos: index >= 6 ? "0" : "1", //0-上,1-下
|
|
|
+ topImg:
|
|
|
+ index % 2 == 0
|
|
|
+ ? require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-fear-0${rank + 1}.jpg`)
|
|
|
+ : require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-neutral.jpg`), //图片地址
|
|
|
+ bottomImg:
|
|
|
+ index % 2 == 0
|
|
|
+ ? require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-neutral.jpg`)
|
|
|
+ : require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-fear-0${rank + 1}.jpg`) //图片地址
|
|
|
+ });
|
|
|
+ //开心-2
|
|
|
+ this.blockList2.push({
|
|
|
+ type: 1, //0-block1,1-block2 数据类型
|
|
|
+ emoType: "happy", // 情绪类型
|
|
|
+ // emoAmp: rank,// 整数0,1,2...
|
|
|
+ responseTime: "", //反应时(ms)
|
|
|
+ correct: "", //用户反映正确性 1-正确, 0-错误
|
|
|
+ dotType: (index % 2 == 0) == 0 ? "0" : "1", //0-鼠标左击:,1-鼠标右击..
|
|
|
+ dot: index % 2 == 0 ? ":" : "..", //:-鼠标左击,..-鼠标右击
|
|
|
+ dotPos: index >= 6 ? "0" : "1", //0-上,1-下
|
|
|
+ topImg:
|
|
|
+ index % 2 == 0
|
|
|
+ ? require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-happy-0${rank + 1}-jumble.jpg`)
|
|
|
+ : require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-neutral.jpg`), //图片地址
|
|
|
+ bottomImg:
|
|
|
+ index % 2 == 0
|
|
|
+ ? require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-neutral.jpg`)
|
|
|
+ : require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-happy-0${rank + 1}-jumble.jpg`) //图片地址
|
|
|
+ });
|
|
|
+ //害怕-2
|
|
|
+ this.blockList2.push({
|
|
|
+ type: 1, //0-block1,1-block2 数据类型
|
|
|
+ emoType: "fear", // 情绪类型
|
|
|
+ // emoAmp: rank,// 整数0,1,2...
|
|
|
+ responseTime: "", //反应时(ms)
|
|
|
+ correct: "", //用户反映正确性 1-正确, 0-错误
|
|
|
+ dotType: index % 2 == 0 ? "0" : "1", //0-鼠标左击:,1-鼠标右击..
|
|
|
+ dot: index % 2 == 0 ? ":" : "..", //:-鼠标左击,..-鼠标右击
|
|
|
+ dotPos: index >= 6 ? "0" : "1", //点位置0-上,1-下
|
|
|
+ topImg:
|
|
|
+ index % 2 == 0
|
|
|
+ ? require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-fear-0${rank + 1}-jumble.jpg`)
|
|
|
+ : require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-neutral.jpg`), //图片地址
|
|
|
+ bottomImg:
|
|
|
+ index % 2 == 0
|
|
|
+ ? require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-neutral.jpg`)
|
|
|
+ : require(`../../assets/congnitiveAblitity/ETBnew/${
|
|
|
+ item >= "06" ? "m" + item : "f" + item
|
|
|
+ }-fear-0${rank + 1}-jumble.jpg`) //图片地址
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ changeImg(type, num) {
|
|
|
+ // 切换图片
|
|
|
+ if (type == "1") {
|
|
|
+ this.topImg = this.blockList1[num].topImg;
|
|
|
+ this.bottomImg = this.blockList1[num].bottomImg;
|
|
|
+ } else {
|
|
|
+ this.topImg = this.blockList2[num].topImg;
|
|
|
+ this.bottomImg = this.blockList2[num].bottomImg;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async imgListSerialize() {
|
|
|
+ // 按情绪等级图片数组序列化
|
|
|
+ await this.initImgList(0);
|
|
|
+ await this.initImgList(1);
|
|
|
+ await this.initImgList(2);
|
|
|
+ await this.initImgList(3);
|
|
|
+ //打乱数组序列
|
|
|
+ await this.shuffle(this.blockList1);
|
|
|
+ await this.shuffle(this.blockList2);
|
|
|
+ //图片数组添加序列号
|
|
|
+ this.blockList1.map((item, i) => {
|
|
|
+ return (item.index = i);
|
|
|
+ });
|
|
|
+ this.blockList2.map((item, i) => {
|
|
|
+ return (item.index = i);
|
|
|
+ });
|
|
|
+ // 图片预加载
|
|
|
+ await this.imgsPreloader(this.blockList1);
|
|
|
+ await this.imgsPreloader(this.blockList2);
|
|
|
|
|
|
- },
|
|
|
- changeImg(type,num) {
|
|
|
- // 切换图片
|
|
|
- if(type == '1'){
|
|
|
- this.topImg = this.blockList1[num].topImg;
|
|
|
- this.bottomImg = this.blockList1[num].bottomImg;
|
|
|
- }else {
|
|
|
- this.topImg = this.blockList2[num].topImg;
|
|
|
- this.bottomImg = this.blockList2[num].bottomImg;
|
|
|
- }
|
|
|
- },
|
|
|
- async imgListSerialize(){
|
|
|
- // 按情绪等级图片数组序列化
|
|
|
- await this.initImgList(0);
|
|
|
- await this.initImgList(1);
|
|
|
- await this.initImgList(2);
|
|
|
- await this.initImgList(3);
|
|
|
- //打乱数组序列
|
|
|
- await this.shuffle(this.blockList1);
|
|
|
- await this.shuffle(this.blockList2);
|
|
|
- //图片数组添加序列号
|
|
|
- this.blockList1.map((item,i)=>{
|
|
|
- return item.index = i;
|
|
|
- });
|
|
|
- this.blockList2.map((item,i)=>{
|
|
|
- return item.index = i;
|
|
|
- });
|
|
|
- // 图片预加载
|
|
|
- await this.imgsPreloader(this.blockList1);
|
|
|
- await this.imgsPreloader(this.blockList2);
|
|
|
-
|
|
|
- // 初始化图片完成后开始倒计时进入测试
|
|
|
- // this.countDown();
|
|
|
- // 加载完图片后开始赋值显示图进行测试
|
|
|
- this.activeBlock = this.blockList1[this.cumulation];
|
|
|
- this.changeImg('1',this.cumulation);
|
|
|
- this.showCross();
|
|
|
- },
|
|
|
- startTime() {
|
|
|
- //初始化设置计时器为0
|
|
|
- this.commonTime = 0;
|
|
|
- this.flag = setInterval(()=>{
|
|
|
- this.commonTime ++
|
|
|
- },10)
|
|
|
- },
|
|
|
- endTime() {
|
|
|
- this.flag = clearInterval(this.flag);
|
|
|
- },
|
|
|
- showCross() {
|
|
|
- //用户不可点击
|
|
|
- this.disableClick = true;
|
|
|
- //显示十字光标
|
|
|
- this.crossShow = true;
|
|
|
- this.expressionShow = false;
|
|
|
- this.dotShow = false;
|
|
|
-
|
|
|
- this.timingOne = setTimeout(() => {
|
|
|
- if(this.activeBlock.type == 0){
|
|
|
- this.showImg(100);
|
|
|
- }else {
|
|
|
- this.showImg(16);
|
|
|
- }
|
|
|
-
|
|
|
- }, 750);
|
|
|
- },
|
|
|
- showImg(times) {
|
|
|
- //显示图片
|
|
|
- this.crossShow = false;
|
|
|
- this.expressionShow = true;
|
|
|
- this.dotShow = false;
|
|
|
-
|
|
|
- this.timingTwo = setTimeout(() => {
|
|
|
- if(this.activeBlock.type == 0){
|
|
|
- //第一组数据展示
|
|
|
- this.showDot();
|
|
|
- }else {
|
|
|
- this.expressionShow = false;
|
|
|
- this.changeImg('1',this.cumulation);
|
|
|
- this.showImgSecond();
|
|
|
- }
|
|
|
-
|
|
|
- }, times);
|
|
|
- },
|
|
|
- showImgSecond() {
|
|
|
- //显示图片
|
|
|
- this.crossShow = false;
|
|
|
- this.expressionShow = true;
|
|
|
- this.dotShow = false;
|
|
|
+ // 初始化图片完成后开始倒计时进入测试
|
|
|
+ // this.countDown();
|
|
|
+ // 加载完图片后开始赋值显示图进行测试
|
|
|
+ this.activeBlock = this.blockList1[this.cumulation];
|
|
|
+ this.changeImg("1", this.cumulation);
|
|
|
+ this.showCross();
|
|
|
+ },
|
|
|
+ startTime() {
|
|
|
+ //初始化设置计时器为0
|
|
|
+ this.commonTime = 0;
|
|
|
+ this.flag = setInterval(() => {
|
|
|
+ this.commonTime++;
|
|
|
+ }, 10);
|
|
|
+ },
|
|
|
+ endTime() {
|
|
|
+ this.flag = clearInterval(this.flag);
|
|
|
+ },
|
|
|
+ showCross() {
|
|
|
+ //用户不可点击
|
|
|
+ this.disableClick = true;
|
|
|
+ //显示十字光标
|
|
|
+ this.crossShow = true;
|
|
|
+ this.expressionShow = false;
|
|
|
+ this.dotShow = false;
|
|
|
|
|
|
- this.timingFour = setTimeout(() => {
|
|
|
+ this.timingOne = setTimeout(() => {
|
|
|
+ if (this.activeBlock.type == 0) {
|
|
|
+ this.showImg(100);
|
|
|
+ } else {
|
|
|
+ this.showImg(16);
|
|
|
+ }
|
|
|
+ }, 750);
|
|
|
+ },
|
|
|
+ showImg(times) {
|
|
|
+ //显示图片
|
|
|
+ this.crossShow = false;
|
|
|
+ this.expressionShow = true;
|
|
|
+ this.dotShow = false;
|
|
|
|
|
|
- this.showDot();
|
|
|
- }, 84);
|
|
|
- },
|
|
|
- showDot() {
|
|
|
- //开始计时
|
|
|
- this.startTime();
|
|
|
- //显示选择按钮
|
|
|
- this.crossShow = false;
|
|
|
- this.expressionShow = false;
|
|
|
- this.dotShow = true;
|
|
|
- this.disableClick = false; //用户可以点击页面
|
|
|
-
|
|
|
- this.recordUserResponse()
|
|
|
- },
|
|
|
- // 开始测试
|
|
|
- async startTest() {
|
|
|
- if (!sessionStorage.getItem("userInfo")) {
|
|
|
- this.$toast("请先登录!");
|
|
|
- this.$router.push("/login");
|
|
|
- return;
|
|
|
- }
|
|
|
- this.isDisabled = true;
|
|
|
-
|
|
|
- // await this.imgListSerialize();
|
|
|
- // 点击开始测试按钮开始倒计时进入测试
|
|
|
- this.countDown();
|
|
|
+ this.timingTwo = setTimeout(() => {
|
|
|
+ if (this.activeBlock.type == 0) {
|
|
|
+ //第一组数据展示
|
|
|
+ this.showDot();
|
|
|
+ } else {
|
|
|
+ this.expressionShow = false;
|
|
|
+ this.changeImg("1", this.cumulation);
|
|
|
+ this.showImgSecond();
|
|
|
+ }
|
|
|
+ }, times);
|
|
|
+ },
|
|
|
+ showImgSecond() {
|
|
|
+ //显示图片
|
|
|
+ this.crossShow = false;
|
|
|
+ this.expressionShow = true;
|
|
|
+ this.dotShow = false;
|
|
|
|
|
|
- },
|
|
|
- recordUserResponse() {
|
|
|
- //记录用户反应
|
|
|
- this.timingThree = setTimeout(() => {
|
|
|
-
|
|
|
- //用户不可点击
|
|
|
- this.disableClick = true;
|
|
|
- //关闭提示点显示
|
|
|
- this.dotShow = false;
|
|
|
- //关闭计时器
|
|
|
- this.endTime();
|
|
|
-
|
|
|
- if(this.activeBlock.type == 0){
|
|
|
- this.blockList1[this.cumulation].responseTime = "NULL"; //反应时(ms)
|
|
|
- this.blockList1[this.cumulation].correct = 0; //反应是否正确
|
|
|
-
|
|
|
- //切换数组二
|
|
|
- this.activeBlock = this.blockList2[this.cumulation];
|
|
|
- this.changeImg('2',this.cumulation);
|
|
|
- // 继续下一组数据
|
|
|
- this.showCross();
|
|
|
-
|
|
|
- }else {
|
|
|
-
|
|
|
- this.blockList2[this.cumulation].responseTime = "NULL"; //反应时(ms)
|
|
|
- this.blockList2[this.cumulation].correct = 0; //反应是否正确
|
|
|
-
|
|
|
- if(this.cumulation >= 95){
|
|
|
- //调用接口,跳转页面
|
|
|
- this.submitData();
|
|
|
-
|
|
|
- }else {
|
|
|
- // 累加器自增
|
|
|
- this.cumulation ++;
|
|
|
- // 判断测试每12组停顿休息10秒
|
|
|
- if(
|
|
|
- this.cumulation == 12 || this.cumulation == 24 || this.cumulation == 36 || this.cumulation == 48 ||
|
|
|
- this.cumulation == 60 || this.cumulation == 72 || this.cumulation == 84
|
|
|
- ){
|
|
|
- //用户不可点击
|
|
|
- this.disableClick = true;
|
|
|
- // 修改提示语与倒计时时间
|
|
|
- this.countDownStr = "休息一下,马上继续!";
|
|
|
- // this.countDownTime = 11;
|
|
|
- this.countDown1();
|
|
|
- }else {
|
|
|
- //切换数组一
|
|
|
- this.activeBlock = this.blockList1[this.cumulation];
|
|
|
- this.changeImg('1',this.cumulation);
|
|
|
- // 继续下一组数据
|
|
|
- this.showCross();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }, 2000);
|
|
|
+ this.timingFour = setTimeout(() => {
|
|
|
+ this.showDot();
|
|
|
+ }, 84);
|
|
|
+ },
|
|
|
+ showDot() {
|
|
|
+ //开始计时
|
|
|
+ this.startTime();
|
|
|
+ //显示选择按钮
|
|
|
+ this.crossShow = false;
|
|
|
+ this.expressionShow = false;
|
|
|
+ this.dotShow = true;
|
|
|
+ this.disableClick = false; //用户可以点击页面
|
|
|
|
|
|
- },
|
|
|
- userClick(param) {
|
|
|
- if(this.disableClick){
|
|
|
- // 播放错误点击声音并阻止此次点击事件
|
|
|
- this.banClickVoice.play();
|
|
|
- return;
|
|
|
- }
|
|
|
- //如果两秒内用户点击了选项按钮
|
|
|
- this.timingThree = clearTimeout(this.timingThree);
|
|
|
- // 播放正确点击声音
|
|
|
- this.clickVoice.play();
|
|
|
- //关闭提示点显示
|
|
|
- this.dotShow = false;
|
|
|
- //关闭计时器
|
|
|
- this.endTime();
|
|
|
-
|
|
|
- if(this.activeBlock.type == 0){
|
|
|
- this.blockList1[this.cumulation].responseTime = this.commonTime * 10; //反应时(ms)
|
|
|
- this.blockList1[this.cumulation].correct = param == this.activeBlock.dotType ? 1 : 0; //反应是否正确
|
|
|
-
|
|
|
- //切换数组二
|
|
|
- this.activeBlock = this.blockList2[this.cumulation];
|
|
|
- this.changeImg('2',this.cumulation);
|
|
|
- // 继续下一组数据
|
|
|
- this.showCross();
|
|
|
-
|
|
|
- }else {
|
|
|
-
|
|
|
- this.blockList2[this.cumulation].responseTime = this.commonTime * 10; //反应时(ms)
|
|
|
- this.blockList2[this.cumulation].correct = param == this.activeBlock.dotType ? 1 : 0; //反应是否正确
|
|
|
-
|
|
|
- if(this.cumulation >= 95){
|
|
|
- //调用接口,跳转页面
|
|
|
- this.submitData();
|
|
|
-
|
|
|
- }else {
|
|
|
- // 累加器自增
|
|
|
- this.cumulation ++;
|
|
|
- // 判断测试每12组停顿休息10秒
|
|
|
- if(
|
|
|
- this.cumulation == 12 || this.cumulation == 24 || this.cumulation == 36 || this.cumulation == 48 ||
|
|
|
- this.cumulation == 60 || this.cumulation == 72 || this.cumulation == 84
|
|
|
- ){
|
|
|
- //用户不可点击
|
|
|
- this.disableClick = true;
|
|
|
- // 修改提示语与倒计时时间
|
|
|
- this.countDownStr = "休息一下,马上继续!";
|
|
|
- // this.countDownTime = 11;
|
|
|
- this.countDown1();
|
|
|
- }else {
|
|
|
- //切换数组一
|
|
|
- this.activeBlock = this.blockList1[this.cumulation];
|
|
|
- this.changeImg('1',this.cumulation);
|
|
|
- // 继续下一组数据
|
|
|
- this.showCross();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ this.recordUserResponse();
|
|
|
+ },
|
|
|
+ // 开始测试
|
|
|
+ async startTest() {
|
|
|
+ if (!sessionStorage.getItem("userInfo")) {
|
|
|
+ this.$toast("请先登录!");
|
|
|
+ this.$router.push("/login");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.isDisabled = true;
|
|
|
|
|
|
- },
|
|
|
- submitData(){
|
|
|
- //清理所有的计时器
|
|
|
- clearInterval(this.myInterval);
|
|
|
- clearInterval(this.myInterval1);
|
|
|
- clearInterval(this.flag);
|
|
|
- clearTimeout(this.timingOne);
|
|
|
- clearTimeout(this.timingTwo);
|
|
|
- clearTimeout(this.timingThree);
|
|
|
- clearTimeout(this.timingFour);
|
|
|
-
|
|
|
- // 数据处理
|
|
|
- let resultData = [];
|
|
|
- let blockRight1 = [],happy1 = [],fear1 = [],neutral1 = [],happyRight1 = [],
|
|
|
- fearRight1 = [],neutralRight1 = [],happyResponse1 = [],fearResponse1 = [],
|
|
|
- neutralResponse1 = [],happyAllTime1 = 0,fearAllTime1 = 0,neutralAllTime1 = 0;
|
|
|
- let blockRight2 = [],happy2 = [],fear2 = [],neutral2 = [],happyRight2 = [],
|
|
|
- fearRight2 = [],neutralRight2 = [],happyResponse2 = [],fearResponse2 = [],
|
|
|
- neutralResponse2 = [],happyAllTime2 = 0,fearAllTime2 = 0,neutralAllTime2 = 0;
|
|
|
-
|
|
|
- for(let i = 0; i < this.blockList1.length; i ++){
|
|
|
- resultData.push(this.blockList1[i]);
|
|
|
- resultData.push(this.blockList2[i]);
|
|
|
- }
|
|
|
- resultData.map((item,i)=>{
|
|
|
- return item.index = i;
|
|
|
- });
|
|
|
- //block1数据处理
|
|
|
- this.blockList1.map((item)=>{
|
|
|
- if(item.correct == 1){
|
|
|
- blockRight1.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'happy' && item.dotType == item.dotPos){
|
|
|
- happy1.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'fear' && item.dotType == item.dotPos){
|
|
|
- fear1.push(item);
|
|
|
- }
|
|
|
- if(item.dotType != item.dotPos){
|
|
|
- neutral1.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'happy' && item.dotType == item.dotPos && item.correct == 1){
|
|
|
- happyRight1.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'fear' && item.dotType == item.dotPos && item.correct == 1){
|
|
|
- fearRight1.push(item);
|
|
|
- }
|
|
|
- if(item.dotType != item.dotPos && item.correct == 1){
|
|
|
- neutralRight1.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'happy' && item.dotType == item.dotPos && item.responseTime != "NULL"){
|
|
|
- happyResponse1.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'fear' && item.dotType == item.dotPos && item.responseTime != "NULL"){
|
|
|
- fearResponse1.push(item);
|
|
|
- }
|
|
|
- if(item.dotType != item.dotPos && item.responseTime != "NULL"){
|
|
|
- neutralResponse1.push(item);
|
|
|
- }
|
|
|
- });
|
|
|
- happyResponse1.map((item)=>{
|
|
|
- happyAllTime1 += item.responseTime
|
|
|
- });
|
|
|
- fearResponse1.map((item)=>{
|
|
|
- fearAllTime1 += item.responseTime
|
|
|
- });
|
|
|
- neutralResponse1.map((item)=>{
|
|
|
- neutralAllTime1 += item.responseTime
|
|
|
- });
|
|
|
- //block2数据处理
|
|
|
- this.blockList2.map((item)=>{
|
|
|
- if(item.correct == 1){
|
|
|
- blockRight2.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'happy' && item.dotType == item.dotPos){
|
|
|
- happy2.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'fear' && item.dotType == item.dotPos){
|
|
|
- fear2.push(item);
|
|
|
- }
|
|
|
- if(item.dotType != item.dotPos){
|
|
|
- neutral2.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'happy' && item.dotType == item.dotPos && item.correct == 1){
|
|
|
- happyRight2.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'fear' && item.dotType == item.dotPos && item.correct == 1){
|
|
|
- fearRight2.push(item);
|
|
|
- }
|
|
|
- if(item.dotType != item.dotPos && item.correct == 1){
|
|
|
- neutralRight2.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'happy' && item.dotType == item.dotPos && item.responseTime != "NULL"){
|
|
|
- happyResponse2.push(item);
|
|
|
- }
|
|
|
- if(item.emoType == 'fear' && item.dotType == item.dotPos && item.responseTime != "NULL"){
|
|
|
- fearResponse2.push(item);
|
|
|
- }
|
|
|
- if(item.dotType != item.dotPos && item.responseTime != "NULL"){
|
|
|
- neutralResponse2.push(item);
|
|
|
- }
|
|
|
- });
|
|
|
- happyResponse2.map((item)=>{
|
|
|
- happyAllTime2 += item.responseTime
|
|
|
- });
|
|
|
- fearResponse2.map((item)=>{
|
|
|
- fearAllTime2 += item.responseTime
|
|
|
- });
|
|
|
- neutralResponse2.map((item)=>{
|
|
|
- neutralAllTime2 += item.responseTime
|
|
|
- });
|
|
|
-
|
|
|
- this.$http.post(`/cognize/FDOT`, {
|
|
|
- userId: this.userId,
|
|
|
- testPlanId: this.testPlanId,
|
|
|
- data: resultData,
|
|
|
- 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),
|
|
|
- }
|
|
|
- }
|
|
|
- },(response) => {
|
|
|
-
|
|
|
- if(response && response.code == '200') {
|
|
|
-
|
|
|
- // sessionStorage.setItem("resultInfo", JSON.stringify(response.data));
|
|
|
- // this.$router.push(`/cognitiveTestResult?from=1&testPlanId=${this.testPlanId}`);
|
|
|
- //跳转新测试结果页面
|
|
|
- this.goTestResult(response.data);
|
|
|
-
|
|
|
- }else {
|
|
|
- this.$toast.fail(response?.msg);
|
|
|
- }
|
|
|
- },(err) => {
|
|
|
- this.$toast.fail(err.msg);
|
|
|
- });
|
|
|
- this.$toast.success('测试结束');
|
|
|
+ // await this.imgListSerialize();
|
|
|
+ // 点击开始测试按钮开始倒计时进入测试
|
|
|
+ this.countDown();
|
|
|
+ },
|
|
|
+ recordUserResponse() {
|
|
|
+ //记录用户反应
|
|
|
+ this.timingThree = setTimeout(() => {
|
|
|
+ //用户不可点击
|
|
|
+ this.disableClick = true;
|
|
|
+ //关闭提示点显示
|
|
|
+ this.dotShow = false;
|
|
|
+ //关闭计时器
|
|
|
+ this.endTime();
|
|
|
+
|
|
|
+ if (this.activeBlock.type == 0) {
|
|
|
+ this.blockList1[this.cumulation].responseTime = "NULL"; //反应时(ms)
|
|
|
+ this.blockList1[this.cumulation].correct = 0; //反应是否正确
|
|
|
+
|
|
|
+ //切换数组二
|
|
|
+ this.activeBlock = this.blockList2[this.cumulation];
|
|
|
+ this.changeImg("2", this.cumulation);
|
|
|
+ // 继续下一组数据
|
|
|
+ this.showCross();
|
|
|
+ } else {
|
|
|
+ this.blockList2[this.cumulation].responseTime = "NULL"; //反应时(ms)
|
|
|
+ this.blockList2[this.cumulation].correct = 0; //反应是否正确
|
|
|
+
|
|
|
+ if (this.cumulation >= 95) {
|
|
|
+ //调用接口,跳转页面
|
|
|
+ this.submitData();
|
|
|
+ } else {
|
|
|
+ // 累加器自增
|
|
|
+ this.cumulation++;
|
|
|
+ // 判断测试每12组停顿休息10秒
|
|
|
+ if (
|
|
|
+ this.cumulation == 12 ||
|
|
|
+ this.cumulation == 24 ||
|
|
|
+ this.cumulation == 36 ||
|
|
|
+ this.cumulation == 48 ||
|
|
|
+ this.cumulation == 60 ||
|
|
|
+ this.cumulation == 72 ||
|
|
|
+ this.cumulation == 84
|
|
|
+ ) {
|
|
|
+ //用户不可点击
|
|
|
+ this.disableClick = true;
|
|
|
+ // 修改提示语与倒计时时间
|
|
|
+ this.countDownStr = "休息一下,马上继续!";
|
|
|
+ // this.countDownTime = 11;
|
|
|
+ this.countDown1();
|
|
|
+ } else {
|
|
|
+ //切换数组一
|
|
|
+ this.activeBlock = this.blockList1[this.cumulation];
|
|
|
+ this.changeImg("1", this.cumulation);
|
|
|
+ // 继续下一组数据
|
|
|
+ this.showCross();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 2000);
|
|
|
+ },
|
|
|
+ userClick(param) {
|
|
|
+ if (this.disableClick) {
|
|
|
+ // 播放错误点击声音并阻止此次点击事件
|
|
|
+ this.banClickVoice.play();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //如果两秒内用户点击了选项按钮
|
|
|
+ this.timingThree = clearTimeout(this.timingThree);
|
|
|
+ // 播放正确点击声音
|
|
|
+ this.clickVoice.play();
|
|
|
+ //关闭提示点显示
|
|
|
+ this.dotShow = false;
|
|
|
+ //关闭计时器
|
|
|
+ this.endTime();
|
|
|
|
|
|
+ if (this.activeBlock.type == 0) {
|
|
|
+ this.blockList1[this.cumulation].responseTime = this.commonTime * 10; //反应时(ms)
|
|
|
+ this.blockList1[this.cumulation].correct =
|
|
|
+ param == this.activeBlock.dotType ? 1 : 0; //反应是否正确
|
|
|
+
|
|
|
+ //切换数组二
|
|
|
+ this.activeBlock = this.blockList2[this.cumulation];
|
|
|
+ this.changeImg("2", this.cumulation);
|
|
|
+ // 继续下一组数据
|
|
|
+ this.showCross();
|
|
|
+ } else {
|
|
|
+ this.blockList2[this.cumulation].responseTime = this.commonTime * 10; //反应时(ms)
|
|
|
+ this.blockList2[this.cumulation].correct =
|
|
|
+ param == this.activeBlock.dotType ? 1 : 0; //反应是否正确
|
|
|
+
|
|
|
+ if (this.cumulation >= 95) {
|
|
|
+ //调用接口,跳转页面
|
|
|
+ this.submitData();
|
|
|
+ } else {
|
|
|
+ // 累加器自增
|
|
|
+ this.cumulation++;
|
|
|
+ // 判断测试每12组停顿休息10秒
|
|
|
+ if (
|
|
|
+ this.cumulation == 12 ||
|
|
|
+ this.cumulation == 24 ||
|
|
|
+ this.cumulation == 36 ||
|
|
|
+ this.cumulation == 48 ||
|
|
|
+ this.cumulation == 60 ||
|
|
|
+ this.cumulation == 72 ||
|
|
|
+ this.cumulation == 84
|
|
|
+ ) {
|
|
|
+ //用户不可点击
|
|
|
+ this.disableClick = true;
|
|
|
+ // 修改提示语与倒计时时间
|
|
|
+ this.countDownStr = "休息一下,马上继续!";
|
|
|
+ // this.countDownTime = 11;
|
|
|
+ this.countDown1();
|
|
|
+ } else {
|
|
|
+ //切换数组一
|
|
|
+ this.activeBlock = this.blockList1[this.cumulation];
|
|
|
+ this.changeImg("1", this.cumulation);
|
|
|
+ // 继续下一组数据
|
|
|
+ this.showCross();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ submitData() {
|
|
|
+ //清理所有的计时器
|
|
|
+ clearInterval(this.myInterval);
|
|
|
+ clearInterval(this.myInterval1);
|
|
|
+ clearInterval(this.flag);
|
|
|
+ clearTimeout(this.timingOne);
|
|
|
+ clearTimeout(this.timingTwo);
|
|
|
+ clearTimeout(this.timingThree);
|
|
|
+ clearTimeout(this.timingFour);
|
|
|
+
|
|
|
+ // 数据处理
|
|
|
+ let resultData = [];
|
|
|
+ let blockRight1 = [],
|
|
|
+ happy1 = [],
|
|
|
+ fear1 = [],
|
|
|
+ neutral1 = [],
|
|
|
+ happyRight1 = [],
|
|
|
+ fearRight1 = [],
|
|
|
+ neutralRight1 = [],
|
|
|
+ happyResponse1 = [],
|
|
|
+ fearResponse1 = [],
|
|
|
+ neutralResponse1 = [],
|
|
|
+ happyAllTime1 = 0,
|
|
|
+ fearAllTime1 = 0,
|
|
|
+ neutralAllTime1 = 0;
|
|
|
+ let blockRight2 = [],
|
|
|
+ happy2 = [],
|
|
|
+ fear2 = [],
|
|
|
+ neutral2 = [],
|
|
|
+ happyRight2 = [],
|
|
|
+ fearRight2 = [],
|
|
|
+ neutralRight2 = [],
|
|
|
+ happyResponse2 = [],
|
|
|
+ fearResponse2 = [],
|
|
|
+ neutralResponse2 = [],
|
|
|
+ happyAllTime2 = 0,
|
|
|
+ fearAllTime2 = 0,
|
|
|
+ neutralAllTime2 = 0;
|
|
|
+
|
|
|
+ for (let i = 0; i < this.blockList1.length; i++) {
|
|
|
+ resultData.push(this.blockList1[i]);
|
|
|
+ resultData.push(this.blockList2[i]);
|
|
|
+ }
|
|
|
+ console.log(resultData, "resultData");
|
|
|
+ resultData.map((item, i) => {
|
|
|
+ return (item.index = i);
|
|
|
+ });
|
|
|
+ //block1数据处理
|
|
|
+ this.blockList1.map(item => {
|
|
|
+ if (item.correct == 1) {
|
|
|
+ blockRight1.push(item);
|
|
|
+ }
|
|
|
+ if (item.emoType == "happy" && item.dotType == item.dotPos) {
|
|
|
+ happy1.push(item);
|
|
|
+ }
|
|
|
+ if (item.emoType == "fear" && item.dotType == item.dotPos) {
|
|
|
+ fear1.push(item);
|
|
|
+ }
|
|
|
+ if (item.dotType != item.dotPos) {
|
|
|
+ neutral1.push(item);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ item.emoType == "happy" &&
|
|
|
+ item.dotType == item.dotPos &&
|
|
|
+ item.correct == 1
|
|
|
+ ) {
|
|
|
+ happyRight1.push(item);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ item.emoType == "fear" &&
|
|
|
+ item.dotType == item.dotPos &&
|
|
|
+ item.correct == 1
|
|
|
+ ) {
|
|
|
+ fearRight1.push(item);
|
|
|
+ }
|
|
|
+ if (item.dotType != item.dotPos && item.correct == 1) {
|
|
|
+ neutralRight1.push(item);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ item.emoType == "happy" &&
|
|
|
+ item.dotType == item.dotPos &&
|
|
|
+ item.responseTime != "NULL"
|
|
|
+ ) {
|
|
|
+ happyResponse1.push(item);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ item.emoType == "fear" &&
|
|
|
+ item.dotType == item.dotPos &&
|
|
|
+ item.responseTime != "NULL"
|
|
|
+ ) {
|
|
|
+ fearResponse1.push(item);
|
|
|
+ }
|
|
|
+ if (item.dotType != item.dotPos && item.responseTime != "NULL") {
|
|
|
+ neutralResponse1.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ happyResponse1.map(item => {
|
|
|
+ happyAllTime1 += item.responseTime;
|
|
|
+ });
|
|
|
+ fearResponse1.map(item => {
|
|
|
+ fearAllTime1 += item.responseTime;
|
|
|
+ });
|
|
|
+ neutralResponse1.map(item => {
|
|
|
+ neutralAllTime1 += item.responseTime;
|
|
|
+ });
|
|
|
+ //block2数据处理
|
|
|
+ this.blockList2.map(item => {
|
|
|
+ if (item.correct == 1) {
|
|
|
+ blockRight2.push(item);
|
|
|
+ }
|
|
|
+ if (item.emoType == "happy" && item.dotType == item.dotPos) {
|
|
|
+ happy2.push(item);
|
|
|
+ }
|
|
|
+ if (item.emoType == "fear" && item.dotType == item.dotPos) {
|
|
|
+ fear2.push(item);
|
|
|
+ }
|
|
|
+ if (item.dotType != item.dotPos) {
|
|
|
+ neutral2.push(item);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ item.emoType == "happy" &&
|
|
|
+ item.dotType == item.dotPos &&
|
|
|
+ item.correct == 1
|
|
|
+ ) {
|
|
|
+ happyRight2.push(item);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ item.emoType == "fear" &&
|
|
|
+ item.dotType == item.dotPos &&
|
|
|
+ item.correct == 1
|
|
|
+ ) {
|
|
|
+ fearRight2.push(item);
|
|
|
+ }
|
|
|
+ if (item.dotType != item.dotPos && item.correct == 1) {
|
|
|
+ neutralRight2.push(item);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ item.emoType == "happy" &&
|
|
|
+ item.dotType == item.dotPos &&
|
|
|
+ item.responseTime != "NULL"
|
|
|
+ ) {
|
|
|
+ happyResponse2.push(item);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ item.emoType == "fear" &&
|
|
|
+ item.dotType == item.dotPos &&
|
|
|
+ item.responseTime != "NULL"
|
|
|
+ ) {
|
|
|
+ fearResponse2.push(item);
|
|
|
+ }
|
|
|
+ if (item.dotType != item.dotPos && item.responseTime != "NULL") {
|
|
|
+ neutralResponse2.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ happyResponse2.map(item => {
|
|
|
+ happyAllTime2 += item.responseTime;
|
|
|
+ });
|
|
|
+ fearResponse2.map(item => {
|
|
|
+ fearAllTime2 += item.responseTime;
|
|
|
+ });
|
|
|
+ neutralResponse2.map(item => {
|
|
|
+ neutralAllTime2 += item.responseTime;
|
|
|
+ });
|
|
|
+
|
|
|
+ this.$http.post(
|
|
|
+ `/cognize/FDOT`,
|
|
|
+ {
|
|
|
+ userId: this.userId,
|
|
|
+ testPlanId: this.testPlanId,
|
|
|
+ data: resultData,
|
|
|
+ result: {
|
|
|
+ block1: {
|
|
|
+ totalCorrectRate:
|
|
|
+ ((blockRight1.length / 96) * 100).toFixed(2) + "%",
|
|
|
+ posCorrectRate:
|
|
|
+ ((happyRight1.length / happy1.length) * 100).toFixed(2) + "%",
|
|
|
+ posAverageTime:
|
|
|
+ happyAllTime1 / happyResponse1.length
|
|
|
+ ? (happyAllTime1 / happyResponse1.length).toFixed(2)
|
|
|
+ : 0.0,
|
|
|
+ negCorrectRate:
|
|
|
+ ((fearRight1.length / fear1.length) * 100).toFixed(2) + "%",
|
|
|
+ negAverageTime:
|
|
|
+ fearAllTime1 / fearResponse1.length
|
|
|
+ ? (fearAllTime1 / fearResponse1.length).toFixed(2)
|
|
|
+ : 0.0,
|
|
|
+ neuCorrectRate:
|
|
|
+ ((neutralRight1.length / neutral1.length) * 100).toFixed(2) +
|
|
|
+ "%",
|
|
|
+ neuAverageTime:
|
|
|
+ neutralAllTime1 / neutralResponse1.length
|
|
|
+ ? (neutralAllTime1 / neutralResponse1.length).toFixed(2)
|
|
|
+ : 0.0
|
|
|
},
|
|
|
- // goTestResult(id){
|
|
|
- // this.$http.get(`getRecordById?id=${id}`, {}, (res) => {
|
|
|
- // if (res.code == 2001) {
|
|
|
- // this.$toast.fail(res.msg);
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (res && res.code == 200) {
|
|
|
- // let versionNo = JSON.parse(res.data?.userRecordEntity?.testResult).versionNo;
|
|
|
- // if (versionNo == "2.0.1" || versionNo == "2.0") {
|
|
|
- // //跳转新测试结果模版数据暂存本地
|
|
|
- // // sessionStorage.setItem("testResult", res.data?.userRecordEntity?.testResult);
|
|
|
- // // this.$store.dispatch('setTestResult',JSON.parse(res.data?.userRecordEntity?.testResult));
|
|
|
- // this.$store.dispatch('setTestResult',res?.data);
|
|
|
- // this.$router.push({
|
|
|
- // name: "testResultNew",
|
|
|
- // query: {
|
|
|
- // id: res.data?.userRecordEntity?.id,
|
|
|
- // title: res.data?.userRecordEntity?.name,
|
|
|
- // testPlanId: this.testPlanId || '',
|
|
|
- // come: 1, //1-来自认知任务列表,2-测试记录列表
|
|
|
- // },
|
|
|
- // });
|
|
|
- // } else {
|
|
|
- // //跳转旧测试结果模版
|
|
|
- // this.$router.push(`/cognitiveTaskOldTestRecord?flag=${res.data?.userRecordEntity?.flag}&id=${id}&from=1&testPlanId=${this.testPlanId}`);
|
|
|
- // }
|
|
|
- //
|
|
|
- // } else {
|
|
|
- // this.$toast.fail("获取数据失败!服务器异常");
|
|
|
- // }
|
|
|
- // });
|
|
|
- // },
|
|
|
+ block2: {
|
|
|
+ totalCorrectRate:
|
|
|
+ ((blockRight2.length / 96) * 100).toFixed(2) + "%",
|
|
|
+ posCorrectRate:
|
|
|
+ ((happyRight2.length / happy2.length) * 100).toFixed(2) + "%",
|
|
|
+ posAverageTime:
|
|
|
+ happyAllTime2 / happyResponse2.length
|
|
|
+ ? (happyAllTime2 / happyResponse2.length).toFixed(2)
|
|
|
+ : 0.0,
|
|
|
+ negCorrectRate:
|
|
|
+ ((fearRight2.length / fear2.length) * 100).toFixed(2) + "%",
|
|
|
+ negAverageTime:
|
|
|
+ fearAllTime2 / fearResponse2.length
|
|
|
+ ? (fearAllTime2 / fearResponse2.length).toFixed(2)
|
|
|
+ : 0.0,
|
|
|
+ neuCorrectRate:
|
|
|
+ ((neutralRight2.length / neutral2.length) * 100).toFixed(2) +
|
|
|
+ "%",
|
|
|
+ neuAverageTime:
|
|
|
+ neutralAllTime2 / neutralResponse2.length
|
|
|
+ ? (neutralAllTime2 / neutralResponse2.length).toFixed(2)
|
|
|
+ : 0.0
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
- destroyed() {
|
|
|
- clearInterval(this.myInterval);
|
|
|
- clearInterval(this.myInterval1);
|
|
|
- clearInterval(this.flag);
|
|
|
- clearTimeout(this.timingOne);
|
|
|
- clearTimeout(this.timingTwo);
|
|
|
- clearTimeout(this.timingThree);
|
|
|
- clearTimeout(this.timingFour);
|
|
|
+ response => {
|
|
|
+ if (response && response.code == "200") {
|
|
|
+ // sessionStorage.setItem("resultInfo", JSON.stringify(response.data));
|
|
|
+ // this.$router.push(`/cognitiveTestResult?from=1&testPlanId=${this.testPlanId}`);
|
|
|
+ //跳转新测试结果页面
|
|
|
+ this.goTestResult(response.data);
|
|
|
+ } else {
|
|
|
+ this.$toast.fail(response?.msg);
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
+ err => {
|
|
|
+ this.$toast.fail(err.msg);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ this.$toast.success("测试结束");
|
|
|
}
|
|
|
+ // goTestResult(id){
|
|
|
+ // this.$http.get(`getRecordById?id=${id}`, {}, (res) => {
|
|
|
+ // if (res.code == 2001) {
|
|
|
+ // this.$toast.fail(res.msg);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (res && res.code == 200) {
|
|
|
+ // let versionNo = JSON.parse(res.data?.userRecordEntity?.testResult).versionNo;
|
|
|
+ // if (versionNo == "2.0.1" || versionNo == "2.0") {
|
|
|
+ // //跳转新测试结果模版数据暂存本地
|
|
|
+ // // sessionStorage.setItem("testResult", res.data?.userRecordEntity?.testResult);
|
|
|
+ // // this.$store.dispatch('setTestResult',JSON.parse(res.data?.userRecordEntity?.testResult));
|
|
|
+ // this.$store.dispatch('setTestResult',res?.data);
|
|
|
+ // this.$router.push({
|
|
|
+ // name: "testResultNew",
|
|
|
+ // query: {
|
|
|
+ // id: res.data?.userRecordEntity?.id,
|
|
|
+ // title: res.data?.userRecordEntity?.name,
|
|
|
+ // testPlanId: this.testPlanId || '',
|
|
|
+ // come: 1, //1-来自认知任务列表,2-测试记录列表
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // //跳转旧测试结果模版
|
|
|
+ // this.$router.push(`/cognitiveTaskOldTestRecord?flag=${res.data?.userRecordEntity?.flag}&id=${id}&from=1&testPlanId=${this.testPlanId}`);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // } else {
|
|
|
+ // this.$toast.fail("获取数据失败!服务器异常");
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ destroyed() {
|
|
|
+ clearInterval(this.myInterval);
|
|
|
+ clearInterval(this.myInterval1);
|
|
|
+ clearInterval(this.flag);
|
|
|
+ clearTimeout(this.timingOne);
|
|
|
+ clearTimeout(this.timingTwo);
|
|
|
+ clearTimeout(this.timingThree);
|
|
|
+ clearTimeout(this.timingFour);
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
- .explan {
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 46px 15px 0;
|
|
|
- }
|
|
|
- .explan h1 {
|
|
|
- font-size: 16px;
|
|
|
- color: #222222;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- .explan p {
|
|
|
- font-size: 14px;
|
|
|
- color: #666666;
|
|
|
- line-height: 26px;
|
|
|
- text-indent: 15px;
|
|
|
- margin: 20px 0 20px;
|
|
|
- }
|
|
|
- .activeTask {
|
|
|
- box-sizing: border-box;
|
|
|
- padding-top: 46px;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- background: url("../../assets/congnitiveAblitity/rememberAbilityTask.png") no-repeat center;
|
|
|
- background-size: cover;
|
|
|
- position: fixed;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- right: 0;
|
|
|
- bottom: 0;
|
|
|
- }
|
|
|
- .timingBox {
|
|
|
- position:absolute;
|
|
|
- top:50%;
|
|
|
- left:50%;
|
|
|
- transform:translate(-50%,-50%);
|
|
|
- color:black;
|
|
|
- font-size:18px;
|
|
|
- text-align:center;
|
|
|
- line-height:50px;
|
|
|
- margin:0 auto;
|
|
|
- z-index: 10;
|
|
|
- }
|
|
|
- .progress-content {
|
|
|
- position: absolute;
|
|
|
- width: 100%;
|
|
|
- height: 20px;
|
|
|
- left: 0;
|
|
|
- top: 60px;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 4px 10px;
|
|
|
- }
|
|
|
- .look-point {
|
|
|
- position: absolute;
|
|
|
- width: 100%;
|
|
|
- /*height: 100%;*/
|
|
|
- top:50%;
|
|
|
- left:50%;
|
|
|
- transform:translate(-50%,-50%);
|
|
|
- z-index: 10;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- .look-point img{
|
|
|
- width: 50px;
|
|
|
- height: 50px;
|
|
|
- }
|
|
|
- .active-img {
|
|
|
- position: absolute;
|
|
|
- width: 150px;
|
|
|
- /*height: 450px;*/
|
|
|
- /*width: 100%;*/
|
|
|
- /*height: 100%;*/
|
|
|
- top:50%;
|
|
|
- left:50%;
|
|
|
- transform:translate(-50%,-50%);
|
|
|
- z-index: 10;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 0 5px;
|
|
|
- }
|
|
|
- .faceImg {
|
|
|
- display: block;
|
|
|
- width: 150px;
|
|
|
- height: 150px;
|
|
|
- }
|
|
|
- .target {
|
|
|
- width: 150px;
|
|
|
- height: 150px;
|
|
|
- font-size: 48px;
|
|
|
- font-weight: 700;
|
|
|
- color: #000000;
|
|
|
- text-align: center;
|
|
|
- line-height: 150px;
|
|
|
- }
|
|
|
- .btn-content {
|
|
|
- position: absolute;
|
|
|
- width: 100%;
|
|
|
- left: 50%;
|
|
|
- bottom: 10%;
|
|
|
- transform:translate(-50%,0);
|
|
|
- text-align: center;
|
|
|
- z-index: 10;
|
|
|
- display: flex;
|
|
|
- flex-direction: row;
|
|
|
- justify-content: space-around;
|
|
|
- align-items: center;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 0 5px;
|
|
|
- }
|
|
|
- .btn-content .btn-item {
|
|
|
- /*margin: 10px 0;*/
|
|
|
- width: 30%;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- justify-content: space-around;
|
|
|
- /*align-items: center;*/
|
|
|
- }
|
|
|
- .btn-content .btn-item /deep/.van-button{
|
|
|
- margin: 35px 0;
|
|
|
- }
|
|
|
+.explan {
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 46px 15px 0;
|
|
|
+}
|
|
|
+
|
|
|
+.explan h1 {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #222222;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.explan p {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #666666;
|
|
|
+ line-height: 26px;
|
|
|
+ text-indent: 15px;
|
|
|
+ margin: 20px 0 20px;
|
|
|
+}
|
|
|
+
|
|
|
+.activeTask {
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding-top: 46px;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ background: url("../../assets/congnitiveAblitity/rememberAbilityTask.png")
|
|
|
+ no-repeat center;
|
|
|
+ background-size: cover;
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.timingBox {
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ color: black;
|
|
|
+ font-size: 18px;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 50px;
|
|
|
+ margin: 0 auto;
|
|
|
+ z-index: 10;
|
|
|
+}
|
|
|
+
|
|
|
+.progress-content {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ height: 20px;
|
|
|
+ left: 0;
|
|
|
+ top: 60px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 4px 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.look-point {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ /*height: 100%;*/
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ z-index: 10;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.look-point img {
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+}
|
|
|
+
|
|
|
+.active-img {
|
|
|
+ position: absolute;
|
|
|
+ width: 150px;
|
|
|
+ /*height: 450px;*/
|
|
|
+ /*width: 100%;*/
|
|
|
+ /*height: 100%;*/
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ z-index: 10;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 0 5px;
|
|
|
+}
|
|
|
+
|
|
|
+.faceImg {
|
|
|
+ display: block;
|
|
|
+ width: 150px;
|
|
|
+ height: 150px;
|
|
|
+}
|
|
|
+
|
|
|
+.target {
|
|
|
+ width: 150px;
|
|
|
+ height: 150px;
|
|
|
+ font-size: 48px;
|
|
|
+ font-weight: 700;
|
|
|
+ color: #000000;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 150px;
|
|
|
+}
|
|
|
+
|
|
|
+.btn-content {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ left: 50%;
|
|
|
+ bottom: 10%;
|
|
|
+ transform: translate(-50%, 0);
|
|
|
+ text-align: center;
|
|
|
+ z-index: 10;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: center;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 0 5px;
|
|
|
+}
|
|
|
+
|
|
|
+.btn-content .btn-item {
|
|
|
+ /*margin: 10px 0;*/
|
|
|
+ width: 30%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-around;
|
|
|
+ /*align-items: center;*/
|
|
|
+}
|
|
|
|
|
|
+.btn-content .btn-item /deep/ .van-button {
|
|
|
+ margin: 35px 0;
|
|
|
+}
|
|
|
</style>
|