camera.vue
4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<template>
<view class="camera-page">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<view class="org-sty">
<view @click="openOrg" class="org-item">
<view class="u-flex org-contact"><text class="text">组织关系</text></view>
<view class="u-flex org-device">
<image class="device-image" src="../../../static/org.png"></image>
<text class="device-text">设备数:{{ deviceTotal }}</text>
</view>
</view>
<view class="org-item"><image class="image" src="../../../static/right-arrow.png"></image></view>
</view>
<view class="camera-container">
<view class="container-item">
<view @click="openCameraDetail(item.url)" v-for="(item, index) in list" :key="index" class="item">
<video class="video" :src="item.videoUrl" controls></video>
<view class="bottom-text">
<text class="text">{{ item.name }}</text>
</view>
<view @click="hideImageUrl(item, index)" :style="[index == current ? { display: 'none' } : { display: 'block' }]" class="avatar-cover">
<image class="image" :src="item.avatar"></image>
</view>
</view>
</view>
</view>
<view style="height: 30rpx;"></view>
</view>
</template>
<script>
export default {
data() {
return {
current: 0,
deviceTotal: 0,
list: [
{
videoUrl: 'http://113.204.115.250:83/openUrl/e5NZg76/live.m3u8',
name: '摄像头1',
avatar: 'http://47.99.141.212:9000/yunteng/bdNZzPQReLufzqx.jpg'
},
{
videoUrl: 'https://klxxcdn.oss-cn-hangzhou.aliyuncs.com/histudy/hrm/media/bg2.mp4',
name: '摄像头2',
avatar: 'http://47.99.141.212:9000/yunteng/bdNZzPQReLufzqx.jpg'
},
{
videoUrl: 'https://stream7.iqilu.com/10339/article/202002/18/2fca1c77730e54c7b500573c2437003f.mp4',
name: '摄像头3',
avatar: 'http://47.99.141.212:9000/yunteng/bdNZzPQReLufzqx.jpg'
},
{
videoUrl: 'https://stream7.iqilu.com/10339/article/202002/17/c292033ef110de9f42d7d539fe0423cf.mp4',
name: '摄像头4',
avatar: 'http://47.99.141.212:9000/yunteng/bdNZzPQReLufzqx.jpg'
},
{
videoUrl: 'https://stream7.iqilu.com/10339/article/202002/16/3be2e4ef4aa21bfe7493064a7415c34d.mp4',
name: '摄像头5',
avatar: 'http://47.99.141.212:9000/yunteng/bdNZzPQReLufzqx.jpg'
},
{
videoUrl: 'https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209104902N3v5Vpxuvb.mp4',
name: '摄像头6',
avatar: 'http://47.99.141.212:9000/yunteng/bdNZzPQReLufzqx.jpg'
},
{
videoUrl: 'https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209104902N3v5Vpxuvb.mp4',
name: '摄像头6',
avatar: 'http://47.99.141.212:9000/yunteng/bdNZzPQReLufzqx.jpg'
},
{
videoUrl: 'https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209104902N3v5Vpxuvb.mp4',
name: '摄像头6',
avatar: 'http://47.99.141.212:9000/yunteng/bdNZzPQReLufzqx.jpg'
},
{
videoUrl: 'https://stream7.iqilu.com/10339/upload_transcode/202002/09/20200209104902N3v5Vpxuvb.mp4',
name: '摄像头6',
avatar: 'http://47.99.141.212:9000/yunteng/bdNZzPQReLufzqx.jpg'
}
]
};
},
onLoad() {
// 隐藏原生的tabbar
uni.hideTabBar();
this.getDeviceTotalData();
this.getCameraList();
},
methods: {
hideImageUrl(item, index) {
this.current = index;
},
getCameraList() {
let httpData = {
page: 1,
pageSize: 10
};
uni.$u.http.get('/yt/video', { params: httpData, custom: { load: false } }).then(res => {
if (res) {
console.log('Video', res);
this.list = res.items;
}
});
},
getDeviceTotalData() {
let httpData = {
page: 1,
pageSize: 10
};
uni.$u.http
.get('/yt/device', { params: httpData, custom: { load: false } })
.then(res => {
if (res) {
this.deviceTotal = res.total;
}
})
.catch(e => {
uni.$u.toast(e.data?.message);
});
},
openCameraDetail(e) {
console.log(e);
},
openOrg() {
uni.navigateTo({
url: './org/org'
});
}
}
};
</script>
<style lang="scss" scoped>
@import '../static/camera.scss';
</style>