previewPicture.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. <template>
  2. <div class="pop-up-main">
  3. <div class="paln-box">
  4. <div class="movableItem" :style="{width:width,height:height}" @mousewheel="rollImg($event)"
  5. @mousedown="drag($event,1)" ref="bigImage">
  6. <!-- 图片不可选中 或不可拖拽到新标签打开-->
  7. <slot name="svg" oncontextmenu="return false;" onselectstart="return false;" draggable="false"></slot>
  8. <template v-if="isEdit &&iconWidth">
  9. <img ref="signImage" :src="iconImgUrl" @mousedown="dragSign($event,key)"
  10. v-for="(item,key) in equipment" :key="key"
  11. :style="{top:equipment[key].top+'%',left:equipment[key].left+'%',width:iconWidth,height:iconHeight}"
  12. class="equipment" />
  13. </template>
  14. <el-popover width="200" placement="bottom-start" trigger="hover" :close-delay="100" content="暂无描述"
  15. v-else-if="!isEdit&&iconWidth &&arrIcon.length==equipment.length " v-for="(item,key) in equipment"
  16. :key="key" popper-class="preview-popover">
  17. <!-- &&arrIcon.length==equipment.length -->
  18. <template>
  19. <div v-if="equipment[key].describe" class="describe">
  20. <p class="describe-top">{{equipment[key].describe.deviceName}}</p>
  21. <p class="describe-center">{{equipment[key].describe.remark}}</p>
  22. <p class="describe-bottom">{{equipment[key].describe.location}}</p>
  23. </div>
  24. </template>
  25. <!-- <img oncontextmenu="return false;" onselectstart="return false;" draggable="false" slot="reference"
  26. ref="signImage" :src="$baseUrl + equipment[key].iconImgUrl"
  27. :style="{top:equipment[key].top+'%',left:equipment[key].left+'%',width:arrIcon[key].iconWidth,height:arrIcon[key].iconHeight}"
  28. class="equipment" /> -->
  29. </el-popover>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. export default {
  36. props: {
  37. equipment: {
  38. type: Array,
  39. default: () => {
  40. return [{
  41. iconImgUrl: "",
  42. top: 0,
  43. left: 0,
  44. }, ];
  45. },
  46. },
  47. isEdit: {
  48. default: false,
  49. },
  50. imgUrl: {},
  51. },
  52. data() {
  53. return {
  54. // 定时器
  55. timer: "",
  56. // 图片加载失败
  57. imgOnerror: false,
  58. imgIndex: 0,
  59. isChange: true,
  60. // 图片显示默认大小
  61. width: "1400px",
  62. height: "800px",
  63. // 可缩小倍数,为空则可无限缩小
  64. minification: 3,
  65. // 可放大倍数 为空则可无限放大
  66. magnification: "",
  67. bigMaxWidth: 1600,
  68. bigMaxHeight: 800,
  69. // 小图标信息
  70. iconImgUrl: "",
  71. iconWidth: "",
  72. // 存储每个小图标处理好的宽高
  73. iconHeight: "",
  74. arrIcon: [],
  75. iconMaxWidth: 32,
  76. iconMaxHeight: 32,
  77. tog: 1,
  78. };
  79. },
  80. methods: {
  81. // 获取图片大小
  82. getImgInfo(
  83. imgUrl,
  84. MaxWidth,
  85. MaxHeight,
  86. StrWidth,
  87. StrHeight,
  88. Array = false,
  89. arr,
  90. num = 0
  91. ) {
  92. var img = new Image();
  93. // img.src = imgUrl;
  94. img = document.getElementsByClassName("svg")
  95. let _this = this;
  96. img.onerror = () => {
  97. // console.log("加载失败!!", _this.arrIcon.length);
  98. // console.log(imgUrl, MaxWidth, MaxHeight, StrWidth, StrHeight);
  99. _this.imgOnerror = true;
  100. _this.imgIndex =
  101. _this.arrIcon.length - 1 < 0 ? 0 : _this.arrIcon.length - 1;
  102. this.timer = setTimeout(() => {
  103. if (num <= 5) {
  104. _this.getImgInfo(
  105. imgUrl,
  106. MaxWidth,
  107. MaxHeight,
  108. StrWidth,
  109. StrHeight,
  110. Array,
  111. arr,
  112. num + 1
  113. );
  114. }
  115. clearInterval(this.timer);
  116. }, 2000);
  117. };
  118. img.onload = function(e) {
  119. // 显示时 初始 最大宽度
  120. let maxWidth = MaxWidth;
  121. // 显示时 初始 最大高度
  122. let maxHeight = MaxHeight;
  123. if (
  124. e.path[0].naturalWidth <= maxWidth &&
  125. e.path[0].naturalHeight <= maxHeight
  126. ) {
  127. _this[StrWidth] = e.path[0].naturalWidth + "px";
  128. _this[StrHeight] = e.path[0].naturalHeight + "px";
  129. } else {
  130. _this[StrWidth] = e.path[0].naturalWidth + "px";
  131. _this[StrHeight] = e.path[0].naturalHeight + "px";
  132. if (
  133. e.path[0].naturalWidth > maxWidth &&
  134. e.path[0].naturalHeight <= maxHeight
  135. ) {
  136. let ratio = e.path[0].naturalWidth / e.path[0].naturalHeight;
  137. _this[StrWidth] = "1600px";
  138. _this[StrHeight] = maxWidth / ratio + "px";
  139. } else if (
  140. e.path[0].naturalWidth <= maxWidth &&
  141. e.path[0].naturalHeight > maxHeight
  142. ) {
  143. let ratio = e.path[0].naturalWidth / e.path[0].naturalHeight;
  144. _this[StrWidth] = maxHeight * ratio + "px";
  145. _this[StrHeight] = "800px";
  146. } else if (
  147. e.path[0].naturalWidth > maxWidth &&
  148. e.path[0].naturalHeight > maxHeight
  149. ) {
  150. let ratio = e.path[0].naturalWidth / e.path[0].naturalHeight;
  151. let w = maxWidth;
  152. let h = w / ratio;
  153. if (h > maxHeight) {
  154. let ratio2 = w / h;
  155. h = maxHeight;
  156. w = h * ratio2;
  157. }
  158. _this[StrWidth] = w + "px";
  159. _this[StrHeight] = h + "px";
  160. }
  161. }
  162. if (Array) {
  163. _this[arr].push({
  164. iconWidth: _this[StrWidth],
  165. iconHeight: _this[StrHeight],
  166. });
  167. // console.log(
  168. // "tow#################################arrIcon",
  169. // _this[arr].length
  170. // );
  171. }
  172. // _this[StrWidth] = `${e.path[0].naturalWidth}px`;
  173. // _this[StrHeight] = `${e.path[0].naturalHeight}px`;
  174. // vm.$set(vm.imgInfo, "width", img.width);
  175. // vm.$set(vm.imgInfo, "height", img.height);
  176. // console.log("打印图片信息", imgUrl, _this[StrWidth], _this[StrHeight]); // 打印图片信息
  177. // console.log("打印图片信息", e.path[0].naturalHeight); // 打印图片信息
  178. // console.log("打印图片信息", e); // 打印图片信息
  179. // console.log("打印图片信息this.width", _this[StrWidth]); // 打印图片信息
  180. // console.log("打印图片信息this.height", _this[StrHeight]); // 打印图片信息
  181. };
  182. },
  183. // 缩放
  184. rollImg() {
  185. var that = this;
  186. // var oImg = document.getElementsByClassName("movableItem")[0];
  187. var oImg = this.$refs.bigImage;
  188. // console.log(
  189. // "length",
  190. // document.getElementsByClassName("movableItem").length
  191. // );
  192. // console.log("oImg", oImg);
  193. var _this = this;
  194. function fnWheel(obj, fncc) {
  195. obj.onmousewheel = fn;
  196. if (obj.addEventListener) {
  197. obj.addEventListener("DOMMouseScroll", fn, false);
  198. }
  199. function fn(ev) {
  200. var oEvent = ev || window.event;
  201. var down = true;
  202. if (oEvent.detail) {
  203. down = oEvent.detail > 0;
  204. } else {
  205. down = oEvent.wheelDelta < 0;
  206. }
  207. if (fncc) {
  208. fncc.call(this, down, oEvent);
  209. }
  210. if (oEvent.preventDefault) {
  211. oEvent.preventDefault();
  212. }
  213. return false;
  214. }
  215. }
  216. fnWheel(oImg, function(down, oEvent) {
  217. var oldWidth = this.offsetWidth;
  218. var oldHeight = this.offsetHeight;
  219. var oldLeft = this.offsetLeft;
  220. var oldTop = this.offsetTop;
  221. var parent = oEvent.path[2];
  222. // 获取父元素距离页面可视区域的位置
  223. var parentLeft = parent.getBoundingClientRect().left;
  224. var parentTop = parent.getBoundingClientRect().top;
  225. // 比例 = (点击位置距离可视窗口位置 - 父元素距离可视窗口位置 - 相对定位的left)/ 本身宽度
  226. var scaleX = (oEvent.clientX - parentLeft - oldLeft) / oldWidth; //比例
  227. var scaleY = (oEvent.clientY - parentTop - oldTop) / oldHeight;
  228. let nowWidth = this.style.width.split("p")[0];
  229. let initWidth = _this.width.split("p")[0];
  230. let initHeight = _this.height.split("p")[0];
  231. let miniFlag = true;
  232. let magniFlag = true;
  233. if (_this.minification) {
  234. // 限制缩小范围
  235. if (nowWidth <= parseInt(initWidth / _this.minification)) {
  236. miniFlag = false;
  237. // console.log("限制缩小范围");
  238. // console.log(
  239. // "限制缩小范围",
  240. // nowWidth,
  241. // parseInt(initWidth / _this.minification)
  242. // );
  243. this.style.width = parseInt(initWidth / _this.minification) + "px";
  244. this.style.height =
  245. parseInt(initHeight / _this.minification) + "px";
  246. }
  247. if (_this.magnification) {
  248. // 限制放大范围
  249. if (nowWidth >= parseInt(initWidth * _this.magnification)) {
  250. magniFlag = false;
  251. // console.log("限制放大范围");
  252. this.style.width =
  253. parseInt(initWidth * _this.magnification) + "px";
  254. this.style.height =
  255. parseInt(initHeight * _this.magnification) + "px";
  256. }
  257. }
  258. }
  259. if (down && miniFlag) {
  260. this.style.width = parseInt(this.offsetWidth * 0.9) + "px";
  261. this.style.height = parseInt(this.offsetHeight * 0.9) + "px";
  262. that.width = parseInt(this.offsetWidth * 0.9) + "px";
  263. that.height = parseInt(this.offsetHeight * 0.9) + "px";
  264. } else if (!down && magniFlag) {
  265. // console.log("放大");
  266. this.style.width = parseInt(this.offsetWidth * 1.1) + "px";
  267. this.style.height = parseInt(this.offsetHeight * 1.1) + "px";
  268. that.width = parseInt(this.offsetWidth * 1.1) + "px";
  269. that.height = parseInt(this.offsetHeight * 1.1) + "px";
  270. }
  271. var newWidth = this.offsetWidth;
  272. var newHeight = this.offsetHeight;
  273. // 新的相对位置left = 原先的相对位置left - 比例 *(本身新的宽度-旧的宽度)
  274. this.style.left =
  275. Math.round(this.offsetLeft - scaleX * (newWidth - oldWidth)) + "px";
  276. this.style.top =
  277. Math.round(this.offsetTop - scaleY * (newHeight - oldHeight)) + "px";
  278. });
  279. // console.log(that.width)
  280. },
  281. // },
  282. //拖拽
  283. drag(ev) {
  284. // var ie = document.all;
  285. console.log(ev / 0);
  286. var nn6 = document.getElementById && !document.all;
  287. var isdrag = false;
  288. var y, x;
  289. var nTY, nTX;
  290. var oDragObj;
  291. function moveMouse(e) {
  292. if (isdrag) {
  293. oDragObj.style.top =
  294. (nn6 ? nTY + e.clientY - y : nTY + event.clientY - y) + "px";
  295. oDragObj.style.left =
  296. (nn6 ? nTX + e.clientX - x : nTX + event.clientX - x) + "px";
  297. return false;
  298. }
  299. }
  300. function initDrag(e) {
  301. // console.log("点击图片initDrag");
  302. var oDragHandle = nn6 ? e.target : event.srcElement;
  303. var topElement = "HTML";
  304. while (
  305. oDragHandle.tagName != topElement &&
  306. oDragHandle.className != "movableItem"
  307. ) {
  308. oDragHandle = nn6 ?
  309. oDragHandle.parentNode :
  310. oDragHandle.parentElement;
  311. }
  312. if (oDragHandle.className == "movableItem") {
  313. isdrag = true;
  314. oDragObj = oDragHandle;
  315. // 父元素宽高
  316. let width = e.path[2].offsetWidth;
  317. let height = e.path[2].offsetHeight;
  318. // 这里判断第一次获取不到style 样式 默认为 居中50%
  319. if (oDragObj.style.top == "") {
  320. nTY = parseInt((50 * height) / 100 + 0);
  321. nTX = parseInt((50 * width) / 100 + 0);
  322. } else {
  323. nTY = parseInt(oDragObj.style.top + 0);
  324. nTX = parseInt(oDragObj.style.left + 0);
  325. }
  326. y = nn6 ? e.clientY : event.clientY;
  327. x = nn6 ? e.clientX : event.clientX;
  328. oDragObj.style.cursor = "move";
  329. document.onmousemove = moveMouse;
  330. return false;
  331. }
  332. }
  333. document.onmousemove = initDrag;
  334. // document.onmouseup = new Function("isdrag=false");
  335. document.onmouseup = function(e) {
  336. isdrag = false;
  337. document.onmousemove = null;
  338. document.onmouseup = null;
  339. var oDragHandle = nn6 ? e.target : event.srcElement;
  340. var topElement = "HTML";
  341. while (
  342. oDragHandle.tagName != topElement &&
  343. oDragHandle.className != "movableItem"
  344. ) {
  345. oDragHandle = nn6 ?
  346. oDragHandle.parentNode :
  347. oDragHandle.parentElement;
  348. }
  349. if (oDragHandle.className == "movableItem") {
  350. oDragObj = oDragHandle;
  351. oDragObj.style.cursor = "Default";
  352. }
  353. };
  354. ev = event || window.event;
  355. // 取消事件冒泡行为
  356. // window.event ? (window.event.cancelBubble = true) : ev.stopPropagation();
  357. },
  358. // 拖拽标记
  359. // eslint-disable-next-line no-unused-vars
  360. dragSign(ev, key) {
  361. var nn6 = document.getElementById && !document.all;
  362. var isdrag = false;
  363. var y, x;
  364. var nTY, nTX;
  365. var oDragObj;
  366. let _this = this;
  367. function moveMouse(e) {
  368. if (isdrag) {
  369. this.equipmentKey = key;
  370. // console.log("thisequipmentKey", this.equipmentKey);
  371. let widthItem = e.path[1].style.width.split("p");
  372. let heightItem = e.path[1].style.height.split("p");
  373. let width = widthItem[0];
  374. // eslint-disable-next-line no-unused-vars
  375. let height = heightItem[0];
  376. let top =
  377. ((nn6 ?
  378. (nTY / 100) * height + e.clientY - y :
  379. (nTY / 100) * height + event.clientY - y) /
  380. height) *
  381. 100;
  382. let left =
  383. ((nn6 ?
  384. (nTX / 100) * width + e.clientX - x :
  385. (nTX / 100) * width + event.clientX - x) /
  386. width) *
  387. 100;
  388. if (top >= 0 && top <= 100) {
  389. _this.equipment[key].top = top;
  390. }
  391. if (left >= 0 && left <= 100) {
  392. _this.equipment[key].left = left;
  393. }
  394. return false;
  395. }
  396. }
  397. // eslint-disable-next-line no-unused-vars
  398. function initDrag(e) {
  399. // console.log("_this", _this);
  400. var oDragHandle = nn6 ? e.target : event.srcElement;
  401. var topElement = "HTML";
  402. while (
  403. oDragHandle.tagName != topElement &&
  404. oDragHandle.className.indexOf("equipment") == -1
  405. ) {
  406. oDragHandle = nn6 ?
  407. oDragHandle.parentNode :
  408. oDragHandle.parentElement;
  409. }
  410. if (oDragHandle.className.indexOf("equipment") != -1) {
  411. isdrag = true;
  412. oDragObj = oDragHandle;
  413. // 父元素宽高
  414. let width = e.path[1].offsetWidth;
  415. // let height = e.path[1].offsetHeight;
  416. // console.log(width, height);
  417. // console.log("oDragObj.style", oDragObj.style);
  418. // 这里判断第一次获取不到style 样式 默认为 居中50%
  419. if (oDragObj.style.top == "") {
  420. // nTY = parseInt((50 * height) / 100 + 0);
  421. nTY= 0;
  422. nTX = parseInt((50 * width) / 100 + 0);
  423. } else if (oDragObj.style.top.indexOf("%") != -1) {
  424. nTY = oDragObj.style.top.split("%")[0];
  425. nTX = oDragObj.style.left.split("%")[0];
  426. } else {
  427. nTY = parseInt(oDragObj.style.top + 0);
  428. nTX = parseInt(oDragObj.style.left + 0);
  429. }
  430. y = nn6 ? e.clientY : event.clientY;
  431. x = nn6 ? e.clientX : event.clientX;
  432. oDragObj.style.cursor = "move";
  433. document.onmousemove = moveMouse;
  434. return false;
  435. }
  436. }
  437. // document.onmousedown = initDrag;
  438. document.onmousemove = initDrag;
  439. document.onmouseup = function(e) {
  440. isdrag = false;
  441. document.onmousemove = null;
  442. document.onmouseup = null;
  443. var oDragHandle = nn6 ? e.target : event.srcElement;
  444. var topElement = "HTML";
  445. while (
  446. oDragHandle.tagName != topElement &&
  447. oDragHandle.className != "equipment"
  448. ) {
  449. oDragHandle = nn6 ?
  450. oDragHandle.parentNode :
  451. oDragHandle.parentElement;
  452. }
  453. if (oDragHandle.className == "equipment") {
  454. oDragObj = oDragHandle;
  455. oDragObj.style.cursor = "Default";
  456. }
  457. };
  458. // _this.equipmentKey = key;
  459. // _this.equipment[_this.equipmentKey].left = l;
  460. // _this.equipment[_this.equipmentKey].top = t;
  461. ev = event || window.event;
  462. // 取消事件冒泡行为
  463. window.event ? (window.event.cancelBubble = true) : ev.stopPropagation();
  464. },
  465. },
  466. watch: {
  467. equipment() {
  468. if (this.equipment.length != 0) {
  469. this.arrIcon = [];
  470. let finish = true;
  471. this.equipment.filter((item) => {
  472. if (!item.iconImgUrl) {
  473. finish = false;
  474. }
  475. return true;
  476. });
  477. // console.log("finish", finish);
  478. if (finish) {
  479. this.equipment.filter((item, index) => {
  480. if (index >= this.imgIndex) {
  481. console.log("iconImgUrl", this.equipment[index].iconImgUrl);
  482. this.getImgInfo(
  483. this.$baseUrl + item.iconImgUrl,
  484. this.iconMaxWidth,
  485. this.iconMaxHeight,
  486. "iconWidth",
  487. "iconHeight",
  488. true,
  489. "arrIcon"
  490. );
  491. }
  492. console.log("22filter", index);
  493. return true;
  494. });
  495. }
  496. }
  497. },
  498. },
  499. created() {
  500. this.getImgInfo(
  501. this.imgUrl,
  502. this.bigMaxWidth,
  503. this.bigMaxHeight,
  504. "width",
  505. "height"
  506. );
  507. if (this.equipment.length != 0) {
  508. this.arrIcon = [];
  509. let finish = true;
  510. this.equipment.filter((item) => {
  511. if (!item.iconImgUrl) {
  512. finish = false;
  513. }
  514. return true;
  515. });
  516. // console.log("finish", finish);
  517. if (finish) {
  518. this.equipment.filter((item, index) => {
  519. if (index >= this.imgIndex) {
  520. // console.log("iconImgUrl", this.equipment[index].iconImgUrl);
  521. this.getImgInfo(
  522. this.$baseUrl + item.iconImgUrl,
  523. this.iconMaxWidth,
  524. this.iconMaxHeight,
  525. "iconWidth",
  526. "iconHeight",
  527. true,
  528. "arrIcon"
  529. );
  530. }
  531. // console.log("22filter", index);
  532. return true;
  533. });
  534. }
  535. }
  536. this.iconImgUrl = JSON.parse(
  537. JSON.stringify(this.$baseUrl + this.equipment[0].iconImgUrl)
  538. );
  539. // console.log("imgUrl", this.imgUrl);
  540. // console.log("equipment", this.equipment);
  541. // //禁止鼠标右键
  542. // document.oncontextmenu = function() {
  543. // return false;
  544. // };
  545. },
  546. };
  547. </script>
  548. <style lang="less">
  549. .preview-popover {
  550. background-color: #d3edf7dd;
  551. padding: 12px;
  552. .popper__arrow::after {
  553. border-bottom-color: #d3edf7dd !important;
  554. }
  555. .describe {
  556. p {
  557. padding-bottom: 5px;
  558. &:last-child {
  559. padding-bottom: 0px;
  560. }
  561. }
  562. .describe-top {
  563. // color: sandybrown;
  564. // color: red;
  565. color: rgb(21, 110, 110);
  566. }
  567. .describe-center {
  568. color: rgb(79, 21, 206);
  569. }
  570. .describe-bottom {
  571. color: rgb(30, 31, 29);
  572. }
  573. }
  574. }
  575. </style>
  576. <style lang="less" scoped>
  577. .pop-up-main {
  578. width: 100%;
  579. height: calc(100vh - 32vh);
  580. overflow-y:hidden ;
  581. .paln-box {
  582. width: 100%;
  583. height: 100%;
  584. position: relative;
  585. .movableItem {
  586. position: absolute;
  587. // top: 75%;
  588. left: 50%;
  589. transform: translate(-50%, -5%);
  590. img,
  591. .svg {
  592. z-index: 1;
  593. width: 100%;
  594. height: 100%;
  595. }
  596. .equipment {
  597. position: absolute;
  598. top: 0;
  599. left: 0;
  600. transform: translate(-50%, -50%);
  601. z-index: 2;
  602. font-size: 40px;
  603. // color: red;
  604. // background: blue;
  605. zoom: 1;
  606. }
  607. }
  608. .shuaxin {
  609. position: absolute;
  610. z-index: 2;
  611. font-size: 40px;
  612. top: 20px;
  613. left: 20px;
  614. cursor: pointer;
  615. &:hover {
  616. color: yellowgreen;
  617. }
  618. }
  619. .equipment {
  620. color: white;
  621. }
  622. &/deep/.el-button {
  623. z-index: 2;
  624. position: absolute;
  625. bottom: 60px;
  626. right: 20px;
  627. width: 60px;
  628. height: 35px;
  629. span {
  630. display: inline-block;
  631. position: absolute;
  632. top: 50%;
  633. left: 50%;
  634. transform: translate(-50%, -50%);
  635. }
  636. i {
  637. display: inline-block;
  638. position: absolute;
  639. top: 50%;
  640. left: 25%;
  641. transform: translate(-50%, -50%);
  642. }
  643. }
  644. }
  645. }
  646. // body {
  647. // height: 100%;
  648. // overflow: hidden;
  649. // margin: 0;
  650. // padding: 0;
  651. // }
  652. </style>