multiple.vue 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998
  1. <template>
  2. <div>
  3. <Header @confirmExit="confirmExit" @setMusic="setMusic"></Header>
  4. <Transition :enter-active-class="proxy?.animate.dialog.enter" :leave-active-class="proxy?.animate.dialog.leave">
  5. <div class="time"
  6. :class="{ 'time1': styleType == 1, 'time2': styleType == 2, 'time3': styleType == 3, 'time4': styleType == 4, }"
  7. v-show="(needStart && [42].includes(examState)) || (['situp', 'jumprope', 'jumpingjack', 'highknees', 'pullup', 'sidepullup', 'squat', 'jumpleftright', 'crossjump', 'kneeupclap'].includes(parameter.project) && [42].includes(examState))">
  8. {{
  9. time.countdownNum
  10. }}
  11. </div>
  12. </Transition>
  13. <div class="main">
  14. <div class="testBox"
  15. :class="{ 'testBox1': styleType == 1, 'testBox2': styleType == 2, 'testBox3': styleType == 3, 'testBox4': styleType == 4 }">
  16. <div class="ul"
  17. :class="{ 'overlap': (examState == 43 && time.ready) || [42].includes(examState) || (showTestAgain && ![41].includes(examState)), 'ready': [41].includes(examState), 'hands': parameter.gesture }"
  18. v-for="(items, indexs) in testListArr" :key="indexs">
  19. <MultipleItem :ref="(el: any) => { multipleItemRef(el, item.itemNumber, item.area) }"
  20. v-for="(item, index) in items" :query="parameter" :area="item.area" :key="index" @returnData="returnData"
  21. @getChooseStudent="getChooseStudent" :examState="examState" :needStart="needStart" :styleType="styleType"
  22. :parentTrainWsMethod="{ initWs, examEnds, openOneTest, startFace, stopFace, faceConfirmOnly, startOneTest, finishOneTest, closeOneTest, suspendFaceRecognitionChannels, resumeFaceRecognitionChannels }"
  23. :parentSpeechMethod="{ initSpeech, speckText, playMusic, controlMusic, speckCancel, chineseNumber }" />
  24. </div>
  25. </div>
  26. </div>
  27. <div class="footerBtn">
  28. <template v-if="needStart">
  29. <div class="btn" @click="getAgain" v-if="examState == 42 || showTestAgain">再测一次</div>
  30. <div class="btn" @click="getStartFace" v-if="examState < 41">开始识别</div>
  31. <div class="btn" @click="getStopFace" v-if="examState == 41">停止人脸识别</div>
  32. <div class="btn startBtn" @click="getReady" v-if="examState == 43">开始测试</div>
  33. <div class="btn" @click="getAllRetestFace" v-if="examState == 43 || examState == 42">重新识别</div>
  34. </template>
  35. <template v-else>
  36. <template v-if="examState == 43">
  37. <div class="btn startBtn" @click="getReady"
  38. v-if="['situp', 'jumprope', 'jumpingjack', 'highknees', 'pullup', 'sidepullup', 'squat', 'jumpleftright', 'crossjump', 'kneeupclap'].includes(parameter.project)">
  39. 开始测试
  40. </div>
  41. <div class="btn startBtn" @click="getStartOneTest" v-else>开始测试</div>
  42. </template>
  43. </template>
  44. <div class="btn" :class="{ testRecordBtn: showReportList }" @click="getTestRecord"
  45. v-if="![43, 42].includes(examState)">
  46. {{ showReportList ? '关闭记录' : '测试记录' }}
  47. </div>
  48. <div class="btn exitBtn" @click="confirmExit">退 出</div>
  49. <!--测试记录开始-->
  50. <div class="mask mask2" v-show="showReportList" @click="getTestRecord"></div>
  51. <Transition :enter-active-class="proxy?.animate.report.enter" :leave-active-class="proxy?.animate.report.leave">
  52. <div class="main-right" v-show="showReportList">
  53. <ReportList ref="reportListRef" :parameter="parameter" :showQRCode="true" />
  54. </div>
  55. </Transition>
  56. <!--测试记录结束-->
  57. </div>
  58. <!--倒计时开始-->
  59. <div>
  60. <Transition :enter-active-class="proxy?.animate.mask.enter" :leave-active-class="proxy?.animate.mask.leave">
  61. <div class="mask" v-show="examState == 43 && time.ready"></div>
  62. </Transition>
  63. <Transition :enter-active-class="proxy?.animate.face.enter" :leave-active-class="proxy?.animate.face.leave">
  64. <div class="confirmDiaBg" v-show="examState == 43 && time.ready">
  65. <div class="confirmDiaWindow">
  66. <div class="readyBox">
  67. <div class="lable">倒计时</div>
  68. <div class="value" :class="{ 'transparent': time.ready > 5 }">{{ time.ready }}</div>
  69. <!-- <div class="lable2">预 备</div> -->
  70. </div>
  71. </div>
  72. </div>
  73. </Transition>
  74. </div>
  75. <!--倒计时结束-->
  76. <!--选择学生-->
  77. <ChooseStudent ref="chooseStudentRef" @returnData="returnStudent" />
  78. <!--十人以内排行榜-->
  79. <MultipleItemRanking ref="multipleItemRankingRef" :testList="testList"></MultipleItemRanking>
  80. <!--十人以上排行榜-->
  81. <MultipleItemAllRanking ref="multipleItemAllRankingRef" :testList="testList"></MultipleItemAllRanking>
  82. </div>
  83. </template>
  84. <script setup name="Multiple" lang="ts">
  85. import { clearInterval, clearTimeout, setInterval, setTimeout } from 'worker-timers';
  86. import useAppStore from '@/store/modules/app';
  87. import { useWs } from '@/utils/trainWs';
  88. import { initSpeech, speckText, playMusic, controlMusic, speckCancel, chineseNumber } from '@/utils/speech';
  89. import { useWebSocket } from '@/utils/handWs';
  90. const { handWs, startDevice, startHand, stateHand } = useWebSocket();
  91. const {
  92. initWs,
  93. examEnds,
  94. openOneTest,
  95. startFace,
  96. stopFace,
  97. faceConfirmOnly,
  98. startOneTest,
  99. finishOneTest,
  100. closeOneTest,
  101. suspendFaceRecognitionChannels,
  102. resumeFaceRecognitionChannels
  103. } = useWs();
  104. const { proxy } = getCurrentInstance() as any;
  105. const router = useRouter();
  106. const route = useRoute();
  107. const reportListRef = ref();
  108. const chooseStudentRef = ref();
  109. const multipleItemRankingRef = ref();
  110. const multipleItemAllRankingRef = ref();
  111. const data = reactive<any>({
  112. timerManager: {}, //计时器管理
  113. parameter: {}, //参数
  114. time: {
  115. testTime: 60, //时长
  116. countdownNum: 0, //计时
  117. ready: 0, //预备
  118. exit: 0 //退出倒计时
  119. },
  120. userInfo: {}, //用户信息
  121. examState: 0, //当前状态
  122. needStart: false, //是否需要按钮
  123. showTestAgain: false, //再测一次按钮
  124. testList: [], //获取区列表
  125. multipleItemRefList: [], //获取区列表
  126. styleType: null, //展示样式1:1-5个,2:6-10个,3:10个以上,4:1-4个,
  127. showReportList: false, //显示隐藏测试记录
  128. exitStatus: 0, //退出响应次数
  129. sid: null, //WS的id
  130. chooseStudentArea: {}, //弹出手动选择对应的区号
  131. deviceInfo: {}, //设备信息
  132. musicList: [] //音乐列表
  133. });
  134. const {
  135. timerManager,
  136. parameter,
  137. time,
  138. userInfo,
  139. examState,
  140. needStart,
  141. showTestAgain,
  142. testList,
  143. multipleItemRefList,
  144. styleType,
  145. showReportList,
  146. exitStatus,
  147. sid,
  148. chooseStudentArea,
  149. deviceInfo,
  150. musicList
  151. } = toRefs(data);
  152. /**
  153. * 创建组件实例
  154. */
  155. const multipleItemRef = (el: any, index: number, area: any) => {
  156. multipleItemRefList.value[index - 1] = el;
  157. };
  158. /**
  159. * 开始项目和识别
  160. */
  161. const getOpenOneTestAndStartFace = () => {
  162. cleanData();
  163. examState.value = 40;
  164. for (let i = 0; i < multipleItemRefList.value.length; i++) {
  165. multipleItemRefList.value[i].getOpenOneTestAndStartFace();
  166. }
  167. };
  168. /**
  169. * 开始项目
  170. */
  171. const getOpenOneTest = () => {
  172. cleanData();
  173. examState.value = 40;
  174. for (let i = 0; i < multipleItemRefList.value.length; i++) {
  175. multipleItemRefList.value[i].getOpenOneTest();
  176. }
  177. };
  178. /**
  179. * 开始识别
  180. */
  181. const getStartFace = () => {
  182. cleanData();
  183. examState.value = 41;
  184. for (let i = 0; i < multipleItemRefList.value.length; i++) {
  185. multipleItemRefList.value[i].getStartFace();
  186. }
  187. };
  188. /**
  189. * 停止人脸识别
  190. */
  191. const getStopFace = async () => {
  192. let flag = false;
  193. for (let i = 0; i < testList.value.length; i++) {
  194. if (testList.value[i] && testList.value[i].faceCheckStu?.student_id) {
  195. flag = true;
  196. }
  197. }
  198. if (!flag) {
  199. proxy?.$modal.msgWarning('请选择人员!');
  200. return false;
  201. }
  202. examState.value = 43;
  203. for (let i = 0; i < multipleItemRefList.value.length; i++) {
  204. multipleItemRefList.value[i].getStopFace();
  205. }
  206. };
  207. /**
  208. * 开始测试
  209. */
  210. const getStartOneTest = () => {
  211. if (examState.value != 43) {
  212. return false;
  213. }
  214. let flag = false;
  215. for (let i = 0; i < testList.value.length; i++) {
  216. if (testList.value[i] && testList.value[i].faceCheckStu?.student_id) {
  217. flag = true;
  218. }
  219. }
  220. if (!flag) {
  221. proxy?.$modal.msgWarning('请选择人员!');
  222. return false;
  223. }
  224. getClearTimer('readyTimer');
  225. time.value.ready = 0;
  226. examState.value = 42;
  227. for (let i = 0; i < multipleItemRefList.value.length; i++) {
  228. if (testList.value[i].examState == 41) {
  229. //正在识别的停止识别
  230. multipleItemRefList.value[i].getStopFace();
  231. }
  232. if (testList.value[i].examState == 43) {
  233. multipleItemRefList.value[i].getStartOneTest();
  234. }
  235. }
  236. speckText('哨声');
  237. if (parameter.value.music && musicList.value.length) {
  238. let obj = musicList.value.find((item: any) => {
  239. return item.id == parameter.value.music;
  240. });
  241. if (obj != undefined) {
  242. playMusic(obj.url);
  243. }
  244. }
  245. //显示再测一次按钮
  246. showTestAgain.value = true;
  247. //时间为0的为正计时,大于0的为倒计时
  248. if (time.value.testTime == 0) {
  249. getCounting('+');
  250. } else {
  251. getCounting('-');
  252. }
  253. };
  254. /**
  255. * 再测一次
  256. */
  257. const getAgain = async () => {
  258. let txt = '是否再测一次?';
  259. await proxy?.$modal.confirm(txt);
  260. getClearTimer();
  261. let loading = ElLoading.service({ text: '请稍等...', background: 'rgba(0, 0, 0, 0.8)', customClass: `sports ${parameter.value.project}` });
  262. cleanData();
  263. examState.value = 41;
  264. speckCancel(); //停止播报
  265. for (let i = 0; i < multipleItemRefList.value.length; i++) {
  266. multipleItemRefList.value[i].getAgain();
  267. }
  268. timerManager.value.againTimer = setInterval(() => {
  269. if (examState.value == 43) {
  270. getClearTimer('againTimer');
  271. loading?.close();
  272. }
  273. }, 300);
  274. let loadingTime = setTimeout(() => {
  275. if (examState.value <= 41) {
  276. loading?.close();
  277. clearTimeout(loadingTime);
  278. getClearTimer('againTimer');
  279. }
  280. }, 10000);
  281. };
  282. /**
  283. * 重新识别
  284. */
  285. const getAllRetestFace = async () => {
  286. let loading = ElLoading.service({ text: '请稍等...', background: 'rgba(0, 0, 0, 0.8)', customClass: `sports ${parameter.value.project}` });
  287. speckCancel(); //停止播报
  288. showTestAgain.value = false;
  289. examState.value = 3;
  290. for (let i = 0; i < multipleItemRefList.value.length; i++) {
  291. multipleItemRefList.value[i].getAllRetestFace();
  292. }
  293. timerManager.value.allRetestFaceTimer = setInterval(() => {
  294. if (examState.value == 41) {
  295. getClearTimer('allRetestFaceTimer');
  296. loading?.close();
  297. }
  298. }, 300);
  299. let loadingTime = setTimeout(() => {
  300. if (examState.value <= 3) {
  301. loading?.close();
  302. clearTimeout(loadingTime);
  303. getClearTimer('allRetestFaceTimer');
  304. }
  305. }, 10000);
  306. };
  307. /**
  308. * 确认退出
  309. */
  310. const confirmExit = () => {
  311. let handcontroller_id = parameter.value.handcontroller;
  312. proxy?.$modal
  313. .confirm(handcontroller_id ? `请保持两秒确认退出` : `确定退出吗?`)
  314. .then(() => {
  315. getExit();
  316. })
  317. .finally(() => { });
  318. };
  319. /**
  320. * 退出
  321. */
  322. const getExit = () => {
  323. getClearTimer(); //清除计时器
  324. examEnds(); //通知工作站关闭
  325. speckCancel(); //停止播报
  326. window.onbeforeunload = null; //移除事件处理器
  327. let handcontroller_id = parameter.value.handcontroller;
  328. if (handcontroller_id) {
  329. router.push({ path: '/gesture' });
  330. } else {
  331. if (parameter.value.taskId) {
  332. router.push({ path: '/test' });
  333. } else {
  334. router.push({ path: '/train' });
  335. }
  336. }
  337. };
  338. /**
  339. * 清空定时任务
  340. */
  341. const getClearTimer = (data?: any) => {
  342. if (data) {
  343. //清除指定
  344. clearInterval(timerManager.value[data]);
  345. timerManager.value[data] = null;
  346. } else {
  347. //清除全部
  348. for (let key in timerManager.value) {
  349. if (timerManager.value.hasOwnProperty(key)) {
  350. clearInterval(timerManager.value[key]);
  351. timerManager.value[key] = null;
  352. }
  353. }
  354. }
  355. };
  356. /**
  357. * 清除历史记录
  358. */
  359. const cleanData = () => {
  360. getClearTimer('countdownTimer');
  361. time.value.countdownNum = time.value.testTime;
  362. showTestAgain.value = false;
  363. };
  364. /**
  365. * 倒计时
  366. */
  367. const getCounting = (type: string) => {
  368. timerManager.value.countdownTimer = setInterval(() => {
  369. //正计时
  370. if (type == '+') {
  371. time.value.countdownNum++;
  372. }
  373. //倒计时
  374. if (type == '-') {
  375. if (time.value.countdownNum <= 0) {
  376. getClearTimer('countdownTimer');
  377. } else {
  378. time.value.countdownNum--;
  379. }
  380. }
  381. }, 1000);
  382. };
  383. /**
  384. * 子组件选择学生
  385. */
  386. const getChooseStudent = (data: any) => {
  387. console.log('data', data);
  388. chooseStudentArea.value = data;
  389. chooseStudentRef.value.open();
  390. };
  391. /**
  392. * 返回被选学生
  393. */
  394. const returnStudent = (data: any) => {
  395. console.log('data', data);
  396. let area = chooseStudentArea.value.area;
  397. let index = testList.value.findIndex((item: any) => {
  398. return area == item.area;
  399. });
  400. console.log('index', index);
  401. multipleItemRefList.value[index]?.returnStudent(data);
  402. };
  403. /**
  404. * 子组件返回数据
  405. */
  406. const returnData = (data: any) => {
  407. let index = testList.value.findIndex((item: any) => {
  408. return item.area == data.area;
  409. });
  410. let obj = Object.assign(testList.value[index], data);
  411. testList.value[index] = JSON.parse(JSON.stringify(obj));
  412. // console.log('testList.value', testList.value);
  413. if (examState.value == 0) {
  414. let flag = false;
  415. //只监听人脸识别的区
  416. let newList = testList.value;
  417. for (let i = 0; i < newList.length; i++) {
  418. if (newList[i] && newList[i].examState == 3) {
  419. flag = true;
  420. }
  421. }
  422. if (flag) {
  423. console.log('变更状态:', 3);
  424. examState.value = 3;
  425. speckCancel(); //停止播报
  426. if (needStart.value) {
  427. let handcontroller = parameter.value.handcontroller;
  428. let ctrl = parameter.value.ctrl;
  429. if (handcontroller && ctrl) {
  430. speckText(`请${ctrl}区举左手开始识别`);
  431. } else {
  432. proxy?.$modal.msgWarning(`请点击右下角的【开始识别】`);
  433. }
  434. }
  435. }
  436. }
  437. if (examState.value == 3) {
  438. let flag = false;
  439. //只监听人脸识别的区
  440. let newList = testList.value;
  441. for (let i = 0; i < newList.length; i++) {
  442. if (newList[i] && newList[i].examState == 40) {
  443. flag = true;
  444. }
  445. }
  446. if (flag) {
  447. console.log('变更状态:', 40);
  448. examState.value = 40;
  449. }
  450. }
  451. if (examState.value == 40) {
  452. let flag = false;
  453. //只监听人脸识别的区
  454. let newList = testList.value;
  455. for (let i = 0; i < newList.length; i++) {
  456. if (newList[i] && newList[i].examState == 41) {
  457. flag = true;
  458. }
  459. }
  460. if (flag) {
  461. console.log('变更状态:', 41);
  462. examState.value = 41;
  463. let txt = parameter.value.gesture ? '请举右手看摄像头进行人脸识别' : '请看摄像头进行人脸识别';
  464. speckText(txt);
  465. //如果过段时候后仍在识别中就提示停止识别
  466. // setTimeout(() => {
  467. // if (examState.value == 41) {
  468. // let handcontroller = parameter.value.handcontroller;
  469. // let ctrl = parameter.value.ctrl;
  470. // if (handcontroller && ctrl) {
  471. // speckText(`各就位后请${ctrl}区举左手停止识别`);
  472. // } else {
  473. // proxy?.$modal.msgWarning(`各就位后请点击右下角的【停止人脸识别】`);
  474. // }
  475. // }
  476. // }, 15000)
  477. }
  478. }
  479. if (examState.value == 41) {
  480. let flag = false;
  481. //只监听人脸识别的区
  482. let newList = testList.value.filter((item: any) => {
  483. return item?.faceCheckStu?.student_id;
  484. });
  485. for (let i = 0; i < newList.length; i++) {
  486. if (newList[i] && newList[i].faceCheckStu?.student_id && newList[i].examState == 43) {
  487. flag = true;
  488. }
  489. }
  490. if (flag) {
  491. console.log('变更状态:', 43);
  492. examState.value = 43;
  493. cleanData();
  494. //如果过段时候后仍在识别中就提示停止识别
  495. // setTimeout(() => {
  496. // if (examState.value == 43) {
  497. // let handcontroller = parameter.value.handcontroller;
  498. // let ctrl = parameter.value.ctrl;
  499. // if (handcontroller && ctrl) {
  500. // speckText(`请${ctrl}区举左手开始测试`);
  501. // } else {
  502. // proxy?.$modal.msgWarning(`请点击右下角的【开始测试】`);
  503. // }
  504. // }
  505. // }, 10000)
  506. }
  507. }
  508. //测试完成后回退状态
  509. if (examState.value == 42) {
  510. let flag = false;
  511. //只监听人脸识别的区
  512. let newList = testList.value.filter((item: any) => {
  513. return item?.faceCheckStu?.student_id;
  514. });
  515. for (let i = 0; i < newList.length; i++) {
  516. if (newList[i] && newList[i].faceCheckStu?.student_id && newList[i].examState == 3) {
  517. flag = true;
  518. } else {
  519. return false;
  520. }
  521. }
  522. if (flag) {
  523. console.log('变更状态:', 3);
  524. examState.value = 3;
  525. speckCancel();//停止播报
  526. //打开排行榜
  527. if (testList.value.length >= 10) {
  528. multipleItemAllRankingRef.value.open();
  529. } else {
  530. multipleItemRankingRef.value.open();
  531. }
  532. }
  533. }
  534. //如果全部状态为0就退出
  535. if (examState.value >= 0) {
  536. let flag = false;
  537. //只监听人脸识别的区
  538. let newList = testList.value;
  539. let myList = newList.filter((item: any) => {
  540. return item.examState == 0;
  541. });
  542. if (myList.length == newList.length) {
  543. examState.value = 0;
  544. getExit();
  545. }
  546. }
  547. };
  548. /**
  549. * 准备开始
  550. */
  551. const getReady = () => {
  552. if (examState.value != 43) {
  553. return false;
  554. }
  555. if (time.value.ready) {
  556. return false;
  557. }
  558. let flag = false;
  559. for (let i = 0; i < testList.value.length; i++) {
  560. if (testList.value[i] && testList.value[i].faceCheckStu?.student_id) {
  561. flag = true;
  562. }
  563. }
  564. if (!flag) {
  565. proxy?.$modal.msgWarning('请选择人员!');
  566. return false;
  567. }
  568. //停止播报;
  569. speckCancel();
  570. //正在识别的停止识别
  571. for (let i = 0; i < multipleItemRefList.value.length; i++) {
  572. if (testList.value[i].examState == 41) {
  573. multipleItemRefList.value[i].getStopFace();
  574. }
  575. }
  576. //speckText("预备3");
  577. //speckText("各就位!预备!");
  578. time.value.ready = 6;
  579. timerManager.value.readyTimer = setInterval(() => {
  580. time.value.ready--;
  581. if (time.value.ready <= 0) {
  582. getClearTimer('readyTimer');
  583. getStartOneTest();
  584. } else {
  585. speckText(time.value.ready);
  586. }
  587. }, 1000);
  588. };
  589. /**
  590. * 成绩列表
  591. */
  592. const getTestRecord = () => {
  593. if (showReportList.value) {
  594. showReportList.value = false;
  595. } else {
  596. reportListRef.value.getIniReportList();
  597. showReportList.value = true;
  598. }
  599. };
  600. /**
  601. * 自动填补空缺
  602. */
  603. const getAddTestList = (num: number) => {
  604. let list = parameter.value.area.split(',');
  605. let myLength = num - list.length;
  606. for (let i = 0; i < myLength; i++) {
  607. let obj = {
  608. area: '',
  609. itemNumber: list.length + (i + 1)
  610. };
  611. testList.value.push(obj);
  612. }
  613. };
  614. /**
  615. * 获取设备项目
  616. */
  617. const getDevice = async () => {
  618. let deviceid = localStorage.getItem('deviceid') || '';
  619. if (deviceid) {
  620. startDevice({ deviceid: deviceid });
  621. } else {
  622. proxy?.$modal.msgError(`缺少设备信息请重新登录!`);
  623. await proxy?.$http.common.logout({}).then((res: any) => { });
  624. proxy?.$modal?.closeLoading();
  625. //清空缓存
  626. // localStorage.clear();
  627. localStorage.removeItem('token');
  628. localStorage.removeItem('userInfo');
  629. //跳转
  630. router.push({ path: '/login/qrcode' });
  631. }
  632. };
  633. /**
  634. * 获取音乐
  635. */
  636. const getMusic = async () => {
  637. const list: any = useAppStore().getMusic();
  638. if (list.length) {
  639. musicList.value = list;
  640. } else {
  641. await proxy?.$http.train.musicList().then((res: any) => {
  642. if (res.data.length > 0) {
  643. let myList: any = res.data;
  644. musicList.value = myList;
  645. useAppStore().setMusic(myList);
  646. }
  647. });
  648. }
  649. };
  650. /**
  651. * 设置音乐
  652. */
  653. const setMusic = async (data: any) => {
  654. //console.log("data",data)
  655. parameter.value.music = data;
  656. };
  657. /**
  658. * 加载手势WS
  659. */
  660. const initHand = () => {
  661. handWs((e: any) => {
  662. if (router.currentRoute.value.path != '/train/multiple' || parameter.value.handcontroller == undefined) {
  663. return false;
  664. }
  665. console.log('eeeee', e);
  666. if (e?.wksid) {
  667. //获取设备项目
  668. getDevice();
  669. }
  670. //接收设备信息
  671. if (e?.device_info) {
  672. deviceInfo.value = e.device_info;
  673. let handcontroller_id = deviceInfo.value.handcontroller_id;
  674. //启用才执行命令
  675. if (deviceInfo.value.status) {
  676. stateHand(handcontroller_id);
  677. }
  678. }
  679. //获取手势状态
  680. if (e?.cmd == 'get_handcontroller_state' && e?.state == 0) {
  681. let handcontroller_id = deviceInfo.value.handcontroller_id;
  682. startHand(handcontroller_id);
  683. }
  684. //刷新
  685. if (e?.data?.result == 'refresh') {
  686. getExit();
  687. //刷新
  688. window.location.reload();
  689. }
  690. //没初始化完成不监听手势动作
  691. if (examState.value == 0) {
  692. return false;
  693. }
  694. //左滑动
  695. if (e?.data?.result == 'next_item') {
  696. // proxy?.$modal.msgSuccess('手势指令:左滑动');
  697. // if(examState.value == 43 && time.value.ready){
  698. // return false;
  699. // }
  700. // if (examState.value == 43 || examState.value == 42) {
  701. // speckCancel();//停止播报
  702. // getAllRetestFace();
  703. // }
  704. }
  705. //举左手
  706. if (e?.data?.result == 'left_hand') {
  707. //proxy?.$modal.msgSuccess('手势指令:举左手');
  708. //举左手确认退出
  709. // if (exitStatus.value) {
  710. // exitStatus.value = 0;
  711. // //确认退出
  712. // let keyEvent: any = null;
  713. // keyEvent = new KeyboardEvent('keydown', {
  714. // key: 'Enter', // 键值
  715. // code: 'Enter', // 键盘代码
  716. // keyCode: 13, // 旧的键盘代码
  717. // which: 13, // 新的键盘代码
  718. // shiftKey: false, // 是否按下Shift键
  719. // ctrlKey: false, // 是否按下Ctrl键
  720. // metaKey: false, // 是否按下Meta键(Win键或Command键)
  721. // bubbles: true, // 事件是否冒泡
  722. // cancelable: true // 是否可以取消事件的默认行为
  723. // });
  724. // document.activeElement?.dispatchEvent(keyEvent);
  725. // return false;
  726. // }
  727. //开始识别
  728. if (needStart.value && examState.value == 40) {
  729. getStartFace();
  730. return false;
  731. }
  732. //停止人脸识别
  733. if (needStart.value && examState.value == 41) {
  734. getStopFace();
  735. return false;
  736. }
  737. //开始测试
  738. if (examState.value == 43) {
  739. getReady();
  740. return false;
  741. }
  742. }
  743. //退出
  744. if (e?.data?.result == 'exit') {
  745. proxy?.$modal.msgSuccess('手势指令:交叉手');
  746. console.log("exitStatus.value", exitStatus.value)
  747. if (exitStatus.value == 0) {
  748. speckText("请保持两秒确认退出");
  749. //第一次才弹出
  750. confirmExit();
  751. setTimeout(() => {
  752. let keyEvent: any = null;
  753. let myKey = null;
  754. //如果交叉手两秒后返回超过4次就确认退出
  755. if (exitStatus.value >= 4) {
  756. myKey = 'Enter';
  757. } else {
  758. myKey = 'Esc';
  759. }
  760. if (myKey == 'Esc') {
  761. keyEvent = new KeyboardEvent('keydown', {
  762. key: 'Escape', // 键值
  763. code: 'Escape', // 键盘代码
  764. keyCode: 27, // 旧的键盘代码
  765. which: 27, // 新的键盘代码
  766. shiftKey: false, // 是否按下Shift键
  767. ctrlKey: false, // 是否按下Ctrl键
  768. metaKey: false, // 是否按下Meta键(Win键或Command键)
  769. bubbles: true, // 事件是否冒泡
  770. cancelable: true // 是否可以取消事件的默认行为
  771. });
  772. exitStatus.value = 0;
  773. }
  774. if (myKey == 'Enter') {
  775. keyEvent = new KeyboardEvent('keydown', {
  776. key: 'Enter', // 键值
  777. code: 'Enter', // 键盘代码
  778. keyCode: 13, // 旧的键盘代码
  779. which: 13, // 新的键盘代码
  780. shiftKey: false, // 是否按下Shift键
  781. ctrlKey: false, // 是否按下Ctrl键
  782. metaKey: false, // 是否按下Meta键(Win键或Command键)
  783. bubbles: true, // 事件是否冒泡
  784. cancelable: true // 是否可以取消事件的默认行为
  785. });
  786. }
  787. document.activeElement?.dispatchEvent(keyEvent);
  788. }, 2500)
  789. }
  790. exitStatus.value = exitStatus.value + 1
  791. }
  792. // if (e?.data?.result == "exit") {
  793. // console.log("exitStatus.value", exitStatus.value)
  794. // if (exitStatus.value == 0) {
  795. // exitStatus.value = 1
  796. // speckText("请5秒内举左手确认退出");
  797. // //第一次才弹出
  798. // confirmExit();
  799. // time.value.exit = 6;
  800. // timerManager.value.exitTimer = setInterval(() => {
  801. // time.value.exit--;
  802. // console.log("取消倒计时", time.value.exit)
  803. // proxy?.$modal.msgWarning(`取消倒计时:${time.value.exit}`)
  804. // if (time.value.exit == 0) {
  805. // exitStatus.value = 0;
  806. // getClearTimer("exitTimer");
  807. // let keyEvent: any = null;
  808. // keyEvent = new KeyboardEvent('keydown', {
  809. // key: 'Escape', // 键值
  810. // code: 'Escape', // 键盘代码
  811. // keyCode: 27, // 旧的键盘代码
  812. // which: 27, // 新的键盘代码
  813. // shiftKey: false, // 是否按下Shift键
  814. // ctrlKey: false, // 是否按下Ctrl键
  815. // metaKey: false, // 是否按下Meta键(Win键或Command键)
  816. // bubbles: true, // 事件是否冒泡
  817. // cancelable: true // 是否可以取消事件的默认行为
  818. // });
  819. // document.activeElement?.dispatchEvent(keyEvent);
  820. // }
  821. // }, 1000);
  822. // }
  823. // }
  824. });
  825. };
  826. /**
  827. * 播报时间
  828. */
  829. watch(
  830. () => time.value.countdownNum,
  831. (newData) => {
  832. if (examState.value != 42) {
  833. return false;
  834. }
  835. if (newData >= 30 && newData < time.value.testTime) {
  836. if (newData % 30 == 0) {
  837. speckText(`还有${newData}秒`);
  838. }
  839. }
  840. if (newData == 10) {
  841. speckText('还有10秒');
  842. }
  843. if (newData <= 5) {
  844. speckText(newData);
  845. }
  846. if (newData == 0) {
  847. speckText('哨声');
  848. }
  849. },
  850. { immediate: true }
  851. );
  852. /**
  853. * 将测试列表转为多行
  854. */
  855. const testListArr = computed(() => {
  856. let list: any = [];
  857. let num = 0;
  858. if (styleType.value == 1) {
  859. num = 3;
  860. }
  861. if (styleType.value == 2) {
  862. num = 5;
  863. }
  864. if (styleType.value == 3) {
  865. num = 10;
  866. }
  867. if (styleType.value == 4) {
  868. num = 4;
  869. }
  870. let myLength = Math.ceil(testList.value.length / num);
  871. for (let i = 0; i < myLength; i++) {
  872. list[i] = [];
  873. for (let j = 0; j < testList.value.length; j++) {
  874. if (j >= i * num && j < (i + 1) * num) {
  875. list[i].push(testList.value[j]);
  876. }
  877. }
  878. }
  879. // console.log('list', list);
  880. return list;
  881. });
  882. /**
  883. * 时间转换
  884. */
  885. // const countdownNumFormat = computed(() => {
  886. // return time.value.countdownNum;
  887. // //return proxy?.$utils.timeFormat(time.value.countdownNum);
  888. // });
  889. onBeforeMount(() => {
  890. parameter.value = route.query;
  891. let project = parameter.value.project;
  892. let area = parameter.value.area;
  893. parameter.value.examId = `${project}_${area}`; //项目+区
  894. if (parameter.value.time) {
  895. time.value.testTime = parameter.value.time;
  896. }
  897. time.value.countdownNum = time.value.testTime;
  898. let myInfo: any = localStorage.getItem('userInfo');
  899. userInfo.value = JSON.parse(myInfo);
  900. if (parameter.value.gesture == 'true') {
  901. parameter.value.gesture = true;
  902. } else {
  903. parameter.value.gesture = false;
  904. }
  905. let list = parameter.value.area.split(',');
  906. testList.value = list.map((item: any, index: number) => {
  907. let obj = {
  908. area: item,
  909. itemNumber: index + 1
  910. };
  911. return obj;
  912. });
  913. //展示样式控制
  914. if (testList.value.length == 5) {
  915. styleType.value = 1;
  916. //填补空缺
  917. getAddTestList(5);
  918. }
  919. if (testList.value.length > 5 && testList.value.length <= 10) {
  920. styleType.value = 2;
  921. //填补空缺
  922. getAddTestList(10);
  923. }
  924. if (testList.value.length > 10) {
  925. styleType.value = 3;
  926. }
  927. if (testList.value.length < 5) {
  928. styleType.value = 4;
  929. }
  930. //需要开始按钮的项目
  931. let myList = ['situp', 'jumprope', 'jumpingjack', 'highknees', 'pullup', 'sidepullup', 'squat', 'jumpleftright', 'crossjump', 'kneeupclap'];
  932. if (myList.includes(project) && [2, 3].includes(styleType.value)) {
  933. needStart.value = true;
  934. }
  935. //加载音乐
  936. getMusic();
  937. });
  938. onMounted(() => {
  939. //加载WS
  940. let project = parameter.value.project;
  941. initWs({ parameter: parameter.value, testTime: time.value.testTime, version: 'v2' }, (data: any) => {
  942. //获取sid
  943. if (data.cmd === 'mySid') {
  944. console.log('data.data.sid', data.data.sid);
  945. sid.value = data.data.sid;
  946. }
  947. let index = testList.value.findIndex((item: any) => {
  948. let examId = `${project}_${item.area}`;
  949. return examId == data.exam_id;
  950. });
  951. multipleItemRefList.value[index]?.getMessage(data);
  952. });
  953. //初始化语音
  954. initSpeech();
  955. //初始化手势
  956. initHand();
  957. //刷新关闭
  958. window.onbeforeunload = function (e) {
  959. var confirmationMessage = '刷新/关闭页面将会关闭页面,是否确认退出页面?';
  960. (e || window.event).returnValue = confirmationMessage; // 兼容 Gecko + IE
  961. testList.value.forEach((item: any) => {
  962. let examId = item.exam_id;
  963. let bUrl = import.meta.env.VITE_APP_BASE_API;
  964. let classId = parameter.value.classes;
  965. let mySid = sid.value;
  966. let token: any = localStorage.getItem('token');
  967. let formData = new FormData();
  968. formData.append('exam_id', examId);
  969. formData.append('class_id', classId);
  970. formData.append('token', token);
  971. formData.append('sid', mySid);
  972. navigator.sendBeacon(bUrl + '/exam/close_exam', formData);
  973. });
  974. return confirmationMessage; // 兼容 Gecko + Webkit, Safari, Chrome
  975. };
  976. });
  977. onBeforeUnmount(() => {
  978. getExit();
  979. });
  980. </script>
  981. <style scoped lang="scss">
  982. $waiPadding: 6.51rem;
  983. .time {
  984. width: 20vh;
  985. height: 20vh;
  986. line-height: 20vh;
  987. border-radius: 50%;
  988. color: #ff9402;
  989. font-size: 8vh;
  990. text-align: center;
  991. background-image: url('@/assets/images/test/time.png');
  992. background-position: center;
  993. background-repeat: no-repeat;
  994. background-size: 100% 100%;
  995. position: absolute;
  996. right: 50%;
  997. top: -4vh;
  998. margin-right: -10vh;
  999. font-family: 'Saira-BlackItalic';
  1000. }
  1001. .time1,
  1002. .time4 {
  1003. width: 26vh;
  1004. height: 26vh;
  1005. line-height: 26vh;
  1006. font-size: 10.3vh;
  1007. right: auto;
  1008. left: 50%;
  1009. top: 0vh;
  1010. margin-left: 8vw;
  1011. margin-right: auto;
  1012. }
  1013. .main {
  1014. width: calc(100% - ($waiPadding * 2));
  1015. height: 78vh;
  1016. padding-top: 10rem;
  1017. margin: 0 auto;
  1018. display: flex;
  1019. overflow: hidden;
  1020. flex-direction: column;
  1021. }
  1022. .mask {
  1023. position: fixed;
  1024. height: 100vh;
  1025. width: 100vw;
  1026. top: 0;
  1027. left: 0;
  1028. background: rgba(0, 0, 0, 0.3);
  1029. z-index: 998;
  1030. }
  1031. .mask2 {
  1032. background: rgba(0, 0, 0, 0.68);
  1033. }
  1034. .confirmDiaBg {
  1035. width: 100%;
  1036. height: 100vh;
  1037. position: fixed;
  1038. left: 0;
  1039. top: 0;
  1040. display: flex;
  1041. align-items: center;
  1042. justify-content: center;
  1043. z-index: 999;
  1044. .confirmDiaWindow {
  1045. width: 40%;
  1046. height: 43.4%;
  1047. border-radius: 1.6rem;
  1048. opacity: 1;
  1049. box-sizing: border-box;
  1050. border: 0.55rem solid #13ed84;
  1051. text-align: center;
  1052. display: flex;
  1053. align-items: center;
  1054. justify-content: center;
  1055. position: fixed;
  1056. background: radial-gradient(96% 96% at 2% 32%, #ffffff 0%, #fcfdfd 54%, #e1e4e7 100%);
  1057. .readyBox {
  1058. text-align: center;
  1059. color: #1a293a;
  1060. .lable {
  1061. font-size: 4.3rem;
  1062. line-height: 1;
  1063. margin-bottom: 1.5rem;
  1064. }
  1065. .value {
  1066. font-size: 10rem;
  1067. line-height: 1;
  1068. font-family: 'Saira-BlackItalic';
  1069. }
  1070. .transparent {
  1071. opacity: 0;
  1072. }
  1073. .lable2 {
  1074. font-size: 4.5rem;
  1075. }
  1076. }
  1077. }
  1078. }
  1079. .footerBtn {
  1080. width: 100%;
  1081. padding: 0 calc(13.02rem / 2);
  1082. box-sizing: border-box;
  1083. position: fixed;
  1084. bottom: 3vh;
  1085. display: flex;
  1086. justify-content: flex-end;
  1087. .btn {
  1088. width: 13vw;
  1089. height: 6.1vh;
  1090. line-height: 6.1vh;
  1091. font-size: 3vh;
  1092. color: #1a293a;
  1093. text-align: center;
  1094. border-radius: 1vh;
  1095. cursor: pointer;
  1096. margin-left: 10px;
  1097. background: radial-gradient(159% 126% at 5% 93%, #8effa9 0%, #07ffe7 100%);
  1098. box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.1874), inset 0px 1px 0px 1px rgba(255, 255, 255, 0.3);
  1099. &:hover {
  1100. background: #8effa9;
  1101. }
  1102. }
  1103. .startBtn {
  1104. color: #ffffff;
  1105. background: radial-gradient(159% 126% at 5% 93%, #f99f02 0%, #ed7905 100%);
  1106. box-shadow: 3px 6px 4px 1px rgba(0, 0, 0, 0.1874), inset 0px 1px 0px 2px rgba(255, 255, 255, 0.3);
  1107. &:hover {
  1108. background: #f99f02;
  1109. }
  1110. }
  1111. .exitBtn {
  1112. color: #ffffff;
  1113. background: radial-gradient(159% 126% at 5% 93%, #931b1b 0%, #ec5624 0%, #ff6860 76%);
  1114. box-shadow: 3px 6px 4px 1px rgba(0, 0, 0, 0.1874), inset 0px 1px 0px 2px rgba(255, 255, 255, 0.5577);
  1115. &:hover {
  1116. background: #ec5624;
  1117. }
  1118. }
  1119. .testRecordBtn {
  1120. position: relative;
  1121. z-index: 999;
  1122. }
  1123. }
  1124. .main-right {
  1125. width: 22.7%;
  1126. height: 80vh;
  1127. border-radius: 1.6rem;
  1128. // background: linear-gradient(29deg, #092941 -82%, #2A484B 94%);
  1129. background-color: rgba(9, 41, 65, 0.8);
  1130. box-shadow: inset 0px 1px 0px 2px rgba(255, 255, 255, 0.4);
  1131. display: flex;
  1132. flex-direction: column;
  1133. overflow: hidden;
  1134. position: absolute;
  1135. z-index: 999;
  1136. bottom: 6.5vh;
  1137. right: calc(13.02rem / 2);
  1138. }
  1139. //列表样式写在此父组件里,子组件尽量减少个性化class和style,多样性以父组件控制类型
  1140. ::v-deep(.testBox1) {
  1141. $listMargin: 10vw;
  1142. $listWidth: calc((100vw - ($waiPadding * 2) - $listMargin) / 5);
  1143. display: flex;
  1144. flex-wrap: wrap;
  1145. align-items: center;
  1146. .ul {
  1147. width: 100%;
  1148. height: 36vh;
  1149. display: flex;
  1150. .li {
  1151. width: $listWidth;
  1152. position: relative;
  1153. .ready {
  1154. position: absolute;
  1155. height: 100%;
  1156. width: 100%;
  1157. display: flex;
  1158. align-items: center;
  1159. justify-items: center;
  1160. img {
  1161. width: 100%;
  1162. }
  1163. }
  1164. .userInfo {
  1165. width: 100%;
  1166. height: 100%;
  1167. border-radius: 1.6rem;
  1168. background: radial-gradient(122% 126% at 97% 6%, #35ffc6 0%, #00ffe8 100%);
  1169. text-align: center;
  1170. display: flex;
  1171. align-items: center;
  1172. justify-content: center;
  1173. cursor: pointer;
  1174. margin-bottom: 3px;
  1175. .userInfo-center {
  1176. .pic {
  1177. width: calc(36vh * 0.62);
  1178. height: calc(36vh * 0.62);
  1179. border-radius: 50%;
  1180. display: flex;
  1181. justify-content: center;
  1182. align-items: center;
  1183. overflow: hidden;
  1184. margin: 0 auto 2vh auto;
  1185. position: relative;
  1186. .area {
  1187. position: absolute;
  1188. top: calc(36vh * 0.18);
  1189. color: #203c52;
  1190. font-size: 5vh;
  1191. line-height: 1;
  1192. font-family: 'Saira-ExtraBold';
  1193. text-align: center;
  1194. }
  1195. img {
  1196. width: 100%;
  1197. }
  1198. }
  1199. .pic2 {
  1200. box-sizing: border-box;
  1201. border: 0.44rem solid rgba(26, 41, 58, 0.6315);
  1202. }
  1203. .name {
  1204. width: 100%;
  1205. color: #1a293a;
  1206. font-size: 2.21rem;
  1207. }
  1208. .name2 {
  1209. box-sizing: border-box;
  1210. padding: 0.1rem 0.4rem;
  1211. border-radius: 1.1rem;
  1212. background: radial-gradient(96% 96% at 2% 32%, #ffffff 0%, #fcfdfd 54%, #e1e4e7 100%);
  1213. box-shadow: inset 0px 1px 0px 2px rgba(255, 255, 255, 0.9046), inset 0px 3px 6px 0px rgba(0, 0, 0, 0.0851);
  1214. }
  1215. .ctrlBox {
  1216. position: absolute;
  1217. left: 0;
  1218. top: 0;
  1219. border: 5px solid #ffffff;
  1220. display: flex;
  1221. flex-direction: column;
  1222. align-items: center;
  1223. background: rgba(0, 0, 0, 0.8);
  1224. z-index: 2;
  1225. width: 100%;
  1226. height: 100%;
  1227. box-sizing: border-box;
  1228. border-radius: 1.6rem;
  1229. img {
  1230. max-width: 100%;
  1231. max-height: 70%;
  1232. margin: 10% 0 5% 0;
  1233. }
  1234. .lable {
  1235. text-align: center;
  1236. font-size: 2rem;
  1237. color: #ffffff;
  1238. }
  1239. }
  1240. }
  1241. }
  1242. .score {
  1243. height: 18vh;
  1244. line-height: 18vh;
  1245. font-size: 12vh;
  1246. font-family: 'Saira-BlackItalic';
  1247. border: 0.55rem solid #13ed84;
  1248. text-align: center;
  1249. border-radius: 1.6rem;
  1250. box-sizing: content-box;
  1251. color: #1a293a;
  1252. position: relative;
  1253. background: radial-gradient(96% 96% at 2% 32%, #ffffff 0%, #fcfdfd 54%, #e1e4e7 100%);
  1254. display: none;
  1255. &::before {
  1256. content: '';
  1257. width: 2vw;
  1258. height: 2vw;
  1259. display: block;
  1260. position: absolute;
  1261. top: -1.5vw;
  1262. left: 50%;
  1263. margin-left: -1vw;
  1264. background-image: url('@/assets/images/test/yuan.png');
  1265. background-position: center;
  1266. background-repeat: no-repeat;
  1267. background-size: 100% 100%;
  1268. border-radius: 50%;
  1269. flex-shrink: 0;
  1270. transition: all 0.5s;
  1271. }
  1272. }
  1273. }
  1274. .disable {
  1275. .userInfo,
  1276. .score {
  1277. opacity: 0.5;
  1278. }
  1279. }
  1280. .wait {
  1281. .userInfo,
  1282. .score {
  1283. opacity: 0.5;
  1284. }
  1285. }
  1286. &:nth-child(1) {
  1287. justify-content: space-between;
  1288. }
  1289. &:nth-child(2) {
  1290. justify-content: space-evenly;
  1291. .li {
  1292. margin-left: calc($listMargin/4);
  1293. margin-right: calc($listMargin/4);
  1294. }
  1295. }
  1296. }
  1297. .ready.ul {
  1298. &:nth-child(1) {
  1299. .li:nth-child(2) {
  1300. &::after {
  1301. content: '';
  1302. position: absolute;
  1303. height: 100%;
  1304. width: 100%;
  1305. display: block;
  1306. background-image: url('@/assets/images/test/ready3.png');
  1307. background-position: center center;
  1308. background-repeat: no-repeat;
  1309. background-size: 100%;
  1310. }
  1311. }
  1312. }
  1313. &:nth-child(2) {
  1314. .li {
  1315. &::after {
  1316. content: '';
  1317. position: absolute;
  1318. height: 100%;
  1319. width: 100%;
  1320. display: block;
  1321. background-image: url('@/assets/images/test/ready3.png');
  1322. background-position: center center;
  1323. background-repeat: no-repeat;
  1324. background-size: 100%;
  1325. top: -100%;
  1326. }
  1327. }
  1328. }
  1329. }
  1330. .hands.ul {
  1331. &:nth-child(1) {
  1332. .li:nth-child(2) {
  1333. &::after {
  1334. background-image: url('@/assets/images/test/ready4.png');
  1335. }
  1336. }
  1337. }
  1338. &:nth-child(2) {
  1339. .li {
  1340. &::after {
  1341. background-image: url('@/assets/images/test/ready4.png');
  1342. }
  1343. }
  1344. }
  1345. }
  1346. .overlap.ul {
  1347. transition: all 0.5s;
  1348. .li {
  1349. .score {
  1350. display: block;
  1351. }
  1352. }
  1353. &:nth-child(1) {
  1354. margin-top: 5vh;
  1355. .li {
  1356. &::before {
  1357. display: none;
  1358. }
  1359. &::after {
  1360. display: none;
  1361. }
  1362. }
  1363. }
  1364. &:nth-child(2) {
  1365. margin-top: -20vh;
  1366. .li {
  1367. &::before {
  1368. display: none;
  1369. }
  1370. &::after {
  1371. display: none;
  1372. }
  1373. }
  1374. }
  1375. }
  1376. }
  1377. ::v-deep(.testBox2) {
  1378. $listMargin: 10vw;
  1379. $listWidth: calc((100% - $listMargin) / 5);
  1380. .ul {
  1381. width: 100%;
  1382. height: 34vh;
  1383. display: flex;
  1384. justify-content: space-between;
  1385. margin-bottom: 4vh;
  1386. .li {
  1387. width: $listWidth;
  1388. position: relative;
  1389. height: 100%;
  1390. border-radius: 3vh;
  1391. padding: 0.6vw;
  1392. background: radial-gradient(122% 126% at 97% 6%, #35ffc6 0%, #00ffe8 100%);
  1393. display: flex;
  1394. flex-direction: column;
  1395. justify-content: space-between;
  1396. box-sizing: border-box;
  1397. .userInfo {
  1398. width: 100%;
  1399. height: 100%;
  1400. border-radius: 1.6rem;
  1401. background: radial-gradient(122% 126% at 97% 6%, #35ffc6 0%, #00ffe8 100%);
  1402. text-align: center;
  1403. display: flex;
  1404. align-items: center;
  1405. justify-content: center;
  1406. cursor: pointer;
  1407. position: relative;
  1408. .userInfo-center {
  1409. .pic {
  1410. width: calc(36vh * 0.62);
  1411. height: calc(36vh * 0.62);
  1412. border-radius: 50%;
  1413. display: flex;
  1414. justify-content: center;
  1415. align-items: center;
  1416. overflow: hidden;
  1417. margin: 0 auto 2vh auto;
  1418. position: relative;
  1419. .area {
  1420. position: absolute;
  1421. top: calc(36vh * 0.18);
  1422. color: #203c52;
  1423. font-size: 5vh;
  1424. line-height: 1;
  1425. font-family: 'Saira-ExtraBold';
  1426. text-align: center;
  1427. }
  1428. img {
  1429. width: 100%;
  1430. }
  1431. }
  1432. .pic2 {
  1433. box-sizing: border-box;
  1434. border: 0.44rem solid rgba(26, 41, 58, 0.6315);
  1435. }
  1436. .name {
  1437. width: 100%;
  1438. color: #1a293a;
  1439. font-size: 2.21rem;
  1440. }
  1441. .ctrlBox {
  1442. position: absolute;
  1443. left: 0;
  1444. top: 0;
  1445. border: 5px solid #ffffff;
  1446. display: flex;
  1447. flex-direction: column;
  1448. align-items: center;
  1449. background: rgba(0, 0, 0, 0.8);
  1450. z-index: 2;
  1451. width: 100%;
  1452. height: 100%;
  1453. box-sizing: border-box;
  1454. border-radius: 1.6rem;
  1455. img {
  1456. max-width: 100%;
  1457. max-height: 70%;
  1458. margin: 10% 0 5% 0;
  1459. }
  1460. .lable {
  1461. text-align: center;
  1462. font-size: 2rem;
  1463. color: #ffffff;
  1464. }
  1465. }
  1466. }
  1467. }
  1468. .score {
  1469. height: 14vh;
  1470. line-height: 14vh;
  1471. font-size: 9vh;
  1472. font-family: 'Saira-BlackItalic';
  1473. background: #ffffff;
  1474. box-sizing: border-box;
  1475. border: 0.55rem solid #13ed84;
  1476. text-align: center;
  1477. border-radius: 1.6rem;
  1478. box-sizing: content-box;
  1479. color: #1a293a;
  1480. position: relative;
  1481. display: none;
  1482. &::before {
  1483. content: '';
  1484. width: 2vw;
  1485. height: 2vw;
  1486. display: block;
  1487. position: absolute;
  1488. top: -1.3vw;
  1489. left: 50%;
  1490. margin-left: -1vw;
  1491. background-image: url('@/assets/images/test/yuan.png');
  1492. background-position: center;
  1493. background-repeat: no-repeat;
  1494. background-size: 100% 100%;
  1495. border-radius: 50%;
  1496. flex-shrink: 0;
  1497. transition: all 0.5s;
  1498. }
  1499. }
  1500. }
  1501. .disable {
  1502. opacity: 0.5;
  1503. }
  1504. .wait {
  1505. opacity: 0.5;
  1506. }
  1507. }
  1508. .overlap {
  1509. .li {
  1510. .userInfo {
  1511. height: 6.2vw;
  1512. .userInfo-center {
  1513. width: 100%;
  1514. text-align: center;
  1515. display: flex;
  1516. align-items: center;
  1517. cursor: pointer;
  1518. .pic {
  1519. width: 6.2vw;
  1520. height: 6.2vw;
  1521. border-radius: 50%;
  1522. display: flex;
  1523. justify-content: center;
  1524. align-items: center;
  1525. overflow: hidden;
  1526. position: relative;
  1527. flex-shrink: 0;
  1528. margin: 0;
  1529. .area {
  1530. position: absolute;
  1531. top: 0;
  1532. left: 0;
  1533. width: 100%;
  1534. height: 100%;
  1535. line-height: 6.2vw;
  1536. color: #ffffff;
  1537. font-size: 2.5vw;
  1538. font-family: 'Saira-ExtraBold';
  1539. text-align: center;
  1540. background: rgba(#000000, 0.4);
  1541. }
  1542. img {
  1543. width: 100%;
  1544. }
  1545. }
  1546. .pic2 {
  1547. box-sizing: border-box;
  1548. border: 2px solid rgba(26, 41, 58, 0.6315);
  1549. }
  1550. .name {
  1551. width: 100%;
  1552. color: #1a293a;
  1553. font-size: 1.8rem;
  1554. border-radius: 2vw;
  1555. padding: 0.5rem 0;
  1556. background: radial-gradient(96% 96% at 2% 32%, #ffffff 0%, #fcfdfd 54%, #e1e4e7 100%);
  1557. box-shadow: inset 0px 1px 0px 2px rgba(255, 255, 255, 0.9046), inset 0px 3px 6px 0px rgba(0, 0, 0, 0.0851);
  1558. }
  1559. }
  1560. }
  1561. .score {
  1562. display: block;
  1563. }
  1564. }
  1565. }
  1566. }
  1567. ::v-deep(.testBox3) {
  1568. $listMargin: 5vw;
  1569. $listWidth: calc((100% - $listMargin) / 10);
  1570. .ul {
  1571. width: 100%;
  1572. height: 14vh;
  1573. display: flex;
  1574. justify-content: space-around;
  1575. margin-bottom: calc($listMargin / 10);
  1576. .li {
  1577. width: $listWidth;
  1578. position: relative;
  1579. height: 100%;
  1580. border-radius: 5vh;
  1581. background: radial-gradient(122% 126% at 97% 6%, #35ffc6 0%, #00ffe8 100%);
  1582. .userInfo {
  1583. padding: 2vh 0.6vw 0 0.6vw;
  1584. margin-bottom: 0.8vh;
  1585. .userInfo-center {
  1586. text-align: center;
  1587. display: flex;
  1588. align-items: center;
  1589. cursor: pointer;
  1590. border-radius: 1.3vw;
  1591. height: 2.6vw;
  1592. background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.6571) 100%);
  1593. border: 1px solid #ffffff;
  1594. .pic {
  1595. width: 2.6vw;
  1596. height: 2.6vw;
  1597. border-radius: 50%;
  1598. display: flex;
  1599. justify-content: center;
  1600. align-items: center;
  1601. overflow: hidden;
  1602. position: relative;
  1603. flex-shrink: 0;
  1604. .area {
  1605. position: absolute;
  1606. top: 0;
  1607. left: 0;
  1608. width: 100%;
  1609. height: 100%;
  1610. line-height: 2.6vw;
  1611. color: #ffffff;
  1612. font-size: 1.4vw;
  1613. font-family: 'Saira-ExtraBold';
  1614. text-align: center;
  1615. background: rgba(#000000, 0.4);
  1616. }
  1617. img {
  1618. width: 100%;
  1619. }
  1620. }
  1621. .pic2 {
  1622. box-sizing: border-box;
  1623. border: 2px solid rgba(26, 41, 58, 0.6315);
  1624. }
  1625. .name {
  1626. color: #1a293a;
  1627. font-size: 1rem;
  1628. margin-left: 0.5vw;
  1629. }
  1630. .ctrlBox {
  1631. position: absolute;
  1632. left: 0;
  1633. top: 0;
  1634. border: 5px solid #ffffff;
  1635. display: flex;
  1636. flex-direction: column;
  1637. align-items: center;
  1638. background: rgba(0, 0, 0, 0.8);
  1639. z-index: 2;
  1640. width: 100%;
  1641. height: 100%;
  1642. box-sizing: border-box;
  1643. border-radius: 5vh;
  1644. img {
  1645. max-width: 100%;
  1646. max-height: 60%;
  1647. margin: 5% 0 5% 0;
  1648. }
  1649. .lable {
  1650. text-align: center;
  1651. font-size: 1rem;
  1652. color: #ffffff;
  1653. }
  1654. }
  1655. }
  1656. }
  1657. .score {
  1658. font-size: 3rem;
  1659. font-family: 'Saira-BlackItalic';
  1660. text-align: center;
  1661. color: #1a293a;
  1662. line-height: 1;
  1663. }
  1664. }
  1665. .disable {
  1666. opacity: 0.5;
  1667. }
  1668. .wait {
  1669. opacity: 0.75;
  1670. }
  1671. .startedAlready {
  1672. background: #15ef96;
  1673. }
  1674. }
  1675. }
  1676. ::v-deep(.testBox4) {
  1677. $listMargin: 10vw;
  1678. $listWidth: calc((100vw - ($waiPadding * 2) - $listMargin) / 5);
  1679. display: flex;
  1680. flex-wrap: wrap;
  1681. align-items: center;
  1682. height: 100%;
  1683. .ul {
  1684. width: 100%;
  1685. display: flex;
  1686. justify-content: space-evenly;
  1687. align-items: center;
  1688. height: 36vh;
  1689. .li {
  1690. width: $listWidth;
  1691. height: 100%;
  1692. position: relative;
  1693. .ready {
  1694. position: absolute;
  1695. height: 100%;
  1696. width: 100%;
  1697. display: flex;
  1698. align-items: center;
  1699. justify-items: center;
  1700. img {
  1701. width: 100%;
  1702. }
  1703. }
  1704. .userInfo {
  1705. width: 100%;
  1706. height: 100%;
  1707. border-radius: 1.6rem;
  1708. background: radial-gradient(122% 126% at 97% 6%, #35ffc6 0%, #00ffe8 100%);
  1709. text-align: center;
  1710. display: flex;
  1711. align-items: center;
  1712. justify-content: center;
  1713. cursor: pointer;
  1714. margin-bottom: 3px;
  1715. .userInfo-center {
  1716. .pic {
  1717. width: calc(36vh * 0.62);
  1718. height: calc(36vh * 0.62);
  1719. border-radius: 50%;
  1720. display: flex;
  1721. justify-content: center;
  1722. align-items: center;
  1723. overflow: hidden;
  1724. margin: 0 auto 2vh auto;
  1725. position: relative;
  1726. .area {
  1727. position: absolute;
  1728. top: calc(36vh * 0.18);
  1729. color: #203c52;
  1730. font-size: 5vh;
  1731. line-height: 1;
  1732. font-family: 'Saira-ExtraBold';
  1733. text-align: center;
  1734. }
  1735. img {
  1736. width: 100%;
  1737. }
  1738. }
  1739. .pic2 {
  1740. box-sizing: border-box;
  1741. border: 0.44rem solid rgba(26, 41, 58, 0.6315);
  1742. }
  1743. .name {
  1744. width: 100%;
  1745. color: #1a293a;
  1746. font-size: 2.21rem;
  1747. }
  1748. .name2 {
  1749. box-sizing: border-box;
  1750. padding: 0.1rem 0.4rem;
  1751. border-radius: 1.1rem;
  1752. background: radial-gradient(96% 96% at 2% 32%, #ffffff 0%, #fcfdfd 54%, #e1e4e7 100%);
  1753. box-shadow: inset 0px 1px 0px 2px rgba(255, 255, 255, 0.9046), inset 0px 3px 6px 0px rgba(0, 0, 0, 0.0851);
  1754. }
  1755. .ctrlBox {
  1756. position: absolute;
  1757. left: 0;
  1758. top: 0;
  1759. border: 5px solid #ffffff;
  1760. display: flex;
  1761. flex-direction: column;
  1762. align-items: center;
  1763. background: rgba(0, 0, 0, 0.8);
  1764. z-index: 2;
  1765. width: 100%;
  1766. height: 100%;
  1767. box-sizing: border-box;
  1768. border-radius: 1.6rem;
  1769. img {
  1770. max-width: 100%;
  1771. max-height: 70%;
  1772. margin: 10% 0 5% 0;
  1773. }
  1774. .lable {
  1775. text-align: center;
  1776. font-size: 2rem;
  1777. color: #ffffff;
  1778. }
  1779. }
  1780. }
  1781. }
  1782. .score {
  1783. height: 18vh;
  1784. line-height: 18vh;
  1785. font-size: 12vh;
  1786. font-family: 'Saira-BlackItalic';
  1787. border: 0.55rem solid #13ed84;
  1788. text-align: center;
  1789. border-radius: 1.6rem;
  1790. box-sizing: content-box;
  1791. color: #1a293a;
  1792. position: relative;
  1793. background: radial-gradient(96% 96% at 2% 32%, #ffffff 0%, #fcfdfd 54%, #e1e4e7 100%);
  1794. display: none;
  1795. &::before {
  1796. content: '';
  1797. width: 2vw;
  1798. height: 2vw;
  1799. display: block;
  1800. position: absolute;
  1801. top: -1.5vw;
  1802. left: 50%;
  1803. margin-left: -1vw;
  1804. background-image: url('@/assets/images/test/yuan.png');
  1805. background-position: center;
  1806. background-repeat: no-repeat;
  1807. background-size: 100% 100%;
  1808. border-radius: 50%;
  1809. flex-shrink: 0;
  1810. transition: all 0.5s;
  1811. }
  1812. }
  1813. }
  1814. .disable {
  1815. .userInfo,
  1816. .score {
  1817. opacity: 0.5;
  1818. }
  1819. }
  1820. .wait {
  1821. .userInfo,
  1822. .score {
  1823. opacity: 0.5;
  1824. }
  1825. }
  1826. }
  1827. .overlap.ul {
  1828. transition: all 0.5s;
  1829. margin-top: -15vh;
  1830. .li {
  1831. .score {
  1832. display: block;
  1833. }
  1834. }
  1835. }
  1836. }
  1837. </style>