bostonTask.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878
  1. <template>
  2. <!--<div>波士顿测试</div>-->
  3. <div class="boston-box">
  4. <div class="boston-warp">
  5. <div
  6. class="modelName"
  7. style="position: absolute; left: 20px; top: 20px; z-index: 10"
  8. >
  9. {{ showCover ? "观看模式" : "控制模式" }}
  10. </div>
  11. <div
  12. style="
  13. position: absolute;
  14. right: 20px;
  15. top: 20px;
  16. z-index: 10;
  17. padding: 20px;
  18. "
  19. @click.stop="screen()"
  20. >
  21. <img src="../../assets/small-big.png" alt="" />
  22. </div>
  23. <div v-if="timingShow" class="timing-content">
  24. <!--<p class="timing-des">{{timingDes}}</p>-->
  25. <p class="timing-num">{{ countDownStr }}</p>
  26. </div>
  27. <div v-if="!timingShow" class="prograss-content">
  28. <el-progress
  29. class="main_progress"
  30. :text-inside="true"
  31. :stroke-width="16"
  32. color="#57ACBB"
  33. :percentage="setItemProgress(scale_index, scale_all)"
  34. v-if="!isNaN(parseInt((scale_index / scale_all) * 100))"
  35. :format="setItemText(scale_index, scale_all)"
  36. ></el-progress>
  37. </div>
  38. <div v-if="!timingShow" class="pic-warp">
  39. <div class="pic-content">
  40. <img :src="imgUrl" alt="" />
  41. </div>
  42. <div class="btn-content">
  43. <!--<el-button @click="sentChoice(1)">回答</el-button>-->
  44. <!--<el-button @click="sentChoice(2)">提示</el-button>-->
  45. <!--<el-button @click="sentChoice(3)">辨认</el-button>-->
  46. <!--<el-button @click="sentChoice(4)">错误</el-button>-->
  47. <el-radio
  48. v-model="radio"
  49. @change="sentChoice(1)"
  50. :label="1"
  51. size="small"
  52. border
  53. >回答</el-radio
  54. >
  55. <el-radio
  56. v-model="radio"
  57. @change="sentChoice(2)"
  58. :label="2"
  59. size="small"
  60. border
  61. >提示</el-radio
  62. >
  63. <el-radio
  64. v-model="radio"
  65. @change="sentChoice(3)"
  66. :label="3"
  67. size="small"
  68. border
  69. >辨认</el-radio
  70. >
  71. <el-radio
  72. v-model="radio"
  73. @change="sentChoice(4)"
  74. :label="4"
  75. size="small"
  76. border
  77. >错误</el-radio
  78. >
  79. </div>
  80. </div>
  81. <div v-if="!timingShow && role == 'doc'" class="btn-switch-content">
  82. <div>
  83. <el-button v-if="scale_index != 1" @click="prevClick()"
  84. >上一题</el-button
  85. >
  86. </div>
  87. <div>
  88. <el-button v-if="scale_index != 30" @click="nextClick()"
  89. >下一题</el-button
  90. >
  91. </div>
  92. </div>
  93. </div>
  94. <el-radio-group
  95. @change="changeMaster"
  96. v-if="role == 'doc'"
  97. v-model="radio1"
  98. class="contral_group"
  99. >
  100. <el-radio-button label="patient">用户控制</el-radio-button>
  101. <el-radio-button label="doc">医生控制</el-radio-button>
  102. </el-radio-group>
  103. <div class="cover" v-show="showCover" @click="disableHandle"></div>
  104. <!-- 选择文化程度 -->
  105. <el-dialog
  106. :z-index="95"
  107. title="请选择学历"
  108. :visible.sync="dialogEducationVisible"
  109. width="30%"
  110. :modal="true"
  111. :show-close="false"
  112. :modal-append-to-body="false"
  113. :close-on-click-modal="false"
  114. >
  115. <el-radio-group v-model="qualification" @change="changeQualification">
  116. <el-radio :label="1">初中及以下</el-radio>
  117. <el-radio :label="2">高中</el-radio>
  118. <el-radio :label="3">大学及以上</el-radio>
  119. </el-radio-group>
  120. <div slot="footer" class="dialog-footer">
  121. <el-button type="primary" @click="computeSum(true)">确 定</el-button>
  122. </div>
  123. </el-dialog>
  124. </div>
  125. </template>
  126. <script>
  127. import { oSessionStorage, preloader } from "@/utils/utils";
  128. import screenfull from "screenfull";
  129. export default {
  130. name: "bostonTask",
  131. data() {
  132. return {
  133. picList: [
  134. {
  135. index: 0,
  136. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/shu.jpg"),
  137. picName: "树",
  138. picChoice: 0,
  139. },
  140. {
  141. index: 1,
  142. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/bi.jpg"),
  143. picName: "笔",
  144. picChoice: 0,
  145. },
  146. {
  147. index: 2,
  148. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/jiandao.jpg"),
  149. picName: "剪刀",
  150. picChoice: 0,
  151. },
  152. {
  153. index: 3,
  154. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/hua.jpg"),
  155. picName: "花",
  156. picChoice: 0,
  157. },
  158. {
  159. index: 4,
  160. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/juzi.jpg"),
  161. picName: "锯子",
  162. picChoice: 0,
  163. },
  164. {
  165. index: 5,
  166. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/saoba.jpg"),
  167. picName: "扫把",
  168. picChoice: 0,
  169. },
  170. {
  171. index: 6,
  172. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/donggu.jpg"),
  173. picName: "冬菇",
  174. picChoice: 0,
  175. },
  176. {
  177. index: 7,
  178. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/yijia.jpg"),
  179. picName: "衣架",
  180. picChoice: 0,
  181. },
  182. {
  183. index: 8,
  184. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/lunyi.jpg"),
  185. picName: "轮椅",
  186. picChoice: 0,
  187. },
  188. {
  189. index: 9,
  190. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/luotuo.jpg"),
  191. picName: "骆驼",
  192. picChoice: 0,
  193. },
  194. {
  195. index: 10,
  196. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/yumaoqiupai.jpg"),
  197. picName: "羽毛球拍",
  198. picChoice: 0,
  199. },
  200. {
  201. index: 11,
  202. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/woniu.jpg"),
  203. picName: "蜗牛",
  204. picChoice: 0,
  205. },
  206. {
  207. index: 12,
  208. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/haima.jpg"),
  209. picName: "海马",
  210. picChoice: 0,
  211. },
  212. {
  213. index: 13,
  214. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/feibiao.jpg"),
  215. picName: "飞镖",
  216. picChoice: 0,
  217. },
  218. {
  219. index: 14,
  220. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/kouqin.jpg"),
  221. picName: "口琴",
  222. picChoice: 0,
  223. },
  224. {
  225. index: 15,
  226. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/xiniu.jpg"),
  227. picName: "犀牛",
  228. picChoice: 0,
  229. },
  230. {
  231. index: 16,
  232. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/bingwu.jpg"),
  233. picName: "冰屋",
  234. picChoice: 0,
  235. },
  236. {
  237. index: 17,
  238. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/xianrenzhang.jpg"),
  239. picName: "仙人掌",
  240. picChoice: 0,
  241. },
  242. {
  243. index: 18,
  244. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/fushoudianti.jpg"),
  245. picName: "扶手电梯",
  246. picChoice: 0,
  247. },
  248. {
  249. index: 19,
  250. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/shuqin.jpg"),
  251. picName: "竖琴",
  252. picChoice: 0,
  253. },
  254. {
  255. index: 20,
  256. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/tingzhenqi.jpg"),
  257. picName: "听诊器",
  258. picChoice: 0,
  259. },
  260. {
  261. index: 21,
  262. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/jinzita.jpg"),
  263. picName: "金字塔",
  264. picChoice: 0,
  265. },
  266. {
  267. index: 22,
  268. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/loudou.jpg"),
  269. picName: "漏斗",
  270. picChoice: 0,
  271. },
  272. {
  273. index: 23,
  274. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/shoufengqin.jpg"),
  275. picName: "手风琴",
  276. picChoice: 0,
  277. },
  278. {
  279. index: 24,
  280. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/yuangui.jpg"),
  281. picName: "圆规",
  282. picChoice: 0,
  283. },
  284. {
  285. index: 25,
  286. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/sanjiaojia.jpg"),
  287. picName: "三脚架",
  288. picChoice: 0,
  289. },
  290. {
  291. index: 26,
  292. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/qian.jpg"),
  293. picName: "钳",
  294. picChoice: 0,
  295. },
  296. {
  297. index: 27,
  298. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/huapeng.jpg"),
  299. picName: "花棚",
  300. picChoice: 0,
  301. },
  302. {
  303. index: 28,
  304. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/liangjiaoqi.jpg"),
  305. picName: "量角器",
  306. picChoice: 0,
  307. },
  308. {
  309. index: 29,
  310. imgUrl: require("../../assets/congnitiveAblitity/bostonTask/suanpan.jpg"),
  311. picName: "算盘",
  312. picChoice: 0,
  313. },
  314. ],
  315. imgUrl: "", //初始化图片地址
  316. count: 0, //累加器初始化
  317. subjectInfo: "",
  318. userId: "",
  319. taskId: "",
  320. timingShow: true, //显示倒计时
  321. timingFlag: null, //倒计时名称
  322. countDownStr: "测试马上开始!",
  323. timingNum: 5, //倒计时初始化时间
  324. rightNum: [], //正确数组
  325. tipNum: [], //提示数组
  326. identifyNum: [], //辨认数组
  327. errorNum: [], //回答错误数组
  328. scale_index: 1, //初始化进度条个数
  329. scale_all: 30, //进度条总个数
  330. radio: 0, //选项值
  331. webSocket: {},
  332. role: "",
  333. toUserId: "",
  334. radio1: "doc",
  335. // webSocket: "",
  336. qualification: 1,
  337. dialogEducationVisible: false,
  338. };
  339. },
  340. computed: {
  341. showCover: function () {
  342. return this.role == this.radio1 ? false : true;
  343. },
  344. },
  345. watch: {
  346. count(val) {
  347. if (val >= 30) {
  348. this.scale_index = 30;
  349. } else {
  350. this.scale_index = val + 1;
  351. }
  352. },
  353. },
  354. created() {
  355. this.chooseRole();
  356. //绑定事件
  357. window.addEventListener('beforeunload', e => this.closeWebsocket(e));
  358. },
  359. mounted() {},
  360. methods: {
  361. init() {
  362. this.subjectInfo = JSON.parse(oSessionStorage.getItem("subjectInfo"));
  363. this.userId = sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f");
  364. this.toUserId =
  365. this.role == "doc" ? `${this.userId}patient` : `${this.userId}doc`;
  366. this.taskId = this.$route.query.taskId;
  367. this.creatScoket();
  368. this.screen();
  369. this.startTiming();
  370. },
  371. screen() {
  372. screenfull.toggle();
  373. },
  374. screenOpen() {
  375. screenfull.request();
  376. },
  377. screenExit() {
  378. screenfull.exit();
  379. },
  380. setItemProgress(currentIndex, totalIndex) {
  381. if (currentIndex >= totalIndex) {
  382. return 100;
  383. } else {
  384. return (currentIndex / totalIndex) * 100;
  385. }
  386. },
  387. setItemText(currentIndex, totalIndex) {
  388. return () => {
  389. return currentIndex + "/" + totalIndex;
  390. };
  391. },
  392. startTiming() {
  393. // if (
  394. // sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f") == "" ||
  395. // sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f") == null
  396. // ) {
  397. // this.$message.error("请先登录!");
  398. // return;
  399. // }
  400. this.timingFlag = setInterval(() => {
  401. if (this.timingNum == 0) {
  402. this.countDownStr = "开始";
  403. setTimeout(() => {
  404. //关闭倒计时提示页面
  405. this.timingShow = false;
  406. this.timingFlag = clearInterval(this.timingFlag);
  407. // 预加载图片后开始测试
  408. preloader(this.picList, () => {
  409. //开始第一张照片
  410. this.changePic(this.count);
  411. });
  412. }, 1000);
  413. this.timingFlag = clearInterval(this.timingFlag);
  414. } else {
  415. this.countDownStr = this.timingNum;
  416. this.timingNum--;
  417. }
  418. }, 1000);
  419. },
  420. sentChoice(type) {
  421. if (
  422. sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f") == "" ||
  423. sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f") == null
  424. ) {
  425. this.$message.error("请先登录!");
  426. return;
  427. }
  428. // 获取选项值
  429. this.picList[this.count].picChoice = type;
  430. //累加器自增
  431. this.count++;
  432. if (this.count > 29) {
  433. //统计选项各回答个数
  434. // this.rightNum = [];
  435. // this.tipNum = [];
  436. // this.identifyNum = [];
  437. // this.errorNum = [];
  438. //
  439. // this.picList.map((item, index) => {
  440. // switch (item.picChoice) {
  441. // case 1:
  442. // this.rightNum.push(this.picList[index]);
  443. // break;
  444. // case 2:
  445. // this.tipNum.push(this.picList[index]);
  446. // break;
  447. // case 3:
  448. // this.identifyNum.push(this.picList[index]);
  449. // break;
  450. // case 4:
  451. // this.errorNum.push(this.picList[index]);
  452. // break;
  453. // }
  454. // });
  455. //调用数据统计接口
  456. // this.$http.post(
  457. // `/cognize/BSNTask`,
  458. // {
  459. // qualification: this.qualification,
  460. // userId: this.userId,
  461. // testPlanId: this.$route.query.testPlanId || "",
  462. // result: {
  463. // rightNum: this.rightNum.length,
  464. // tipNum: this.tipNum.length,
  465. // identifyNum: this.identifyNum.length,
  466. // errorNum: this.errorNum.length,
  467. // picList: this.picList,
  468. // },
  469. // },
  470. // (response) => {
  471. // if (response) {
  472. // let routerInfo = {
  473. // name: "TestResult",
  474. // params: {
  475. // result: [
  476. // {
  477. // name: "回答正确个数",
  478. // value: this.rightNum.length + "",
  479. // },
  480. // {
  481. // name: "提示回答个数",
  482. // value: this.tipNum.length + "",
  483. // },
  484. // {
  485. // name: "辨认回答个数",
  486. // value: this.identifyNum.length + "",
  487. // },
  488. // {
  489. // name: "回答错误个数",
  490. // value: this.errorNum.length + "",
  491. // },
  492. // ],
  493. // },
  494. // };
  495. // // 向非控制端发送结束通知
  496. // if (!this.showCover) {
  497. // // this.sendMsgHandle(4104, routerInfo);
  498. // this.sendMsgHandle(4104, response.data);
  499. // }
  500. // // 跳转到结果页面
  501. // // this.$router.push(routerInfo);
  502. // //跳转新测试结果页面
  503. // this.goTestResult(response.data);
  504. // //关闭socket
  505. // this.closeWebsocket()
  506. // }
  507. // }
  508. // );
  509. //
  510. // this.$message({
  511. // message: "测试结束",
  512. // type: "success",
  513. // });
  514. // //提交数据或跳转得分页
  515. // this.screenExit();
  516. // this.$router.push("/welcome/CognitiveAbility");
  517. this.computeSum(false);
  518. } else {
  519. //切换图片
  520. this.changePic(this.count);
  521. // 发送同步通知
  522. this.sendMsgHandle(4101, type);
  523. }
  524. },
  525. computeSum (hasQualification){
  526. if (hasQualification) {
  527. this.rightNum = [];
  528. this.tipNum = [];
  529. this.identifyNum = [];
  530. this.errorNum = [];
  531. this.picList.map((item, index) => {
  532. switch (item.picChoice) {
  533. case 1:
  534. this.rightNum.push(this.picList[index]);
  535. break;
  536. case 2:
  537. this.tipNum.push(this.picList[index]);
  538. break;
  539. case 3:
  540. this.identifyNum.push(this.picList[index]);
  541. break;
  542. case 4:
  543. this.errorNum.push(this.picList[index]);
  544. break;
  545. }
  546. });
  547. this.$http.post(
  548. `/cognize/BSNTask`,
  549. {
  550. qualification: this.qualification,
  551. userId: this.userId,
  552. testPlanId: this.$route.query.testPlanId || "",
  553. result: {
  554. rightNum: this.rightNum.length,
  555. tipNum: this.tipNum.length,
  556. identifyNum: this.identifyNum.length,
  557. errorNum: this.errorNum.length,
  558. picList: this.picList,
  559. },
  560. },
  561. (response) => {
  562. if (response) {
  563. // 向非控制端发送结束通知
  564. if (!this.showCover) {
  565. // this.sendMsgHandle(4104, routerInfo);
  566. this.sendMsgHandle(4104, response.data);
  567. }
  568. //跳转新测试结果页面
  569. this.goTestResult(response.data);
  570. //关闭socket
  571. this.closeWebsocket()
  572. }
  573. }
  574. );
  575. this.$message({
  576. message: "测试结束",
  577. type: "success",
  578. });
  579. //提交数据或跳转得分页
  580. this.screenExit();
  581. }else {
  582. this.dialogEducationVisible = true;
  583. this.sendMsgHandle(4105, true);
  584. }
  585. },
  586. changePic(param) {
  587. this.imgUrl = this.picList[param].imgUrl;
  588. // 绑定回答选项值
  589. this.radio = this.picList[param].picChoice;
  590. console.log(this.radio, "选项值");
  591. },
  592. prevClick() {
  593. this.count--;
  594. this.changePic(this.count);
  595. this.sendMsgHandle(4102, "");
  596. },
  597. nextClick() {
  598. if (this.picList[this.count].picChoice == 0) {
  599. this.$message.error("请先答本题!");
  600. } else {
  601. this.count++;
  602. this.changePic(this.count);
  603. this.sendMsgHandle(4103, "");
  604. }
  605. },
  606. // 选择身份
  607. chooseRole() {
  608. this.$confirm("请选择你的身份,医生还是普通用户", "提示", {
  609. distinguishCancelAndClose: true,
  610. confirmButtonText: "医生",
  611. cancelButtonText: "普通用户",
  612. type: "info",
  613. })
  614. .then(() => {
  615. this.role = "doc";
  616. this.init();
  617. })
  618. .catch(() => {
  619. this.role = "patient";
  620. this.init();
  621. });
  622. },
  623. // 切换控制权限
  624. changeMaster() {
  625. let msg = {
  626. toUserId: this.toUserId,
  627. message: {
  628. msg: "角色切换",
  629. master: this.radio1 == this.role,
  630. },
  631. };
  632. console.log(msg);
  633. this.webSocket.send(JSON.stringify(msg));
  634. },
  635. // 创建socket连接
  636. creatScoket() {
  637. this.webSocket = new WebSocket(`${scoketUrl}${this.userId}${this.role}`);
  638. console.log("连接成功");
  639. this.webSocket.onerror = (event) => {
  640. alert("连接错误");
  641. };
  642. this.webSocket.onopen = (event) => {
  643. //alert("open"+event.data);
  644. //console.log(event);
  645. };
  646. this.webSocket.onclose = (event) => {
  647. alert("服务不存在或者被关闭");
  648. };
  649. this.webSocket.onmessage = (event) => {
  650. let data = JSON.parse(event.data);
  651. if (!data.message) {
  652. // if (data.code == "201") {
  653. // this.chooseRole();
  654. // this.$message.error(data.msg);
  655. // }
  656. } else {
  657. this.receiveMsgHandle(data.message);
  658. }
  659. };
  660. },
  661. // 接收消息处理方法
  662. receiveMsgHandle(res) {
  663. // 切换控制权权
  664. if (res.master == undefined) {
  665. if (res.eventNo == 4101) {
  666. console.log(res.data);
  667. this.sentChoice(res.data);
  668. }
  669. if (res.eventNo == 4102) {
  670. this.prevClick();
  671. }
  672. if (res.eventNo == 4103) {
  673. this.nextClick();
  674. }
  675. if (res.eventNo == 4104) {
  676. screenfull.exit();
  677. // this.$router.push(res.data);
  678. //跳转新测试结果页面
  679. this.goTestResult(res.data);
  680. }
  681. //学历弹窗控制
  682. if (res.eventNo == 4105) {
  683. this.dialogEducationVisible = res.data;
  684. }
  685. if (res.eventNo == 4106) {
  686. this.qualification = res.data;
  687. }
  688. } else {
  689. this.radio1 = res.master ? "doc" : "patient";
  690. }
  691. },
  692. // 发送消息处理方法
  693. sendMsgHandle(No, data) {
  694. let msg = {
  695. toUserId: this.toUserId,
  696. message: {
  697. msg: "发送成功",
  698. eventNo: No,
  699. data: data,
  700. },
  701. };
  702. this.webSocket.send(JSON.stringify(msg));
  703. },
  704. // 禁止操作
  705. disableHandle() {
  706. this.$message.warning("您暂时不需要操作,请耐心等待");
  707. },
  708. //关闭websocket
  709. closeWebsocket(e){
  710. if(this.webSocket){
  711. this.webSocket.close();
  712. // let _this=this
  713. this.webSocket.onclose = function(evt) {
  714. console.log("websocket已关闭");
  715. };
  716. }
  717. },
  718. changeQualification(){
  719. this.sendMsgHandle(4106, this.qualification);
  720. },
  721. },
  722. beforeDestroy() {
  723. //卸载事件
  724. window.removeEventListener('beforeunload', e => this.closeWebsocket(e))
  725. },
  726. destroyed() {
  727. clearInterval(this.timingFlag);
  728. //关闭socket
  729. this.closeWebsocket()
  730. },
  731. };
  732. </script>
  733. <style scoped>
  734. .boston-box {
  735. width: 100%;
  736. height: 100%;
  737. }
  738. .boston-warp {
  739. width: 100%;
  740. height: 100%;
  741. background: url(../../assets/congnitiveAblitity/zhixing.png) no-repeat center;
  742. background-size: cover;
  743. position: fixed;
  744. top: 0;
  745. left: 0;
  746. right: 0;
  747. display: flex;
  748. flex-direction: column;
  749. justify-content: space-around;
  750. align-items: center;
  751. z-index: 2;
  752. }
  753. .prograss-content {
  754. width: 800px;
  755. }
  756. .pic-warp {
  757. width: 650px;
  758. display: flex;
  759. flex-direction: row;
  760. justify-content: space-around;
  761. align-items: center;
  762. }
  763. .pic-content {
  764. width: 380px;
  765. height: 380px;
  766. border-radius: 5px;
  767. /*background: #000;*/
  768. text-align: center;
  769. }
  770. .pic-content img {
  771. /*width: 100%;*/
  772. /*height: 100%;*/
  773. max-height: 100%;
  774. max-width: 100%;
  775. vertical-align: middle;
  776. margin: 0 auto;
  777. }
  778. .btn-content {
  779. width: 100px;
  780. height: 380px;
  781. display: flex;
  782. flex-direction: column;
  783. justify-content: space-between;
  784. align-items: center;
  785. }
  786. .btn-content .el-radio {
  787. background: #fff;
  788. border-radius: 8px;
  789. margin: 0 !important;
  790. }
  791. .btn-switch-content {
  792. width: 600px;
  793. height: 50px;
  794. /*margin-top: 60px;*/
  795. display: flex;
  796. flex-direction: row;
  797. justify-content: space-between;
  798. align-items: center;
  799. }
  800. .btn-content .el-button,
  801. .btn-switch-content .el-button {
  802. background: rgb(87, 172, 187);
  803. border: 2px solid rgb(255, 255, 255);
  804. box-shadow: 0px 3px 6px rgba(0 0 0 0.16);
  805. opacity: 1;
  806. border-radius: 39px;
  807. color: #fff;
  808. }
  809. .btn-content .el-button:hover,
  810. .btn-switch-content .el-button:hover {
  811. color: rgb(87, 172, 187);
  812. background: #fff;
  813. border: 2px solid rgb(87, 172, 187);
  814. }
  815. .timing-content {
  816. width: 100%;
  817. position: absolute;
  818. top: 50%;
  819. left: 50%;
  820. transform: translate(-50%, -50%);
  821. color: black;
  822. font-size: 70px;
  823. text-align: center;
  824. line-height: 100px;
  825. }
  826. .contral_group {
  827. position: fixed;
  828. bottom: 5%;
  829. left: 50%;
  830. transform: translateX(-50%);
  831. z-index: 100;
  832. }
  833. .cover {
  834. position: fixed;
  835. top: 0;
  836. right: 0;
  837. bottom: 0;
  838. left: 0;
  839. overflow: auto;
  840. z-index: 99;
  841. background: #ddd;
  842. opacity: 0.2;
  843. }
  844. </style>