WordAssociation.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <template>
  2. <div id="bd " class="activeTask" v-if="quest == true">
  3. <img
  4. @click="screenState()"
  5. src="../../assets/small-big.png"
  6. alt=""
  7. style="
  8. height: 48px;
  9. width: 48px;
  10. position: fixed;
  11. top: 24px;
  12. right: 22px;
  13. cursor: pointer;
  14. "
  15. />
  16. <div class="glass">
  17. <div style="width: 92%; margin-left: 4%">
  18. <el-row>
  19. <el-col :span="12"><h3 class="bTitle">2.词汇联想</h3></el-col>
  20. <el-col :span="12">
  21. <div
  22. id="t1"
  23. style="
  24. margin-left: 58%;
  25. height: 36px;
  26. background: rgba(0, 0, 0, 0.39);
  27. margin-bottom:10px;
  28. border-radius: 24px;
  29. color: #ffffff;
  30. padding-top: 10px;
  31. "
  32. v-if="
  33. (isComplete == 0 && isDelay == false && isok == false) ||
  34. (isComplete == 0 && isDelay == true && isok == true)
  35. "
  36. v-bind:text-content.prop="time1 + '(用时)'"
  37. >
  38. 用时
  39. </div>
  40. </el-col>
  41. </el-row>
  42. <el-card
  43. style="
  44. margin-top: 20px;
  45. background: rgb(255, 255, 255);
  46. opacity: 1 !important;
  47. border-radius: 8px;
  48. "
  49. >
  50. <p style="text-align: left">
  51. 注释:包含有逻辑关系和无逻辑关系词组各12对(有关联想和无关联想),通过录音播放进行学习,随后进行测查,30分钟后进行延时回忆测查。
  52. </p>
  53. </el-card>
  54. </div>
  55. <div v-if="isDelay == true && isok == false">
  56. <h1 v-if="countDownDivShow" style="margin-top: 5rem;text-align: center;">
  57. 延时测试剩余时间:{{ remainingTime }}分钟
  58. </h1>
  59. <div class="btn-content">
  60. <el-button
  61. v-if="delayTestButtonShow"
  62. style="margin-top: 60px;"
  63. type="primary"
  64. @click="isOk"
  65. >延时测试>></el-button>
  66. </div>
  67. </div>
  68. <div v-if="isComplete == 0 && isDelay == true && isok == true">
  69. <h1 style="text-align: center">延时测试</h1>
  70. </div>
  71. <div
  72. id="c1"
  73. class="txt-center"
  74. v-if="isComplete == 1 && isDelay == false"
  75. >
  76. <h4 class="sTitle" style="text-align: left">请先听音频后做题:</h4>
  77. <audio ref="audio1">
  78. <source src="../../assets/assoia_one.mp3" type="audio/mpeg" />
  79. </audio>
  80. <audio ref="audio2">
  81. <source src="../../assets/assoia_two.mp3" type="audio/mpeg" />
  82. </audio>
  83. <audio ref="baudio1">
  84. <source src="../../assets/assoia_three.mp3" type="audio/mpeg" />
  85. </audio>
  86. <audio ref="baudio2">
  87. <source src="../../assets/assoia_four.mp3" type="audio/mpeg" />
  88. </audio>
  89. <div style="text-align: left">
  90. <el-button
  91. id="btn2"
  92. icon="el-icon-video-play"
  93. @click.once="autoAudio1"
  94. >第一组</el-button
  95. >
  96. </div>
  97. <div style="text-align: left">
  98. <el-button
  99. id="btn4"
  100. :disabled="complete"
  101. icon="el-icon-video-play"
  102. @click.once="autoAudio2"
  103. >第二组</el-button
  104. >
  105. </div>
  106. <el-button
  107. v-if="showButton"
  108. class="saveclass"
  109. id="btn1"
  110. @click="WordTest"
  111. >开始即时记忆测试</el-button
  112. >
  113. </div>
  114. <div
  115. id="c2"
  116. class="txt-center"
  117. v-if="
  118. (isComplete == 0 && isDelay == false && isok == false) ||
  119. (isComplete == 0 && isDelay == true && isok == true)
  120. "
  121. >
  122. <h3 style="text-align: left">请根据学习的音频进行作答:</h3>
  123. <div id="table">
  124. <el-tag class="el">回忆</el-tag>
  125. </div>
  126. <div class="rc">
  127. <el-row class="el-row">
  128. <el-col class="elc" :span="3">{{display_two[two_flag][0]}}</el-col>
  129. <el-col class="elc" :span="3"
  130. ><el-input size="mini" v-model.lazy.trim="hard[0]"></el-input
  131. ></el-col>
  132. <el-col class="elc" :span="3">{{display_one[one_flag][0]}}</el-col>
  133. <el-col class="elc" :span="3"
  134. ><el-input size="mini" v-model.lazy.trim="simple[0]"></el-input
  135. ></el-col>
  136. <el-col class="elc" :span="3">{{display_two[two_flag][1]}}</el-col>
  137. <el-col class="elc" :span="3"
  138. ><el-input size="mini" v-model.lazy.trim="hard[1]"></el-input
  139. ></el-col>
  140. <el-col class="elc" :span="3">{{display_one[one_flag][1]}}</el-col>
  141. <el-col class="elc" :span="3"
  142. ><el-input size="mini" v-model.lazy.trim="simple[1]"></el-input
  143. ></el-col>
  144. <el-col class="elc" :span="3">{{display_two[two_flag][2]}}</el-col>
  145. <el-col class="elc" :span="3"
  146. ><el-input size="mini" v-model.lazy.trim="hard[2]"></el-input
  147. ></el-col>
  148. <el-col class="elc" :span="3">{{display_one[one_flag][2]}}</el-col>
  149. <el-col class="elc" :span="3"
  150. ><el-input size="mini" v-model.lazy.trim="simple[2]"></el-input
  151. ></el-col>
  152. <el-col class="elc" :span="3">{{display_two[two_flag][3]}}</el-col>
  153. <el-col class="elc" :span="3"
  154. ><el-input size="mini" v-model.lazy.trim="hard[3]"></el-input
  155. ></el-col>
  156. <el-col class="elc" :span="3">{{display_one[one_flag][3]}}</el-col>
  157. <el-col class="elc" :span="3"
  158. ><el-input size="mini" v-model.lazy.trim="simple[3]"></el-input
  159. ></el-col>
  160. <el-col class="elc" :span="3">{{display_two[two_flag][4]}}</el-col>
  161. <el-col class="elc" :span="3"
  162. ><el-input size="mini" v-model.lazy.trim="hard[4]"></el-input
  163. ></el-col>
  164. <el-col class="elc" :span="3">{{display_one[one_flag][4]}}</el-col>
  165. <el-col class="elc" :span="3"
  166. ><el-input size="mini" v-model.lazy.trim="simple[4]"></el-input
  167. ></el-col>
  168. <el-col class="elc" :span="3">{{display_one[one_flag][5]}}</el-col>
  169. <el-col class="elc" :span="3"
  170. ><el-input size="mini" v-model.lazy.trim="simple[5]"></el-input
  171. ></el-col>
  172. <el-col class="elc" :span="3">{{display_two[two_flag][5]}}</el-col>
  173. <el-col class="elc" :span="3"
  174. ><el-input size="mini" v-model.lazy.trim="hard[5]"></el-input
  175. ></el-col>
  176. </el-row>
  177. </div>
  178. <!--<el-button id="btn3" class="saveclass" @click="submit">保&nbsp;&nbsp;存</el-button>-->
  179. <el-button id="btn3" class="saveclass" @click="throttle">保&nbsp;&nbsp;存</el-button>
  180. </div>
  181. </div>
  182. </div>
  183. </template>
  184. <script>
  185. import screenfull from "screenfull";
  186. export default {
  187. data() {
  188. return {
  189. complete: true,
  190. isComplete: 1,
  191. quest: false,
  192. simple: ["", "", "", "", "", ""],
  193. hard: ["", "", "", "", "", ""],
  194. display_one:[["太阳","北方","困难","颜色","牲口","站着"],["首先","剪刀","书桌","手机","树木","铅笔"]],
  195. display_two:[["勇敢","热心","西瓜","老师","团结","光明"],["米饭","水管","水壶","眼镜","沙发","衣架"]],
  196. isSimple: [["月亮", "东方", "容易", "粉红", "牛马", "躺下"],["其次", "卡片", "椅子", "电脑", "花草", "橡皮"]],
  197. isHard: [["电灯", "玻璃", "衣服", "铁路", "长短", "服从"],["镜子","口红","沙发","墙壁","伪装","合作"]],
  198. time1: "00时00分00秒",
  199. timer: "",
  200. simpleResult: 0,
  201. hardResult: 0,
  202. memoryType: 1,
  203. correlationMemory: "",
  204. countDownDivShow: false, //控制剩余时间显示隐藏
  205. delayTestButtonShow: false, //控制剩余时间显示隐藏
  206. remainingTime: 0, //延时测试剩余时间
  207. status: 1,
  208. phone: "",
  209. isDelay: false,
  210. isok: false,
  211. beforeTime: true,
  212. showButton: false,
  213. one_flag:"",
  214. two_flag:"",
  215. throttleTimer: null, //防重复点击
  216. };
  217. },
  218. created() {
  219. this.phone = sessionStorage.getItem("f7a42fe7211f98ac7a60a285ac3a9e87");
  220. this.internetQuest();
  221. },
  222. mounted: function () {
  223. var that = this;
  224. screenfull.request();
  225. document.onkeydown = function (e) {
  226. let key = window.event.keyCode;
  227. if (key === 122) {
  228. e.preventDefault();
  229. screenfull.toggle();
  230. }
  231. };
  232. },
  233. methods: {
  234. screenState() {
  235. screenfull.toggle();
  236. },
  237. internetQuest() {
  238. this.$http.post("memory/getIfUsable", { phone: this.phone }, (msg) => {
  239. if (msg.msg == "还未到时间") {
  240. this.isDelay = true;
  241. this.remainingTime = msg.data;
  242. this.countDownDivShow = true;
  243. this.delayTestButtonShow = false;
  244. } else if (msg.msg == "需要先进行即时测试") {
  245. console.log("进行即时测试");
  246. //随机音频播放次序
  247. this.one_flag=Math.floor(Math.random()*2);
  248. this.two_flag=Math.floor(Math.random()*2);
  249. /* for(let i=1;i<10;i++){
  250. console.log(Math.floor(Math.random()*2))
  251. } */
  252. } else {
  253. console.log(msg.data)
  254. switch (msg.data.length) {
  255. case 9:
  256. this.isDelay = true;
  257. this.beforeTime = false;
  258. this.memoryType = 2;
  259. this.countDownDivShow = false;
  260. this.delayTestButtonShow = true;
  261. this.correlationMemory = msg.data[0].id;
  262. let arr = msg.data[1].credentials.split('&');
  263. this.one_flag = JSON.parse(arr[0]);
  264. this.two_flag = JSON.parse(arr[1]);
  265. console.log(this.two_flag);
  266. break;
  267. case 10:
  268. this.$router.push("freeRecall");
  269. break;
  270. case 11:
  271. this.$router.push("pictureAssociation");
  272. break;
  273. case 12:
  274. this.$router.push("personRecall");
  275. break;
  276. }
  277. }
  278. this.quest = true;
  279. });
  280. },
  281. WordTest() {
  282. console.log("点击了我一下");
  283. this.isComplete = 0;
  284. this.begintime();
  285. },
  286. begintime() {
  287. console.log("执行了");
  288. var count = 0;
  289. let _this = this;
  290. this.timer = setInterval(function () {
  291. var h = parseInt(count / 1000 / 60 / 60);
  292. var m = parseInt(count / 1000 / 60) % 60;
  293. var s = parseInt(count / 1000) % 60;
  294. h = h < 10 ? "0" + h : h;
  295. m = m < 10 ? "0" + m : m;
  296. s = s < 10 ? "0" + s : s;
  297. _this.time1 = h + "时" + m + "分" + s + "秒";
  298. count = count + 1000;
  299. }, 1000);
  300. console.log(this.timer);
  301. },
  302. isOk() {
  303. if (this.beforeTime) {
  304. this.$message({
  305. message: "30分钟未到,不能进行延时测试",
  306. type: "info",
  307. });
  308. return;
  309. }
  310. this.isComplete = 0;
  311. this.begintime();
  312. this.isok = true;
  313. },
  314. submit() {
  315. for (var i = 0; i <= 5; i++) {
  316. if (this.simple[i] == this.isSimple[this.one_flag][i]) {
  317. this.simpleResult++; //简单成绩
  318. }
  319. }
  320. for (var i = 0; i <= 5; i++) {
  321. if (this.hard[i] == this.isHard[this.two_flag][i]) {
  322. this.hardResult++; //复杂成绩
  323. }
  324. }
  325. console.log(this.simpleResult + "####" + this.hardResult);
  326. console.log(this.time1); //用时
  327. var question2 = {
  328. questionNo: "2",
  329. gradea: this.simpleResult,
  330. gradeb: this.hardResult,
  331. gradec: this.simpleResult + this.hardResult,
  332. mina: this.time1,
  333. memoryType: this.memoryType,
  334. correlationMemory: this.correlationMemory,
  335. status: this.status,
  336. credentials:JSON.stringify(this.one_flag)+"&"+JSON.stringify(this.two_flag)
  337. };
  338. if (this.memoryType == 1) {
  339. sessionStorage.setItem("question2", JSON.stringify(question2));
  340. console.log(sessionStorage.getItem("question2"));
  341. this.$router.push("freeRecall");
  342. } else if (this.memoryType == 2) {
  343. console.log("延时测试信息提交");
  344. this.userId = sessionStorage.getItem(
  345. "b80bb7740288fda1f201890375a60c8f"
  346. );
  347. this.$http.post(
  348. "memory/saveMemoryCheck", //后台接口地址
  349. {
  350. userId: this.userId,
  351. memoryCheck: [question2],
  352. },
  353. (res) => {
  354. if (parseInt(res.code) === 200) {
  355. this.$router.push("freeRecall");
  356. } else {
  357. this.$message({
  358. message: "服务器内部故障,请联系管理员",
  359. type: "error",
  360. });
  361. }
  362. }
  363. );
  364. }
  365. clearInterval(this.timer); //清空定时器
  366. },
  367. autoAudio1() {
  368. if(this.one_flag===0){
  369. this.$refs.audio1.play();
  370. }else if(this.one_flag===1){
  371. this.$refs.audio2.play();
  372. }
  373. let _this = this;
  374. setTimeout(function () {
  375. _this.complete = false;
  376. }, 20000);
  377. },
  378. autoAudio2() {
  379. if(this.two_flag===0){
  380. this.$refs.baudio1.play();
  381. }else if(this.two_flag===1){
  382. this.$refs.baudio2.play();
  383. }
  384. let _this = this;
  385. setTimeout(function () {
  386. _this.showButton = true;
  387. }, 20000);
  388. },
  389. openFullScreen2() {
  390. const loading = this.$loading({
  391. lock: true,
  392. text: "Loading",
  393. spinner: "el-icon-loading",
  394. background: "rgba(0, 0, 0, 0.7)",
  395. });
  396. setTimeout(() => {
  397. loading.close();
  398. }, 2000);
  399. },
  400. throttle(){
  401. clearTimeout(this.throttleTimer);
  402. this.throttleTimer = setTimeout(()=>{
  403. this.submit();
  404. },500)
  405. },
  406. },
  407. beforeDestroy() {
  408. console.log("我执行了摧毁");
  409. clearInterval(this.timer); //关闭定时器
  410. },
  411. };
  412. </script>
  413. <style scoped>
  414. #bd {
  415. margin-top: 20px;
  416. }
  417. .bTitle {
  418. font-size: 24px;
  419. color: #333333;
  420. text-align: left;
  421. }
  422. .sTitle {
  423. font-size: 20px;
  424. color: #333333;
  425. margin-left: 5%;
  426. }
  427. .el-row {
  428. margin-bottom: 5px;
  429. height: 30px;
  430. }
  431. .rc {
  432. margin-left: 10%;
  433. }
  434. .el-input {
  435. font-size: 20px;
  436. }
  437. .elc {
  438. margin-right: 75px;
  439. font-size: 20px;
  440. margin-top: 5px;
  441. margin-bottom: 5px;
  442. }
  443. .el {
  444. width: 160px;
  445. line-height: 40px;
  446. margin: 20px 0;
  447. font-size: 24px;
  448. }
  449. .el-tag {
  450. line-height: 40px;
  451. height: 40px;
  452. }
  453. h5 {
  454. margin-top: 20px;
  455. }
  456. #table {
  457. margin-top: 20px;
  458. }
  459. #c1 {
  460. margin-top: 10px;
  461. }
  462. #c2 {
  463. width: 90%;
  464. margin: 0 auto;
  465. }
  466. #t1 {
  467. font-size: 20px;
  468. margin-top: 20px;
  469. margin-left: 80%;
  470. }
  471. .mp3 {
  472. height: 120px;
  473. margin-left: 35%;
  474. margin-top: 20px;
  475. display: flex;
  476. }
  477. #btn2 {
  478. margin-top: 60px;
  479. width: 170px;
  480. height: 48px;
  481. background: rgb(87, 172, 187);
  482. border: 2px solid rgba(255, 255, 255, 0.8);
  483. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  484. opacity: 1;
  485. border-radius: 39px;
  486. color: white;
  487. margin-left: 20px;
  488. }
  489. #btn1 {
  490. margin-top: 60px;
  491. }
  492. #btn3 {
  493. margin-top: 20px;
  494. }
  495. #btn4 {
  496. margin-top: 30px;
  497. margin-left: 20px;
  498. width: 170px;
  499. height: 48px;
  500. background: rgb(87, 172, 187);
  501. border: 2px solid rgba(255, 255, 255, 0.8);
  502. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  503. opacity: 1;
  504. border-radius: 39px;
  505. color: white;
  506. }
  507. .activeTask {
  508. background: url(../../assets/congnitiveAblitity/zhixing.png) no-repeat center;
  509. background-size: cover;
  510. /* background: black; */
  511. position: fixed;
  512. top: 0;
  513. left: 0;
  514. right: 0;
  515. bottom: 0;
  516. }
  517. .glass {
  518. width: 932px;
  519. height: 720px;
  520. /* height: 593px; */
  521. background: rgba(255, 255, 255, 0.41);
  522. border: 3px solid rgb(255, 255, 255);
  523. box-shadow: 0px 3px 6px rgba(255, 255, 255);
  524. border-radius: 12px;
  525. margin: 1vh auto;
  526. position: relative;
  527. }
  528. .saveclass {
  529. background: rgb(87, 172, 187);
  530. border: 2px solid rgba(255, 255, 255, 0.8);
  531. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  532. opacity: 1;
  533. border-radius: 39px;
  534. font-size: 20px;
  535. font-family: PingFang SC;
  536. color: #ffffff;
  537. }
  538. .btn-content {
  539. width: 100%;
  540. display: flex;
  541. flex-direction: row;
  542. justify-content: center;
  543. }
  544. </style>