ETBexperiment_new.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806
  1. <template>
  2. <div>
  3. <!--<div v-if="testFlag" class="desc_wrap">-->
  4. <!--<div-->
  5. <!--style="-->
  6. <!--width: 70%;-->
  7. <!--height: 100%;-->
  8. <!--background: rgb(248, 248, 248);-->
  9. <!--opacity: 1;-->
  10. <!--border-radius: 12px;-->
  11. <!--margin: 0 auto;-->
  12. <!--"-->
  13. <!--&gt;-->
  14. <!--<div class="left_part"
  15. >-->
  16. <!--<div id="left_top">-->
  17. <!--<div>-->
  18. <!--<div id="setting">-->
  19. <!--<img src="../../assets/9551.png" alt="" />-->
  20. <!--</div>-->
  21. <!--<div id="text">-->
  22. <!--<span>操作提示:</span>-->
  23. <!--</div>-->
  24. <!--</div>-->
  25. <!--</div>-->
  26. <!--<div style="margin: 100px auto; width: 80%; text-align: left">-->
  27. <!--<p> 请你注视眼前屏幕,注视点“+”过后,你将陆续看到一些表情图片,请你想象在看到他人对你做出这种表情时,他有着什么样的情绪。请尽快和尽可能准确的作出判断,并按下相应按键。【按键为:开心、害怕、生气、厌恶、悲伤以及惊讶】。</p>-->
  28. <!--&lt;!&ndash; <p>{{subjectInfo.description}}</p> &ndash;&gt;-->
  29. <!--</div>-->
  30. <!--</div>-->
  31. <!--<div-->
  32. <!--class="right_part"-->
  33. <!--:style="{background:'url(' + require('../../assets/page28.png') + ')','background-size': '100% 100%',}"-->
  34. <!--&gt;-->
  35. <!--<div id="title">-->
  36. <!--<span>任务一</span>-->
  37. <!--</div>-->
  38. <!--<div style="position: absolute; bottom: 30px; right: 38%">-->
  39. <!--<el-button type="primary" class="start" @click="startTiming()">开始测试</el-button>-->
  40. <!--</div>-->
  41. <!--</div>-->
  42. <!--</div>-->
  43. <!--</div>-->
  44. <div v-if="!testFlag" class="activeTask">
  45. <MainProgress v-if="testMode && testMode !== '0'" :cur-percentage="(cumulation + 1) / 72" />
  46. <div class="taskHead">
  47. <div class="scale" @click.stop="screen">
  48. <img src="@/assets/small-big.png" alt="" />
  49. </div>
  50. </div>
  51. <div style="width: 50%; margin-left: 10%; margin-top: 24px; z-index: 10">
  52. <p v-if="testMode == 0" style='margin-top:50px'>&nbsp;</p>
  53. </div>
  54. <p v-if="timingShow" class="timingBox">{{ countDownStr }}</p>
  55. <div
  56. v-if="crossShow && !expressionShow && !buttonShow"
  57. style="text-align: center"
  58. >
  59. <img
  60. src="../../assets/congnitiveAblitity/whiteFlag-new.png"
  61. alt=""
  62. style="width: 50px; height: 50px; margin-top: 20%"
  63. />
  64. </div>
  65. <div class="shape_glass">
  66. <img
  67. v-if="expressionShow && !crossShow"
  68. class="active-img addImg"
  69. :src="examImgUrl"
  70. alt=""
  71. />
  72. </div>
  73. <!-- <div
  74. v-if="buttonShow && !crossShow && !expressionShow"
  75. class="btn-content"
  76. >
  77. <el-button class="butt" @click="userClick('happy')">开心</el-button>
  78. <el-button class="butt" @click="userClick('fear')">害怕</el-button>
  79. <el-button class="butt" @click="userClick('angry')">生气</el-button>
  80. <el-button class="butt" @click="userClick('disgust')">厌恶</el-button>
  81. <el-button class="butt" @click="userClick('sad')">悲伤</el-button>
  82. <el-button class="butt" @click="userClick('surprise')">惊讶</el-button>
  83. </div> -->
  84. <div v-if="buttonShow && !crossShow" class="btn-content">
  85. <el-button
  86. v-for="item in emoList"
  87. :key="item.val"
  88. class="butt"
  89. :class="{
  90. active: item.val == resultData[cumulation].emoType && showGuider,
  91. }"
  92. @click="userClick(item.val)"
  93. >
  94. {{ item.name }}
  95. </el-button>
  96. </div>
  97. <div class="guider" v-show="showGuider">
  98. <div class="txt">
  99. <p class="explain">
  100. 观察图片中人物的面部表情,想象人物有着怎样的情绪。点击下方按钮,选择对应的情绪
  101. </p>
  102. <!-- <div class="next_step">知道啦</div> -->
  103. </div>
  104. <!-- <div class="guider_img">
  105. <img src="../../assets/congnitiveAblitity/ETBnew/m09-happy-04.jpg" alt="">
  106. </div>
  107. <div class="btn-content guider_btn">
  108. <el-button class="butt" @click="userClick('happy')">开心</el-button>
  109. <el-button class="butt" @click="userClick('fear')">害怕</el-button>
  110. <el-button class="butt" @click="userClick('angry')">生气</el-button>
  111. <el-button class="butt" @click="userClick('disgust')">厌恶</el-button>
  112. <el-button class="butt" @click="userClick('sad')">悲伤</el-button>
  113. <el-button class="butt" @click="userClick('surprise')">惊讶</el-button>
  114. </div> -->
  115. </div>
  116. </div>
  117. <go-back />
  118. </div>
  119. </template>
  120. <script>
  121. import { oSessionStorage, preloader } from "@/utils/utils";
  122. import screenfull from "screenfull";
  123. import MainProgress from "@/components/MainProgress/index.vue";
  124. import GoBack from "@/components/goBack/index.vue";
  125. export default {
  126. name: "ETBexperiment_new",
  127. components: {GoBack, MainProgress},
  128. data() {
  129. return {
  130. testMode: null, //是引导模式还是正式测试模式
  131. buttonShowTime: 2000, //按钮出现的时间
  132. cycles: 71, //循环的次数
  133. showGuider: false, //显示灰色背景当作引导
  134. testFlag: true, //显示提示页面与测试页面控制开关
  135. timingShow: true, //倒计时5秒提示开始
  136. timingFlag: null, //倒计时名称
  137. timingNum: 5, //倒计时5秒
  138. countDownStr: "测试马上开始!",
  139. crossShow: false, //显示注视点
  140. expressionShow: false, //显示表情图片
  141. buttonShow: false, //显示选择按钮
  142. timingOne: null,
  143. timingTwo: null,
  144. timingThree: null,
  145. flag: null, //反应时间计时器名
  146. commonTime: 0, //计时器获取反应时间
  147. cumulation: 0, //累加器
  148. examImgUrl: "", //展示图片
  149. arrList: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10"], //取样数组
  150. randomArr: [], //从十个人中随机获取3个人
  151. resultData: [
  152. // {
  153. // index:"",//序号
  154. // emoType:"",// 情绪类型
  155. // emoAmp:"",// 整数0,1,2...
  156. // userSelectEmoType:"",//用户选择的情绪类型
  157. // responseTime:"",//反应时(ms)
  158. // correct:"",//用户反映正确性 True, False
  159. // imgUrl:"", //图片地址
  160. // }
  161. ],
  162. emoList: [
  163. { name: "开心", val: "happy" },
  164. { name: "害怕", val: "fear" },
  165. { name: "生气", val: "angry" },
  166. { name: "厌恶", val: "disgust" },
  167. { name: "悲伤", val: "sad" },
  168. { name: "惊讶", val: "surprise" },
  169. ],
  170. baseUrlPort: ''
  171. };
  172. },
  173. // 页面初始化函数
  174. created() {
  175. this.subjectInfo = JSON.parse(oSessionStorage.getItem("subjectInfo"));
  176. this.userId = sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f");
  177. this.taskId = this.$route.query.taskId;
  178. this.testMode = this.$route.query.testMode;
  179. },
  180. mounted() {
  181. this.baseUrlPort = window.location.origin
  182. // this.imgListSerialize();
  183. //进入页面即初始化开始测试
  184. console.log(this.testMode);
  185. // this.startTiming();
  186. if (this.testMode == "0") {
  187. //进入引导模式
  188. this.buttonShowTime = 20000000;
  189. this.cycles = 6;
  190. this.startTiming();
  191. } else {
  192. //进入正式测试模式
  193. this.buttonShowTime = 2000;
  194. this.cycles = 71;
  195. this.startTiming();
  196. }
  197. //判断是引导模式还是正式测试模式
  198. },
  199. methods: {
  200. screen() {
  201. // 如果不允许进入全屏,发出不允许提示
  202. // if (!screenfull.isEnabled) {
  203. // this.$message("您的浏览器不能全屏");
  204. // return false;
  205. // }
  206. screenfull.toggle();
  207. },
  208. screenOpen() {
  209. screenfull.request();
  210. },
  211. screenExit() {
  212. screenfull.exit();
  213. },
  214. startTiming() {
  215. this.screen();
  216. if (
  217. sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f") == "" ||
  218. sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f") == null
  219. ) {
  220. this.$message.error("请先登录!");
  221. return;
  222. }
  223. //关闭提示内容窗口
  224. this.testFlag = false;
  225. console.log(this.timingNum);
  226. this.timingFlag = setInterval(() => {
  227. if (this.timingNum == 0) {
  228. this.countDownStr = "开始";
  229. setTimeout(() => {
  230. //关闭倒计时提示页面
  231. this.timingShow = false;
  232. this.timingFlag = clearInterval(this.timingFlag);
  233. //练习开始
  234. // this.isPractice();
  235. this.startTest();
  236. }, 1000);
  237. this.timingFlag = clearInterval(this.timingFlag);
  238. } else {
  239. this.countDownStr = this.timingNum;
  240. this.timingNum--;
  241. }
  242. }, 1000);
  243. },
  244. format(percentage) {
  245. return percentage === 100 ? "任务已完成" : "任务进度";
  246. },
  247. startTime() {
  248. //初始化设置计时器为0
  249. this.commonTime = 0;
  250. this.flag = setInterval(() => {
  251. this.commonTime++;
  252. }, 10);
  253. },
  254. endTime() {
  255. this.flag = clearInterval(this.flag);
  256. },
  257. randomList() {
  258. // 从十个人中随机获取三个不同的人
  259. this.randomArr = [];
  260. for (let k = 0; k < 3; k++) {
  261. let id = Math.floor(Math.random() * 10);
  262. if (k < 10) {
  263. if (this.randomArr.indexOf(this.arrList[id]) === -1) {
  264. this.randomArr.push(this.arrList[id]);
  265. } else {
  266. k = k - 1;
  267. continue;
  268. }
  269. } else {
  270. this.randomArr.push(this.arrList[id]);
  271. }
  272. }
  273. },
  274. async shuffle(arr) {
  275. for (let i = 1; i < arr.length; i++) {
  276. const random = Math.floor(Math.random() * (i + 1));
  277. [arr[i], arr[random]] = [arr[random], arr[i]];
  278. }
  279. return arr;
  280. },
  281. async initImgList(rank) {
  282. //动态初始化图片序列数组
  283. //随机挑选3个人
  284. await this.randomList();
  285. //根据情绪等级初始化数组
  286. this.randomArr.map((item) => {
  287. //开心
  288. this.resultData.push({
  289. emoType: "happy", // 情绪类型
  290. emoAmp: rank, // 整数0,1,2...
  291. userSelectEmoType: "", //用户选择的情绪类型
  292. responseTime: "", //反应时(ms)
  293. correct: "", //用户反映正确性 True, False
  294. imgUrl: `${this.baseUrlPort}/static/assets/ETBnew/${ (Number(item) > 5 ? 'm' : 'f') + item}-happy-${rank > 8 ? rank + 1 : '0' + (rank + 1)}.jpg`, //图片地址
  295. });
  296. //害怕
  297. this.resultData.push({
  298. emoType: "fear", // 情绪类型
  299. emoAmp: rank, // 整数0,1,2...
  300. userSelectEmoType: "", //用户选择的情绪类型
  301. responseTime: "", //反应时(ms)
  302. correct: "", //用户反映正确性 True, False
  303. imgUrl: `${this.baseUrlPort}/static/assets/ETBnew/${ (Number(item) > 5 ? 'm' : 'f') + item}-fear-${rank > 8 ? rank + 1 : '0' + (rank + 1)}.jpg`,
  304. });
  305. //生气
  306. this.resultData.push({
  307. emoType: "angry", // 情绪类型
  308. emoAmp: rank, // 整数0,1,2...
  309. userSelectEmoType: "", //用户选择的情绪类型
  310. responseTime: "", //反应时(ms)
  311. correct: "", //用户反映正确性 True, False
  312. imgUrl: `${this.baseUrlPort}/static/assets/ETBnew/${ (Number(item) > 5 ? 'm' : 'f') + item}-angry-${rank > 8 ? rank + 1 : '0' + (rank + 1)}.jpg`,
  313. });
  314. //厌恶
  315. this.resultData.push({
  316. emoType: "disgust", // 情绪类型
  317. emoAmp: rank, // 整数0,1,2...
  318. userSelectEmoType: "", //用户选择的情绪类型
  319. responseTime: "", //反应时(ms)
  320. correct: "", //用户反映正确性 True, False
  321. imgUrl: `${this.baseUrlPort}/static/assets/ETBnew/${ (Number(item) > 5 ? 'm' : 'f') + item}-disgust-${rank > 8 ? rank + 1 : '0' + (rank + 1)}.jpg`,
  322. });
  323. // 悲伤
  324. this.resultData.push({
  325. emoType: "sad", // 情绪类型
  326. emoAmp: rank, // 整数0,1,2...
  327. userSelectEmoType: "", //用户选择的情绪类型
  328. responseTime: "", //反应时(ms)
  329. correct: "", //用户反映正确性 True, False
  330. imgUrl: `${this.baseUrlPort}/static/assets/ETBnew/${ (Number(item) > 5 ? 'm' : 'f') + item}-sad-${rank > 8 ? rank + 1 : '0' + (rank + 1)}.jpg`,
  331. });
  332. // 惊讶
  333. this.resultData.push({
  334. emoType: "surprise", // 情绪类型
  335. emoAmp: rank, // 整数0,1,2...
  336. userSelectEmoType: "", //用户选择的情绪类型
  337. responseTime: "", //反应时(ms)
  338. correct: "", //用户反映正确性 True, False
  339. imgUrl: `${this.baseUrlPort}/static/assets/ETBnew/${ (Number(item) > 5 ? 'm' : 'f') + item}-surprise-${rank > 8 ? rank + 1 : '0' + (rank + 1)}.jpg`,
  340. });
  341. });
  342. },
  343. async imgListSerialize() {
  344. // 按情绪等级图片数组序列化
  345. await this.initImgList(0);
  346. await this.initImgList(1);
  347. await this.initImgList(2);
  348. await this.initImgList(3);
  349. //打乱数组序列
  350. await this.shuffle(this.resultData);
  351. this.resultData.map((item, i) => {
  352. return (item.index = i);
  353. });
  354. // 图片预加载
  355. preloader(this.resultData, () => {
  356. //图片赋值开始测试
  357. this.changeImg(this.cumulation);
  358. this.showCross();
  359. });
  360. console.log(this.resultData, "图片数组序列222");
  361. },
  362. changeImg(num) {
  363. // 切换图片
  364. this.examImgUrl = this.resultData[num].imgUrl;
  365. },
  366. showCross() {
  367. //显示十字光标
  368. this.crossShow = true;
  369. this.expressionShow = false;
  370. this.buttonShow = false;
  371. this.timingOne = setTimeout(() => {
  372. this.showImg();
  373. }, 750);
  374. },
  375. showImg() {
  376. //显示图片
  377. this.crossShow = false;
  378. this.expressionShow = true;
  379. if (this.testMode == 0) {
  380. this.buttonShow = true;
  381. } else {
  382. this.buttonShow = false;
  383. }
  384. this.timingTwo = setTimeout(() => {
  385. this.showBtn();
  386. }, 500);
  387. },
  388. showBtn() {
  389. //开始计时
  390. this.startTime();
  391. //显示选择按钮
  392. this.crossShow = false;
  393. if (this.testMode == 0) {
  394. this.expressionShow = true;
  395. } else {
  396. this.expressionShow = false;
  397. }
  398. this.buttonShow = true;
  399. this.timingThree = setTimeout(() => {
  400. console.log("123");
  401. //关闭按钮显示
  402. this.buttonShow = false;
  403. //关闭计时器
  404. this.endTime();
  405. this.resultData[this.cumulation].userSelectEmoType = "NO"; //用户选择的情绪类型
  406. this.resultData[this.cumulation].responseTime = "NULL"; //反应时(ms)
  407. this.resultData[this.cumulation].correct = "False"; //用户反映正确性 True, False
  408. if (this.cumulation >= this.cycles) {
  409. //调用接口,跳转页面
  410. this.submitData();
  411. } else {
  412. // 累加器自增
  413. this.cumulation++;
  414. //换展示图片
  415. this.changeImg(this.cumulation);
  416. // 继续下一组数据
  417. this.showCross();
  418. }
  419. }, this.buttonShowTime);
  420. },
  421. userClick(param) {
  422. if (
  423. this.showGuider &&
  424. this.resultData[this.cumulation].emoType != param
  425. ) {
  426. this.$message.error("点击错误,请点击闪烁的正确选项");
  427. return;
  428. }
  429. //如果两秒内用户点击了选项按钮
  430. this.timingThree = clearTimeout(this.timingThree);
  431. //关闭计时器
  432. this.endTime();
  433. this.resultData[this.cumulation].userSelectEmoType = param; //用户选择的情绪类型
  434. this.resultData[this.cumulation].responseTime = this.commonTime * 10; //反应时(ms)
  435. this.resultData[this.cumulation].correct =
  436. param == this.resultData[this.cumulation].emoType ? "True" : "False"; //用户反映正确性 True, False
  437. if (this.cumulation >= this.cycles) {
  438. //调用接口,跳转页面
  439. if (this.testMode == 0) {
  440. this.$message.success("引导结束");
  441. this.$router.go(-1);
  442. } else {
  443. this.submitData();
  444. }
  445. } else {
  446. // 累加器自增
  447. this.cumulation++;
  448. //换展示图片
  449. this.changeImg(this.cumulation);
  450. // 继续下一组数据
  451. this.showCross();
  452. }
  453. },
  454. submitData() {
  455. let correctNum = [],
  456. happy1 = [],
  457. happy2 = [],
  458. happy3 = [],
  459. happy4 = [],
  460. fear1 = [],
  461. fear2 = [],
  462. fear3 = [],
  463. fear4 = [],
  464. angry1 = [],
  465. angry2 = [],
  466. angry3 = [],
  467. angry4 = [],
  468. disgust1 = [],
  469. disgust2 = [],
  470. disgust3 = [],
  471. disgust4 = [],
  472. sad1 = [],
  473. sad2 = [],
  474. sad3 = [],
  475. sad4 = [],
  476. surprise1 = [],
  477. surprise2 = [],
  478. surprise3 = [],
  479. surprise4 = [];
  480. this.resultData.map((item, i) => {
  481. if (item.correct == "True") correctNum.push(item);
  482. });
  483. console.log(correctNum, "正确个数");
  484. correctNum.map((item) => {
  485. if (item.emoType == "happy" && item.emoAmp == 0) happy1.push(item);
  486. if (item.emoType == "happy" && item.emoAmp == 1) happy2.push(item);
  487. if (item.emoType == "happy" && item.emoAmp == 2) happy3.push(item);
  488. if (item.emoType == "happy" && item.emoAmp == 3) happy4.push(item);
  489. if (item.emoType == "fear" && item.emoAmp == 0) fear1.push(item);
  490. if (item.emoType == "fear" && item.emoAmp == 1) fear2.push(item);
  491. if (item.emoType == "fear" && item.emoAmp == 2) fear3.push(item);
  492. if (item.emoType == "fear" && item.emoAmp == 3) fear4.push(item);
  493. if (item.emoType == "angry" && item.emoAmp == 0) angry1.push(item);
  494. if (item.emoType == "angry" && item.emoAmp == 1) angry2.push(item);
  495. if (item.emoType == "angry" && item.emoAmp == 2) angry3.push(item);
  496. if (item.emoType == "angry" && item.emoAmp == 3) angry4.push(item);
  497. if (item.emoType == "disgust" && item.emoAmp == 0) disgust1.push(item);
  498. if (item.emoType == "disgust" && item.emoAmp == 1) disgust2.push(item);
  499. if (item.emoType == "disgust" && item.emoAmp == 2) disgust3.push(item);
  500. if (item.emoType == "disgust" && item.emoAmp == 3) disgust4.push(item);
  501. if (item.emoType == "sad" && item.emoAmp == 0) sad1.push(item);
  502. if (item.emoType == "sad" && item.emoAmp == 1) sad2.push(item);
  503. if (item.emoType == "sad" && item.emoAmp == 2) sad3.push(item);
  504. if (item.emoType == "sad" && item.emoAmp == 3) sad4.push(item);
  505. if (item.emoType == "surprise" && item.emoAmp == 0)
  506. surprise1.push(item);
  507. if (item.emoType == "surprise" && item.emoAmp == 1)
  508. surprise2.push(item);
  509. if (item.emoType == "surprise" && item.emoAmp == 2)
  510. surprise3.push(item);
  511. if (item.emoType == "surprise" && item.emoAmp == 3)
  512. surprise4.push(item);
  513. });
  514. this.$http.post(
  515. `/cognize/ETB01`,
  516. {
  517. userId: this.userId,
  518. testPlanId: this.$route.query.testPlanId || "",
  519. data: this.resultData,
  520. result: {
  521. totalResult: ((correctNum.length / 72) * 100).toFixed(2) + "%",
  522. happy: {
  523. level1: ((happy1.length / 3) * 100).toFixed(2) + "%",
  524. level2: ((happy2.length / 3) * 100).toFixed(2) + "%",
  525. level3: ((happy3.length / 3) * 100).toFixed(2) + "%",
  526. level4: ((happy4.length / 3) * 100).toFixed(2) + "%",
  527. },
  528. fear: {
  529. level1: ((fear1.length / 3) * 100).toFixed(2) + "%",
  530. level2: ((fear2.length / 3) * 100).toFixed(2) + "%",
  531. level3: ((fear3.length / 3) * 100).toFixed(2) + "%",
  532. level4: ((fear4.length / 3) * 100).toFixed(2) + "%",
  533. },
  534. angry: {
  535. level1: ((angry1.length / 3) * 100).toFixed(2) + "%",
  536. level2: ((angry2.length / 3) * 100).toFixed(2) + "%",
  537. level3: ((angry3.length / 3) * 100).toFixed(2) + "%",
  538. level4: ((angry4.length / 3) * 100).toFixed(2) + "%",
  539. },
  540. disgust: {
  541. level1: ((disgust1.length / 3) * 100).toFixed(2) + "%",
  542. level2: ((disgust2.length / 3) * 100).toFixed(2) + "%",
  543. level3: ((disgust3.length / 3) * 100).toFixed(2) + "%",
  544. level4: ((disgust4.length / 3) * 100).toFixed(2) + "%",
  545. },
  546. sad: {
  547. level1: ((sad1.length / 3) * 100).toFixed(2) + "%",
  548. level2: ((sad2.length / 3) * 100).toFixed(2) + "%",
  549. level3: ((sad3.length / 3) * 100).toFixed(2) + "%",
  550. level4: ((sad4.length / 3) * 100).toFixed(2) + "%",
  551. },
  552. surprise: {
  553. level1: ((surprise1.length / 3) * 100).toFixed(2) + "%",
  554. level2: ((surprise2.length / 3) * 100).toFixed(2) + "%",
  555. level3: ((surprise3.length / 3) * 100).toFixed(2) + "%",
  556. level4: ((surprise4.length / 3) * 100).toFixed(2) + "%",
  557. },
  558. },
  559. },
  560. (response) => {
  561. if (response && response.code == "200") {
  562. //跳转新测试结果页面
  563. this.goTestResult(response.data);
  564. } else {
  565. this.$message.error("接口数据出错");
  566. }
  567. }
  568. );
  569. this.screenExit();
  570. this.$message({
  571. message: "测试结束!",
  572. type: "success",
  573. });
  574. },
  575. startTest() {
  576. if (this.testMode == 0) {
  577. this.showGuider = true;
  578. }
  579. this.imgListSerialize();
  580. },
  581. },
  582. destroyed() {
  583. clearInterval(this.timingFlag);
  584. clearInterval(this.flag);
  585. clearTimeout(this.timingOne);
  586. clearTimeout(this.timingTwo);
  587. clearTimeout(this.timingThree);
  588. },
  589. };
  590. </script>
  591. <style scoped>
  592. .butt {
  593. width: 100px;
  594. text-align: center;
  595. border: 1px solid rgb(87, 172, 187);
  596. opacity: 1;
  597. border-radius: 10px;
  598. }
  599. .bgAdd {
  600. width: 150px;
  601. height: 400px;
  602. background: url("../../assets/congnitiveAblitity/whiteFlag-new.png") no-repeat
  603. center;
  604. position: absolute;
  605. top: 25%;
  606. left: 50%;
  607. margin-left: -75px;
  608. }
  609. .activeTask {
  610. width: 100%;
  611. height: 100%;
  612. background: url("../../assets/congnitiveAblitity/rememberAbilityTask.png")
  613. no-repeat center;
  614. background-size: cover;
  615. position: fixed;
  616. top: 0;
  617. left: 0;
  618. right: 0;
  619. bottom: 0;
  620. }
  621. .timingBox {
  622. position: absolute;
  623. top: 50%;
  624. left: 50%;
  625. transform: translate(-50%, -50%);
  626. color: black;
  627. font-size: 70px;
  628. text-align: center;
  629. line-height: 100px;
  630. margin: 0 auto;
  631. z-index: 10;
  632. }
  633. /* .active-img {
  634. position: absolute;
  635. width: 450px;
  636. height: 450px;
  637. top: 50%;
  638. left: 50%;
  639. transform: translate(-50%, -50%);
  640. z-index: 10;
  641. } */
  642. .btn-content {
  643. position: absolute;
  644. width: 60%;
  645. left: 50%;
  646. bottom: 10%;
  647. transform: translate(-50%, 0);
  648. text-align: center;
  649. z-index: 1000;
  650. }
  651. .scaleName {
  652. margin-top: 70px;
  653. background-size: cover;
  654. }
  655. .scaleButton {
  656. margin-top: 20px;
  657. margin-bottom: 20px;
  658. background-size: cover;
  659. background: rgb(87, 172, 187);
  660. border: 2px solid rgb(255, 255, 255);
  661. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  662. opacity: 1;
  663. border-radius: 39px;
  664. color: #ffffff;
  665. }
  666. .steering {
  667. width: 50%;
  668. position: absolute;
  669. bottom: 20%;
  670. left: 50%;
  671. transform: translateX(-50%);
  672. display: flex;
  673. justify-content: space-between;
  674. }
  675. .steering .left {
  676. width: 60px;
  677. height: 60px;
  678. background: url(../../assets/left.png) no-repeat center;
  679. }
  680. .steering .right {
  681. width: 60px;
  682. height: 60px;
  683. background: url(../../assets/right.png) no-repeat center;
  684. margin-left: 15px;
  685. }
  686. .guider {
  687. position: absolute;
  688. top: 0;
  689. bottom: 0;
  690. left: 0;
  691. right: 0;
  692. z-index: 999;
  693. background: rgba(0, 0, 0, 0.75);
  694. }
  695. .addImg {
  696. width: 50%;
  697. height: auto;
  698. z-index: 1000;
  699. }
  700. .shape_glass {
  701. display: flex;
  702. justify-content: center;
  703. align-items: center;
  704. width: 50%;
  705. height: auto;
  706. margin: 5vh auto 0;
  707. }
  708. .active {
  709. position: relative;
  710. }
  711. .active:after {
  712. background-color: #2ea598;
  713. }
  714. /* 设置动画后颜色 */
  715. .active:before {
  716. background-color: rgba(0, 168, 253, 0.2);
  717. }
  718. /* 设置动画 */
  719. .active:before,
  720. .active:after {
  721. content: "";
  722. width: 80px;
  723. height: 40px;
  724. position: absolute;
  725. left: 50%;
  726. top: 50%;
  727. margin-left: -40px;
  728. margin-top: -20px;
  729. border-radius: 10%;
  730. animation: warn 1.5s ease-out 0s infinite;
  731. }
  732. @keyframes warn {
  733. 0% {
  734. transform: scale(0.5);
  735. opacity: 1;
  736. }
  737. 30% {
  738. opacity: 1;
  739. }
  740. 100% {
  741. transform: scale(1.4);
  742. opacity: 0;
  743. }
  744. }
  745. .txt {
  746. width: 300px;
  747. font-weight: PingFang-SC-Medium;
  748. margin: 0 auto;
  749. font-size: 16px;
  750. color: #ffffff;
  751. position: absolute;
  752. left: 50%;
  753. top: 70%;
  754. transform: translateX(-50%);
  755. z-index: 1000;
  756. }
  757. .explain {
  758. padding: 6px 8px;
  759. border: 2px solid #0abdc4;
  760. border-radius: 5px;
  761. }
  762. </style>