doorAnimate.vue 11 KB

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