doorAnimate.vue 11 KB

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