Show.vue
8.19 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<template>
<div class="">
<el-header class="headers">
<span class="title">实事分析展示</span>
</el-header>
<el-container style="min-height:calc(100vh - 64px);" class="showbox">
<el-main style="padding: 12px;overflow:hidden">
<div style="margin-bottom: 12px;">
<el-row :gutter="20">
<el-col :span="15">
<div class="videoCon">
<!-- 加入视频 -->
<videoplay ref="videoplay" :playurl="playurl"></videoplay>
</div>
</el-col>
<el-col :span="9">
<div class="imgCon">
<div class="imgDiv">
<!-- 加入img 100% -->
<div v-if="resultData[0]">
<img :src = "resultData[0].pic" class="photos"/>
</div>
</div>
<div style="padding:0 10px 10px 10px">
<div class="textDiv">
<div v-if="resultData[0]">
<p>抓拍时间:{{resultData[0].shoot_dt}}</p>
<p>抓拍地点:{{resultData[0].location_name}}</p>
<p>车牌号码:{{resultData[0].vehicle_plate_text}}</p>
<p>车辆类型:{{resultData[0].vehicle_body_type_text}}</p>
<p>车身颜色:{{resultData[0].vehicle_body_color_text}}</p>
<p>违法类型:{{resultData[0].illegal_text}}</p>
</div>
</div>
</div>
</div>
</el-col>
</el-row>
<div style="clear: both;"></div>
</div>
<el-row class="bottomDiv" :gutter="10">
<!-- 循环生成lDiv -->
<el-col :span="8" class="lDiv">
<div class="leftImg">
<!-- 加入img 100% -->
<div v-if="resultData[1]">
<img :src = "resultData[1].pic" class="photos"/>
</div>
</div>
<div class="rightDiv">
<div v-if="resultData[1]">
<p>抓拍时间:{{resultData[1].shoot_dt}}</p>
<p>抓拍地点:{{resultData[1].location_name}}</p>
<p>车牌号码:{{resultData[1].vehicle_plate_text}}</p>
<p>车辆类型:{{resultData[1].vehicle_body_type_text}}</p>
<p>车身颜色:{{resultData[1].vehicle_body_color_text}}</p>
<p>违法类型:{{resultData[1].illegal_text}}</p>
</div>
</div>
<div style="clear: both;"></div>
</el-col>
<el-col :span="8" class="lDiv">
<div class="leftImg">
<!-- 加入img 100% -->
<div v-if="resultData[2]">
<img :src = "resultData[2].pic" class="photos"/>
</div>
</div>
<div class="rightDiv">
<div v-if="resultData[2]">
<p>抓拍时间:{{resultData[2].shoot_dt}}</p>
<p>抓拍地点:{{resultData[2].location_name}}</p>
<p>车牌号码:{{resultData[2].vehicle_plate_text}}</p>
<p>车辆类型:{{resultData[2].vehicle_body_type_text}}</p>
<p>车身颜色:{{resultData[2].vehicle_body_color_text}}</p>
<p>违法类型:{{resultData[2].illegal_text}}</p>
</div>
</div>
<div style="clear: both;"></div>
</el-col>
<el-col :span="8" class="lDiv">
<div class="leftImg">
<!-- 加入img 100% -->
<div v-if="resultData[3]">
<img :src = "resultData[3].pic" class="photos"/>
</div>
</div>
<div class="rightDiv">
<div v-if="resultData[3]">
<p>抓拍时间:{{resultData[3].shoot_dt}}</p>
<p>抓拍地点:{{resultData[3].location_name}}</p>
<p>车牌号码:{{resultData[3].vehicle_plate_text}}</p>
<p>车辆类型:{{resultData[3].vehicle_body_type_text}}</p>
<p>车身颜色:{{resultData[3].vehicle_body_color_text}}</p>
<p>违法类型:{{resultData[3].illegal_text}}</p>
</div>
</div>
<div style="clear: both;"></div>
</el-col>
<div style="clear: both;"></div>
</el-row>
</el-main>
</el-container>
</div>
</template>
<script>
import videoplay from './public/videoPlay'
export default {
name: "home",
data(){
return{
isCollapse: false,
conHeight:0,
playurl:'',
subtaskid:'',
taskid:'',
showws:null,
keepAlive:null,
quitws:false,
resultData:[]
};
},
created(){
this.taskid = this.$route.params.taskid
this.subtaskid = this.$route.params.subtaskid
this.playurl = this.$route.params.playurl
},
mounted(){
this.$refs.videoplay.videoPlay()
},
components: {
videoplay
// HelloWorld
},
methods:{
connectwebsocket(type) {
let that = this;
this.connect_id = new Date().getTime();
this.showws = new WebSocket(
"ws://" +
this.$api.wsIP +
"/websocket/v1/recv_data/connects/" +
this.connect_id
);
this.showws.onopen = () => {
console.log("ws事件推送服务连接成功");
let send_mesage =
'{"type":"request","connect_id": "' +
this.connect_id +
'","subtask_id":"' +
this.subtaskid +
'"}';
this.showws.send(send_mesage);
};
this.showws.onmessage = evt => {
let data = JSON.parse(evt.data);
if (data.command) {
} else if (data.type == "response") {
console.log("请求任务推送成功");
} else if (data.event_cate) {
debugger
if (data.event_cate != "flow") {
try {
data.picsEmpty = data.pics.length == 0 ? true : false;
data.pic =
data.pics[0].src_url || "data:image/jpeg;base64," + data.pics[0].pic_base64;
data.bigpic = data.pics[0].src_url || "data:image/jpeg;base64," + data.pics[0].pic_base64;
that.$buildCode.init(data);
if(that.resultData.length > 4) {
that.resultData.pop(data)
} else {
that.resultData.unshift(data)
}
} catch (err) {
console.log(err);
}
}
}
};
try {
this.keepAlive = setInterval(() => {
let send_mesage =
'{"type":"request","id":"' +
new Date().getTime() +
'","mts":"' +
new Date().getTime() +
'","command": "get /websocket/v1/recv_data/connects/' +
this.connect_id +
'/keep_alive"}';
if (that.showws.readyState == 1) {
that.showws.send(send_mesage);
} else {
clearInterval(that.keepAlive);
that.connectwebsocket(1);
console.log("推送服务断开连接");
}
}, 20000);
} catch (err) {
console.log(err);
}
}
},
beforeMount() {
this.connectwebsocket();
//监听成功
this.showws.onopen = ()=> {
let send_mesage =
'{"type":"request","connect_id": "' +
this.connect_id +
'","subtask_id":"' +
this.subtaskid +
'"}';
this.showws.send(send_mesage);
console.log("showws事件推送服务连接成功");
};
//监听断开
this.showws.onclose = function() {
if(quitws) return
window.clearInterval(this.keepAlive);
this.connectwebsocket(1);
};
},
beforeDestroy() {
this.showws.close();
this.quitws = true
try {
window.clearTimeout(this.keepAlive);
} catch (error) {}
}
};
</script>
<style scoped="scoped" lang="scss">
.headers{
line-height: 60px;
}
.title{
font-size:24px;
font-family:MicrosoftYaHeiUI;
color:rgba(255,255,255,1);
-webkit-background-clip:text;
}
.videoCon{
background: #FFFFFF;
width:100%;
height:70vh;
}
.imgCon{
height: 70vh;
background: #FFFFFF;
}
.imgDiv{
padding:0 10px 0 10px;
height:40vh;
}
.imgDiv>div{
height: 100%;
background: #d8d8d8;
}
.lDiv{
float: left;
}
.lDiv:nth-last-of-type(2){
margin: 0;
}
.rightDiv{
width:10.5vw;
height:20vh;
border:1px solid rgba(229,229,229,1);
border-left: none;
color: #555555;
font-size: 12px;
float: left;
}
.rightDiv p{
margin: 10px 0;
margin-left: 10px;
}
.textDiv{
height:29vh;
border:1px solid rgba(229,229,229,1);
color: #555555;
font-size:22px;
}
.textDiv p{
margin: 14px 0;
margin-left: 37px;
}
.bottomDiv{
padding: 7px;
background: #FFFFFF;
display: flex;
flex-flow: row nowrap;
}
.leftImg{
width: 21vw;
height: 20.2vh;
background: #d8d8d8;
overflow: hidden;
float: left;
}
.leftImg>div{
height: 100%;
width: 100%;
}
.photos{
width: 100%;
height: 100%;
}
</style>