functionFan2.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918
  1. <template>
  2. <div style="width: 100%; height: calc(100%); background: #fff; display: flex">
  3. <div class="ablockly">
  4. <div id="blocklyDiv"></div>
  5. <xml id="toolbox" style="display: none">
  6. <category name="逻辑" colour="%{BKY_LOGIC_HUE}">
  7. <block type="controls_if"></block>
  8. <block type="logic_compare"></block>
  9. <block type="logic_operation"></block>
  10. <block type="logic_negate"></block>
  11. <block type="logic_boolean"></block>
  12. <block type="logic_number"></block>
  13. </category>
  14. <sep></sep>
  15. <category name="循环" colour="#5ba55b">
  16. <block type="controls_repeat_forever"></block>
  17. <block type="controls_whileUntil"></block>
  18. <block type="controls_for"></block>
  19. </category>
  20. <sep></sep>
  21. <category id="catIOTScreen" name="屏幕" colour="#5cb2d6">
  22. <block type="iot_lcd_screeninit"></block>
  23. </category>
  24. <sep></sep>
  25. <category id="cat" name="人脸识别" colour="#ee783a">
  26. <block type="iot_lcd_faceinit"></block>
  27. </category>
  28. <sep></sep>
  29. <category id="police" name="电子警察组件" colour="#1b5873">
  30. <block type="iot_lcd_policeinit"></block>
  31. </category>
  32. <sep></sep>
  33. <category id="police" name="AI组件" colour="#935ba5">
  34. <block type="ai_gesture"></block>
  35. <block type="ai_motor"></block>
  36. </category>
  37. </xml>
  38. </div>
  39. <div class="container">
  40. <div class="img">
  41. <div class="left" style="width: 120px"></div>
  42. <div class="controlZ">
  43. <div id="fan" ref="fan">
  44. <img :src="img[0]" alt />
  45. </div>
  46. <div id="fanB">
  47. <img :src="img[6]" alt />
  48. </div>
  49. <div id="motor">
  50. <img :src="img[1]" alt />
  51. </div>
  52. <div id="base">
  53. <img :src="img[2]" alt />
  54. </div>
  55. <div id="a4">
  56. <img :src="img[3]" alt />
  57. </div>
  58. <div id="screan">
  59. <img :src="img[4]" alt />
  60. <!--图片展示-->
  61. <video
  62. ref="video"
  63. id="video_cam"
  64. width="178"
  65. height="142.4"
  66. class="face"
  67. autoplay
  68. v-show="isCamera"
  69. ></video>
  70. <canvas
  71. ref="canvasDOM"
  72. width="178"
  73. height="142.4"
  74. class="kuang"
  75. v-show="isCamera"
  76. ></canvas>
  77. </div>
  78. <div id="line">
  79. <img :src="img[5]" alt />
  80. </div>
  81. </div>
  82. <div class="cameraZ">
  83. <!--开启摄像头-->
  84. <div class="cameraBtn">
  85. <div class="open" @click="start()" v-if="!isZuan">
  86. <img src="../assets/img/fan/icon.png" alt />
  87. </div>
  88. <div class="close" @click="closeCamera()" v-else>
  89. <img src="../assets/img/fan/icon2.png" alt />
  90. </div>
  91. </div>
  92. <!--确认-->
  93. <div v-show="false" class="isPhoto">
  94. <!--canvas截取流-->
  95. <canvas
  96. ref="canvas"
  97. width="300"
  98. height="240"
  99. v-show="false"
  100. ></canvas>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </template>
  107. <style>
  108. .as {
  109. animation: myfirst 1s;
  110. -webkit-animation: myfirst 1s; /* Safari and Chrome */
  111. }
  112. .asn {
  113. transform: rotate(0deg);
  114. }
  115. @keyframes myfirst {
  116. 0% {
  117. transform: rotate(0deg);
  118. }
  119. 100% {
  120. transform: rotate(360deg);
  121. }
  122. }
  123. @-webkit-keyframes myfirst /* Safari and Chrome */ {
  124. 0% {
  125. transform: rotate(0deg);
  126. }
  127. 100% {
  128. transform: rotate(360deg);
  129. }
  130. }
  131. .ass {
  132. animation: myfirst 3s;
  133. -webkit-animation: myfirst 3s; /* Safari and Chrome */
  134. }
  135. </style>
  136. <script>
  137. import * as handPoseDetection from "@tensorflow-models/hand-pose-detection";
  138. import "@tensorflow/tfjs-backend-webgl";
  139. import * as mpHands from "@mediapipe/hands";
  140. // 引入Blockly
  141. import Blockly from "blockly";
  142. // 引入想要转换的语言,语言有php python dart lua javascript
  143. import * as JavaScript from "blockly/javascript";
  144. import * as Blocks from "blockly/blocks";
  145. // 引入语言包并使用
  146. import * as hans from "blockly/msg/zh-hans";
  147. Blockly.setLocale(hans);
  148. //引入媒体文件:我是在github上下载的blockly源码,将源码中的media文件放入我项目中的public文件夹下
  149. //忽略被vue错认为组件的blockly中的标签,不止以下这些,请发现一个忽略一个
  150. import Vue from "vue";
  151. Vue.config.ignoredElements.push("xml");
  152. Vue.config.ignoredElements.push("block");
  153. Vue.config.ignoredElements.push("field");
  154. Vue.config.ignoredElements.push("category");
  155. Vue.config.ignoredElements.push("sep");
  156. Vue.config.ignoredElements.push("value");
  157. Vue.config.ignoredElements.push("statement");
  158. Vue.config.ignoredElements.push("mutation");
  159. export default {
  160. data() {
  161. return {
  162. that: this,
  163. img: [
  164. require("../assets/img/fan/fan.png"),
  165. require("../assets/img/fan/2.png"),
  166. require("../assets/img/fan/3.png"),
  167. require("../assets/img/fan/4.png"),
  168. require("../assets/img/fan/5.png"),
  169. require("../assets/img/fan/6.png"),
  170. require("../assets/img/fan/fanB.png"),
  171. ],
  172. shibieImg: require("../assets/img/face.png"),
  173. isCamera: false,
  174. isZuan: false,
  175. count: 0,
  176. change: 0,
  177. closeUpdateMessage: false,
  178. updateMessage: false,
  179. upName: "",
  180. number: 0,
  181. isdetected: "请您保持脸部在画面中央",
  182. videoEl: {},
  183. canvasEL: {},
  184. formLabelWidth: "100px",
  185. resultImg: {
  186. img: [],
  187. name: "",
  188. },
  189. // 预设样本图,支持本地,网络,beas64
  190. sampleArr: [
  191. // {
  192. // name: "编号1",
  193. // img: []
  194. // }
  195. ],
  196. // 匹配图,支持本地,网络,beas64
  197. detArr: [
  198. //"" 图片1
  199. ],
  200. numberOne: 0,
  201. // 匹配结果
  202. resultArr: [],
  203. // 人脸匹配矩阵数组对象转码结果
  204. faceMatcher: null,
  205. rotate: 0,
  206. timer: null,
  207. detector: null,
  208. hand: 0,
  209. isC: false,
  210. };
  211. },
  212. methods: {
  213. cancel() {
  214. this.updateMessage = false;
  215. this.sampleArr[this.sampleArr.length - 1].name = "编号:" + this.number;
  216. if (this.sampleArr.length > 0) {
  217. // var a = document.getElementsByClassName("spot");
  218. // a[0].style.display = "block";
  219. this.fnsample();
  220. }
  221. },
  222. start() {
  223. this.isZuan = true;
  224. this.isCamera = true;
  225. let video = this.$refs["video"];
  226. var that = this;
  227. var f = window.requestAnimationFrame(function () {
  228. window.cancelAnimationFrame(f);
  229. setTimeout(function () {
  230. that.handsFind(video);
  231. that.start();
  232. }, 1000);
  233. });
  234. // setInterval(() => {
  235. // this.handsFind(video);
  236. // // window.requestAnimationFrame(this.start);
  237. // }, 1000);
  238. },
  239. zhuan() {
  240. var _fan = this.$refs.fan;
  241. _fan.className = "asn as";
  242. clearInterval(this.timer);
  243. this.timer = setInterval(function () {
  244. _fan.className = "asn";
  245. setTimeout(function () {
  246. _fan.className = "as";
  247. }, 0);
  248. }, 1000);
  249. },
  250. zhuann() {
  251. var _fan = this.$refs.fan;
  252. this.$refs.fan.className = "asn ass";
  253. clearInterval(this.timer);
  254. this.timer = setInterval(function () {
  255. _fan.className = "asn";
  256. setTimeout(function () {
  257. _fan.className = "ass";
  258. }, 0);
  259. }, 3000);
  260. },
  261. update() {
  262. this.change = 1;
  263. this.number = this.number + 1;
  264. if (this.change == 1) {
  265. if (this.sampleArr.length > 0) {
  266. this.sampleArr[this.sampleArr.length - 1].name = this.upName;
  267. this.isdetected = "已识别到" + this.resultImg.name + "的图片";
  268. }
  269. }
  270. if (this.sampleArr.length > 0) {
  271. // var a = document.getElementsByClassName("spot");
  272. // a[0].style.display = "block";
  273. this.fnsample();
  274. }
  275. this.updateMessage = false;
  276. },
  277. async handsFind(video) {
  278. let hands = await this.detector.estimateHands(video, {
  279. flipHorizontal: false,
  280. });
  281. console.log(hands);
  282. if (hands.length > 0 && this.isCamera) {
  283. let handsA = hands[0].keypoints;
  284. let _58y = handsA[5].y / handsA[8].y;
  285. let _912y = handsA[9].y / handsA[12].y;
  286. let _1316y = handsA[13].y / handsA[16].y;
  287. let _1720y = handsA[17].y / handsA[20].y;
  288. /*石头剪刀布的转速 */
  289. let buNum = 100;
  290. let sNum = 0;
  291. let jNum = 50;
  292. /**1布2石头3剪刀 */
  293. if (_58y > 1 && _912y > 1 && _1316y > 1 && _1720y > 1) {
  294. console.log("布");
  295. if (this.hand == 1) {
  296. return;
  297. }
  298. this.hand = 1;
  299. this.zhuan();
  300. } else if (_58y < 1 && _912y < 1 && _1316y < 1 && _1720y < 1) {
  301. console.log("石头");
  302. if (this.hand == 2) {
  303. return;
  304. }
  305. this.hand = 2;
  306. clearInterval(this.timer);
  307. this.$refs.fan.className = "asn";
  308. } else if (_58y > 1 && _912y > 1 && _1316y < 1 && _1720y < 1) {
  309. console.log("剪刀");
  310. if (this.hand == 3) {
  311. return;
  312. }
  313. this.hand = 3;
  314. this.zhuann();
  315. }
  316. }
  317. },
  318. // 调用摄像头
  319. callCamera() {
  320. const loading = this.$loading.service({
  321. background: "rgba(255, 255, 255, 0.7)",
  322. target: document.body,
  323. });
  324. let _this = this;
  325. // H5调用电脑摄像头API
  326. window.navigator.mediaDevices
  327. .getUserMedia({
  328. video: true,
  329. })
  330. .then((success) => {
  331. // 摄像头开启成功
  332. _this.$refs["video"].srcObject = success;
  333. // 实时拍照效果
  334. _this.$refs["video"].play();
  335. loading.close();
  336. })
  337. .catch((error) => {
  338. // console.error("摄像头开启失败,请检查摄像头是否可用!");
  339. _this.isC = false;
  340. _this.$message.error("摄像头开启失败,请检查摄像头是否可用!");
  341. loading.close();
  342. });
  343. },
  344. // 拍照
  345. photograph() {
  346. let ctx = this.$refs["canvas"].getContext("2d");
  347. // 把当前视频帧内容渲染到canvas上
  348. ctx.drawImage(this.$refs["video"], 0, 0, 300, 240);
  349. // 转base64格式、图片格式转换、图片质量压缩
  350. let imgBase64 = this.$refs["canvas"].toDataURL("image/jpeg", 0.7); // 由字节转换为KB 判断大小
  351. let str = imgBase64.replace("data:image/jpeg;base64,", "");
  352. let strLength = str.length;
  353. let fileLength = parseInt(strLength - (strLength / 8) * 2); // 图片尺寸 用于判断
  354. let size = (fileLength / 1024).toFixed(2);
  355. console.log(size); // 上传拍照信息 调用接口上传图片 .........
  356. // this.detArr.push(imgBase64);
  357. var json = { name: "", img: [] };
  358. this.number = this.number + 1;
  359. this.upName = "";
  360. json.img.push(imgBase64);
  361. this.sampleArr.push(json);
  362. this.updateMessage = true;
  363. },
  364. // 关闭摄像头
  365. closeCamera() {
  366. // if (!this.$refs["video"].srcObject) {
  367. // this.isCamera = false;
  368. // return;
  369. // }
  370. // let stream = this.$refs["video"].srcObject;
  371. // let tracks = stream.getTracks();
  372. // tracks.forEach((track) => {
  373. // track.stop();
  374. // });
  375. // this.$refs["video"].srcObject = null;
  376. this.isCamera = false;
  377. this.isZuan = false;
  378. clearInterval(this.timer);
  379. this.timer = null;
  380. this.hand = 0;
  381. },
  382. async fnInit() {
  383. const model = handPoseDetection.SupportedModels.MediaPipeHands;
  384. const detectorConfig = {
  385. runtime: "mediapipe", // or 'tfjs'
  386. modelType: "full",
  387. // solutionPath: `https://cdn.jsdelivr.net/npm/@mediapipe/hands@${mpHands.VERSION}`,
  388. solutionPath: `/static/hands`,
  389. };
  390. this.detector = await handPoseDetection.createDetector(
  391. model,
  392. detectorConfig
  393. );
  394. this.callCamera();
  395. },
  396. async fnsample() {
  397. const labeledFaceDescriptors = await Promise.all(
  398. this.sampleArr.map(async (item) => {
  399. // 临时图片转码数据,将图片对象转数据矩阵对象
  400. let descriptors = [];
  401. for (let image of item.img) {
  402. const imageEl = await faceapi.fetchImage(image);
  403. descriptors.push(await faceapi.computeFaceDescriptor(imageEl));
  404. }
  405. // 返回图片用户和图片转码数组
  406. return new faceapi.LabeledFaceDescriptors(item.name, descriptors);
  407. })
  408. );
  409. // 人脸匹配矩阵数组对象转码结果
  410. this.faceMatcher = new faceapi.FaceMatcher(labeledFaceDescriptors);
  411. },
  412. // 执行遍历识别匹配图片,数值误差越小越精确
  413. fnRun() {
  414. let ctx = this.$refs["canvas"].getContext("2d");
  415. // 把当前视频帧内容渲染到canvas上
  416. ctx.drawImage(this.$refs["video"], 0, 0, 300, 240);
  417. // 转base64格式、图片格式转换、图片质量压缩
  418. let imgBase64 = this.$refs["canvas"].toDataURL("image/jpeg", 0.7); // 由字节转换为KB 判断大小
  419. this.detArr = [];
  420. this.detArr.push(imgBase64);
  421. this.detArr.forEach(async (img) => {
  422. let ts = Date.now();
  423. // 将图片对象转数据矩阵对象,进行匹配
  424. const inputEl = await faceapi.fetchImage(img);
  425. const inputDescriptor = await faceapi.computeFaceDescriptor(inputEl);
  426. const bestMatch = await this.faceMatcher.findBestMatch(inputDescriptor);
  427. // 结果
  428. this.resultArr = [];
  429. this.resultArr.push({
  430. target: img,
  431. result: bestMatch.toString(),
  432. time: Date.now() - ts + "ms",
  433. fps: Math.round(1000 / (Date.now() - ts)),
  434. });
  435. console.log(this.resultArr);
  436. var a = document.getElementsByClassName("pFace");
  437. for (var i = 0; i < this.sampleArr.length; i++) {
  438. if (this.sampleArr[i].name == bestMatch.label) {
  439. // this.closeUpdateMessage = true;
  440. // if (this.change == 1) {
  441. // this.resultImg.name = this.upName;
  442. // } else {
  443. // this.resultImg.name = this.sampleArr[i].name;
  444. // }
  445. this.isdetected = "已识别到" + this.sampleArr[i].name + "的图片";
  446. this.shibieImg = this.sampleArr[i].img[0];
  447. if (this.shibieImg.length > 0) {
  448. a[0].style.width = "300px";
  449. }
  450. this.resultImg.img[0] = this.sampleArr[i].img[0];
  451. }
  452. }
  453. });
  454. },
  455. handleClose(done) {
  456. done();
  457. },
  458. // 更换匹配图
  459. async fnChange(e) {
  460. if (!e.target.files.length) return;
  461. this.detArr = [];
  462. this.resultArr = [];
  463. // 将文件显示为图像并识别
  464. e.target.files.forEach(async (file) => {
  465. let ts = Date.now();
  466. let img = await faceapi.bufferToImage(file);
  467. const inputDescriptor = await faceapi.computeFaceDescriptor(img);
  468. const bestMatch = await this.faceMatcher.findBestMatch(inputDescriptor);
  469. // 结果
  470. this.detArr.push(img.src);
  471. this.resultArr.push({
  472. target: file.name,
  473. result: bestMatch.toString(),
  474. time: Date.now() - ts + "ms",
  475. fps: Math.round(1000 / (Date.now() - ts)),
  476. });
  477. });
  478. },
  479. blocklyInit() {
  480. this.workspace = Blockly.inject("blocklyDiv", {
  481. //工具栏
  482. toolbox: document.getElementById("toolbox"),
  483. //网格效果
  484. grid: { spacing: 20, length: 3, colour: "#ccc", snap: true },
  485. //媒体资源
  486. media: "../assets/img/",
  487. //垃圾桶
  488. trashcan: true,
  489. });
  490. //工作区监听代码生成器
  491. this.workspace.addChangeListener(this.myUpdateFunction);
  492. Blockly.Blocks["iot_lcd_screeninit"] = {
  493. init: function () {
  494. this.appendDummyInput().appendField(
  495. new Blockly.FieldImage(
  496. require("../assets/img/screen_init_header.png"),
  497. 45,
  498. 45
  499. )
  500. );
  501. this.appendDummyInput().appendField("LCD屏幕打开");
  502. this.setInputsInline(false);
  503. this.setPreviousStatement(true);
  504. this.setNextStatement(true);
  505. this.setColour("#5cb2d6");
  506. this.setTooltip("");
  507. this.setHelpUrl("");
  508. },
  509. };
  510. Blockly.JavaScript.iot_lcd_screeninit = function (block) {
  511. var _code = "screen=1;";
  512. return _code;
  513. };
  514. Blockly.Blocks["iot_lcd_faceinit"] = {
  515. init: function () {
  516. this.appendDummyInput().appendField(
  517. new Blockly.FieldImage(
  518. require("../assets/img/face_recognition_header.png"),
  519. 45,
  520. 45
  521. )
  522. );
  523. this.appendDummyInput().appendField("人脸辨识");
  524. this.setInputsInline(false);
  525. this.setPreviousStatement(true);
  526. this.setNextStatement(true);
  527. this.setColour("#ee783a");
  528. this.setTooltip("");
  529. this.setHelpUrl("");
  530. },
  531. };
  532. Blockly.JavaScript.iot_lcd_faceinit = function (block) {
  533. var _code = "face=1;";
  534. return _code;
  535. };
  536. Blockly.Blocks["iot_lcd_policeinit"] = {
  537. init: function () {
  538. this.appendDummyInput().appendField(
  539. new Blockly.FieldImage(
  540. require("../assets/img/screen_init_header.png"),
  541. 45,
  542. 45
  543. )
  544. );
  545. this.appendDummyInput().appendField("电子警察组件");
  546. this.setInputsInline(false);
  547. this.setPreviousStatement(true);
  548. this.setNextStatement(true);
  549. this.setColour("#1b5873");
  550. this.setTooltip("");
  551. this.setHelpUrl("");
  552. },
  553. };
  554. Blockly.JavaScript.iot_lcd_policeinit = function (block) {
  555. var _code = "police=1;";
  556. return _code;
  557. };
  558. Blockly.Blocks["iot_lcd_trunLeftinit"] = {
  559. init: function () {
  560. this.appendDummyInput().appendField("向左移动");
  561. this.setInputsInline(false);
  562. this.setPreviousStatement(true);
  563. this.setNextStatement(true);
  564. this.setColour("#1b5873");
  565. this.setTooltip("");
  566. this.setHelpUrl("");
  567. },
  568. };
  569. Blockly.JavaScript.iot_lcd_trunLeftinit = function (block) {
  570. var _code = "trunLeft=1;";
  571. return _code;
  572. };
  573. Blockly.Blocks["iot_lcd_trunRightinit"] = {
  574. init: function () {
  575. this.appendDummyInput().appendField("向右移动");
  576. this.setInputsInline(false);
  577. this.setPreviousStatement(true);
  578. this.setNextStatement(true);
  579. this.setColour("#1b5873");
  580. this.setTooltip("");
  581. this.setHelpUrl("");
  582. },
  583. };
  584. Blockly.JavaScript.iot_lcd_trunRightinit = function (block) {
  585. var _code = "trunRight=1;";
  586. return _code;
  587. };
  588. var that = this;
  589. window.addEventListener("message", function (e) {
  590. // 监听 message 事件
  591. if (e.data.success) {
  592. that.loading = true;
  593. that.$refs.unityvue.contentWindow.postMessage(
  594. { type: that.type },
  595. "*"
  596. );
  597. }
  598. if (e.data.active) {
  599. that.active = true;
  600. } else if (e.data.active != undefined) {
  601. that.active = false;
  602. }
  603. if (e.data.noCamera) {
  604. that.$message.error(e.data.noCamera);
  605. }
  606. });
  607. },
  608. },
  609. mounted() {
  610. this.blocklyInit();
  611. this.fnInit();
  612. this.videoEl = this.$refs.video;
  613. this.canvasEL = this.$refs.canvasDOM;
  614. },
  615. };
  616. </script>
  617. <style scoped>
  618. html,
  619. body {
  620. margin: 0;
  621. padding: 0;
  622. width: 100%;
  623. }
  624. .dialog_diy >>> .el-form-item__label {
  625. width: 50px !important;
  626. margin-left: 35px !important;
  627. }
  628. .dialog_diy >>> .el-form-item__content {
  629. margin-left: 0 !important;
  630. }
  631. .update {
  632. margin-left: 20%;
  633. font-size: 16px !important;
  634. }
  635. .tip {
  636. margin: 25px 0 30px 20px;
  637. }
  638. #fan > img,
  639. #fanB > img,
  640. #motor > img,
  641. #base > img,
  642. #line > img,
  643. .right > img,
  644. #a4 > img,
  645. #screan > img {
  646. width: 100%;
  647. height: 100%;
  648. user-select: none;
  649. }
  650. .img {
  651. display: flex;
  652. flex-direction: row;
  653. justify-content: flex-start;
  654. justify-content: center;
  655. width: 100%;
  656. height: 500px;
  657. position: relative;
  658. }
  659. #fan {
  660. width: 425px;
  661. position: absolute;
  662. z-index: 5;
  663. left: 150px;
  664. top: 0;
  665. transition: all 0.5s;
  666. transform: rotate(0deg);
  667. }
  668. #fanB {
  669. width: 116.6px;
  670. position: absolute;
  671. z-index: 4;
  672. left: 300px;
  673. top: 155px;
  674. }
  675. #base {
  676. width: 423.33px;
  677. position: absolute;
  678. z-index: 4;
  679. top: 295px;
  680. left: 0;
  681. }
  682. #motor {
  683. width: 134.16px;
  684. position: absolute;
  685. z-index: 3;
  686. left: 292px;
  687. top: 175px;
  688. }
  689. #a4 {
  690. width: 210px;
  691. position: absolute;
  692. z-index: 5;
  693. top: 517px;
  694. left: 111px;
  695. }
  696. #screan {
  697. width: 178.33px;
  698. position: absolute;
  699. left: -19px;
  700. top: 126px;
  701. }
  702. #line {
  703. width: 470.83px;
  704. position: absolute;
  705. z-index: 2;
  706. top: 245px;
  707. left: -113px;
  708. }
  709. .button {
  710. color: #fff;
  711. background: #8ca1de;
  712. width: 550px;
  713. height: 55px;
  714. font-size: 20px;
  715. text-align: center;
  716. line-height: 55px;
  717. position: absolute;
  718. bottom: 10%;
  719. left: 50%;
  720. transform: translateX(-50%);
  721. user-select: none;
  722. }
  723. .right {
  724. width: 40px;
  725. position: absolute;
  726. left: 55%;
  727. top: 70%;
  728. display: none;
  729. }
  730. .dark {
  731. background: #5b79d0;
  732. cursor: pointer;
  733. }
  734. .controlZ {
  735. width: 560px;
  736. height: 620px;
  737. /* margin-left: calc(50% - (490px / 2)); */
  738. position: relative;
  739. }
  740. .cameraZ {
  741. display: flex;
  742. height: 340px;
  743. flex-direction: column;
  744. flex-wrap: nowrap;
  745. width: 300px;
  746. }
  747. .cameraBtn {
  748. display: flex;
  749. flex-direction: column;
  750. align-items: center;
  751. }
  752. .cameraBtn button {
  753. margin: 0 0 10px 0;
  754. }
  755. .face {
  756. position: absolute;
  757. z-index: 9999;
  758. padding: 5px 0px;
  759. left: 0;
  760. top: 37px;
  761. }
  762. .kuang {
  763. position: absolute;
  764. z-index: 10000;
  765. padding: 26.5px 0;
  766. left: 0;
  767. top: 37px;
  768. }
  769. .pFace {
  770. /* width: 300px; */
  771. /* height: 240px; */
  772. width: 150px;
  773. margin: 0 auto;
  774. margin-top: 220px;
  775. }
  776. .close > img,
  777. .save > img,
  778. .pFace > img,
  779. .open > img,
  780. .spotPhoto > img {
  781. width: 100%;
  782. height: 100%;
  783. cursor: pointer;
  784. }
  785. .cameraBtn {
  786. margin-top: 80px;
  787. }
  788. .close {
  789. margin-bottom: 25px;
  790. }
  791. .isPhoto {
  792. height: 410px;
  793. padding: 80px 0 0 0;
  794. box-sizing: border-box;
  795. background: #fff;
  796. }
  797. .isPhoto > span {
  798. font-size: 25px;
  799. color: #ccc;
  800. margin-left: 10px;
  801. }
  802. .nav {
  803. text-align: center;
  804. font-size: 32px;
  805. color: #ccc;
  806. }
  807. .spot {
  808. background: #64ff64;
  809. color: #fff;
  810. width: 140px;
  811. height: 40px;
  812. text-align: center;
  813. line-height: 40px;
  814. border-radius: 20px;
  815. margin-top: 25px;
  816. cursor: pointer;
  817. display: none;
  818. }
  819. .spotNumber {
  820. text-align: center;
  821. margin: 0 auto;
  822. font-size: 20px;
  823. color: #8c8c8c;
  824. }
  825. .spotPhoto {
  826. width: 300px;
  827. height: 245px;
  828. }
  829. .spotPhoto {
  830. margin-top: 20px;
  831. font-size: 20px;
  832. }
  833. .gdt {
  834. display: flex;
  835. flex-direction: column;
  836. }
  837. .ablockly,
  838. #blocklyDiv {
  839. height: 100%;
  840. width: 100%;
  841. }
  842. .blocklySvg {
  843. height: 905px !important;
  844. }
  845. .ablockly {
  846. position: relative;
  847. }
  848. .container {
  849. width: 50%;
  850. height: 100%;
  851. min-width: 960px;
  852. }
  853. </style>