123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485 |
- <template>
- <view style="width: 100%; height: 100%">
- <div class="door-container">
- <div style="display: flex" v-show="doorcount == 1">
- <div class="door1" v-show="doorcount == 1" :style="{ height: height }">
- <div
- class="left_door"
- v-bind:class="
- gatestate1 == '1' ||
- gatestate1 == '开启' ||
- gatestate1 == '打开' ||
- gatestate1 == 'true'
- ? 'open_left'
- : 'close_left'
- "
- id="leftdoor1"
- ></div>
- <div
- class="right_door"
- v-bind:class="
- gatestate1 == '1' ||
- gatestate1 == '开启' ||
- gatestate1 == '打开' ||
- gatestate1 == 'true'
- ? 'open_right'
- : 'close_right'
- "
- id="rightdoor1"
- ></div>
- </div>
- <div>
- <video
- v-if="item.type == 'flv'"
- :id="'cameraElement' + item.id"
- muted
- autoplay
- controls
- width="100%"
- height="100%"
- style="width: 100%"
- ></video>
- </div>
- </div>
- <div style="" v-show="doorcount == 2">
- <div class="door2" v-show="doorcount == 2" :style="{ height: height }">
- <div
- class="left_door"
- v-bind:class="
- gatestate1 == '1' ||
- gatestate1 == '开启' ||
- gatestate1 == '打开' ||
- gatestate1 == 'true'
- ? 'open_left'
- : 'close_left'
- "
- id="leftdoor2"
- ></div>
- <div
- class="right_door"
- v-bind:class="
- gatestate1 == '1' ||
- gatestate1 == '开启' ||
- gatestate1 == '打开' ||
- gatestate1 == 'true'
- ? 'open_right'
- : 'close_right'
- "
- id="rightdoor2"
- ></div>
- </div>
- <div class="door2" v-show="doorcount == 2" :style="{ height: height }">
- <div
- class="left_door"
- v-bind:class="
- gatestate2 == '1' ||
- gatestate2 == '开启' ||
- gatestate2 == '打开' ||
- gatestate2 == 'true'
- ? 'open_left'
- : 'close_left'
- "
- id="leftdoor3"
- ></div>
- <div
- class="right_door"
- v-bind:class="
- gatestate2 == '1' ||
- gatestate2 == '开启' ||
- gatestate2 == '打开' ||
- gatestate2 == 'true'
- ? 'open_right'
- : 'close_right'
- "
- id="rightdoor3"
- ></div>
- </div>
- <div>
- <video
- v-if="item.type == 'flv'"
- :id="'cameraElement' + item.id"
- muted
- autoplay
- controls
- width="100%"
- height="100%"
- style="width: 100%"
- ></video>
- </div>
- </div>
- <div style="" v-show="doorcount == 3">
- <div class="door3" v-show="doorcount == 3" :style="{ height: height }">
- <div
- class="left_door"
- v-bind:class="
- gatestate1 == '1' ||
- gatestate1 == '开启' ||
- gatestate1 == '打开' ||
- gatestate1 == 'true'
- ? 'open_left'
- : 'close_left'
- "
- id="leftdoor4"
- ></div>
- <div
- class="right_door"
- v-bind:class="
- gatestate1 == '1' ||
- gatestate1 == '开启' ||
- gatestate1 == '打开' ||
- gatestate1 == 'true'
- ? 'open_right'
- : 'close_right'
- "
- id="rightdoor4"
- ></div>
- </div>
- <div class="door3" v-show="doorcount == 3" :style="{ height: height }">
- <div
- class="left_door"
- v-bind:class="
- gatestate2 == '1' ||
- gatestate2 == '开启' ||
- gatestate2 == '打开' ||
- gatestate2 == 'true'
- ? 'open_left'
- : 'close_left'
- "
- id="leftdoor5"
- ></div>
- <div
- class="right_door"
- v-bind:class="
- gatestate2 == '1' ||
- gatestate2 == '开启' ||
- gatestate2 == '打开' ||
- gatestate2 == 'true'
- ? 'open_right'
- : 'close_right'
- "
- id="rightdoor5"
- ></div>
- </div>
- <div class="door3" v-show="doorcount == 3" :style="{ height: height }">
- <div
- class="left_door"
- v-bind:class="
- gatestate3 == '1' ||
- gatestate3 == '开启' ||
- gatestate3 == '打开' ||
- gatestate3 == 'true'
- ? 'open_left'
- : 'close_left'
- "
- id="leftdoor6"
- ></div>
- <div
- class="right_door"
- v-bind:class="
- gatestate3 == '1' ||
- gatestate3 == '开启' ||
- gatestate3 == '打开' ||
- gatestate3 == 'true'
- ? 'open_right'
- : 'close_right'
- "
- id="rightdoor6"
- ></div>
- </div>
- <div>
- <video
- v-if="item.type == 'flv'"
- :id="'cameraElement' + item.id"
- muted
- autoplay
- controls
- width="100%"
- height="100%"
- style="width: 100%"
- ></video>
- </div>
- </div>
- <div style="" v-show="doorcount == 4">
- <div class="door4" v-show="doorcount == 4" :style="{ height: height }">
- <div
- class="left_door"
- v-bind:class="
- gatestate1 == '1' ||
- gatestate1 == '开启' ||
- gatestate1 == '打开' ||
- gatestate1 == 'true'
- ? 'open_left'
- : 'close_left'
- "
- id="leftdoor7"
- ></div>
- <div
- class="right_door"
- v-bind:class="
- gatestate1 == '1' ||
- gatestate1 == '开启' ||
- gatestate1 == '打开' ||
- gatestate1 == 'true'
- ? 'open_right'
- : 'close_right'
- "
- id="rightdoor7"
- ></div>
- </div>
- <div class="door4" v-show="doorcount == 4" :style="{ height: height }">
- <div
- class="left_door"
- v-bind:class="
- gatestate2 == '1' ||
- gatestate2 == '开启' ||
- gatestate2 == '打开' ||
- gatestate2 == 'true'
- ? 'open_left'
- : 'close_left'
- "
- id="leftdoor8"
- ></div>
- <div
- class="right_door"
- v-bind:class="
- gatestate2 == '1' ||
- gatestate2 == '开启' ||
- gatestate2 == '打开' ||
- gatestate2 == 'true'
- ? 'open_right'
- : 'close_right'
- "
- id="rightdoor8"
- ></div>
- </div>
- <div class="door4" v-show="doorcount == 4" :style="{ height: height }">
- <div
- class="left_door"
- v-bind:class="
- gatestate3 == '1' ||
- gatestate3 == '开启' ||
- gatestate3 == '打开' ||
- gatestate3 == 'true'
- ? 'open_left'
- : 'close_left'
- "
- id="leftdoor9"
- ></div>
- <div
- class="right_door"
- v-bind:class="
- gatestate3 == '1' ||
- gatestate3 == '开启' ||
- gatestate3 == '打开' ||
- gatestate3 == 'true'
- ? 'open_right'
- : 'close_right'
- "
- id="rightdoor9"
- ></div>
- </div>
- <div class="door4" v-show="doorcount == 4" :style="{ height: height }">
- <div
- class="left_door"
- v-bind:class="
- gatestate4 == '1' ||
- gatestate4 == '开启' ||
- gatestate4 == '打开' ||
- gatestate4 == 'true'
- ? 'open_left'
- : 'close_left'
- "
- id="leftdoor10"
- ></div>
- <div
- class="right_door"
- v-bind:class="
- gatestate4 == '1' ||
- gatestate4 == '开启' ||
- gatestate4 == '打开' ||
- gatestate4 == 'true'
- ? 'open_right'
- : 'close_right'
- "
- id="rightdoor10"
- ></div>
- </div>
- <div>
- <video
- v-if="item.type == 'flv'"
- :id="'cameraElement' + item.id"
- muted
- autoplay
- controls
- width="100%"
- height="100%"
- style="width: 100%"
- ></video>
- </div>
- </div>
- </div>
- </view>
- </template>
- <script>
- import flvjs from "flv.js";
- export default {
- data() {
- return {
- height: "200px",
- flvPlayer: [], // flv 播放地址
- };
- },
- props: [
- "gatestate1",
- "gatestate2",
- "gatestate3",
- "gatestate4",
- "doorcount",
- "cameralist",
- ],
- methods: {
- initData() {
- if (this.cameralist.devicekind == "flv") {
- // 根据id设置每个播放摄像头的地址
- this.setVideoUrl(this.cameralist.addr, this.cameralist.deviceid);
- }
- },
- setVideoUrl(url, id) {
- if (flvjs.isSupported()) {
- this.flvPlayer = [];
- var videoElement = document.getElementById("cameraElement" + id);
- // 控件设置地址信息
- var vdo = flvjs.createPlayer({
- type: "flv",
- url: url,
- });
- // 控件绑定
- vdo.attachMediaElement(videoElement);
- vdo.load();
- // 播放
- vdo.play();
- this.flvPlayer.push(vdo);
- }
- },
- },
- watch: {
- doorcount(val) {
- if (val == 1) {
- this.height = "180px";
- }
- if (val == 2) {
- this.height = "180px";
- }
- if (val == 3) {
- this.height = "110px";
- }
- if (val == 4) {
- this.height = "180px";
- }
- },
- cameralist(val) {
- this.initData();
- },
- },
- onUnload() {
- this.flvPlayer.forEach((element) => {
- element.pause();
- element.unload();
- element.detachMediaElement();
- element.destroy();
- element = null;
- });
- },
- };
- </script>
- <style scoped>
- /*门里面*/
- div.door1 {
- width: 50%;
- float: left;
- margin-left: 20%;
- background-image: url(/static/door.png);
- background-size: 100% 100%;
- perspective: 800px;
- }
- div.door2 {
- width: 50%;
- float: left;
- background-image: url(/static/door.png);
- background-size: 100% 100%;
- perspective: 800px;
- }
- div.door3 {
- width: 33.3%;
- float: left;
- background-image: url(/static/door.png);
- background-size: 100% 100%;
- perspective: 400px;
- }
- div.door4 {
- width: 50%;
- float: left;
- background-image: url(/static/door.png);
- background-size: 100% 100%;
- perspective: 800px;
- }
- /*左门/右门*/
- div.left_door {
- top: 12%;
- left: 10%;
- width: 40.5%;
- height: 78%;
- box-sizing: border-box;
- float: left;
- z-index: 1;
- position: absolute;
- transition: all 2s ease;
- background-image: url(/static/left.png);
- background-size: 100% 100%;
- }
- div.right_door {
- top: 12%;
- right: 10%;
- width: 40.2%;
- height: 78%;
- box-sizing: border-box;
- float: left;
- z-index: 1;
- position: absolute;
- transition: all 2s ease;
- background-image: url(/static/left.png);
- background-size: 100% 100%;
- }
- div.left_door {
- transform-origin: left center;
- border-right: 1px solid rgb(8, 8, 8);
- }
- div.right_door {
- transform-origin: right center;
- border-left: 1px solid rgb(8, 8, 8);
- }
- .open_left {
- transform: rotateY(100deg);
- }
- .open_right {
- transform: rotateY(-100deg);
- }
- .close_left {
- transform: rotateY(0);
- }
- .close_right {
- transform: rotateY(0deg);
- }
- /*使用css变形功能
- div.door:hover div.left_door{
- transform:rotateY(100deg);
- }
- div.door:hover div.right_door{
- transform:rotateY(-100deg);
- }*/
- </style>
|