wszhyWx/pages/timeVideo/timeVideo.vue

214 lines
4.3 KiB
Vue

<template>
<view class="timeVideo">
<u-navbar :background="background" :is-back='true' back-icon-color='#FFFFFF' :border-bottom="false" title="实时视频"
title-color='#FFFFFF' :title-bold='true' title-size='32'></u-navbar>
<view class="content">
<view class="item" v-for="(item,index) in deviceList" :key="index">
<view class="nav">
<image src="../../static/video.png" mode=""></image>
<text>{{item.deviceTypeName}}-摄像机#2</text>
</view>
<view class="video" >
<image src="../../static/video1.png" mode=""></image>
<!-- <live-player :src="src" mode='live' muted='true' autoplay @error="error"
style="width: 100%; height: 100%;border-radius: 15rpx;" /> -->
</view>
<view class="timer">
<view class="left">
<image src="../../static/timer.png" mode=""></image>
<text>2023-09-20 14:00:55</text>
</view>
<view class="right" @click="toVideoLive">
<image src="../../static/play.png" mode=""></image>
<text>现场实况</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
// import EZUIKit from 'ezuikit-js';
export default {
data() {
return {
// 头部导航背景
background: {
backgroundColor: '#24B383',
},
userid: '',
deviceList: [],
liveList: [],
src: ''
};
},
onPullDownRefresh() {
this.getEquipmentInfo(this.userid)
},
mounted() {
this.userid = uni.getStorageSync('userid');
// console.log(EZUIKit);
this.getEquipmentInfo(this.userid)
},
methods: {
// 根据用户id查询对应的设备数据
getEquipmentInfo(userid) {
uni.showLoading({
title: '加载中...'
})
this.$http({
url: this.api.sel_eqbyid + userid,
method: 'GET'
}).then(res => {
if (res.code == 200) {
uni.hideLoading()
uni.stopPullDownRefresh();
this.deviceList = res.data
// this.deviceList.forEach(el=>{
// this.getVideoData(el.cameraSerialNumber,el.cameraChannelNumber)
// })
this.getVideoData("AD6463273", 11)
} else {
this.$refs.uToast.show({
title: res.msg,
type: 'error',
})
}
})
},
// 获取摄像头得地址
getVideoData(cameraid, channelid) {
this.$http({
url: this.api.camera_gethls,
method: 'GET',
data: {
cameraid,
channelid,
}
}).then(res => {
if (res.code == 200) {
this.src = res.ezopen
}
})
},
toVideoLive() {
uni.navigateTo({
url: '/pages/videoLive/videoLive'
})
}
}
}
</script>
<style lang="scss" scoped>
.timeVideo {
width: 100%;
min-height: 100vh;
background-color: #F5F6FA;
.content {
box-sizing: border-box;
padding: 30rpx;
.item {
width: 690rpx;
height: 577rpx;
background: #FFFFFF;
border-radius: 15rpx;
margin-bottom: 30rpx;
.nav {
height: 90rpx;
box-sizing: border-box;
padding: 20rpx;
display: flex;
align-items: center;
>image {
width: 50rpx;
height: 50rpx;
margin-right: 16rpx;
}
>text {
font-size: 30rpx;
font-family: PingFang SC;
font-weight: bold;
color: #333333;
}
}
.video {
width: 690rpx;
height: 380rpx;
background: #FFFFFF;
border-radius: 15rpx;
box-sizing: border-box;
padding: 0 20rpx;
>image {
width: 100%;
height: 100%;
}
}
.timer {
width: 100%;
height: 107rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 0 20rpx;
.left {
display: flex;
align-items: center;
>image {
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
}
>text {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: bold;
color: #666666;
}
}
.right {
width: 200rpx;
height: 66rpx;
background: linear-gradient(0deg, #7BD4B6 0%, #26B383 100%);
border-radius: 33rpx;
display: flex;
justify-content: center;
align-items: center;
>image {
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
}
>text {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
}
}
}
}
}
</style>