doorAnimate.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <view style="width: 100%; height: 100%">
  3. <div class="door-container">
  4. <div style="display: flex" v-show="doorcount == 1">
  5. <div class="door1" v-show="doorcount == 1" :style="{ height: height }">
  6. <div
  7. class="left_door"
  8. v-bind:class="
  9. gatestate1 == '1' ||
  10. gatestate1 == '开启' ||
  11. gatestate1 == '打开' ||
  12. gatestate1 == 'true'
  13. ? 'open_left'
  14. : 'close_left'
  15. "
  16. id="leftdoor1"
  17. ></div>
  18. <div class="doortitle">风门</div>
  19. <div
  20. class="right_door"
  21. v-bind:class="
  22. gatestate1 == '1' ||
  23. gatestate1 == '开启' ||
  24. gatestate1 == '打开' ||
  25. gatestate1 == 'true'
  26. ? 'open_right'
  27. : 'close_right'
  28. "
  29. id="rightdoor1"
  30. ></div>
  31. </div>
  32. <div></div>
  33. </div>
  34. <div
  35. style="
  36. background: linear-gradient(
  37. to right,
  38. rgba(55, 135, 254, 0.08),
  39. rgba(4, 184, 255, 0.08),
  40. rgba(60, 161, 237, 0.08)
  41. );
  42. background-size: 100% 100%;
  43. background-repeat: no-repeat;
  44. "
  45. v-show="doorcount == 2"
  46. >
  47. <div class="door2" v-show="doorcount == 2" :style="{ height: height }">
  48. <div
  49. class="left_door"
  50. v-bind:class="
  51. gatestate1 == '1' ||
  52. gatestate1 == '开启' ||
  53. gatestate1 == '打开' ||
  54. gatestate1 == 'true'
  55. ? 'open_left'
  56. : 'close_left'
  57. "
  58. id="leftdoor2"
  59. ></div>
  60. <div class="doortitle">前门</div>
  61. <div
  62. class="right_door"
  63. v-bind:class="
  64. gatestate1 == '1' ||
  65. gatestate1 == '开启' ||
  66. gatestate1 == '打开' ||
  67. gatestate1 == 'true'
  68. ? 'open_right'
  69. : 'close_right'
  70. "
  71. id="rightdoor2"
  72. ></div>
  73. </div>
  74. <div class="door2" v-show="doorcount == 2" :style="{ height: height }">
  75. <div
  76. class="left_door"
  77. v-bind:class="
  78. gatestate3 == '1' ||
  79. gatestate3 == '开启' ||
  80. gatestate3 == '打开' ||
  81. gatestate3 == 'true'
  82. ? 'open_left'
  83. : 'close_left'
  84. "
  85. id="leftdoor3"
  86. ></div>
  87. <div class="doortitle">后门</div>
  88. <div
  89. class="right_door"
  90. v-bind:class="
  91. gatestate3 == '1' ||
  92. gatestate3 == '开启' ||
  93. gatestate3 == '打开' ||
  94. gatestate3 == 'true'
  95. ? 'open_right'
  96. : 'close_right'
  97. "
  98. id="rightdoor3"
  99. ></div>
  100. </div>
  101. </div>
  102. <div style="" v-show="doorcount == 3">
  103. <div class="door3" v-show="doorcount == 3" :style="{ height: height }">
  104. <div
  105. class="left_door"
  106. v-bind:class="
  107. gatestate1 == '1' ||
  108. gatestate1 == '开启' ||
  109. gatestate1 == '打开' ||
  110. gatestate1 == 'true'
  111. ? 'open_left'
  112. : 'close_left'
  113. "
  114. id="leftdoor4"
  115. ></div>
  116. <div class="doortitle">前门</div>
  117. <div
  118. class="right_door"
  119. v-bind:class="
  120. gatestate1 == '1' ||
  121. gatestate1 == '开启' ||
  122. gatestate1 == '打开' ||
  123. gatestate1 == 'true'
  124. ? 'open_right'
  125. : 'close_right'
  126. "
  127. id="rightdoor4"
  128. ></div>
  129. </div>
  130. <div class="door3" v-show="doorcount == 3" :style="{ height: height }">
  131. <div
  132. class="left_door"
  133. v-bind:class="
  134. gatestate2 == '1' ||
  135. gatestate2 == '开启' ||
  136. gatestate2 == '打开' ||
  137. gatestate2 == 'true'
  138. ? 'open_left'
  139. : 'close_left'
  140. "
  141. id="leftdoor5"
  142. ></div>
  143. <div class="doortitle">中门</div>
  144. <div
  145. class="right_door"
  146. v-bind:class="
  147. gatestate2 == '1' ||
  148. gatestate2 == '开启' ||
  149. gatestate2 == '打开' ||
  150. gatestate2 == 'true'
  151. ? 'open_right'
  152. : 'close_right'
  153. "
  154. id="rightdoor5"
  155. ></div>
  156. </div>
  157. <div class="door3" v-show="doorcount == 3" :style="{ height: height }">
  158. <div
  159. class="left_door"
  160. v-bind:class="
  161. gatestate3 == '1' ||
  162. gatestate3 == '开启' ||
  163. gatestate3 == '打开' ||
  164. gatestate3 == 'true'
  165. ? 'open_left'
  166. : 'close_left'
  167. "
  168. id="leftdoor6"
  169. ></div>
  170. <div class="doortitle">后门</div>
  171. <div
  172. class="right_door"
  173. v-bind:class="
  174. gatestate3 == '1' ||
  175. gatestate3 == '开启' ||
  176. gatestate3 == '打开' ||
  177. gatestate3 == 'true'
  178. ? 'open_right'
  179. : 'close_right'
  180. "
  181. id="rightdoor6"
  182. ></div>
  183. </div>
  184. <div>
  185. <!-- <video
  186. v-if="item.type == 'flv'"
  187. :id="'cameraElement' + item.id"
  188. muted
  189. autoplay
  190. controls
  191. width="100%"
  192. height="100%"
  193. style="width: 100%"
  194. ></video> -->
  195. </div>
  196. </div>
  197. <div style="" v-show="doorcount == 4">
  198. <div class="door4" v-show="doorcount == 4" :style="{ height: height }">
  199. <div
  200. class="left_door"
  201. v-bind:class="
  202. gatestate1 == '1' ||
  203. gatestate1 == '开启' ||
  204. gatestate1 == '打开' ||
  205. gatestate1 == 'true'
  206. ? 'open_left'
  207. : 'close_left'
  208. "
  209. id="leftdoor7"
  210. ></div>
  211. <div class="doortitle">1号门</div>
  212. <div
  213. class="right_door"
  214. v-bind:class="
  215. gatestate1 == '1' ||
  216. gatestate1 == '开启' ||
  217. gatestate1 == '打开' ||
  218. gatestate1 == 'true'
  219. ? 'open_right'
  220. : 'close_right'
  221. "
  222. id="rightdoor7"
  223. ></div>
  224. </div>
  225. <div class="door4" v-show="doorcount == 4" :style="{ height: height }">
  226. <div
  227. class="left_door"
  228. v-bind:class="
  229. gatestate2 == '1' ||
  230. gatestate2 == '开启' ||
  231. gatestate2 == '打开' ||
  232. gatestate2 == 'true'
  233. ? 'open_left'
  234. : 'close_left'
  235. "
  236. id="leftdoor8"
  237. ></div>
  238. <div class="doortitle">2号门</div>
  239. <div
  240. class="right_door"
  241. v-bind:class="
  242. gatestate2 == '1' ||
  243. gatestate2 == '开启' ||
  244. gatestate2 == '打开' ||
  245. gatestate2 == 'true'
  246. ? 'open_right'
  247. : 'close_right'
  248. "
  249. id="rightdoor8"
  250. ></div>
  251. </div>
  252. <div class="door4" v-show="doorcount == 4" :style="{ height: height }">
  253. <div
  254. class="left_door"
  255. v-bind:class="
  256. gatestate3 == '1' ||
  257. gatestate3 == '开启' ||
  258. gatestate3 == '打开' ||
  259. gatestate3 == 'true'
  260. ? 'open_left'
  261. : 'close_left'
  262. "
  263. id="leftdoor9"
  264. ></div>
  265. <div class="doortitle">3号门</div>
  266. <div
  267. class="right_door"
  268. v-bind:class="
  269. gatestate3 == '1' ||
  270. gatestate3 == '开启' ||
  271. gatestate3 == '打开' ||
  272. gatestate3 == 'true'
  273. ? 'open_right'
  274. : 'close_right'
  275. "
  276. id="rightdoor9"
  277. ></div>
  278. </div>
  279. <div class="door4" v-show="doorcount == 4" :style="{ height: height }">
  280. <div
  281. class="left_door"
  282. v-bind:class="
  283. gatestate4 == '1' ||
  284. gatestate4 == '开启' ||
  285. gatestate4 == '打开' ||
  286. gatestate4 == 'true'
  287. ? 'open_left'
  288. : 'close_left'
  289. "
  290. id="leftdoor10"
  291. ></div>
  292. <div class="doortitle">4号门</div>
  293. <div
  294. class="right_door"
  295. v-bind:class="
  296. gatestate4 == '1' ||
  297. gatestate4 == '开启' ||
  298. gatestate4 == '打开' ||
  299. gatestate4 == 'true'
  300. ? 'open_right'
  301. : 'close_right'
  302. "
  303. id="rightdoor10"
  304. ></div>
  305. </div>
  306. <div>
  307. <!-- <video
  308. v-if="item.type == 'flv'"
  309. :id="'cameraElement' + item.id"
  310. muted
  311. autoplay
  312. controls
  313. width="100%"
  314. height="100%"
  315. style="width: 100%"
  316. ></video> -->
  317. </div>
  318. </div>
  319. </div>
  320. </view>
  321. </template>
  322. <script>
  323. export default {
  324. data() {
  325. return {
  326. rows: [], //分行
  327. height: "200px",
  328. videoDeviceId: "",
  329. flvPlayer: [],
  330. VideoDeviceUrl: "",
  331. videoList: [],
  332. num: 1, //摄像头个数
  333. columnNum: 1, //列数
  334. columSpan: 24, //列块
  335. };
  336. },
  337. props: [
  338. "gatestate1",
  339. "gatestate2",
  340. "gatestate3",
  341. "gatestate4",
  342. "doorcount",
  343. "cameralist",
  344. ],
  345. methods: {},
  346. watch: {
  347. doorcount(val) {
  348. if (val == 1) {
  349. this.height = "180px";
  350. }
  351. if (val == 2) {
  352. this.height = "180px";
  353. }
  354. if (val == 3) {
  355. this.height = "110px";
  356. }
  357. if (val == 4) {
  358. this.height = "180px";
  359. }
  360. },
  361. },
  362. };
  363. </script>
  364. <style scoped>
  365. /*门里面*/
  366. div.door1 {
  367. width: 50%;
  368. float: left;
  369. margin-left: 20%;
  370. background-image: url(/static/door.png);
  371. background-size: 100% 100%;
  372. perspective: 800px;
  373. }
  374. div.door2 {
  375. width: 50%;
  376. float: left;
  377. background-image: url(/static/door.png);
  378. background-size: 100% 100%;
  379. perspective: 800px;
  380. }
  381. div.door3 {
  382. width: 33.3%;
  383. float: left;
  384. background-image: url(/static/door.png);
  385. background-size: 100% 100%;
  386. perspective: 400px;
  387. }
  388. div.door4 {
  389. width: 50%;
  390. float: left;
  391. background-image: url(/static/door.png);
  392. background-size: 100% 100%;
  393. perspective: 800px;
  394. }
  395. /*左门/右门*/
  396. div.left_door {
  397. top: 12%;
  398. left: 10%;
  399. width: 40.5%;
  400. height: 78%;
  401. box-sizing: border-box;
  402. float: left;
  403. z-index: 1;
  404. position: absolute;
  405. transition: all 2s ease;
  406. background-image: url(/static/left.png);
  407. background-size: 100% 100%;
  408. }
  409. div.right_door {
  410. top: 12%;
  411. right: 10%;
  412. width: 40.2%;
  413. height: 78%;
  414. box-sizing: border-box;
  415. float: left;
  416. z-index: 1;
  417. position: absolute;
  418. transition: all 2s ease;
  419. background-image: url(/static/left.png);
  420. background-size: 100% 100%;
  421. }
  422. div.left_door {
  423. transform-origin: left center;
  424. border-right: 1px solid rgb(8, 8, 8);
  425. }
  426. div.right_door {
  427. transform-origin: right center;
  428. border-left: 1px solid rgb(8, 8, 8);
  429. }
  430. .open_left {
  431. transform: rotateY(100deg);
  432. }
  433. .open_right {
  434. transform: rotateY(-100deg);
  435. }
  436. .close_left {
  437. transform: rotateY(0);
  438. }
  439. .close_right {
  440. transform: rotateY(0deg);
  441. }
  442. /*使用css变形功能
  443. div.door:hover div.left_door{
  444. transform:rotateY(100deg);
  445. }
  446. div.door:hover div.right_door{
  447. transform:rotateY(-100deg);
  448. }*/
  449. .doortitle {
  450. position: absolute;
  451. top: 50%;
  452. left: 50%;
  453. transform: translate(-50%, -50%);
  454. font-size: 20px;
  455. color: #677799;
  456. z-index: 999;
  457. text-align: center;
  458. }
  459. </style>