视频监控
This commit is contained in:
@@ -1,57 +1,41 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="videoSurve">
|
<section class="videoSurveillance">
|
||||||
<div class="top">
|
<div class="area-content">
|
||||||
<AiAreaPicker ref="area" class="ai-area" :value="areaId" :name.sync="areaName" :areaId="$areaId" @select="areaSelect">
|
<AiAreaPicker class="ai-area" :value="areaId" :areaId="areaId" :name.sync="areaName" @select="areaSelect">
|
||||||
<div class="ai-area__wrapper">
|
<div class="ai-area__wrapper">
|
||||||
<span class="label" v-if="areaName">{{ areaName }}</span>
|
<span class="label" v-if="areaName">{{ areaName }}</span>
|
||||||
<span v-else>请选择</span>
|
<span v-else>请选择</span>
|
||||||
<!-- <u-icon name="arrow-right"></u-icon> -->
|
<u-icon name="arrow-down" color="#666" size="24"></u-icon>
|
||||||
</div>
|
</div>
|
||||||
</AiAreaPicker>
|
</AiAreaPicker>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="msgs">
|
<div class="num-content">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<span class="tag"></span>
|
<h3>{{ count.online || 0 }}</h3>
|
||||||
<span class="hint">设备总数</span>
|
<p>在线设备</p>
|
||||||
<span class="num">50</span>
|
</div>
|
||||||
</div>
|
<div class="item">
|
||||||
|
<h3>{{ count.sum - count.online || 0 }}</h3>
|
||||||
<div class="item">
|
<p>离线</p>
|
||||||
<span class="tag"></span>
|
</div>
|
||||||
<span class="hint">在线率</span>
|
<div class="item">
|
||||||
<span class="num">68%</span>
|
<h3>{{ onlineRate * 100 || 0 }}%</h3>
|
||||||
</div>
|
<p>在线率</p>
|
||||||
|
|
||||||
<div class="item">
|
|
||||||
<span class="tag"></span>
|
|
||||||
<span class="hint">在线设备</span>
|
|
||||||
<span class="num">34</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="item">
|
|
||||||
<span class="tag"></span>
|
|
||||||
<span class="hint">离线设备</span>
|
|
||||||
<span class="num">16</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="middle">
|
<div class="list-content">
|
||||||
<div class="nav">设备列表</div>
|
<div class="item" v-for="(item, index) in list" :key="index" @click="showMonitor(item)">
|
||||||
|
<img class="img" :src="item.indexUrl" alt="" v-if="item.deviceStatus == 1" />
|
||||||
<div class="imgs">
|
<img class="img" src="../../static/AppVideoSurve/offline.png" alt="" v-else />
|
||||||
<div class="items">
|
<p>{{ item.name }}</p>
|
||||||
<img src="../../static/img/avatar.png" alt="" />
|
<img class="icon" src="../../static/AppVideoSurve/play-icon.png" alt="" v-if="item.deviceStatus == 1" />
|
||||||
<span class="hint">11</span>
|
<img class="icon" src="../../static/AppVideoSurve/not-play-icon.png" alt="" v-else />
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="items">
|
|
||||||
<img src="../../static/img/avatar.png" alt="" />
|
|
||||||
<span class="hint">11</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<AiEmpty v-if="!list.length" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -60,39 +44,79 @@ import { mapState } from 'vuex'
|
|||||||
export default {
|
export default {
|
||||||
name: 'AppVideoSurve',
|
name: 'AppVideoSurve',
|
||||||
appName: '视频监控',
|
appName: '视频监控',
|
||||||
components: {},
|
|
||||||
props: {},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
nodes: [{ nodeName: '首页' }],
|
||||||
|
monitors: [],
|
||||||
|
|
||||||
areaId: '',
|
areaId: '',
|
||||||
$areaId: '',
|
|
||||||
areaName: '',
|
areaName: '',
|
||||||
|
list: [],
|
||||||
|
count: {},
|
||||||
|
Echart: null,
|
||||||
|
onlineRate: '',
|
||||||
|
offlineRate: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: { ...mapState(['user']) },
|
||||||
...mapState(['user']),
|
onLoad() {},
|
||||||
},
|
onShow() {
|
||||||
watch: {},
|
|
||||||
onLoad() {
|
|
||||||
this.areaId = this.$areaId
|
this.areaId = this.$areaId
|
||||||
this.areaName = this.$areaName
|
this.areaName = this.$areaName
|
||||||
|
this.getList()
|
||||||
},
|
},
|
||||||
onShow() {},
|
|
||||||
methods: {
|
methods: {
|
||||||
|
getMonitors(nodeId, queryType = 0) {
|
||||||
|
this.monitors = []
|
||||||
|
this.$instance
|
||||||
|
.post('/app/appzyvideoequipment/getTree', {
|
||||||
|
nodeId,
|
||||||
|
queryType,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (res?.data) {
|
||||||
|
this.monitors = JSON.parse(res.data)?.[queryType == 0 ? 'node' : 'device'] || []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getMore(row) {
|
||||||
|
this.nodes.push(row)
|
||||||
|
this.getMonitors(row.nodeId, row.hasChild == 1 ? 0 : 1)
|
||||||
|
},
|
||||||
|
isCurrent(index) {
|
||||||
|
return index == Math.max(this.nodes?.length - 1, 0)
|
||||||
|
},
|
||||||
|
gotoNode(node, index) {
|
||||||
|
this.nodes.splice(index + 1)
|
||||||
|
this.getMonitors(node.nodeId)
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
this.$instance.post(`/app/appzyvideoequipment/getAreaEquipment?areaId=${this.areaId}`).then((res) => {
|
||||||
|
if (res?.data) {
|
||||||
|
this.list = res.data.list
|
||||||
|
this.count = res.data.count
|
||||||
|
this.onlineRate = (this.count.online / this.count.sum).toFixed(2)
|
||||||
|
this.offlineRate = (1 - this.onlineRate).toFixed(2)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
areaSelect(e) {
|
areaSelect(e) {
|
||||||
console.log(e)
|
this.areaId = e
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
showMonitor(row) {
|
||||||
|
if (row.deviceStatus != 1) return
|
||||||
|
uni.navigateTo({ url: `./monitorDetail?id=${row.id}` })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style lang="scss" scoped>
|
||||||
.videoSurve {
|
.videoSurveillance {
|
||||||
height: 100%;
|
background: #fff;
|
||||||
.top {
|
padding: 0 32px;
|
||||||
padding: 0 32px;
|
.area-content {
|
||||||
background: #58657e;
|
|
||||||
color: #fff;
|
|
||||||
.ai-area {
|
.ai-area {
|
||||||
.ai-area__wrapper {
|
.ai-area__wrapper {
|
||||||
padding: 28px 0;
|
padding: 28px 0;
|
||||||
@@ -100,71 +124,97 @@ export default {
|
|||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.msgs {
|
.u-icon {
|
||||||
display: flex;
|
margin-left: 6px;
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: 8px 0 32px 0;
|
|
||||||
.item {
|
|
||||||
margin-top: 24px;
|
|
||||||
.tag {
|
|
||||||
display: inline-block;
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
vertical-align: middle;
|
|
||||||
margin-right: 8px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
}
|
||||||
.hint {
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
.num {
|
|
||||||
font-size: 28px;
|
|
||||||
font-weight: 500;
|
|
||||||
margin-left: 32px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.item:nth-child(2n + 1) {
|
|
||||||
width: 45%;
|
|
||||||
}
|
|
||||||
.item:nth-child(2n) {
|
|
||||||
width: 55%;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.middle {
|
.num-content {
|
||||||
padding: 0 32px;
|
// width: calc(100% - 40px);
|
||||||
.nav {
|
height: 164px;
|
||||||
padding: 48px 0 32px 0;
|
background: #eee;
|
||||||
font-size: 38px;
|
border-radius: 16px;
|
||||||
font-weight: 600;
|
margin: 32px 0 0 0;
|
||||||
}
|
display: flex;
|
||||||
|
|
||||||
.imgs {
|
.item {
|
||||||
display: flex;
|
flex: 1;
|
||||||
flex-wrap: wrap;
|
text-align: center;
|
||||||
.items {
|
position: relative;
|
||||||
width: 49%;
|
|
||||||
margin-top: 24px;
|
.monitor-icon {
|
||||||
img {
|
width: 48px;
|
||||||
width: 100%;
|
height: 48px;
|
||||||
height: 188px;
|
position: absolute;
|
||||||
}
|
top: 50%;
|
||||||
.hint {
|
left: 50%;
|
||||||
margin-top: 8px;
|
margin-left: -24px;
|
||||||
}
|
margin-top: -24px;
|
||||||
}
|
}
|
||||||
.items:nth-child(2n + 1) {
|
|
||||||
margin-right: 2%;
|
h3 {
|
||||||
|
font-size: 44px;
|
||||||
|
font-family: PingFangSC-Semibold, PingFang SC;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
line-height: 60px;
|
||||||
|
margin-top: 32px;
|
||||||
}
|
}
|
||||||
.items:nth-child(-n + 2) {
|
|
||||||
margin-top: 0;
|
p {
|
||||||
|
font-size: 28px;
|
||||||
|
font-family: PingFangSC-Regular, PingFang SC;
|
||||||
|
color: #666;
|
||||||
|
line-height: 40px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.list-content {
|
||||||
|
width: 100%;
|
||||||
|
padding: 38px 0 0 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
display: inline-block;
|
||||||
|
width: calc(50% - 36px);
|
||||||
|
// margin-right: 36px;
|
||||||
|
border-radius: 16px;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
vertical-align: top;
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 100%;
|
||||||
|
height: 218px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
border-radius: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 34px;
|
||||||
|
font-family: PingFangSC-Regular, PingFang SC;
|
||||||
|
color: #333;
|
||||||
|
line-height: 48px;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 40px;
|
||||||
|
height: 48px;
|
||||||
|
position: absolute;
|
||||||
|
top: 84px;
|
||||||
|
left: 158px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item:nth-child(2n + 0) {
|
||||||
|
margin-left: 36px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
92
src/mods/AppVideoSurve/monitorDetail.vue
Normal file
92
src/mods/AppVideoSurve/monitorDetail.vue
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<template>
|
||||||
|
<section class="monitorDetail">
|
||||||
|
<div class="videoBox">
|
||||||
|
<iframe ref="monitorIns" :style="style" :src="monitor.url" allow="autoplay *; microphone *; fullscreen *" allowfullscreen allowtransparency allowusermedia frameBorder="no" />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'monitorDetail',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
style: {},
|
||||||
|
monitor: {},
|
||||||
|
width: '',
|
||||||
|
height: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(params) {
|
||||||
|
this.getDetail(params.id)
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.detectOrient()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getDetail(deviceId) {
|
||||||
|
deviceId &&
|
||||||
|
this.$instance
|
||||||
|
.post('/app/appzyvideoequipment/getWebSdkUrl', null, {
|
||||||
|
params: { deviceId },
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (res?.data) {
|
||||||
|
this.monitor = JSON.parse(res.data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
detectOrient() {
|
||||||
|
uni.onWindowResize((res) => {
|
||||||
|
this.width = res.size.windowWidth
|
||||||
|
this.height = res.size.windowHeight
|
||||||
|
console.log('变化后的窗口宽度=' + res.size.windowWidth)
|
||||||
|
console.log('变化后的窗口高度=' + res.size.windowHeight)
|
||||||
|
})
|
||||||
|
// var width = document.querySelector('.monitorDetail').clientWidth
|
||||||
|
// var height = document.querySelector('.monitorDetail').clientHeight
|
||||||
|
if (this.width >= this.height) {
|
||||||
|
// 竖屏
|
||||||
|
this.style = {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
transform: 'rotate(0eg)',
|
||||||
|
transformOrigin: `0 0`,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.style = {
|
||||||
|
width: height + 'px',
|
||||||
|
height: width + 'px',
|
||||||
|
transform: 'rotate(90deg)',
|
||||||
|
transformOrigin: `${width / 2}px ${width / 2}px`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.monitorDetail {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background: #000;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
.videoBox {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
BIN
src/static/AppVideoSurve/not-play-icon.png
Normal file
BIN
src/static/AppVideoSurve/not-play-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/static/AppVideoSurve/off-icon.png
Normal file
BIN
src/static/AppVideoSurve/off-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src/static/AppVideoSurve/offline.png
Normal file
BIN
src/static/AppVideoSurve/offline.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
BIN
src/static/AppVideoSurve/on-icon.png
Normal file
BIN
src/static/AppVideoSurve/on-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 802 B |
BIN
src/static/AppVideoSurve/play-icon.png
Normal file
BIN
src/static/AppVideoSurve/play-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 622 B |
Reference in New Issue
Block a user