functionFan2.vue 22 KB

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