doorAnimate.vue 11 KB

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