|
@ -83,6 +83,7 @@ s<template>
|
83
|
83
|
<div>抓拍图片</div>
|
84
|
84
|
<div>
|
85
|
85
|
<img :src="rowdata.pictureInfo.fileUrl" alt="" srcset="" style="width:100%;height:100%">
|
|
86
|
|
86
|
87
|
</div>
|
87
|
88
|
</div>
|
88
|
89
|
<div class="detail_item2">
|
|
@ -90,12 +91,19 @@ s<template>
|
90
|
91
|
<div>
|
91
|
92
|
<div>
|
92
|
93
|
<!-- 修改-->
|
93
|
|
<img src="" alt="" srcset="" style="width:120px;height:160px;border-radius: 5px; ">
|
|
94
|
<img :src="newimage" alt="" srcset="" style="width:120px;height:160px;border-radius: 5px; ">
|
|
95
|
|
|
96
|
<!-- <div class="scaleimg">
|
|
97
|
<div :style="{backgroundImage:style.bgimg,backgroundPosition:style.bgposition,
|
|
98
|
transform:style.scale,
|
|
99
|
width:style.width,
|
|
100
|
height:style.height}" class="imgcontant"></div>
|
|
101
|
</div> -->
|
94
|
102
|
<div class="bottomimg">抓拍图片</div>
|
95
|
103
|
</div>
|
96
|
104
|
<div>
|
97
|
105
|
<!-- 修改-->
|
98
|
|
<img src="http://img95.699pic.com/photo/50028/0321.jpg_wh300.jpg" alt="" srcset="">
|
|
106
|
<img src="@/assets/images/Identify_the_successful.png" alt="" srcset="">
|
99
|
107
|
</div>
|
100
|
108
|
<div>
|
101
|
109
|
<img :src="rowdata.alarmInfo.headerImage" alt="" srcset="" style="width:100%;height:160px; border-radius: 5px;">
|
|
@ -167,7 +175,17 @@ export default {
|
167
|
175
|
],
|
168
|
176
|
// 当前页
|
169
|
177
|
page: 1,
|
170
|
|
limit: 10
|
|
178
|
limit: 10,
|
|
179
|
// style: {
|
|
180
|
// bgimg: '',
|
|
181
|
// bgposition: '',
|
|
182
|
// scale: '',
|
|
183
|
// width: '',
|
|
184
|
// height: ''
|
|
185
|
|
|
186
|
// }
|
|
187
|
// 截取后的图片
|
|
188
|
newimage: ''
|
171
|
189
|
|
172
|
190
|
}
|
173
|
191
|
},
|
|
@ -175,7 +193,6 @@ export default {
|
175
|
193
|
mounted () {
|
176
|
194
|
// this.gettype()
|
177
|
195
|
this.getcompanyTypesList()
|
178
|
|
// this.search()
|
179
|
196
|
},
|
180
|
197
|
methods: {
|
181
|
198
|
// 表格中的选择数据
|
|
@ -201,12 +218,43 @@ export default {
|
201
|
218
|
var res = await accessapi.getOneInAndOutRecord({ params: { aiIdenLogId: scope.row.aiIdenLogId } })
|
202
|
219
|
|
203
|
220
|
if (res.data.success) {
|
204
|
|
this.detail_modal = true
|
205
|
221
|
// this.rowdata = res.data.data
|
206
|
222
|
this.rowdata.pictureInfo = res.data.data.pictureInfo
|
|
223
|
console.log('数据', this.rowdata.pictureInfo)
|
207
|
224
|
this.rowdata.alarmInfo = res.data.data.alarmInfo
|
208
|
|
// console.log(res.data.data)
|
209
|
|
// console.log('详情数据是', this.rowdata)
|
|
225
|
console.log('数据', this.rowdata.alarmInfo)
|
|
226
|
// this.rowdata.alarmInfo.newImg = this.rowdata.pictureInfo.fileUrl
|
|
227
|
|
|
228
|
this.getImage()
|
|
229
|
// var loadTimer
|
|
230
|
// var imgObject = new Image()
|
|
231
|
// imgObject.setAttribute('crossOrigin', 'anonymous')
|
|
232
|
// imgObject.src = this.rowdata.pictureInfo.fileUrl
|
|
233
|
// console.log(this)
|
|
234
|
// imgObject.onload = this.onImgLoaded(loadTimer, imgObject, this.rowdata.alarmInfo)
|
|
235
|
|
|
236
|
// console.log(this.rowdata.alarmInfo.newImg)
|
|
237
|
|
|
238
|
// this.style.width = res.data.data.alarmInfo.face_box[2] - res.data.data.alarmInfo.face_box[0] + 'px'
|
|
239
|
// // console.log('width是', this.style.width)
|
|
240
|
// this.style.height = res.data.data.alarmInfo.face_box[3] - res.data.data.alarmInfo.face_box[1] + 'px'
|
|
241
|
// // console.log('height是', this.style.height)
|
|
242
|
// this.style.bgimg = 'url(' + res.data.data.pictureInfo.fileUrl + ')'
|
|
243
|
// // console.log('bgimg是', this.style.bgimg)
|
|
244
|
// this.style.bgposition = '' + -res.data.data.alarmInfo.face_box[0] + 'px ' + -res.data.data.alarmInfo.face_box[1] + 'px'
|
|
245
|
// console.log('bgposition是', this.style.bgposition)
|
|
246
|
// // transform: scale(0.33, 0.33);
|
|
247
|
// var width = res.data.data.alarmInfo.face_box[2] - res.data.data.alarmInfo.face_box[0]
|
|
248
|
// var height = res.data.data.alarmInfo.face_box[3] - res.data.data.alarmInfo.face_box[1]
|
|
249
|
// var scalex = 120 / width
|
|
250
|
// var scaley = 160 / height
|
|
251
|
// // console.log(scalex)
|
|
252
|
// this.style.scale = 'scale(' + scalex + ',' + scaley + ')'
|
|
253
|
// // console.log('scale是', this.style.scale)
|
|
254
|
// // console.log(res.data.data)
|
|
255
|
// console.log('详情数据是', this.rowdata.alarmInfo)
|
|
256
|
|
|
257
|
this.detail_modal = true
|
210
|
258
|
} else {
|
211
|
259
|
this.$Message.danger('获取数据失败')
|
212
|
260
|
}
|
|
@ -311,7 +359,41 @@ export default {
|
311
|
359
|
} else {
|
312
|
360
|
return true
|
313
|
361
|
}
|
|
362
|
},
|
|
363
|
async getImage () {
|
|
364
|
var loadTimer
|
|
365
|
var imgObject = new Image()
|
|
366
|
imgObject.setAttribute('crossOrigin', 'anonymous')
|
|
367
|
imgObject.src = this.rowdata.pictureInfo.fileUrl
|
|
368
|
var e = this.rowdata.alarmInfo
|
|
369
|
var that = this
|
|
370
|
imgObject.onload = onImgLoaded()
|
|
371
|
// eslint-disable-next-line no-return-assign
|
|
372
|
function onImgLoaded () {
|
|
373
|
if (loadTimer != null) clearTimeout(loadTimer)
|
|
374
|
if (!imgObject.complete) {
|
|
375
|
loadTimer = setTimeout(() => {
|
|
376
|
onImgLoaded()
|
|
377
|
}, 3)
|
|
378
|
} else {
|
|
379
|
that.newimage = getImagePortion(imgObject, e.face_box[2] - e.face_box[0], e.face_box[3] - e.face_box[1], e.face_box[0], e.face_box[1])
|
|
380
|
}
|
|
381
|
}
|
|
382
|
function getImagePortion (imgObj, newWidth, newHeight, startX, startY) {
|
|
383
|
var tnCanvas = document.createElement('canvas')
|
|
384
|
var tnCanvasContext = tnCanvas.getContext('2d')
|
|
385
|
tnCanvas.width = newWidth; tnCanvas.height = newHeight
|
|
386
|
var bufferCanvas = document.createElement('canvas')
|
|
387
|
var bufferContext = bufferCanvas.getContext('2d')
|
|
388
|
bufferCanvas.width = imgObj.width
|
|
389
|
bufferCanvas.height = imgObj.height
|
|
390
|
bufferContext.drawImage(imgObj, 0, 0)
|
|
391
|
tnCanvasContext.drawImage(bufferCanvas, startX, startY, newWidth, newHeight, 0, 0, newWidth, newHeight)
|
|
392
|
// console.log(tnCanvas.toDataURL())
|
|
393
|
return tnCanvas.toDataURL()
|
|
394
|
}
|
314
|
395
|
}
|
|
396
|
|
315
|
397
|
}
|
316
|
398
|
}
|
317
|
399
|
</script>
|
|
@ -370,6 +452,7 @@ export default {
|
370
|
452
|
|
371
|
453
|
border-radius: 5px;
|
372
|
454
|
overflow: hidden;
|
|
455
|
position: relative;
|
373
|
456
|
}
|
374
|
457
|
}
|
375
|
458
|
|
|
@ -398,6 +481,21 @@ export default {
|
398
|
481
|
> div:nth-child(1) {
|
399
|
482
|
width: 120px;
|
400
|
483
|
height: 100%;
|
|
484
|
|
|
485
|
.scaleimg {
|
|
486
|
width: 120px;
|
|
487
|
height: 160px;
|
|
488
|
|
|
489
|
position: relative;
|
|
490
|
.imgcontant {
|
|
491
|
border-radius: 10px;
|
|
492
|
background-repeat: no-repeat;
|
|
493
|
background-attachment: local;
|
|
494
|
position: absolute;
|
|
495
|
top: -160px;
|
|
496
|
left: -120px;
|
|
497
|
}
|
|
498
|
}
|
401
|
499
|
}
|
402
|
500
|
> div:nth-child(2) {
|
403
|
501
|
width: 117.76px;
|