car.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508
  1. <template>
  2. <div>
  3. <div class="tip">
  4. <img src="../assets/img/shop/tips.png" alt="" />
  5. </div>
  6. <div class="img">
  7. <div
  8. v-show="f3 != 1"
  9. id="screan"
  10. v-drag="{
  11. go,
  12. setPan,
  13. getPan,
  14. setTou,
  15. getTou,
  16. setAi,
  17. getAi,
  18. setScrean,
  19. getScrean,
  20. setlightWhite,
  21. getlightWhite,
  22. setlightBlue,
  23. getlightBlue,
  24. setf1White,
  25. getf1White,
  26. setF4,
  27. getF4,
  28. setF2,
  29. getF2,
  30. setLight,
  31. getLight,
  32. setwheelWhite,
  33. getwheelWhite,
  34. setwheelBlack,
  35. getwheelBlack,
  36. setF3,
  37. getF3,
  38. }"
  39. >
  40. <img src="../assets/img/light/screan.png" alt="" />
  41. </div>
  42. <div
  43. v-show="f3 != 1"
  44. id="tou"
  45. v-drag="{
  46. go,
  47. setPan,
  48. getPan,
  49. setTou,
  50. getTou,
  51. setAi,
  52. getAi,
  53. setScrean,
  54. getScrean,
  55. setlightWhite,
  56. getlightWhite,
  57. setlightBlue,
  58. getlightBlue,
  59. setf1White,
  60. getf1White,
  61. setF4,
  62. getF4,
  63. setF2,
  64. getF2,
  65. setLight,
  66. getLight,
  67. setwheelWhite,
  68. getwheelWhite,
  69. setwheelBlack,
  70. getwheelBlack,
  71. setF3,
  72. getF3,
  73. }"
  74. >
  75. <img src="../assets/img/tou1.png" alt="" />
  76. </div>
  77. <div
  78. v-show="f3 != 1"
  79. id="ai"
  80. v-drag="{
  81. go,
  82. setPan,
  83. getPan,
  84. setTou,
  85. getTou,
  86. setAi,
  87. getAi,
  88. setScrean,
  89. getScrean,
  90. setlightWhite,
  91. getlightWhite,
  92. setlightBlue,
  93. getlightBlue,
  94. setf1White,
  95. getf1White,
  96. setF4,
  97. getF4,
  98. setF2,
  99. getF2,
  100. setLight,
  101. getLight,
  102. setwheelWhite,
  103. getwheelWhite,
  104. setwheelBlack,
  105. getwheelBlack,
  106. setF3,
  107. getF3,
  108. }"
  109. >
  110. <img src="../assets/img/ai.png" alt="" />
  111. </div>
  112. <div
  113. id="lightBlue"
  114. v-drag="{
  115. go,
  116. setPan,
  117. getPan,
  118. setTou,
  119. getTou,
  120. setAi,
  121. getAi,
  122. setScrean,
  123. getScrean,
  124. setlightWhite,
  125. getlightWhite,
  126. setlightBlue,
  127. getlightBlue,
  128. setf1White,
  129. getf1White,
  130. setF4,
  131. getF4,
  132. setF2,
  133. getF2,
  134. setLight,
  135. getLight,
  136. setwheelWhite,
  137. getwheelWhite,
  138. setwheelBlack,
  139. getwheelBlack,
  140. setF3,
  141. getF3,
  142. }"
  143. >
  144. <img src="../assets/img/car/lightBlue.png" alt="" />
  145. </div>
  146. <div
  147. id="lightWhite"
  148. v-drag="{
  149. go,
  150. setPan,
  151. getPan,
  152. setTou,
  153. getTou,
  154. setAi,
  155. getAi,
  156. setScrean,
  157. getScrean,
  158. setlightWhite,
  159. getlightWhite,
  160. setlightBlue,
  161. getlightBlue,
  162. setf1White,
  163. getf1White,
  164. setF4,
  165. getF4,
  166. setF2,
  167. getF2,
  168. setLight,
  169. getLight,
  170. setwheelWhite,
  171. getwheelWhite,
  172. setwheelBlack,
  173. getwheelBlack,
  174. setF3,
  175. getF3,
  176. }"
  177. >
  178. <img src="../assets/img/car/lightWhite.png" alt="" />
  179. </div>
  180. <div
  181. v-show="f3 != 1"
  182. id="F3"
  183. v-drag="{
  184. go,
  185. setPan,
  186. getPan,
  187. setTou,
  188. getTou,
  189. setAi,
  190. getAi,
  191. setScrean,
  192. getScrean,
  193. setlightWhite,
  194. getlightWhite,
  195. setlightBlue,
  196. getlightBlue,
  197. setf1White,
  198. getf1White,
  199. setF4,
  200. getF4,
  201. setF2,
  202. getF2,
  203. setLight,
  204. getLight,
  205. setwheelWhite,
  206. getwheelWhite,
  207. setwheelBlack,
  208. getwheelBlack,
  209. setF3,
  210. getF3,
  211. }"
  212. >
  213. <img src="../assets/img/car/f3.png" alt="" />
  214. </div>
  215. <div
  216. id="F4"
  217. v-drag="{
  218. go,
  219. setPan,
  220. getPan,
  221. setTou,
  222. getTou,
  223. setAi,
  224. getAi,
  225. setScrean,
  226. getScrean,
  227. setlightWhite,
  228. getlightWhite,
  229. setlightBlue,
  230. getlightBlue,
  231. setf1White,
  232. getf1White,
  233. setF4,
  234. getF4,
  235. setF2,
  236. getF2,
  237. setLight,
  238. getLight,
  239. setwheelWhite,
  240. getwheelWhite,
  241. setwheelBlack,
  242. getwheelBlack,
  243. setF3,
  244. getF3,
  245. }"
  246. >
  247. <img src="../assets/img/car/f4.png" alt="" />
  248. </div>
  249. <div
  250. id="F2"
  251. v-drag="{
  252. go,
  253. setPan,
  254. getPan,
  255. setTou,
  256. getTou,
  257. setAi,
  258. getAi,
  259. setScrean,
  260. getScrean,
  261. setlightWhite,
  262. getlightWhite,
  263. setlightBlue,
  264. getlightBlue,
  265. setf1White,
  266. getf1White,
  267. setF4,
  268. getF4,
  269. setF2,
  270. getF2,
  271. setLight,
  272. getLight,
  273. setwheelWhite,
  274. getwheelWhite,
  275. setwheelBlack,
  276. getwheelBlack,
  277. setF3,
  278. getF3,
  279. }"
  280. >
  281. <img src="../assets/img/car/f2.png" alt="" />
  282. </div>
  283. <div
  284. id="f1White"
  285. v-drag="{
  286. go,
  287. setPan,
  288. getPan,
  289. setTou,
  290. getTou,
  291. setAi,
  292. getAi,
  293. setScrean,
  294. getScrean,
  295. setlightWhite,
  296. getlightWhite,
  297. setlightBlue,
  298. getlightBlue,
  299. setf1White,
  300. getf1White,
  301. setF4,
  302. getF4,
  303. setF2,
  304. getF2,
  305. setLight,
  306. getLight,
  307. setwheelWhite,
  308. getwheelWhite,
  309. setwheelBlack,
  310. getwheelBlack,
  311. setF3,
  312. getF3,
  313. }"
  314. >
  315. <img src="../assets/img/car/f1White.png" alt="" />
  316. </div>
  317. <div
  318. id="f1Blue"
  319. v-drag="{
  320. go,
  321. setPan,
  322. getPan,
  323. setTou,
  324. getTou,
  325. setAi,
  326. getAi,
  327. setScrean,
  328. getScrean,
  329. setlightWhite,
  330. getlightWhite,
  331. setlightBlue,
  332. getlightBlue,
  333. setf1White,
  334. getf1White,
  335. setF4,
  336. getF4,
  337. setF2,
  338. getF2,
  339. setLight,
  340. getLight,
  341. setwheelWhite,
  342. getwheelWhite,
  343. setwheelBlack,
  344. getwheelBlack,
  345. setF3,
  346. getF3,
  347. }"
  348. >
  349. <img src="../assets/img/car/f1Blue.png" alt="" />
  350. </div>
  351. <div
  352. id="wheelWhite"
  353. v-drag="{
  354. go,
  355. setPan,
  356. getPan,
  357. setTou,
  358. getTou,
  359. setAi,
  360. getAi,
  361. setScrean,
  362. getScrean,
  363. setlightWhite,
  364. getlightWhite,
  365. setlightBlue,
  366. getlightBlue,
  367. setf1White,
  368. getf1White,
  369. setF4,
  370. getF4,
  371. setF2,
  372. getF2,
  373. setLight,
  374. getLight,
  375. setwheelWhite,
  376. getwheelWhite,
  377. setwheelBlack,
  378. getwheelBlack,
  379. setF3,
  380. getF3,
  381. }"
  382. >
  383. <img src="../assets/img/car/wheelWhite.png" alt="" />
  384. </div>
  385. <div
  386. id="wheelBlack"
  387. v-drag="{
  388. go,
  389. setPan,
  390. getPan,
  391. setTou,
  392. getTou,
  393. setAi,
  394. getAi,
  395. setScrean,
  396. getScrean,
  397. setlightWhite,
  398. getlightWhite,
  399. setlightBlue,
  400. getlightBlue,
  401. setf1White,
  402. getf1White,
  403. setF4,
  404. getF4,
  405. setF2,
  406. getF2,
  407. setLight,
  408. getLight,
  409. setwheelWhite,
  410. getwheelWhite,
  411. setwheelBlack,
  412. getwheelBlack,
  413. setF3,
  414. getF3,
  415. }"
  416. >
  417. <img src="../assets/img/car/wheelBlack.png" alt="" />
  418. </div>
  419. <div
  420. id="light"
  421. v-drag="{
  422. go,
  423. setPan,
  424. getPan,
  425. setTou,
  426. getTou,
  427. setAi,
  428. getAi,
  429. setScrean,
  430. getScrean,
  431. setlightWhite,
  432. getlightWhite,
  433. setlightBlue,
  434. getlightBlue,
  435. setf1White,
  436. getf1White,
  437. setF4,
  438. getF4,
  439. setF2,
  440. getF2,
  441. setLight,
  442. getLight,
  443. setwheelWhite,
  444. getwheelWhite,
  445. setwheelBlack,
  446. getwheelBlack,
  447. setF3,
  448. getF3,
  449. }"
  450. >
  451. <img src="../assets/img/car/light.png" alt="" />
  452. </div>
  453. <div
  454. v-show="f3 == 1"
  455. id="line"
  456. v-drag="{
  457. go,
  458. setPan,
  459. getPan,
  460. setTou,
  461. getTou,
  462. setAi,
  463. getAi,
  464. setScrean,
  465. getScrean,
  466. setlightWhite,
  467. getlightWhite,
  468. setlightBlue,
  469. getlightBlue,
  470. setf1White,
  471. getf1White,
  472. setF4,
  473. getF4,
  474. setF2,
  475. getF2,
  476. setLight,
  477. getLight,
  478. setwheelWhite,
  479. getwheelWhite,
  480. setwheelBlack,
  481. getwheelBlack,
  482. setF3,
  483. getF3,
  484. }"
  485. >
  486. <img src="../assets/img/car/line.png" alt="" />
  487. </div>
  488. </div>
  489. <div class="right"><img src="../assets/img/right.png" alt="" /></div>
  490. <div class="button">进入CocoBlockly编程平台</div>
  491. <video
  492. id="musicC"
  493. :src="require('../assets/music/click.mp3')"
  494. v-show="false"
  495. ></video>
  496. </div>
  497. </template>
  498. <script>
  499. export default {
  500. data() {
  501. return {
  502. panThing: "",
  503. tou: "",
  504. ai: "",
  505. screan: "",
  506. lightWhite: "",
  507. lightBlue: "",
  508. f1White: "",
  509. f4: "",
  510. f2: "",
  511. light: "",
  512. wheelWhite: "",
  513. wheelBlack: "",
  514. f3: "",
  515. };
  516. },
  517. directives: {
  518. drag: {
  519. // 指令的定义
  520. inserted: function (el, binding) {
  521. // el.drag();
  522. console.log(el);
  523. //获取元素
  524. // var dv = document.getElementById("dv");
  525. let x = 0;
  526. let y = 0;
  527. let l = 0;
  528. let t = 0;
  529. let isDown = false;
  530. var _screan = document.getElementById("screan");
  531. var _tou = document.getElementById("tou");
  532. var _ai = document.getElementById("ai");
  533. var _lightBlue = document.getElementById("lightBlue");
  534. var _lightWhite = document.getElementById("lightWhite");
  535. var _F3 = document.getElementById("F3");
  536. var _F4 = document.getElementById("F4");
  537. var _F2 = document.getElementById("F2");
  538. var _f1White = document.getElementById("f1White");
  539. var _f1Blue = document.getElementById("f1Blue");
  540. var _wheelWhite = document.getElementById("wheelWhite");
  541. var _wheelBlack = document.getElementById("wheelBlack");
  542. var _light = document.getElementById("light");
  543. var _line = document.getElementById("line");
  544. var musicC = document.getElementById("musicC");
  545. //鼠标按下事件
  546. el.onmousedown = function (e) {
  547. //获取x坐标和y坐标
  548. e.preventDefault();
  549. x = e.clientX;
  550. y = e.clientY;
  551. //获取左部和顶部的偏移量
  552. l = el.offsetLeft;
  553. t = el.offsetTop;
  554. //开关打开
  555. isDown = true;
  556. //设置样式
  557. el.style.cursor = "move";
  558. subiao(el);
  559. };
  560. function subiao(cdiv) {
  561. document.onmousemove = function (e) {
  562. if (isDown == false) {
  563. return;
  564. }
  565. //获取x和y
  566. var nx = e.clientX;
  567. var ny = e.clientY;
  568. //计算移动后的左偏移量和顶部的偏移量
  569. var nl = nx - (x - l);
  570. var nt = ny - (y - t);
  571. cdiv.style.left = nl + "px";
  572. cdiv.style.top = nt + "px";
  573. if (el.id == "screan") {
  574. binding.value.setPan("screan");
  575. moveP(nl, nt, "screan");
  576. }
  577. if (el.id == "tou") {
  578. binding.value.setPan("tou");
  579. moveP(nl, nt, "tou");
  580. }
  581. if (el.id == "ai") {
  582. binding.value.setPan("ai");
  583. moveP(nl, nt, "ai");
  584. }
  585. if (el.id == "lightBlue") {
  586. binding.value.setPan("lightBlue");
  587. moveP(nl, nt, "lightBlue");
  588. }
  589. if (el.id == "lightWhite") {
  590. binding.value.setPan("lightWhite");
  591. moveP(nl, nt, "lightWhite");
  592. }
  593. if (el.id == "F3") {
  594. binding.value.setPan("F3");
  595. moveP(nl, nt, "F3");
  596. }
  597. if (el.id == "F4") {
  598. binding.value.setPan("F4");
  599. moveP(nl, nt, "F4");
  600. }
  601. if (el.id == "F2") {
  602. binding.value.setPan("F2");
  603. moveP(nl, nt, "F2");
  604. }
  605. if (el.id == "f1White") {
  606. binding.value.setPan("f1White");
  607. moveP(nl, nt, "f1White");
  608. }
  609. if (el.id == "f1Blue") {
  610. binding.value.setPan("f1Blue");
  611. moveP(nl, nt, "f1Blue");
  612. }
  613. if (el.id == "wheelWhite") {
  614. binding.value.setPan("wheelWhite");
  615. moveP(nl, nt, "wheelWhite");
  616. }
  617. if (el.id == "wheelBlack") {
  618. binding.value.setPan("wheelBlack");
  619. moveP(nl, nt, "wheelBlack");
  620. }
  621. if (el.id == "light") {
  622. binding.value.setPan("light");
  623. moveP(nl, nt, "light");
  624. }
  625. };
  626. }
  627. //鼠标抬起事件
  628. el.onmouseup = function (e) {
  629. //开关关闭
  630. isDown = false;
  631. el.style.cursor = "default";
  632. document.onmousemove = null;
  633. var nx = e.clientX;
  634. var ny = e.clientY;
  635. var nl = nx - (x - l);
  636. var nt = ny - (y - t);
  637. if (binding.value.getPan() == "screan") {
  638. st(nl, nt, "screan");
  639. }
  640. if (binding.value.getPan() == "tou") {
  641. st(nl, nt, "tou");
  642. }
  643. if (binding.value.getPan() == "ai") {
  644. st(nl, nt, "ai");
  645. }
  646. if (binding.value.getPan() == "lightBlue") {
  647. st(nl, nt, "lightBlue");
  648. }
  649. if (binding.value.getPan() == "lightWhite") {
  650. st(nl, nt, "lightWhite");
  651. }
  652. if (binding.value.getPan() == "F3") {
  653. st(nl, nt, "F3");
  654. }
  655. if (binding.value.getPan() == "F4") {
  656. st(nl, nt, "F4");
  657. }
  658. if (binding.value.getPan() == "F2") {
  659. st(nl, nt, "F2");
  660. }
  661. if (binding.value.getPan() == "f1White") {
  662. st(nl, nt, "f1White");
  663. }
  664. if (binding.value.getPan() == "f1Blue") {
  665. st(nl, nt, "f1Blue");
  666. }
  667. if (binding.value.getPan() == "wheelWhite") {
  668. st(nl, nt, "wheelWhite");
  669. }
  670. if (binding.value.getPan() == "wheelBlack") {
  671. st(nl, nt, "wheelBlack");
  672. }
  673. if (binding.value.getPan() == "light") {
  674. st(nl, nt, "light");
  675. }
  676. pan();
  677. };
  678. function pan() {
  679. var btn = document.getElementsByClassName("button")[0];
  680. var right = document.getElementsByClassName("right")[0];
  681. var policeL = _wheelWhite.offsetLeft;
  682. var policeT = _wheelWhite.offsetTop;
  683. if (binding.value.getlightWhite() == 1 &&
  684. binding.value.getlightBlue() == 1 &&
  685. binding.value.getf1White() == 1 &&
  686. binding.value.getF4() == 1 &&
  687. binding.value.getF2() == 1 &&
  688. binding.value.getLight() == 1 &&
  689. binding.value.getwheelWhite() == 1 &&
  690. binding.value.getwheelBlack() == 1 &&
  691. binding.value.getF3() == 1) {
  692. btn.className = "button dark";
  693. btn.onclick = function () {
  694. binding.value.go();
  695. };
  696. right.style.display = "block";
  697. right.style.left = policeL + 535 + "px";
  698. right.style.top = policeT + 65 + "px";
  699. } else {
  700. btn.className = "button";
  701. btn.onclick = null;
  702. right.style.display = "none";
  703. }
  704. }
  705. function st(nl, nt, type) {
  706. var screanL = _screan.offsetLeft;
  707. var screanT = _screan.offsetTop;
  708. var touL = _tou.offsetLeft;
  709. var touT = _tou.offsetTop;
  710. var aiL = _ai.offsetLeft;
  711. var aiT = _ai.offsetTop;
  712. var lightBlueL = _lightBlue.offsetLeft;
  713. var lightBlueT = _lightBlue.offsetTop;
  714. var lightWhiteL = _lightWhite.offsetLeft;
  715. var lightWhiteT = _lightWhite.offsetTop;
  716. var f3L = _F3.offsetLeft;
  717. var f3T = _F3.offsetTop;
  718. var f4L = _F4.offsetLeft;
  719. var f4T = _F4.offsetTop;
  720. var f2L = _F2.offsetLeft;
  721. var f2T = _F2.offsetTop;
  722. var f1WhiteL = _f1White.offsetLeft;
  723. var f1WhiteT = _f1White.offsetTop;
  724. var f1BlueL = _f1Blue.offsetLeft;
  725. var f1BlueT = _f1Blue.offsetTop;
  726. var wheelWhiteL = _wheelWhite.offsetLeft;
  727. var wheelWhiteT = _wheelWhite.offsetTop;
  728. var wheelBlackL = _wheelBlack.offsetLeft;
  729. var wheelBlackT = _wheelBlack.offsetTop;
  730. var lightL = _light.offsetLeft;
  731. var lightT = _light.offsetTop;
  732. var lineL = _line.offsetLeft;
  733. var lineT = _line.offsetTop;
  734. var firstL = screanL - touL;
  735. var firstT = screanT - touT;
  736. var secondL = f3L - aiL;
  737. var secondT = f3T - aiT;
  738. var thirdL = f3L - screanL;
  739. var thirdT = f3T - screanT;
  740. var fourthL = f1WhiteL - lightWhiteL;
  741. var fourthT = f1WhiteT - lightWhiteT;
  742. var fivethL = f1BlueL - lightBlueL;
  743. var fivethT = f1BlueT - lightBlueT;
  744. var sixthL = f1BlueL - f1WhiteL;
  745. var sixthT = f1BlueT - f1WhiteT;
  746. var seventhL = f1WhiteL - f4L;
  747. var seventhT = f1WhiteT - f4T;
  748. var eighthL = f1WhiteL - f2L;
  749. var eighthT = f1WhiteT - f2T;
  750. var nighthL = f2L - lightL;
  751. var nighthT = f2T - lightT;
  752. var tenthL = f1WhiteL - wheelWhiteL;
  753. var tenthT = f1WhiteT - wheelWhiteT;
  754. var eleventhL = f1WhiteL - wheelBlackL;
  755. var eleventhT = f1WhiteT - wheelBlackT;
  756. var twlevethL = f1WhiteL - f3L;
  757. var twlevethT = f1WhiteT - f3T;
  758. if (
  759. -70 < firstL &&
  760. firstL < -15 &&
  761. 33 < firstT &&
  762. firstT < 106 &&
  763. type == "tou"
  764. ) {
  765. _tou.style.left = screanL + 40 + "px";
  766. _tou.style.top = screanT - 81 + "px";
  767. binding.value.setTou(1);
  768. playMusic();
  769. } else if (type == "tou") {
  770. binding.value.setTou(0);
  771. }
  772. if (
  773. -170 < secondL &&
  774. secondL < 42 &&
  775. -98 < secondT &&
  776. secondT < 99 &&
  777. type == "ai"
  778. ) {
  779. _ai.style.left = f3L + 71 + "px";
  780. _ai.style.top = f3T - 3 + "px";
  781. binding.value.setAi(1);
  782. playMusic();
  783. } else if (type == "ai") {
  784. binding.value.setAi(0);
  785. }
  786. if (
  787. -170 < thirdL &&
  788. thirdL < 32 &&
  789. -103 < thirdT &&
  790. thirdT < 115 &&
  791. type == "screan"
  792. ) {
  793. _screan.style.left = f3L + 70 + "px";
  794. _screan.style.top = f3T - 2 + "px";
  795. if (binding.value.getTou() == 1) {
  796. _tou.style.left = f3L + 70 + 40 + "px";
  797. _tou.style.top = f3T - 2 - 81 + "px";
  798. }
  799. binding.value.setScrean(1);
  800. playMusic();
  801. } else if (type == "screan") {
  802. binding.value.setScrean(0);
  803. }
  804. if (
  805. -175 < fourthL &&
  806. fourthL < -11 &&
  807. -76 < fourthT &&
  808. fourthT < 14 &&
  809. type == "lightWhite"
  810. ) {
  811. _lightWhite.style.left = f1WhiteL + 42 + "px";
  812. _lightWhite.style.top = f1WhiteT + 28 + "px";
  813. binding.value.setlightWhite(1);
  814. playMusic();
  815. } else if (type == "lightWhite") {
  816. binding.value.setlightWhite(0);
  817. }
  818. if (
  819. -174 < fivethL &&
  820. fivethL < 68 &&
  821. -72 < fivethT &&
  822. fivethT < 14 &&
  823. type == "lightBlue"
  824. ) {
  825. _lightBlue.style.left = f1BlueL + 42 + "px";
  826. _lightBlue.style.top = f1BlueT + 23 + "px";
  827. binding.value.setlightBlue(1);
  828. playMusic();
  829. } else if (type == "lightBlue") {
  830. binding.value.setlightBlue(0);
  831. }
  832. if (
  833. -244 < sixthL &&
  834. sixthL < 310 &&
  835. -93 < sixthT &&
  836. sixthT < 121 &&
  837. binding.value.getlightWhite() == 1 &&
  838. binding.value.getlightBlue() == 1 &&
  839. type == "f1White"
  840. ) {
  841. _f1White.style.left = f1BlueL + 0 + "px";
  842. _f1White.style.top = f1BlueT + 0 + "px";
  843. binding.value.setf1White(1);
  844. playMusic();
  845. } else if (type == "f1White") {
  846. binding.value.setf1White(0);
  847. }
  848. if (
  849. -21 < seventhL &&
  850. seventhL < -3 &&
  851. -72 < seventhT &&
  852. seventhT < 126 &&
  853. binding.value.getlightWhite() == 1 &&
  854. binding.value.getlightBlue() == 1 &&
  855. type == "F4"
  856. ) {
  857. _F4.style.left = f1WhiteL + 12 + "px";
  858. _F4.style.top = f1WhiteT - 4 + "px";
  859. binding.value.setF4(1);
  860. playMusic();
  861. } else if (type == "F4") {
  862. binding.value.setF4(0);
  863. }
  864. if (
  865. -250 < eighthL &&
  866. eighthL < 238 &&
  867. -88 < eighthT &&
  868. eighthT < -56 &&
  869. binding.value.getlightWhite() == 1 &&
  870. binding.value.getlightBlue() == 1 &&
  871. binding.value.getF4() == 1 &&
  872. type == "F2"
  873. ) {
  874. _F2.style.left = f1WhiteL - 2 + "px";
  875. _F2.style.top = f1WhiteT + 67 + "px";
  876. binding.value.setF2(1);
  877. playMusic();
  878. } else if (type == "F2") {
  879. binding.value.setF2(0);
  880. }
  881. if (
  882. -393 < nighthL &&
  883. nighthL < -302 &&
  884. -113 < nighthT &&
  885. nighthT < -27 &&
  886. binding.value.getlightWhite() == 1 &&
  887. binding.value.getlightBlue() == 1 &&
  888. binding.value.getF4() == 1 &&
  889. binding.value.getF2() == 1 &&
  890. type == "light"
  891. ) {
  892. _light.style.left = f2L + 354 + "px";
  893. _light.style.top = f2T + 23 + "px";
  894. binding.value.setLight(1);
  895. playMusic();
  896. } else if (type == "light") {
  897. binding.value.setLight(0);
  898. }
  899. if (
  900. -5 < tenthL &&
  901. tenthL < 28 &&
  902. -42 < tenthT &&
  903. tenthT < -9 &&
  904. binding.value.getlightWhite() == 1 &&
  905. binding.value.getlightBlue() == 1 &&
  906. binding.value.getF4() == 1 &&
  907. binding.value.getF2() == 1 &&
  908. binding.value.getLight() == 1 &&
  909. type == "wheelWhite"
  910. ) {
  911. _wheelWhite.style.left = f1WhiteL - 11 + "px";
  912. _wheelWhite.style.top = f1WhiteT + 23 + "px";
  913. binding.value.setwheelWhite(1);
  914. playMusic();
  915. } else if (type == "wheelWhite") {
  916. binding.value.setwheelWhite(0);
  917. }
  918. if (
  919. -5 < eleventhL &&
  920. eleventhL < 28 &&
  921. -42 < eleventhT &&
  922. eleventhT < -9 &&
  923. binding.value.getlightWhite() == 1 &&
  924. binding.value.getlightBlue() == 1 &&
  925. binding.value.getF4() == 1 &&
  926. binding.value.getF2() == 1 &&
  927. binding.value.getLight() == 1 &&
  928. binding.value.getwheelWhite() == 1 &&
  929. type == "wheelBlack"
  930. ) {
  931. _wheelBlack.style.left = f1WhiteL - 11 + "px";
  932. _wheelBlack.style.top = f1WhiteT + 23 + "px";
  933. binding.value.setwheelBlack(1);
  934. playMusic();
  935. } else if (type == "wheelBlack") {
  936. binding.value.setwheelBlack(0);
  937. }
  938. if (
  939. -436 < twlevethL &&
  940. twlevethL < -152 &&
  941. -136 < twlevethT &&
  942. twlevethT < 10 &&
  943. binding.value.getlightWhite() == 1 &&
  944. binding.value.getlightBlue() == 1 &&
  945. binding.value.getF4() == 1 &&
  946. binding.value.getF2() == 1 &&
  947. binding.value.getLight() == 1 &&
  948. binding.value.getwheelWhite() == 1 &&
  949. binding.value.getwheelBlack() == 1 &&
  950. binding.value.getScrean() == 1 &&
  951. binding.value.getAi() == 1 &&
  952. binding.value.getTou() == 1 &&
  953. type == "F3"
  954. ) {
  955. binding.value.setF3(1);
  956. _line.style.left = f1WhiteL + 73 + "px";
  957. _line.style.top = f1WhiteT - 22 + "px";
  958. playMusic();
  959. } else if (type == "F3") {
  960. binding.value.setF3(0);
  961. }
  962. }
  963. function playMusic() {
  964. musicC.play();
  965. }
  966. function moveP(nl, nt, type) {
  967. if (binding.value.getTou() == 1 && type == "screan") {
  968. _tou.style.left = nl + 40 + "px";
  969. _tou.style.top = nt - 81 + "px";
  970. }
  971. if (binding.value.getAi() == 1 && type == "F3") {
  972. _ai.style.left = nl + 71 + "px";
  973. _ai.style.top = nt - 3 + "px";
  974. }
  975. if (
  976. binding.value.getScrean() == 1 &&
  977. binding.value.getTou() == 1 &&
  978. type == "F3"
  979. ) {
  980. _screan.style.left = nl + 70 + "px";
  981. _screan.style.top = nt - 2 + "px";
  982. _tou.style.left = nl + 110 + "px";
  983. _tou.style.top = nt - 83 + "px";
  984. }
  985. if (binding.value.getlightWhite() == 1 && type == "f1White") {
  986. _lightWhite.style.left = nl + 42 + "px";
  987. _lightWhite.style.top = nt + 28 + "px";
  988. }
  989. if (binding.value.getlightBlue() == 1 && type == "f1Blue") {
  990. _lightBlue.style.left = nl + 42 + "px";
  991. _lightBlue.style.top = nt + 23 + "px";
  992. }
  993. if (
  994. binding.value.getlightWhite() == 1 &&
  995. binding.value.getlightBlue() == 1 &&
  996. binding.value.getf1White() == 1 &&
  997. type == "f1White"
  998. ) {
  999. _lightWhite.style.left = nl + 42 + "px";
  1000. _lightWhite.style.top = nt + 28 + "px";
  1001. _lightBlue.style.left = nl + 42 + "px";
  1002. _lightBlue.style.top = nt + 23 + "px";
  1003. _f1Blue.style.left = nl + 0 + "px";
  1004. _f1Blue.style.top = nt + 0 + "px";
  1005. }
  1006. if (
  1007. binding.value.getlightWhite() == 1 &&
  1008. binding.value.getlightBlue() == 1 &&
  1009. binding.value.getf1White() == 1 &&
  1010. binding.value.getF4() == 1 &&
  1011. type == "f1White"
  1012. ) {
  1013. _lightWhite.style.left = nl + 42 + "px";
  1014. _lightWhite.style.top = nt + 28 + "px";
  1015. _lightBlue.style.left = nl + 42 + "px";
  1016. _lightBlue.style.top = nt + 23 + "px";
  1017. _f1Blue.style.left = nl + 0 + "px";
  1018. _f1Blue.style.top = nt + 0 + "px";
  1019. _F4.style.left = nl + 12 + "px";
  1020. _F4.style.top = nt - 4 + "px";
  1021. }
  1022. if (
  1023. binding.value.getlightWhite() == 1 &&
  1024. binding.value.getlightBlue() == 1 &&
  1025. binding.value.getf1White() == 1 &&
  1026. binding.value.getF4() == 1 &&
  1027. binding.value.getF2() == 1 &&
  1028. type == "f1White"
  1029. ) {
  1030. _lightWhite.style.left = nl + 42 + "px";
  1031. _lightWhite.style.top = nt + 28 + "px";
  1032. _lightBlue.style.left = nl + 42 + "px";
  1033. _lightBlue.style.top = nt + 23 + "px";
  1034. _f1Blue.style.left = nl + 0 + "px";
  1035. _f1Blue.style.top = nt + 0 + "px";
  1036. _F4.style.left = nl + 12 + "px";
  1037. _F4.style.top = nt - 4 + "px";
  1038. _F2.style.left = nl - 2 + "px";
  1039. _F2.style.top = nt + 67 + "px";
  1040. }
  1041. if (
  1042. binding.value.getlightWhite() == 1 &&
  1043. binding.value.getlightBlue() == 1 &&
  1044. binding.value.getf1White() == 1 &&
  1045. binding.value.getF4() == 1 &&
  1046. binding.value.getF2() == 1 &&
  1047. binding.value.getLight() == 1 &&
  1048. type == "f1White"
  1049. ) {
  1050. _lightWhite.style.left = nl + 42 + "px";
  1051. _lightWhite.style.top = nt + 28 + "px";
  1052. _lightBlue.style.left = nl + 42 + "px";
  1053. _lightBlue.style.top = nt + 23 + "px";
  1054. _f1Blue.style.left = nl + 0 + "px";
  1055. _f1Blue.style.top = nt + 0 + "px";
  1056. _F4.style.left = nl + 12 + "px";
  1057. _F4.style.top = nt - 4 + "px";
  1058. _F2.style.left = nl - 2 + "px";
  1059. _F2.style.top = nt + 67 + "px";
  1060. _light.style.left = nl + 352 + "px";
  1061. _light.style.top = nt + 90 + "px";
  1062. }
  1063. if (
  1064. binding.value.getlightWhite() == 1 &&
  1065. binding.value.getlightBlue() == 1 &&
  1066. binding.value.getf1White() == 1 &&
  1067. binding.value.getF4() == 1 &&
  1068. binding.value.getF2() == 1 &&
  1069. binding.value.getLight() == 1 &&
  1070. binding.value.getwheelWhite() == 1 &&
  1071. type == "f1White"
  1072. ) {
  1073. _lightWhite.style.left = nl + 42 + "px";
  1074. _lightWhite.style.top = nt + 28 + "px";
  1075. _lightBlue.style.left = nl + 42 + "px";
  1076. _lightBlue.style.top = nt + 23 + "px";
  1077. _f1Blue.style.left = nl + 0 + "px";
  1078. _f1Blue.style.top = nt + 0 + "px";
  1079. _F4.style.left = nl + 12 + "px";
  1080. _F4.style.top = nt - 4 + "px";
  1081. _F2.style.left = nl - 2 + "px";
  1082. _F2.style.top = nt + 67 + "px";
  1083. _light.style.left = nl + 352 + "px";
  1084. _light.style.top = nt + 90 + "px";
  1085. _wheelWhite.style.left = nl - 11 + "px";
  1086. _wheelWhite.style.top = nt + 23 + "px";
  1087. }
  1088. if (
  1089. binding.value.getlightWhite() == 1 &&
  1090. binding.value.getlightBlue() == 1 &&
  1091. binding.value.getf1White() == 1 &&
  1092. binding.value.getF4() == 1 &&
  1093. binding.value.getF2() == 1 &&
  1094. binding.value.getLight() == 1 &&
  1095. binding.value.getwheelWhite() == 1 &&
  1096. binding.value.getwheelBlack() == 1 &&
  1097. type == "f1White"
  1098. ) {
  1099. _lightWhite.style.left = nl + 42 + "px";
  1100. _lightWhite.style.top = nt + 28 + "px";
  1101. _lightBlue.style.left = nl + 42 + "px";
  1102. _lightBlue.style.top = nt + 23 + "px";
  1103. _f1Blue.style.left = nl + 0 + "px";
  1104. _f1Blue.style.top = nt + 0 + "px";
  1105. _F4.style.left = nl + 12 + "px";
  1106. _F4.style.top = nt - 4 + "px";
  1107. _F2.style.left = nl - 2 + "px";
  1108. _F2.style.top = nt + 67 + "px";
  1109. _light.style.left = nl + 352 + "px";
  1110. _light.style.top = nt + 90 + "px";
  1111. _wheelWhite.style.left = nl - 11 + "px";
  1112. _wheelWhite.style.top = nt + 23 + "px";
  1113. _wheelBlack.style.left = nl - 11 + "px";
  1114. _wheelBlack.style.top = nt + 23 + "px";
  1115. }
  1116. if (
  1117. binding.value.getlightWhite() == 1 &&
  1118. binding.value.getlightBlue() == 1 &&
  1119. binding.value.getf1White() == 1 &&
  1120. binding.value.getF4() == 1 &&
  1121. binding.value.getF2() == 1 &&
  1122. binding.value.getLight() == 1 &&
  1123. binding.value.getwheelWhite() == 1 &&
  1124. binding.value.getwheelBlack() == 1 &&
  1125. binding.value.getF3() == 1 &&
  1126. type == "f1White"
  1127. ) {
  1128. _lightWhite.style.left = nl + 42 + "px";
  1129. _lightWhite.style.top = nt + 28 + "px";
  1130. _lightBlue.style.left = nl + 42 + "px";
  1131. _lightBlue.style.top = nt + 23 + "px";
  1132. _f1Blue.style.left = nl + 0 + "px";
  1133. _f1Blue.style.top = nt + 0 + "px";
  1134. _F4.style.left = nl + 12 + "px";
  1135. _F4.style.top = nt - 4 + "px";
  1136. _F2.style.left = nl - 2 + "px";
  1137. _F2.style.top = nt + 67 + "px";
  1138. _light.style.left = nl + 352 + "px";
  1139. _light.style.top = nt + 90 + "px";
  1140. _wheelWhite.style.left = nl - 11 + "px";
  1141. _wheelWhite.style.top = nt + 23 + "px";
  1142. _wheelBlack.style.left = nl - 11 + "px";
  1143. _wheelBlack.style.top = nt + 23 + "px";
  1144. _line.style.left = nl + 73 + "px";
  1145. _line.style.top = nt -22 + "px";
  1146. }
  1147. }
  1148. },
  1149. },
  1150. },
  1151. methods: {
  1152. go() {
  1153. this.$router.push("/blockly");
  1154. },
  1155. setPan(value) {
  1156. this.panThing = value;
  1157. },
  1158. getPan() {
  1159. return this.panThing;
  1160. },
  1161. setTou(value) {
  1162. this.tou = value;
  1163. },
  1164. getTou() {
  1165. return this.tou;
  1166. },
  1167. setAi(value) {
  1168. this.ai = value;
  1169. },
  1170. getAi() {
  1171. return this.ai;
  1172. },
  1173. setScrean(value) {
  1174. this.screan = value;
  1175. },
  1176. getScrean() {
  1177. return this.screan;
  1178. },
  1179. setlightWhite(value) {
  1180. this.lightWhite = value;
  1181. },
  1182. getlightWhite() {
  1183. return this.lightWhite;
  1184. },
  1185. setlightBlue(value) {
  1186. this.lightBlue = value;
  1187. },
  1188. getlightBlue() {
  1189. return this.lightBlue;
  1190. },
  1191. setf1White(value) {
  1192. this.f1White = value;
  1193. },
  1194. getf1White() {
  1195. return this.f1White;
  1196. },
  1197. setF4(value) {
  1198. this.f4 = value;
  1199. },
  1200. getF4() {
  1201. return this.f4;
  1202. },
  1203. setF2(value) {
  1204. this.f2 = value;
  1205. },
  1206. getF2() {
  1207. return this.f2;
  1208. },
  1209. setLight(value) {
  1210. this.light = value;
  1211. },
  1212. getLight() {
  1213. return this.light;
  1214. },
  1215. setwheelWhite(value) {
  1216. this.wheelWhite = value;
  1217. },
  1218. getwheelWhite() {
  1219. return this.wheelWhite;
  1220. },
  1221. setwheelBlack(value) {
  1222. this.wheelBlack = value;
  1223. },
  1224. getwheelBlack() {
  1225. return this.wheelBlack;
  1226. },
  1227. setF3(value) {
  1228. this.f3 = value;
  1229. },
  1230. getF3() {
  1231. return this.f3;
  1232. },
  1233. },
  1234. };
  1235. </script>
  1236. <style scoped>
  1237. html,
  1238. body {
  1239. margin: 0;
  1240. padding: 0;
  1241. width: 100%;
  1242. }
  1243. .tip {
  1244. margin: 25px 0 30px 20px;
  1245. }
  1246. #screan > img,
  1247. #tou > img,
  1248. #ai > img,
  1249. #lightBlue > img,
  1250. #lightWhite > img,
  1251. #F3 > img,
  1252. #F4 > img,
  1253. #F2 > img,
  1254. #f1White > img,
  1255. #f1Blue > img,
  1256. #wheelWhite > img,
  1257. #wheelBlack > img,
  1258. #line>img,
  1259. #light > img,
  1260. .right > img {
  1261. width: 100%;
  1262. height: 100%;
  1263. user-select: none;
  1264. }
  1265. .img {
  1266. display: flex;
  1267. flex-direction: row;
  1268. justify-content: flex-end;
  1269. margin: auto;
  1270. width: 70%;
  1271. /* position: relative; */
  1272. }
  1273. #screan {
  1274. width: 150px;
  1275. position: absolute;
  1276. left: 10%;
  1277. top: 50%;
  1278. transform: translateY(-50%);
  1279. z-index: 11;
  1280. }
  1281. #ai {
  1282. width: 150px;
  1283. position: absolute;
  1284. top: 68%;
  1285. left: 10%;
  1286. transform: translateY(-50%);
  1287. z-index: 9;
  1288. }
  1289. #lightBlue {
  1290. width: 240px;
  1291. position: absolute;
  1292. top: 37%;
  1293. left: 23%;
  1294. transform: translateY(-50%);
  1295. z-index: 4;
  1296. }
  1297. #lightWhite {
  1298. width: 240px;
  1299. position: absolute;
  1300. top: 48%;
  1301. left: 23%;
  1302. transform: translateY(-50%);
  1303. z-index: 3;
  1304. }
  1305. #F3 {
  1306. width: 300px;
  1307. position: absolute;
  1308. top: 68%;
  1309. left: 21%;
  1310. transform: translateY(-50%);
  1311. z-index: 8;
  1312. }
  1313. #F4 {
  1314. width: 25px;
  1315. position: absolute;
  1316. top: 68%;
  1317. left: 40%;
  1318. transform: translateY(-50%);
  1319. z-index: 6;
  1320. }
  1321. #F2 {
  1322. width: 480px;
  1323. position: absolute;
  1324. top: 27%;
  1325. left: 41%;
  1326. transform: translateY(-50%);
  1327. z-index: 6;
  1328. }
  1329. #f1White {
  1330. width: 480px;
  1331. position: absolute;
  1332. top: 42%;
  1333. left: 42%;
  1334. transform: translateY(-50%);
  1335. z-index: 5;
  1336. }
  1337. #f1Blue {
  1338. width: 480px;
  1339. position: absolute;
  1340. top: 65%;
  1341. left: 42%;
  1342. transform: translateY(-50%);
  1343. z-index: 3;
  1344. }
  1345. #wheelWhite {
  1346. width: 200px;
  1347. position: absolute;
  1348. top: 37%;
  1349. left: 71%;
  1350. transform: translateY(-50%);
  1351. z-index: 6;
  1352. }
  1353. #wheelBlack {
  1354. width: 200px;
  1355. position: absolute;
  1356. top: 58%;
  1357. left: 71%;
  1358. transform: translateY(-50%);
  1359. z-index: 7;
  1360. }
  1361. #light {
  1362. width: 65px;
  1363. position: absolute;
  1364. top: 72%;
  1365. left: 75%;
  1366. transform: translateY(-50%);
  1367. z-index: 6;
  1368. }
  1369. #tou {
  1370. width: 65px;
  1371. position: absolute;
  1372. top: 37%;
  1373. left: 12%;
  1374. transform: translateY(-50%);
  1375. z-index: 10;
  1376. }
  1377. #line {
  1378. width: 450px;
  1379. position: absolute;
  1380. top: 37%;
  1381. left: 71%;
  1382. transform: translateY(-50%);
  1383. z-index: 3;
  1384. }
  1385. .button {
  1386. color: #fff;
  1387. background: #8ca1de;
  1388. width: 550px;
  1389. height: 55px;
  1390. font-size: 20px;
  1391. text-align: center;
  1392. line-height: 55px;
  1393. position: absolute;
  1394. bottom: 10%;
  1395. left: 50%;
  1396. transform: translateX(-50%);
  1397. user-select: none;
  1398. }
  1399. .right {
  1400. width: 40px;
  1401. position: absolute;
  1402. left: 55%;
  1403. top: 70%;
  1404. display: none;
  1405. }
  1406. .dark {
  1407. background: #5b79d0;
  1408. cursor: pointer;
  1409. }
  1410. </style>