From c6e8b341f3e266c857622e59d67edd1457be144e Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期六, 10 十月 2020 17:33:29 +0800 Subject: [PATCH] web页面集成 --- web_src/src/assets/play.png | 0 web_src/src/components/Loading.vue | 98 +++ web_src/src/assets/loading.png | 0 web_src/src/components/videoList.vue | 241 ++++++++ web_src/src/assets/logo.png | 0 web_src/src/components/gb28181/devicePlayer.vue | 377 +++++++++++++ web_src/src/components/Login.vue | 180 ++++++ web_src/src/main.js | 25 web_src/src/assets/login-bg.jpg | 0 web_src/src/components/channelList.vue | 304 +++++++++++ web_src/src/assets/login-cloud.png | 0 web_src/src/components/control.vue | 346 ++++++++++++ web_src/src/components/UiHeader.vue | 26 13 files changed, 1,597 insertions(+), 0 deletions(-) diff --git a/web_src/src/assets/loading.png b/web_src/src/assets/loading.png new file mode 100644 index 0000000..fa490e6 --- /dev/null +++ b/web_src/src/assets/loading.png Binary files differ diff --git a/web_src/src/assets/login-bg.jpg b/web_src/src/assets/login-bg.jpg new file mode 100644 index 0000000..ee27d8e --- /dev/null +++ b/web_src/src/assets/login-bg.jpg Binary files differ diff --git a/web_src/src/assets/login-cloud.png b/web_src/src/assets/login-cloud.png new file mode 100644 index 0000000..02b1958 --- /dev/null +++ b/web_src/src/assets/login-cloud.png Binary files differ diff --git a/web_src/src/assets/logo.png b/web_src/src/assets/logo.png new file mode 100644 index 0000000..f3d2503 --- /dev/null +++ b/web_src/src/assets/logo.png Binary files differ diff --git a/web_src/src/assets/play.png b/web_src/src/assets/play.png new file mode 100644 index 0000000..e4b33f3 --- /dev/null +++ b/web_src/src/assets/play.png Binary files differ diff --git a/web_src/src/components/Loading.vue b/web_src/src/components/Loading.vue new file mode 100644 index 0000000..433705e --- /dev/null +++ b/web_src/src/components/Loading.vue @@ -0,0 +1,98 @@ +//loading鏁堟灉缁勪欢 + +<template> +<div class="loadEffect" :style="{marginTop: marginTop? marginTop : '50%'}"> + <span class="ld-span"></span> + <span class="ld-span"></span> + <span class="ld-span"></span> + <span class="ld-span"></span> + <span class="ld-span"></span> + <span class="ld-span"></span> + <span class="ld-span"></span> + <span class="ld-span"></span> +</div> +</template> + +<script> +export default { + name: 'Loading', + props: ["marginTop"] + +} +</script> + +<style scoped> +.loadEffect{ + width: 100px; + height: 100px; + position: relative; + margin: 0 auto; + position: relative; + top:-50px; + margin-top:50%; + transform: scale(.5) +} +.loadEffect .ld-span{ + display: inline-block; + width: 20px; + height: 20px; + border-radius: 50%; + background: #67e7d5; + position: absolute; + -webkit-animation: load 1.04s ease infinite; +} +@-webkit-keyframes load{ + 0%{ + -webkit-transform: scale(1.2); + opacity: 1; + } + 100%{ + -webkit-transform: scale(.3); + opacity: 0.5; + } +} +.loadEffect .ld-span:nth-child(1){ + left: 0; + top: 50%; + margin-top:-10px; + -webkit-animation-delay:0.13s; +} +.loadEffect .ld-span:nth-child(2){ + left: 14px; + top: 14px; + -webkit-animation-delay:0.26s; +} +.loadEffect .ld-span:nth-child(3){ + left: 50%; + top: 0; + margin-left: -10px; + -webkit-animation-delay:0.39s; +} +.loadEffect .ld-span:nth-child(4){ + top: 14px; + right:14px; + -webkit-animation-delay:0.52s; +} +.loadEffect .ld-span:nth-child(5){ + right: 0; + top: 50%; + margin-top:-10px; + -webkit-animation-delay:0.65s; +} +.loadEffect .ld-span:nth-child(6){ + right: 14px; + bottom:14px; + -webkit-animation-delay:0.78s; +} +.loadEffect .ld-span:nth-child(7){ + bottom: 0; + left: 50%; + margin-left: -10px; + -webkit-animation-delay:0.91s; +} +.loadEffect .ld-span:nth-child(8){ + bottom: 14px; + left: 14px; + -webkit-animation-delay:1.04s; +} +</style> diff --git a/web_src/src/components/Login.vue b/web_src/src/components/Login.vue new file mode 100644 index 0000000..030d3ee --- /dev/null +++ b/web_src/src/components/Login.vue @@ -0,0 +1,180 @@ +<template> +<div class="login" id="login"> + <a href="javascript:;" class="log-close"><i class="icons close"></i></a> + <div class="log-bg"> + <div class="log-cloud cloud1"></div> + <div class="log-cloud cloud2"></div> + <div class="log-cloud cloud3"></div> + <div class="log-cloud cloud4"></div> + + <div class="log-logo">Welcome!</div> + <div class="log-text"></div> + </div> + <div class="log-email"> + <input type="text" placeholder="鐢ㄦ埛鍚�" :class="'log-input' + (username==''?' log-input-empty':'')" v-model="username"><input type="password" placeholder="瀵嗙爜" :class="'log-input' + (password==''?' log-input-empty':'')" v-model="password"> + <a href="javascript:;" class="log-btn" @click="login" >鐧诲綍</a> + </div> + <Loading v-if="isLoging" marginTop="-30%"></Loading> +</div> +</template> + +<script> +import Loading from './Loading.vue' +import crypto from 'crypto' +export default { + name: 'Login', + data(){ + return { + isLoging: false, + username: '', + password: '' + } + }, + components:{ + Loading + }, + created(){ + var that = this; + document.onkeydown = function(e) { + var key = window.event.keyCode; + if (key == 13) { + that.login(); + } + } + + }, + methods:{ + + //鐧诲綍閫昏緫 + login(){ + if(this.username!='' && this.password!=''){ + this.toLogin(); + } + }, + + //鐧诲綍璇锋眰 + toLogin(){ + + //涓�鑸璺熷悗绔簡瑙e瘑鐮佺殑鍔犲瘑瑙勫垯 + //杩欓噷渚嬪瓙鐢ㄧ殑鍝堝笇绠楁硶鏉ヨ嚜./js/sha1.min.js + + //闇�瑕佹兂鍚庣鍙戦�佺殑鐧诲綍鍙傛暟 + let loginParam = { + username: this.username, + password: crypto.createHash('md5').update(this.password, "utf8").digest('hex') + } + var that = this; + //璁剧疆鍦ㄧ櫥褰曠姸鎬� + this.isLoging = true; + + this.$axios.get("/auth/login",{ + params: loginParam + } ) + .then(function (res) { + console.log(JSON.stringify(res)); + if (res.data == "success") { + that.$cookies.set("session", {"username": that.username}) ; + //鐧诲綍鎴愬姛鍚� + that.$router.push('/'); + } + }) + .catch(function (error) { + console.log(error); + }); + + + + }, + setCookie: function (cname, cvalue, exdays) { + var d = new Date(); + d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); + var expires = "expires=" + d.toUTCString(); + console.info(cname + "=" + cvalue + "; " + expires); + document.cookie = cname + "=" + cvalue + "; " + expires; + console.info(document.cookie); + }, + } +} +</script> + +<style scoped> +.login{position: fixed; overflow: hidden;left: 50%; margin-left: -250px; top:50%; margin-top: -350px; width: 500px; min-height: 555px; z-index: 10; right: 140px; background: #fff;-webkit-border-radius: 5px; +-moz-border-radius: 5px; +-ms-border-radius: 5px; +-o-border-radius: 5px; +border-radius: 5px; -webkit-box-shadow: 0px 3px 16px -5px #070707; box-shadow: 0px 3px 16px -5px #070707} +.log-close{display: block; position: absolute; top:12px; right: 12px; opacity: 1;} +.log-close:hover .icons{transform: rotate(180deg);} +.log-close .icons{opacity: 1; transition: all .3s} +.log-cloud{background-image: url(../assets/login-cloud.png); width: 63px ;height: 40px; position: absolute; z-index: 1} +.login .cloud1{top:21px; left: -30px; transform: scale(.6); animation: cloud1 20s linear infinite;} +.login .cloud2{top:87px; right: 20px; animation: cloud2 19s linear infinite;} +.login .cloud3{top:160px; left: 5px;transform: scale(.8);animation: cloud3 21s linear infinite;} +.login .cloud4{top:150px; left: -40px;transform: scale(.4);animation: cloud4 19s linear infinite;} +.log-bg{background: url(../assets/login-bg.jpg); width: 100%; height: 312px; overflow: hidden;} +.log-logo{height: 80px; margin: 120px auto 25px; text-align: center; color: #1fcab3; font-weight: bold; font-size: 40px;} +.log-text{color: #57d4c3; font-size: 13px; text-align: center; margin: 0 auto;} +.log-logo,.log-text{z-index: 2} +.icons{background:url(../assets/icons.png) no-repeat; display: inline-block;} +.close{height:16px;width:16px;background-position:-13px 0;} +.login-email{height:17px;width:29px;background-position:-117px 0;} + +.log-btns{padding: 15px 0; margin: 0 auto;} +.log-btn{width:402px; display: block; text-align: left; line-height: 50px;margin:0 auto 15px; height:50px; color:#fff; font-size:13px;-webkit-border-radius: 5px; background-color: #3B5999; +-moz-border-radius: 5px; +-ms-border-radius: 5px; +-o-border-radius: 5px; +border-radius: 5px; +position: relative;} +.log-btn.tw{background-color: #13B4E9} +.log-btn.email{background-color: #50E3CE} +.log-btn:hover,.log-btn:focus{color: #fff; opacity: .8;} + +.log-email{text-align: center; margin-top: 20px;} +.log-email .log-btn{background-color: #50E3CE;text-align: center;} +.log-input-empty{border: 1px solid #f37474 !important;} +.isloading{background: #d6d6d6} +.log-btn .icons{margin-left: 30px; vertical-align: middle;} +.log-btn .text{left: 95px; line-height: 50px; text-align: left; position: absolute;} +.log-input{width: 370px;overflow: hidden; padding: 0 15px;font-size: 13px; border: 1px solid #EBEBEB; margin:0 auto 15px; height: 48px; line-height: 48px; -webkit-border-radius: 5px; +-moz-border-radius: 5px; +-ms-border-radius: 5px; +-o-border-radius: 5px; +border-radius: 5px;} +.log-input.warn{border: 1px solid #f88787} + + @-webkit-keyframes cloud1 { + 0%{left: 200px} + 100%{left:-130px;} +} +@keyframes cloud1{ + 0%{left: 200px} + 100%{left:-130px;} +} + + @-webkit-keyframes cloud2 { + 0%{left:500px;} + 100%{left:-90px;} +} +@keyframes cloud2{ + 0%{left:500px;} + 100%{left:-90px;} +} + +@-webkit-keyframes cloud3 { + 0%{left:620px;} + 100%{left:-70px;} +} +@keyframes cloud3{ + 0%{left:620px;} + 100%{left:-70px;} +}@-webkit-keyframes cloud4 { + 0%{left:100px;} + 100%{left:-70px;} +} +@keyframes cloud4{ + 0%{left:100px;} + 100%{left:-70px;} +} + +</style> diff --git a/web_src/src/components/UiHeader.vue b/web_src/src/components/UiHeader.vue new file mode 100644 index 0000000..67f310a --- /dev/null +++ b/web_src/src/components/UiHeader.vue @@ -0,0 +1,26 @@ +<template> + <div id="UiHeader"> + <el-menu router :default-active="this.$route.path" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" mode="horizontal"> + <el-menu-item index="/">鎺у埗鍙�</el-menu-item> + <el-menu-item index="/videoList">璁惧鍒楄〃</el-menu-item> + <!-- <el-menu-item index="/videoReplay">褰曞儚鍥炵湅</el-menu-item> --> + <!-- <el-menu-item index="4">绾ц仈璁剧疆</el-menu-item> --> + <el-menu-item style="float: right;" @click="loginout">閫�鍑�</el-menu-item> + </el-menu> + </div> +</template> + +<script> +export default { + name: "UiHeader", + methods:{ + + loginout(){ + // 鍒犻櫎cookie锛屽洖鍒扮櫥褰曢〉闈� + this.$cookies.remove("session"); + this.$router.push('/login'); + }, + } +} + +</script> \ No newline at end of file diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue new file mode 100644 index 0000000..5cd108e --- /dev/null +++ b/web_src/src/components/channelList.vue @@ -0,0 +1,304 @@ +<template> + <div id="channelList"> + <el-container> + + <el-header> + <uiHeader></uiHeader> + </el-header> + <el-main> + <div style="background-color: #FFFFFF; position: relative; padding: 1rem 0.5rem 0.5rem 0.5rem; text-align: center;"> + <span style="font-size: 1rem; font-weight: 500; ">閫氶亾鍒楄〃({{parentChannelId ==0 ? deviceId:parentChannelId}})</span> + + </div> + <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;"> + <el-button icon="el-icon-arrow-left" size="mini" style="margin-right: 1rem;" @click="showDevice">杩斿洖</el-button> + 鎼滅储: <el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="鍏抽敭瀛�" prefix-icon="el-icon-search" v-model="searchSrt" clearable> </el-input> + + 閫氶亾绫诲瀷: <el-select size="mini" @change="search" style="margin-right: 1rem;" v-model="channelType" placeholder="璇烽�夋嫨" default-first-option> + <el-option label="鍏ㄩ儴" value="" ></el-option> + <el-option label="璁惧" value="false"></el-option> + <el-option label="瀛愮洰褰�" value="true" ></el-option> + </el-select> + 鍦ㄧ嚎鐘舵��: <el-select size="mini" @change="search" v-model="online" placeholder="璇烽�夋嫨" default-first-option> + <el-option label="鍏ㄩ儴" value=""></el-option> + <el-option label="鍦ㄧ嚎" value="on"></el-option> + <el-option label="绂荤嚎" value="off"></el-option> + </el-select> + + </div> + <devicePlayer ref="devicePlayer"></devicePlayer> + <!--璁惧鍒楄〃--> + <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" border style="width: 100%"> + <el-table-column prop="channelId" label="閫氶亾缂栧彿" width="210"> + </el-table-column> + <el-table-column prop="name" label="閫氶亾鍚嶇О" width="500"> + </el-table-column> + <el-table-column prop="subCount" label="瀛愯妭鐐规暟"> + </el-table-column> + <el-table-column prop="ptztypeText" label="浜戝彴绫诲瀷"> + </el-table-column> + <el-table-column label="鎿嶄綔" width="240" align="center" fixed="right"> + <template slot-scope="scope"> + <el-button size="mini" icon="el-icon-video-play" v-if="scope.row.parental == 0" @click="sendDevicePush(scope.row)">棰勮瑙嗛</el-button> + <el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.parental == 1" @click="changeSubchannel(scope.row)">鏌ョ湅瀛愮洰褰�</el-button> + <!-- <el-button size="mini" @click="sendDevicePush(scope.row)">褰曞儚鏌ヨ</el-button> --> + </template> + </el-table-column> + </el-table> + <el-pagination + style="float: right" + @size-change="handleSizeChange" + @current-change="currentChange" + :current-page="currentPage" + :page-size="count" + :page-sizes="[15, 20, 30, 50]" + layout="total, sizes, prev, pager, next" + :total="total"> + </el-pagination> + + </el-main> + </el-container> + </div> +</template> + +<script> + import devicePlayer from './gb28181/devicePlayer.vue' + import uiHeader from './UiHeader.vue' + export default { + name: 'channelList', + components: { + devicePlayer, + uiHeader + }, + data() { + return { + deviceId: this.$route.params.deviceId, + parentChannelId: this.$route.params.parentChannelId, + deviceChannelList: [], + videoComponentList: [], + currentPlayerInfo: {}, //褰撳墠鎾斁瀵硅薄 + updateLooper: 0, //鏁版嵁鍒锋柊杞鏍囧織 + searchSrt: "", + channelType: "", + online: "", + winHeight: window.innerHeight - 250, + currentPage: parseInt(this.$route.params.page), + count: parseInt(this.$route.params.count), + total:0, + beforeUrl:"/videoList" + }; + }, + + mounted() { + this.initData(); + // this.updateLooper = setInterval(this.initData, 10000); + }, + destroyed() { + this.$destroy('videojs'); + clearTimeout(this.updateLooper); + }, + methods: { + initData: function() { + if (this.parentChannelId == "" || this.parentChannelId == 0 ) { + this.getDeviceChannelList(); + }else{ + this.showSubchannels(); + } + + }, + initParam: function(){ + this.deviceId= this.$route.params.deviceId; + this.parentChannelId= this.$route.params.parentChannelId; + this.currentPage= parseInt(this.$route.params.page); + this.count= parseInt(this.$route.params.count); + if (this.parentChannelId == "" || this.parentChannelId == 0 ) { + this.beforeUrl = "/videoList" + } + + }, + currentChange: function(val){ + var url = `/${this.$router.currentRoute.name}/${this.deviceId}/${this.parentChannelId}/${this.count}/${val}` + console.log(url) + this.$router.push(url).then(()=>{ + this.initParam(); + this.initData(); + }) + }, + handleSizeChange: function(val){ + var url = `/${this.$router.currentRoute.name}/${this.$router.params.deviceId}/${this.$router.params.parentChannelId}/${val}/1` + this.$router.push(url).then(()=>{ + this.initParam(); + this.initData(); + }) + + }, + getDeviceChannelList: function() { + let that = this; + console.log(this.currentPage - 1) + + this.$axios.get(`/api/devices/${this.$route.params.deviceId}/channels`,{ + params: { + page: that.currentPage - 1, + count: that.count, + query: that.searchSrt, + online: that.online, + channelType: that.channelType + } + } ) + .then(function (res) { + console.log(res); + that.total = res.data.total; + that.deviceChannelList = res.data.data; + // 闃叉鍑虹幇琛ㄦ牸閿欎綅 + that.$nextTick(()=>{ + that.$refs.channelListTable.doLayout(); + }) + }) + .catch(function (error) { + console.log(error); + }); + + }, + + + //gb28181骞冲彴瀵规帴 + //鍒锋柊璁惧淇℃伅 + refDevice: function(itemData) { + ///api/devices/{deviceId}/sync + console.log("鍒锋柊瀵瑰簲璁惧:" + itemData.deviceId); + this.$axios({ + method: 'post', + url: '/api/devices/' + itemData.deviceId + '/sync' + }).then(function(res) { + // console.log("鍒锋柊璁惧缁撴灉锛�"+JSON.stringify(res)); + }).catch(function(e) { + that.$message({ + showClose: true, + message: '璇锋眰鎴愬姛', + type: 'success' + }); + });; + }, + //閫氱煡璁惧涓婁紶濯掍綋娴� + sendDevicePush: function(itemData) { + let deviceId = this.deviceId; + + let channelId = itemData.channelId; + console.log("閫氱煡璁惧鎺ㄦ祦1锛�" + deviceId + " : " + channelId); + let that = this; + this.$axios({ + method: 'get', + url: '/api/play/' + deviceId + '/' + channelId + }).then(function(res) { + let ssrc = res.data.ssrc; + that.$refs.devicePlayer.play(res.data,deviceId,channelId); + }).catch(function(e) { + }); + }, + showDevice: function(){ + this.$router.push(this.beforeUrl).then(()=>{ + this.initParam(); + this.initData(); + }) + }, + changeSubchannel(itemData) { + console.log(this.$router.currentRoute) + this.beforeUrl = this.$router.currentRoute.path; + + var url = `/${this.$router.currentRoute.name}/${this.$router.currentRoute.params.deviceId}/${itemData.channelId}/${this.$router.currentRoute.params.count}/1` + this.$router.push(url).then(()=>{ + this.searchSrt= ""; + this.channelType= ""; + this.online= ""; + this.initParam(); + this.initData(); + }) + }, + showSubchannels: function(channelId){ + let that = this; + + this.$axios.get(`/api/subChannels/${this.deviceId}/${this.parentChannelId}/channels`,{ + params: { + page: that.currentPage - 1, + count: that.count, + query: that.searchSrt, + online: that.online, + channelType: that.channelType + } + } ) + .then(function (res) { + that.total = res.data.total; + that.deviceChannelList = res.data.data; + // 闃叉鍑虹幇琛ㄦ牸閿欎綅 + that.$nextTick(()=>{ + that.$refs.channelListTable.doLayout(); + }) + }) + .catch(function (error) { + console.log(error); + }); + }, + search: function() { + console.log(this.searchSrt) + this.currentPage = 1; + this.total = 0; + this.initData(); + } + + } + }; +</script> + +<style> + .videoList { + display: flex; + flex-wrap: wrap; + align-content: flex-start; + } + + .video-item { + position: relative; + width: 15rem; + height: 10rem; + margin-right: 1rem; + background-color: #000000; + } + + .video-item-img { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + width: 100%; + height: 100%; + } + + .video-item-img:after { + content: ""; + display: inline-block; + position: absolute; + z-index: 2; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + width: 3rem; + height: 3rem; + background-image: url("../assets/loading.png"); + background-size: cover; + background-color: #000000; + } + + .video-item-title { + position: absolute; + bottom: 0; + color: #000000; + background-color: #ffffff; + line-height: 1.5rem; + padding: 0.3rem; + width: 14.4rem; + } +</style> diff --git a/web_src/src/components/control.vue b/web_src/src/components/control.vue new file mode 100644 index 0000000..316db30 --- /dev/null +++ b/web_src/src/components/control.vue @@ -0,0 +1,346 @@ +<template> + <div id="app"> + <el-container> + <el-header> + <uiHeader></uiHeader> + </el-header> + <el-main> + <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;"> + <span style="font-size: 1rem; font-weight: bold;">鎺у埗鍙�</span> + <div style="position: absolute; right: 1rem; top: 0.3rem;"> + <el-popover placement="bottom" width="750" height="300" trigger="click"> + <div style="height: 600px;overflow:auto;"> + <table class="table-c" cellspacing="0"> + <tr v-for="(value, key, index) in serverConfig"> + <td style="width: 18rem; text-align: right;">{{ key }}</td> + <td style="width: 33rem; text-align:left">{{ value }}</td> + </tr> + </table> + </div> + <el-button type="primary" slot="reference" size="mini" @click="getServerConfig()">鏌ョ湅鏈嶅姟鍣ㄩ厤缃�</el-button> + </el-popover> + <el-button style="margin-left: 1rem;" type="danger" size="mini" @click="reStartServer()">閲嶅惎鏈嶅姟鍣�</el-button> + </div> + </div> + <el-row :gutter="30"> + <el-col :span="12"><div class="control-table" id="ThreadsLoad">table1</div></el-col> + <el-col :span="12"><div class="control-table" id="WorkThreadsLoad">table2</div></el-col> + </el-row> + <el-table :data="allSessionData" style="margin-top: 1rem;"> + <el-table-column prop="peer_ip" label="杩滅"></el-table-column> + <el-table-column prop="local_ip" label="鏈湴"></el-table-column> + <el-table-column prop="typeid" label="绫诲瀷"></el-table-column> + <el-table-column align="right"> + <template slot="header" slot-scope="scope"> + <el-button icon="el-icon-refresh-right" circle @click="getAllSession()"></el-button> + </template> + <template slot-scope="scope"> + <el-button @click.native.prevent="deleteRow(scope.$index, allSessionData)" type="text" size="small">绉婚櫎</el-button> + </template> + </el-table-column> + </el-table> + + </el-main> + <!-- <el-footer style="position: absolute; bottom: 0; width: 100%;">ZLMediaKit-VUE_UI v1</el-footer> --> + </el-container> + + </div> +</template> + +<script> + +import uiHeader from './UiHeader.vue' + +import echarts from 'echarts'; +export default { + name: 'app', + components: { + echarts, + uiHeader + }, + data() { + return { + tableOption: { + // legend: {}, + xAxis: {}, + yAxis: {}, + label: {}, + tooltip: {}, + dataZoom: [], + series: [] + }, + table1Option: { + // legend: {}, + xAxis: {}, + yAxis: {}, + label: {}, + tooltip: {}, + series: [] + }, + mChart: null, + mChart1: null, + charZoomStart: 0, + charZoomEnd: 100, + chartInterval: 0, //鏇存柊鍥捐〃缁熻鍥惧畾鏃朵换鍔℃爣璇� + allSessionData: [], + visible: false, + serverConfig: {} + }; + }, + mounted() { + this.getAllSession(); + this.initTable(); + this.updateData(); + this.chartInterval = setInterval(this.updateData, 3000); + }, + destroyed() { + clearInterval(this.chartInterval); //閲婃斁瀹氭椂浠诲姟 + }, + methods: { + updateData: function() { + this.getThreadsLoad(); + }, + /** + * 鑾峰彇绾跨▼鐘舵�� + */ + getThreadsLoad: function() { + let that = this; + this.$axios({ + method: 'get', + url: '/zlm/index/api/getThreadsLoad' + }).then(function(res) { + if (res.data.code == 0) { + that.tableOption.xAxis.data.push(new Date().toLocaleTimeString()); + that.table1Option.xAxis.data.push(new Date().toLocaleTimeString()); + + for (var i = 0; i < res.data.data.length; i++) { + if (that.tableOption.series[i] === undefined) { + let data = { + data: [], + type: 'line' + }; + let data1 = { + data: [], + type: 'line' + }; + data.data.push(res.data.data[i].delay); + data1.data.push(res.data.data[i].load); + that.tableOption.series.push(data); + that.table1Option.series.push(data1); + } else { + that.tableOption.series[i].data.push(res.data.data[i].delay); + that.table1Option.series[i].data.push(res.data.data[i].load); + } + } + that.tableOption.dataZoom[0].start = that.charZoomStart; + that.tableOption.dataZoom[0].end = that.charZoomEnd; + that.table1Option.dataZoom[0].start = that.charZoomStart; + that.table1Option.dataZoom[0].end = that.charZoomEnd; + //that.myChart = echarts.init(document.getElementById('ThreadsLoad')); + that.myChart.setOption(that.tableOption, true); + // that.myChart1 = echarts.init(document.getElementById('WorkThreadsLoad')); + that.myChart1.setOption(that.table1Option, true); + } + }); + }, + initTable: function() { + let that = this; + this.tableOption.xAxis = { + type: 'category', + data: [], // x杞存暟鎹� + name: '鏃堕棿', // x杞村悕绉� + // x杞村悕绉版牱寮� + nameTextStyle: { + fontWeight: 300, + fontSize: 15 + } + }; + this.tableOption.yAxis = { + type: 'value', + name: '寤惰繜鐜�', // y杞村悕绉� + boundaryGap: [0, '100%'], + max: 100, + axisLabel: { + show: true, + interval: 'auto', + formatter: '{value} %' + }, + // y杞村悕绉版牱寮� + nameTextStyle: { + fontWeight: 300, + fontSize: 15 + } + }; + this.tableOption.dataZoom = [ + { + show: true, + start: this.charZoomStart, + end: this.charZoomEnd + } + ]; + this.myChart = echarts.init(document.getElementById('ThreadsLoad')); + this.myChart.setOption(this.tableOption); + this.myChart.on('dataZoom', function(event) { + if (event.batch) { + that.charZoomStart = event.batch[0].start; + that.charZoomEnd = event.batch[0].end; + } else { + that.charZoomStart = event.start; + that.charZoomEnd = event.end; + } + }); + + this.table1Option.xAxis = { + type: 'category', + data: [], // x杞存暟鎹� + name: '鏃堕棿', // x杞村悕绉� + // x杞村悕绉版牱寮� + nameTextStyle: { + fontWeight: 300, + fontSize: 15 + } + }; + this.table1Option.yAxis = { + type: 'value', + name: '璐熻浇鐜�', // y杞村悕绉� + boundaryGap: [0, '100%'], + max: 100, + axisLabel: { + show: true, + interval: 'auto', + formatter: '{value} %' + }, + // y杞村悕绉版牱寮� + nameTextStyle: { + fontWeight: 300, + fontSize: 15 + } + }; + this.table1Option.dataZoom = [ + { + show: true, + start: this.charZoomStart, + end: this.charZoomEnd + } + ]; + this.myChart1 = echarts.init(document.getElementById('WorkThreadsLoad')); + this.myChart1.setOption(this.table1Option); + this.myChart1.on('dataZoom', function(event) { + if (event.batch) { + that.charZoomStart = event.batch[0].start; + that.charZoomEnd = event.batch[0].end; + } else { + that.charZoomStart = event.start; + that.charZoomEnd = event.end; + } + }); + }, + + getAllSession: function() { + let that = this; + that.allSessionData = []; + console.log("鍦板潃锛�"+'/zlm/index/api/getAllSession'); + this.$axios({ + method: 'get', + url: '/zlm/index/api/getAllSession' + }).then(function(res) { + res.data.data.forEach(item => { + let data = { + peer_ip: item.peer_ip, + local_ip: item.local_ip, + typeid: item.typeid, + id: item.id + }; + that.allSessionData.push(data); + }); + }); + }, + getServerConfig: function() { + let that = this; + this.$axios({ + method: 'get', + url: '/zlm/index/api/getServerConfig' + }).then(function(res) { + that.serverConfig = res.data.data[0]; + that.visible = true; + }); + }, + reStartServer: function() { + let that = this; + this.$confirm('姝ゆ搷浣滃皢閲嶅惎濯掍綋鏈嶅姟鍣�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + let that = this; + this.$axios({ + method: 'get', + url: '/zlm/index/api/restartServer' + }).then(function(res) { + that.getAllSession(); + if (res.data.code == 0) { + that.$message({ + type: 'success', + message: '鎿嶄綔瀹屾垚' + }); + } + }); + }); + }, + deleteRow: function(index, tabledata) { + let that = this; + this.$confirm('姝ゆ搷浣滃皢鏂紑璇ラ�氫俊閾捐矾, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }) + .then(() => { + that.deleteSession(tabledata[index].id); + }) + .catch(() => { + console.log('id锛�' + JSON.stringify(tabledata[index])); + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + console.log(JSON.stringify(tabledata[index])); + }, + deleteSession: function(id) { + let that = this; + this.$axios({ + method: 'get', + url: '/zlm/index/api/kick_session&id=' + id + }).then(function(res) { + that.getAllSession(); + that.$message({ + type: 'success', + message: '鍒犻櫎鎴愬姛!' + }); + }); + } + } +}; +</script> + +<style> +#app { + height: 100%; +} +.control-table { + background-color: #ffffff; + height: 25rem; +} +.table-c { + border-right: 1px solid #dcdcdc; + border-bottom: 1px solid #dcdcdc; +} +.table-c td { + border-left: 1px solid #dcdcdc; + border-top: 1px solid #dcdcdc; + padding: 0.2rem; +} +.el-table { + width: 99.9% !important; +} +</style> diff --git a/web_src/src/components/gb28181/devicePlayer.vue b/web_src/src/components/gb28181/devicePlayer.vue new file mode 100644 index 0000000..e193d7c --- /dev/null +++ b/web_src/src/components/gb28181/devicePlayer.vue @@ -0,0 +1,377 @@ +<template> + <div id="devicePlayer"> + <el-dialog title="瑙嗛鎾斁" top="0" :visible.sync="showVideoDialog" :destroy-on-close="true" @close="stop()"> + <LivePlayer v-if="showVideoDialog" ref="videoPlayer" :videoUrl="videoUrl" :error="videoError" fluent autoplay live stretch></LivePlayer> + <div id="shared" style="text-align: right; margin-top: 1rem;"> + <el-tabs v-model="tabActiveName"> + <el-tab-pane label="濯掍綋娴佷俊鎭�" name="media"> + <div style="margin-bottom: 0.5rem;"> + <el-button type="primary" size="small" @click="playRecord(true, '')">鎾斁</el-button> + <el-button type="primary" size="small" @click="startRecord()">褰曞埗</el-button> + <el-button type="primary" size="small" @click="stopRecord()">鍋滄褰曞埗</el-button> + </div> + <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;"> + <span style="width: 5rem; line-height: 2.5rem; text-align: right;">鎾斁鍦板潃锛�</span> + <el-input v-model="getPlayerShared.sharedUrl" :disabled="true" v-on:click.native="copySharedInfo(getPlayerShared.sharedUrl)"></el-input> + </div> + <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;"> + <span style="width: 5rem; line-height: 2.5rem; text-align: right;">iframe锛�</span> + <el-input v-model="getPlayerShared.sharedIframe" :disabled="true" v-on:click.native="copySharedInfo(getPlayerShared.sharedIframe)"></el-input> + </div> + <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;"> + <span style="width: 5rem; line-height: 2.5rem; text-align: right;">璧勬簮鍦板潃锛�</span> + <el-input v-model="getPlayerShared.sharedRtmp" :disabled="true" v-on:click.native="copySharedInfo(getPlayerShared.sharedRtmp)"></el-input> + </div> + </el-tab-pane> + <!--{"code":0,"data":{"paths":["22-29-30.mp4"],"rootPath":"/home/kkkkk/Documents/ZLMediaKit/release/linux/Debug/www/record/hls/kkkkk/2020-05-11/"}}--> + <el-tab-pane label="褰曞儚鏌ヨ" name="second"> + <el-date-picker v-model="videoHistory.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="寮�濮嬫椂闂�" + @change="recordList()"></el-date-picker> + <el-date-picker v-model="videoHistory.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="缁撴潫鏃堕棿" + @change="recordList()"></el-date-picker> + <el-table :data="videoHistory.searchHistoryResult" style="width: 100%"> + <el-table-column label="鍚嶇О" prop="name" width="150"></el-table-column> + <el-table-column label="鏂囦欢" prop="filePath" width="300"></el-table-column> + <el-table-column label="寮�濮嬫椂闂�" prop="startTime" width="160"></el-table-column> + <el-table-column label="缁撴潫鏃堕棿" prop="endTime" width="160"></el-table-column> + + <el-table-column label="鎿嶄綔"> + <template slot-scope="scope"> + <el-button type="primary" size="mini" @click="playRecord(false, scope.row)">鎾斁</el-button> + </template> + </el-table-column> + </el-table> + </el-tab-pane> + <!--閬ユ帶鐣岄潰--> + <el-tab-pane label="浜戝彴鎺у埗" name="third"> + <div style="display: flex; justify-content: center;"> + <div class="control-wrapper"> + <div class="control-btn control-top" @mousedown="ptzCamera(0, 1, 0)" @mouseup="ptzCamera(0, 0, 0)"> + <i class="el-icon-caret-top"></i> + <div class="control-inner-btn control-inner"></div> + </div> + <div class="control-btn control-left" @mousedown="ptzCamera(1, 0, 0)" @mouseup="ptzCamera(0, 0, 0)"> + <i class="el-icon-caret-left"></i> + <div class="control-inner-btn control-inner"></div> + </div> + <div class="control-btn control-bottom" @mousedown="ptzCamera(0, 2, 0)" @mouseup="ptzCamera(0, 0, 0)"> + <i class="el-icon-caret-bottom"></i> + <div class="control-inner-btn control-inner"></div> + </div> + <div class="control-btn control-right" @mousedown="ptzCamera(2, 0, 0)" @mouseup="ptzCamera(0, 0, 0)"> + <i class="el-icon-caret-right"></i> + <div class="control-inner-btn control-inner"></div> + </div> + <div class="control-round"> + <div class="control-round-inner"><i class="fa fa-pause-circle"></i></div> + </div> + + <div style="position: absolute; left: 7.25rem; top: 1.25rem" @mousedown="ptzCamera(0, 0, 2)" @mouseup="ptzCamera(0, 0, 0)"><i + class="el-icon-zoom-in" style="font-size: 1.875rem;"></i></div> + <div style="position: absolute; left: 7.25rem; top: 3.25rem; font-size: 1.875rem;" @mousedown="ptzCamera(0, 0, 1)" + @mouseup="ptzCamera(0, 0, 0)"><i class="el-icon-zoom-out"></i></div> + </div> + </div> + + </el-tab-pane> + </el-tabs> + </div> + </el-dialog> + </div> +</template> + +<script> + import LivePlayer from '@liveqing/liveplayer' + export default { + name: 'devicePlayer', + props: {}, + components: { + LivePlayer + }, + computed: { + getPlayerShared: function() { + return { + sharedUrl: window.location.host + '/' + this.videoUrl, + sharedIframe: '<iframe src="' + window.location.host + '/' + this.videoUrl + '"></iframe>', + sharedRtmp: this.videoUrl + }; + } + }, + created() { + // this.videoHistory.searchHistoryResult = falsificationData.recordData.recordList; + }, + data() { + return { + video:'http://lndxyj.iqilu.com/public/upload/2019/10/14/8c001ea0c09cdc59a57829dabc8010fa.mp4', + videoUrl: '', + videoHistory: { + startTime: '', + endTime: '', + searchHistoryResult: [] //濯掍綋娴佸巻鍙茶褰曟悳绱㈢粨鏋� + }, + showVideoDialog: false, + normalssrc: '', + ssrc: '', + deviceId: '', + channelId: '', + tabActiveName: 'media' + }; + }, + methods: { + + play: function(streamInfo, deviceId, channelId) { + this.ssrc = streamInfo.ssrc; + this.deviceId = deviceId; + this.channelId = channelId; + this.videoUrl = streamInfo.flv + "?" + new Date().getTime(); + this.showVideoDialog = true; + console.log(this.ssrc); + }, + stop: function() { + console.log('鍏抽棴瑙嗛'); + this.$refs.videoPlayer.pause(); + this.videoUrl = ''; + this.showVideoDialog = false; + this.$axios({ + method: 'post', + url: '/api/play/' + this.ssrc + '/stop' + }).then(function(res) { + console.log(JSON.stringify(res)); + }); + + this.$axios({ + method: 'post', + url: '/api/playback/' + this.ssrc + '/stop' + }).then(function(res) { + console.log(JSON.stringify(res)); + }); + }, + copySharedInfo: function(data) { + console.log('澶嶅埗鍐呭锛�' + data); + let _this = this; + this.$copyText(data).then( + function(e) { + _this.$message({ + showClose: true, + message: '澶嶅埗鎴愬姛', + type: 'success' + }); + }, + function(e) { + _this.$message({ + showClose: true, + message: '澶嶅埗澶辫触锛岃鎵嬪姩澶嶅埗', + type: 'error' + }); + } + ); + }, + + recordList: function() { + if (!this.videoHistory.startTime || !this.videoHistory.endTime) { + return; + } + let that = this; + this.$axios({ + method: 'get', + url: '/api/record/' + this.deviceId + '/' + this.channelId + '?startTime=' + this.videoHistory + .startTime + '&endTime=' + this.videoHistory.endTime + }).then(function(res) { + console.log(JSON.stringify(res)); + }).catch(function(e) { + // that.videoHistory.searchHistoryResult = falsificationData.recordData; + }); + + }, + playRecord: function(isBackLive, rowData) { + let that = this; + if(isBackLive){ + this.videoUrl=this.getVideoUrlBySsrc(this.normalssrc); + return; + } + this.$axios({ + method: 'get', + url: '/api/playback/' + this.deviceId + '/' + this.channelId + '?startTime=' + rowData.startTime + '&endTime=' + + rowData.endTime + }).then(function(res) { + let ssrc = res.data.ssrc; + that.videoUrl = that.getVideoUrlBySsrc(ssrc); + //that.videoUrl='http://hls.cntv.kcdnvip.com/asp/hls/main/0303000a/3/default/f466089412c04a759c5515dbfcc3ac3d/main.m3u8?maxbr=2048'; + }); + + }, + ptzCamera: function(leftRight, upDown, zoom) { + console.log('浜戝彴鎺у埗锛�' + leftRight + ' : ' + upDown + " : " + zoom); + let that = this; + this.$axios({ + method: 'post', + url: '/api/ptz/' + this.deviceId + '/' + this.channelId + '?leftRight=' + leftRight + '&upDown=' + upDown + + '&inOut=' + zoom + '&moveSpeed=50&zoomSpeed=50' + }).then(function(res) {}); + }, + //////////////////////鎾斁鍣ㄤ簨浠跺鐞�////////////////////////// + videoError:function(e){ + console.log("鎾斁鍣ㄩ敊璇細"+JSON.stringify(e)); + } + } + }; +</script> + +<style> + .control-wrapper { + position: relative; + width: 6.25rem; + height: 6.25rem; + max-width: 6.25rem; + max-height: 6.25rem; + margin: 0 auto; + border-radius: 100%; + float: left; + } + + .control-btn { + display: flex; + justify-content: center; + position: absolute; + width: 44%; + height: 44%; + border-radius: 5px; + border: 1px solid #78aee4; + box-sizing: border-box; + transition: all 0.3s linear; + } + + .control-btn i { + font-size: 20px; + color: #78aee4; + display: flex; + justify-content: center; + align-items: center; + } + + .control-round { + position: absolute; + top: 21%; + left: 21%; + width: 58%; + height: 58%; + background: #fff; + border-radius: 100%; + } + + .control-round-inner { + position: absolute; + left: 15%; + top: 15%; + display: flex; + justify-content: center; + align-items: center; + width: 70%; + height: 70%; + font-size: 40px; + color: #78aee4; + border: 1px solid #78aee4; + border-radius: 100%; + transition: all 0.3s linear; + } + + .control-inner-btn { + position: absolute; + width: 60%; + height: 60%; + background: #fafafa; + } + + .control-top { + top: -8%; + left: 27%; + transform: rotate(-45deg); + border-radius: 5px 100% 5px 0; + } + + .control-top i { + transform: rotate(45deg); + border-radius: 5px 100% 5px 0; + } + + .control-top .control-inner { + left: -1px; + bottom: 0; + border-top: 1px solid #78aee4; + border-right: 1px solid #78aee4; + border-radius: 0 100% 0 0; + } + + .control-top .fa { + transform: rotate(45deg) translateY(-7px); + } + + .control-left { + top: 27%; + left: -8%; + transform: rotate(45deg); + border-radius: 5px 0 5px 100%; + } + + .control-left i { + transform: rotate(-45deg); + } + + .control-left .control-inner { + right: -1px; + top: -1px; + border-bottom: 1px solid #78aee4; + border-left: 1px solid #78aee4; + border-radius: 0 0 0 100%; + } + + .control-left .fa { + transform: rotate(-45deg) translateX(-7px); + } + + .control-right { + top: 27%; + right: -8%; + transform: rotate(45deg); + border-radius: 5px 100% 5px 0; + } + + .control-right i { + transform: rotate(-45deg); + } + + .control-right .control-inner { + left: -1px; + bottom: -1px; + border-top: 1px solid #78aee4; + border-right: 1px solid #78aee4; + border-radius: 0 100% 0 0; + } + + .control-right .fa { + transform: rotate(-45deg) translateX(7px); + } + + .control-bottom { + left: 27%; + bottom: -8%; + transform: rotate(45deg); + border-radius: 0 5px 100% 5px; + } + + .control-bottom i { + transform: rotate(-45deg); + } + + .control-bottom .control-inner { + top: -1px; + left: -1px; + border-bottom: 1px solid #78aee4; + border-right: 1px solid #78aee4; + border-radius: 0 0 100% 0; + } + + .control-bottom .fa { + transform: rotate(-45deg) translateY(7px); + } +</style> diff --git a/web_src/src/components/videoList.vue b/web_src/src/components/videoList.vue new file mode 100644 index 0000000..234ddc8 --- /dev/null +++ b/web_src/src/components/videoList.vue @@ -0,0 +1,241 @@ +<template> + <div id="app"> + <el-container> + + <el-header> + <uiHeader></uiHeader> + </el-header> + <el-main> + <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;"> + <span style="font-size: 1rem; font-weight: bold;">璁惧鍒楄〃</span> + <div style="position: absolute; right: 1rem; top: 0.3rem;"> + <el-button icon="el-icon-refresh-right" circle size="mini" @click="getDeviceList()"></el-button> + </div> + </div> + <devicePlayer ref="devicePlayer"></devicePlayer> + <!--璁惧鍒楄〃--> + <el-table :data="deviceList" border style="width: 100%" :height="winHeight"> + <el-table-column prop="name" label="鍚嶇О" width="180" align="center"> + </el-table-column> + <el-table-column prop="deviceId" label="璁惧缂栧彿" width="240" align="center"> + </el-table-column> + <el-table-column label="鍦板潃" width="180" align="center"> + <template slot-scope="scope"> + <div slot="reference" class="name-wrapper"> + <el-tag size="medium">{{ scope.row.host.address }}</el-tag> + </div> + </template> + </el-table-column> + <el-table-column prop="manufacturer" label="鍘傚" align="center"> + </el-table-column> + <el-table-column prop="model" label="鍥轰欢鐗堟湰" align="center"> + </el-table-column> + <el-table-column prop="transport" label="閫氳鏂瑰紡" align="center"> + </el-table-column> + <el-table-column prop="channelCount" label="閫氶亾鏁�" align="center"> + </el-table-column> + <el-table-column label="鐘舵��" width="180" align="center"> + <template slot-scope="scope"> + <div slot="reference" class="name-wrapper"> + <el-tag size="medium">{{ scope.row.online==1?'鍦ㄧ嚎' :'绂荤嚎'}}</el-tag> + </div> + </template> + </el-table-column> + + <el-table-column label="鎿嶄綔" width="240" align="center" fixed="right"> + <template slot-scope="scope"> + <el-button size="mini" icon="el-icon-refresh" @click="refDevice(scope.row)">鍒锋柊</el-button> + <el-button size="mini" icon="el-icon-s-open" type="primary" @click="showChannelList(scope.row)">鏌ョ湅閫氶亾</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination + style="float: right" + @size-change="handleSizeChange" + @current-change="currentChange" + :current-page="currentPage" + :page-size="count" + :page-sizes="[15, 25, 35, 50]" + layout="total, sizes, prev, pager, next" + :total="total"> + </el-pagination> + + </el-main> + </el-container> + </div> +</template> + +<script> + import devicePlayer from './gb28181/devicePlayer.vue' + import uiHeader from './UiHeader.vue' + export default { + name: 'app', + components: { + devicePlayer, + uiHeader + }, + data() { + return { + deviceList: [], //璁惧鍒楄〃 + currentDevice: {}, //褰撳墠鎿嶄綔璁惧瀵硅薄 + + videoComponentList: [], + updateLooper: 0, //鏁版嵁鍒锋柊杞鏍囧織 + currentDeviceChannelsLenth:0, + winHeight: window.innerHeight - 200, + currentPage:1, + count:15, + total:0 + }; + }, + computed: { + getcurrentDeviceChannels: function() { + let data = this.currentDevice['channelMap']; + let channels = null; + if (data) { + channels = Object.keys(data).map(key => { + return data[key]; + }); + this.currentDeviceChannelsLenth = channels.length; + } + + console.log("鏁版嵁锛�" + JSON.stringify(channels)); + return channels; + } + }, + mounted() { + this.initData(); + this.updateLooper = setInterval(this.initData, 10000); + }, + destroyed() { + this.$destroy('videojs'); + clearTimeout(this.updateLooper); + }, + methods: { + initData: function() { + this.getDeviceList(); + }, + currentChange: function(val){ + this.currentPage = val; + this.getDeviceList(); + }, + handleSizeChange: function(val){ + this.count = val; + this.getDeviceList(); + }, + getDeviceList: function() { + let that = this; + + this.$axios.get(`/api/devices`,{ + params: { + page: that.currentPage - 1, + count: that.count + } + } ) + .then(function (res) { + console.log(res); + that.total = res.data.total; + that.deviceList = res.data.data; + }) + .catch(function (error) { + console.log(error); + }); + + }, + showChannelList: function(row) { + console.log(JSON.stringify(row)) + this.$router.push(`/channelList/${row.deviceId}/0/15/1`); + }, + + + //gb28181骞冲彴瀵规帴 + //鍒锋柊璁惧淇℃伅 + refDevice: function(itemData) { + ///api/devices/{deviceId}/sync + console.log("鍒锋柊瀵瑰簲璁惧:" + itemData.deviceId); + this.$axios({ + method: 'post', + url: '/api/devices/' + itemData.deviceId + '/sync' + }).then(function(res) { + // console.log("鍒锋柊璁惧缁撴灉锛�"+JSON.stringify(res)); + }).catch(function(e) { + that.$message({ + showClose: true, + message: '璇锋眰鎴愬姛', + type: 'success' + }); + });; + }, + //閫氱煡璁惧涓婁紶濯掍綋娴� + sendDevicePush: function(itemData) { + let deviceId = this.currentDevice.deviceId; + let channelId = itemData.channelId; + console.log("閫氱煡璁惧鎺ㄦ祦1锛�" + deviceId + " : " + channelId); + let that = this; + this.$axios({ + method: 'get', + url: '/api/play/' + deviceId + '/' + channelId + }).then(function(res) { + let ssrc = res.data.ssrc; + that.$refs.devicePlayer.play(ssrc,deviceId,channelId); + }).catch(function(e) { + }); + } + + } + }; +</script> + +<style> + .videoList { + display: flex; + flex-wrap: wrap; + align-content: flex-start; + } + + .video-item { + position: relative; + width: 15rem; + height: 10rem; + margin-right: 1rem; + background-color: #000000; + } + + .video-item-img { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + width: 100%; + height: 100%; + } + + .video-item-img:after { + content: ""; + display: inline-block; + position: absolute; + z-index: 2; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + width: 3rem; + height: 3rem; + background-image: url("../assets/loading.png"); + background-size: cover; + background-color: #000000; + } + + .video-item-title { + position: absolute; + bottom: 0; + color: #000000; + background-color: #ffffff; + line-height: 1.5rem; + padding: 0.3rem; + width: 14.4rem; + } +</style> diff --git a/web_src/src/main.js b/web_src/src/main.js new file mode 100644 index 0000000..1b31f7b --- /dev/null +++ b/web_src/src/main.js @@ -0,0 +1,25 @@ +import Vue from 'vue'; +import App from './App.vue'; +Vue.config.productionTip = false; +import ElementUI from 'element-ui'; +import 'element-ui/lib/theme-chalk/index.css'; +import router from './router/index.js'; +import axios from 'axios'; +import VueCookies from 'vue-cookies'; + +import echarts from 'echarts'; +import VueClipboard from 'vue-clipboard2' +Vue.use(VueClipboard) +Vue.use(ElementUI); +Vue.use(VueCookies); +Vue.prototype.$axios = axios; + +axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : ""; + +Vue.prototype.$cookies.config(60*30); + + +new Vue({ + router: router, + render: h => h(App), +}).$mount('#app') -- Gitblit v1.8.0