配置增加人脸识别
This commit is contained in:
@@ -5,16 +5,16 @@
|
||||
<title><spring:message code="${cfgName}"></spring:message></title>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
var ifSubmit=true;
|
||||
var sfd = $("#functionId").val();
|
||||
var fileType=[];
|
||||
if(sfd==28||sfd==630){
|
||||
fileType=["mp4","flv","asf","wmv","avi","mpeg","mov","dat","m4v","m4p","m4b","webm","ogv","wav","mp3"];
|
||||
}
|
||||
if(sfd==29||sfd==631){
|
||||
if(sfd==29){
|
||||
fileType=["mp4","flv","asf","wmv","avi","mpeg","mov","dat","m4v","m4p","m4b","webm","ogv"];
|
||||
}
|
||||
if(sfd==30||sfd==632){
|
||||
if(sfd==30||sfd==632||sfd==631){
|
||||
fileType=["bmp","jpg","tiff","raw","gif"];
|
||||
}
|
||||
if(sfd==31){
|
||||
@@ -45,9 +45,9 @@ $(function(){
|
||||
$("#srcFile").trigger("click");
|
||||
|
||||
});
|
||||
|
||||
|
||||
$("#srcFile").on('change',function(){
|
||||
if(sampleFileValidate(fileType,$("#srcFile").val())){
|
||||
if(sfd!=632&&sampleFileValidate(fileType,$("#srcFile").val())){
|
||||
//样例文件类型正确进行后续处理
|
||||
$("#srcFileInfo").val($("#srcFile").val());
|
||||
var videoToPicture = $("#videoToPicture").val();
|
||||
@@ -74,6 +74,65 @@ $(function(){
|
||||
var url = "${ctx}/ntc/av/sample/selectVedioPicture?picFilePath="+encodeURIComponent(data.picFilePath);
|
||||
//openPicWindow(url);
|
||||
}else{
|
||||
// alert(data.msg);
|
||||
top.$.jBox.tip(data.msg, "<spring:message code='info'/>");
|
||||
return;
|
||||
}
|
||||
|
||||
},
|
||||
error:function(jqXHR, textStatus, errorThrown){
|
||||
top.$.jBox.closeTip();
|
||||
//alert(jqXHR.responseText);
|
||||
top.$.jBox(jqXHR.responseText,{
|
||||
width: $(document).width()*0.9,
|
||||
height:$(document).height()*0.8,
|
||||
top: '10%',
|
||||
draggable:false,
|
||||
title: "Error Info", buttons:{ "close":true}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 人脸识别
|
||||
if(sfd==632){
|
||||
var files = $(this)[0].files;
|
||||
for(var i = 0;i < files.length;i ++) {
|
||||
var file = files[i];
|
||||
var faceName = file.name;
|
||||
var vals=sampleFileValidate(fileType,faceName)
|
||||
if (!vals){
|
||||
ifSubmit=false;
|
||||
return;
|
||||
}else{
|
||||
ifSubmit=true;
|
||||
}
|
||||
}
|
||||
if(ifSubmit){
|
||||
$("#srcFileInfo").val($("#srcFile").val());
|
||||
var srcFacePath =$("#srcPath").val();
|
||||
var fd = new FormData($('#cfgFrom')[0]);
|
||||
$.ajax({
|
||||
url: "${ctx}/ntc/av/sample/faceToPicture",
|
||||
type: "POST",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: fd,
|
||||
async: true,
|
||||
cache: false,
|
||||
beforeSend: function(){
|
||||
loading('onloading...');
|
||||
},
|
||||
success: function(data) {
|
||||
top.$.jBox.closeTip();
|
||||
if(data.status==1){
|
||||
$("#picPath").val(data.picFilePath);
|
||||
$("#srcPath").val(data.srcPath);
|
||||
$("#showPicture").removeClass("hidden");
|
||||
var url = "${ctx}/ntc/av/sample/selectVedioPicture?picFilePath="+encodeURIComponent(data.picFilePath);
|
||||
//openPicWindow(url);
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
|
||||
@@ -91,8 +150,8 @@ $(function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
/* $("#uploadSample,#sampleFileInfo").on('click',function(){
|
||||
$("#sampleFile").trigger("click");
|
||||
@@ -127,8 +186,13 @@ $(function(){
|
||||
var srcFile = $("#srcFile").val();
|
||||
|
||||
if(srcFile!=''){
|
||||
if(!sampleFileValidate(fileType,srcFile)){
|
||||
if(!ifSubmit){
|
||||
$("#fileErrorNote").append("<label id='level-error' class='error'><spring:message code='file_in_wrong_format'/></label>");
|
||||
return false;
|
||||
}else{
|
||||
if(!sampleFileValidate(fileType,srcFile)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -137,7 +201,7 @@ $(function(){
|
||||
var srcPath = $("#srcPath").val();
|
||||
//var sampleUrl = $("#sampleUrl").val();
|
||||
var videoToPicture = $("#videoToPicture").val();
|
||||
if(videoToPicture=="true"){
|
||||
if(videoToPicture=="true"&&sfd!=632){
|
||||
if((srcUrl==null||srcUrl=="") && (srcPath==null || srcPath=="")){//srcUrl判断修改时未重新上传文件,srcPath判断修改时重新上传文件但未选择关键帧图片
|
||||
$("div[for='srcFileInfo']").append("<label id='level-error' class='error' for='srcFile'><spring:message code='keyframe_pic_required'></spring:message></label>");
|
||||
return false;
|
||||
@@ -204,7 +268,6 @@ function hiddenlevel(){
|
||||
|
||||
// 校验文件后缀名
|
||||
function sampleFileValidate(fileType,fileName){
|
||||
|
||||
var flag=false; //状态,检测文件后缀用
|
||||
var arr=fileType;//使用是什么格式的后缀
|
||||
var cFile=fileName;//文件的值
|
||||
@@ -306,12 +369,14 @@ function sampleFileValidate(fileType,fileName){
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="src_file"/></label>
|
||||
<div class="col-md-6">
|
||||
<%-- <input class="form-control required" type="text" name="srcUrl" value="${_cfg.srcUrl }"> --%>
|
||||
<input id="srcFile" type="file" name="srcFile" style="width: 330px;display:none" />
|
||||
<c:if test="${_cfg.functionId != 632}">
|
||||
<input id="srcFile" type="file" name="srcFile" style="width: 330px;display:none" />
|
||||
</c:if>
|
||||
<c:set var="videoToPicture" value="${fns:getDictLabel('VIDEO_TO_PICTURE', _cfg.functionId, 'false')}" />
|
||||
<input type="hidden" name="videoToPicture" id="videoToPicture" value="${videoToPicture }">
|
||||
<c:choose>
|
||||
|
||||
<c:when test="${videoToPicture}">
|
||||
<c:when test="${videoToPicture and _cfg.functionId != 632}">
|
||||
<input id="srcPath" name="srcPath" type="hidden" style="width: 330px;" />
|
||||
<div class="input-group">
|
||||
<input id="srcFileInfo" name="srcFileInfo" readonly="readonly" data-msg-required=""
|
||||
@@ -328,6 +393,26 @@ function sampleFileValidate(fileType,fileName){
|
||||
<i class="fa btn-search"></i>
|
||||
<spring:message code="show"></spring:message></button>
|
||||
</c:when>
|
||||
|
||||
<c:when test="${_cfg.functionId eq 632}">
|
||||
<input id="srcFile" type="file" name="srcFile" style="width: 330px;display:none" multiple/>
|
||||
<input id="srcPath" name="srcPath" type="hidden" style="width: 330px;"/>
|
||||
<div class="input-group">
|
||||
<input id="srcFileInfo" name="srcFileInfo" readonly="readonly" data-msg-required=""
|
||||
placeholder="<spring:message code="select_file"/>" class="required form-control" style=" background-color:transparent"
|
||||
aria-required="true" type="text" value="${_cfg.srcUrl }">
|
||||
|
||||
<div class="input-group-btn">
|
||||
<a id="uploadSrc" class="btn btn-default btn-search " href="javascript:" style=""><i class="fa fa-search"></i></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input id="srcUrl" name="srcUrl" type="hidden" value="${_cfg.srcUrl }"/>
|
||||
<button type="button" id="showPicture" class="btn btn-warning hidden ">
|
||||
<i class="fa btn-search"></i>
|
||||
<spring:message code="show"></spring:message></button>
|
||||
</c:when>
|
||||
|
||||
<c:otherwise>
|
||||
<div class="input-group">
|
||||
<input id="srcFileInfo" name="srcFileInfo" readonly="readonly" data-msg-required=""
|
||||
|
||||
Reference in New Issue
Block a user