|
|
|
@ -32,9 +32,9 @@
|
|
|
|
|
</split>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="margin-top: 18px;text-align:center">
|
|
|
|
|
<!-- <upload action="/car/distinguish/upload">-->
|
|
|
|
|
<!-- <i-button icon="ios-cloud-upload-outline">上传车牌</i-button>-->
|
|
|
|
|
<!-- </upload>-->
|
|
|
|
|
<!-- <upload action="/car/distinguish/upload">-->
|
|
|
|
|
<!-- <i-button icon="ios-cloud-upload-outline">上传车牌</i-button>-->
|
|
|
|
|
<!-- </upload>-->
|
|
|
|
|
<Upload
|
|
|
|
|
multiple
|
|
|
|
|
type="drag"
|
|
|
|
@ -54,133 +54,124 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div th:replace="common/foot :: foot(script)"></div>
|
|
|
|
|
<script th:inline="none">
|
|
|
|
|
layui.use(["okUtils", "okLayer"], function () {
|
|
|
|
|
var okUtils = layui.okUtils;
|
|
|
|
|
var okLayer = layui.okLayer;
|
|
|
|
|
var vm = new Vue({
|
|
|
|
|
el: '#app',
|
|
|
|
|
data: function(){
|
|
|
|
|
var that = this;
|
|
|
|
|
return {
|
|
|
|
|
entity:{},
|
|
|
|
|
parkManageList:[],
|
|
|
|
|
split1: 0.5,
|
|
|
|
|
licensePlate:'',
|
|
|
|
|
uploadData:{}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
listParkManage : function() {
|
|
|
|
|
layui.use(["okUtils", "okLayer"], function () {
|
|
|
|
|
var okUtils = layui.okUtils;
|
|
|
|
|
var okLayer = layui.okLayer;
|
|
|
|
|
var vm = new Vue({
|
|
|
|
|
el: '#app',
|
|
|
|
|
data: function(){
|
|
|
|
|
var that = this;
|
|
|
|
|
okUtils.ajaxCloud({
|
|
|
|
|
url:"/car/parkManage/select",
|
|
|
|
|
success : function(result) {
|
|
|
|
|
that.parkManageList = result.msg;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleSuccess:function(response, file, fileList){
|
|
|
|
|
if(response.code==0){
|
|
|
|
|
vm.licensePlate = "/"+response.imagePath;
|
|
|
|
|
okLayer.msg.greenTick(response.msg);
|
|
|
|
|
}else{
|
|
|
|
|
okLayer.msg.redCross(response.msg);
|
|
|
|
|
return {
|
|
|
|
|
entity:{},
|
|
|
|
|
parkManageList:[],
|
|
|
|
|
split1: 0.5,
|
|
|
|
|
licensePlate:'',
|
|
|
|
|
uploadData:{}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleUpload (file) {
|
|
|
|
|
if(vm.entity.parkManageId==undefined){
|
|
|
|
|
okLayer.msg.redCross("请选择停车场");
|
|
|
|
|
return false;
|
|
|
|
|
methods: {
|
|
|
|
|
listParkManage : function() {
|
|
|
|
|
var that = this;
|
|
|
|
|
okUtils.ajaxCloud({
|
|
|
|
|
url:"/car/parkManage/select",
|
|
|
|
|
success : function(result) {
|
|
|
|
|
that.parkManageList = result.msg;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleSuccess:function(response, file, fileList){
|
|
|
|
|
if(response.code==0){
|
|
|
|
|
vm.licensePlate = "/"+response.imagePath;
|
|
|
|
|
okLayer.msg.greenTick(response.msg);
|
|
|
|
|
}else{
|
|
|
|
|
okLayer.msg.redCross(response.msg);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleUpload (file) {
|
|
|
|
|
if(vm.entity.parkManageId==undefined){
|
|
|
|
|
okLayer.msg.redCross("请选择停车场");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
vm.uploadData.id = vm.entity.parkManageId;
|
|
|
|
|
}
|
|
|
|
|
vm.uploadData.id = vm.entity.parkManageId;
|
|
|
|
|
},
|
|
|
|
|
mounted: function() {
|
|
|
|
|
this.listParkManage();
|
|
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted: function() {
|
|
|
|
|
this.listParkManage();
|
|
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
var canvas,context;
|
|
|
|
|
function init(){
|
|
|
|
|
var video = document.querySelector('video');
|
|
|
|
|
canvas = document.getElementById('qr-canvas');
|
|
|
|
|
context = canvas.getContext('2d');
|
|
|
|
|
var mediaStreamTrack;
|
|
|
|
|
|
|
|
|
|
// 一堆兼容代码
|
|
|
|
|
window.URL = (window.URL || window.webkitURL || window.mozURL || window.msURL);
|
|
|
|
|
if (navigator.mediaDevices === undefined) {
|
|
|
|
|
navigator.mediaDevices = {};
|
|
|
|
|
}
|
|
|
|
|
if (navigator.mediaDevices.getUserMedia === undefined) {
|
|
|
|
|
navigator.mediaDevices.getUserMedia = function(constraints) {
|
|
|
|
|
var getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
|
|
|
|
|
if (!getUserMedia) {
|
|
|
|
|
return Promise.reject(new Error('getUserMedia is not implemented in this browser'));
|
|
|
|
|
}
|
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
|
getUserMedia.call(navigator, constraints, resolve, reject);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
openMedia();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
var canvas,context;
|
|
|
|
|
function init(){
|
|
|
|
|
var video = document.querySelector('video');
|
|
|
|
|
canvas = document.getElementById('qr-canvas');
|
|
|
|
|
context = canvas.getContext('2d');
|
|
|
|
|
var mediaStreamTrack;
|
|
|
|
|
|
|
|
|
|
//摄像头调用配置
|
|
|
|
|
var mediaOpts = {
|
|
|
|
|
audio: false,
|
|
|
|
|
video: true,
|
|
|
|
|
video: { facingMode: "environment"} // 或者 "user"
|
|
|
|
|
//video: { width: 50%, height: 350 }
|
|
|
|
|
// video: { facingMode: { exact: "environment" } }// 或者 "user"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 回调
|
|
|
|
|
function successFunc(stream) {
|
|
|
|
|
mediaStreamTrack = stream;
|
|
|
|
|
video = document.querySelector('video');
|
|
|
|
|
if ("srcObject" in video) {
|
|
|
|
|
video.srcObject = stream
|
|
|
|
|
} else {
|
|
|
|
|
video.src = window.URL && window.URL.createObjectURL(stream) || stream
|
|
|
|
|
}
|
|
|
|
|
video.play();
|
|
|
|
|
}
|
|
|
|
|
function errorFunc(err) {
|
|
|
|
|
alert(err.name);
|
|
|
|
|
}
|
|
|
|
|
// 一堆兼容代码
|
|
|
|
|
window.URL = (window.URL || window.webkitURL || window.mozURL || window.msURL);
|
|
|
|
|
if (navigator.mediaDevices === undefined) {
|
|
|
|
|
navigator.mediaDevices = {};
|
|
|
|
|
}
|
|
|
|
|
if (navigator.mediaDevices.getUserMedia === undefined) {
|
|
|
|
|
navigator.mediaDevices.getUserMedia = function(constraints) {
|
|
|
|
|
var getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
|
|
|
|
|
if (!getUserMedia) {
|
|
|
|
|
return Promise.reject(new Error('getUserMedia is not implemented in this browser'));
|
|
|
|
|
}
|
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
|
getUserMedia.call(navigator, constraints, resolve, reject);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
openMedia();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 正式启动摄像头
|
|
|
|
|
function openMedia(){
|
|
|
|
|
navigator.mediaDevices.getUserMedia(mediaOpts).then(successFunc).catch(errorFunc);
|
|
|
|
|
// 截屏间隔时间(单位:毫秒)
|
|
|
|
|
var interval = 5000;
|
|
|
|
|
//摄像头调用配置
|
|
|
|
|
var mediaOpts = {
|
|
|
|
|
audio: false,
|
|
|
|
|
video: true,
|
|
|
|
|
video: { facingMode: "environment"} // 或者 "user"
|
|
|
|
|
//video: { width: 50%, height: 350 }
|
|
|
|
|
// video: { facingMode: { exact: "environment" } }// 或者 "user"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 开始定时截屏
|
|
|
|
|
setInterval(function() {
|
|
|
|
|
drawMedia();
|
|
|
|
|
}, interval);
|
|
|
|
|
// 回调
|
|
|
|
|
function successFunc(stream) {
|
|
|
|
|
mediaStreamTrack = stream;
|
|
|
|
|
video = document.querySelector('video');
|
|
|
|
|
if ("srcObject" in video) {
|
|
|
|
|
video.srcObject = stream
|
|
|
|
|
} else {
|
|
|
|
|
video.src = window.URL && window.URL.createObjectURL(stream) || stream
|
|
|
|
|
}
|
|
|
|
|
video.play();
|
|
|
|
|
}
|
|
|
|
|
function errorFunc(err) {
|
|
|
|
|
alert(err.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// 正式启动摄像头
|
|
|
|
|
function openMedia(){
|
|
|
|
|
navigator.mediaDevices.getUserMedia(mediaOpts).then(successFunc).catch(errorFunc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//关闭摄像头
|
|
|
|
|
function closeMedia(){
|
|
|
|
|
mediaStreamTrack.getVideoTracks().forEach(function (track) {
|
|
|
|
|
track.stop();
|
|
|
|
|
context.clearRect(0, 0,context.width, context.height);//清除画布
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//关闭摄像头
|
|
|
|
|
function closeMedia(){
|
|
|
|
|
mediaStreamTrack.getVideoTracks().forEach(function (track) {
|
|
|
|
|
track.stop();
|
|
|
|
|
context.clearRect(0, 0,context.width, context.height);//清除画布
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//截取视频
|
|
|
|
|
function drawMedia(){
|
|
|
|
|
canvas.setAttribute("width", video.videoWidth);
|
|
|
|
|
canvas.setAttribute("height", video.videoHeight);
|
|
|
|
|
context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
|
|
|
|
|
}
|
|
|
|
|
//截取视频
|
|
|
|
|
function drawMedia(){
|
|
|
|
|
canvas.setAttribute("width", video.videoWidth);
|
|
|
|
|
canvas.setAttribute("height", video.videoHeight);
|
|
|
|
|
context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|