wszhyWx/pages/timeVideo/timeVideo.vue

250 lines
5.4 KiB
Vue
Raw Normal View History

2023-09-28 10:07:02 +00:00
<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>
2024-01-10 02:42:05 +00:00
<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>
</view>
<view class="timer">
<view class="left">
<image src="../../static/timer.png" mode=""></image>
2024-01-26 02:25:01 +00:00
<text>{{ time }}</text>
2023-09-28 10:07:02 +00:00
</view>
2024-01-26 02:25:01 +00:00
<view class="right" @click="toVideoLive(item.cameraSerialNumber,item.cameraChannelNumber)">
2024-01-10 02:42:05 +00:00
<image src="../../static/play.png" mode=""></image>
<text>现场实况</text>
2023-09-28 10:07:02 +00:00
</view>
</view>
</view>
2024-01-10 02:42:05 +00:00
</view>
2023-09-28 10:07:02 +00:00
</view>
</template>
<script>
export default {
data() {
return {
// 头部导航背景
background: {
backgroundColor: '#24B383',
},
2024-01-10 02:42:05 +00:00
userid: '',
deviceList: [],
liveList: [],
2024-01-26 02:25:01 +00:00
accesstoken:'',
src: '',
time:'',
2023-09-28 10:07:02 +00:00
};
},
2024-01-26 02:25:01 +00:00
onLoad() {
this.userid = uni.getStorageSync('userid');
this.getEquipmentInfo(this.userid);
},
2024-01-10 02:42:05 +00:00
onPullDownRefresh() {
this.getEquipmentInfo(this.userid)
},
mounted() {
2024-01-26 02:25:01 +00:00
setInterval(() => {
this.time = this.getCurrentTime()
}, 1000);
2024-01-10 02:42:05 +00:00
},
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)
// })
2024-01-26 02:25:01 +00:00
// this.getVideoData("AD6463273", 11)
2024-01-10 02:42:05 +00:00
} else {
this.$refs.uToast.show({
title: res.msg,
type: 'error',
})
}
})
},
// 获取摄像头得地址
2024-01-26 02:25:01 +00:00
// getVideoData(cameraid, channelid) {
// this.$http({
// url: this.api.camera_gethls,
// method: 'GET',
// data: {
// cameraid,
// channelid,
// }
// }).then(res => {
// if (res.code == 200) {
// this.accesstoken = res.data.accesstoken;
// this.src = res.data.ezopen;
// }
// })
// },
toMiniProgram(){
uni.navigateToMiniProgram({
appId: 'wxf2b3a0262975d8c2',
path: 'pages/live/live?accessToken=' + this.accesstoken + '&deviceSerial=AD6463273&channelNo=11',
success(res) {
console.log(res);
}
2024-01-10 02:42:05 +00:00
})
},
2024-01-26 02:25:01 +00:00
toVideoLive(cameraSerialNumber,cameraChannelNumber) {
if(cameraSerialNumber && cameraChannelNumber){
uni.navigateTo({
url: '/pages/videoLive/videoLive?cameraSerialNumber=' + cameraSerialNumber + '&cameraChannelNumber=' + cameraChannelNumber
})
}else{
uni.showToast({
icon:'none',
title: '暂无监控数据',
duration: 2000
});
}
},
getCurrentTime() {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
2023-09-28 10:07:02 +00:00
}
}
}
</script>
<style lang="scss" scoped>
2024-01-10 02:42:05 +00:00
.timeVideo {
width: 100%;
min-height: 100vh;
background-color: #F5F6FA;
.content {
box-sizing: border-box;
padding: 30rpx;
.item {
2023-09-28 10:07:02 +00:00
width: 690rpx;
2024-01-10 02:42:05 +00:00
height: 577rpx;
2023-09-28 10:07:02 +00:00
background: #FFFFFF;
border-radius: 15rpx;
2024-01-10 02:42:05 +00:00
margin-bottom: 30rpx;
.nav {
height: 90rpx;
box-sizing: border-box;
padding: 20rpx;
2023-09-28 10:07:02 +00:00
display: flex;
align-items: center;
2024-01-10 02:42:05 +00:00
>image {
width: 50rpx;
height: 50rpx;
margin-right: 16rpx;
2023-09-28 10:07:02 +00:00
}
2024-01-10 02:42:05 +00:00
>text {
font-size: 30rpx;
2023-09-28 10:07:02 +00:00
font-family: PingFang SC;
font-weight: bold;
2024-01-10 02:42:05 +00:00
color: #333333;
2023-09-28 10:07:02 +00:00
}
}
2024-01-10 02:42:05 +00:00
.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;
2023-09-28 10:07:02 +00:00
display: flex;
align-items: center;
2024-01-10 02:42:05 +00:00
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;
}
2023-09-28 10:07:02 +00:00
}
2024-01-10 02:42:05 +00:00
.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;
}
2023-09-28 10:07:02 +00:00
}
}
}
}
}
2024-01-10 02:42:05 +00:00
</style>