doorAnimate.vue 12 KB

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