Index: ssts-web/src/main/webapp/disinfectsystem/test/videoAndImg.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/test/videoAndImg.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/test/videoAndImg.js (revision 27172) @@ -0,0 +1,404 @@ +var sw = window.screen.width; +var blobs = []; +var imageIdsData = imageIds; +var videoIdsData = videoIds; +var popwin = null; +//获取图片id +function getImageIds() { + var imageIdsArr=[]; + var imageIds = ""; + $('.spotlight_parent').each(function(index,ele) { + if($(this).attr("imgIds") != undefined){ + imageIdsArr.push($(this).attr("imgIds")); + } + }) + + imageIds = imageIdsArr.join(","); + return imageIds; +} + +//获取视频id +function getVideoIds() { + var videoIdsArr=[]; + var videoIds = ""; + $('.spotlight_parent').each(function(index,ele) { + if($(this).attr("videoIds") != undefined){ + videoIdsArr.push($(this).attr("videoIds")); + } + }) + videoIds = videoIdsArr.join(","); + return videoIds; +} + +/* + 加载图片和视频 + imageIdsData 图片id + videoIdsData 视频id + */ +function loadingVideoAndImg(imageIdsData,videoIdsData){ + $.ajax({ + type : 'post', + url : WWWROOT +'/disinfectSystem/baseData/uploadImageAndVideoAction!getImageAndVideoInfo.do', + data:{ + objectId:objectId, + imageType:imageType, + videoType:videoType, + imageIds:imageIdsData, + videoIds:videoIdsData + }, + success : function(result) { + var data = JSON.parse(result); + if(data.success){ + var imageCount = data.imageCount; + var videoCount = data.videoCount; + + if(data.imageArray.length > 0){ + for(var i = 0;i < data.imageArray.length; i++){ + var serialNum = data.imageArray[i].serialNum; + var imgUrl = WWWROOT +'/disinfectSystem/baseData/uploadImageAndVideoAction!getImageById.do?imageId='+ data.imageArray[i].id+'&original=false'; + var imgList = "
"; + imgList += ""; + imgList += ""; + imgList += "
"; + imgList += ""; + //imgList += ""; + imgList += "
"; + imgList += "已上传"; + imgList += "
"; + $("#imgVideoBtn").before(imgList); + } + } + + if(data.videoArray.length > 0){ + for(var j = 0;j < data.videoArray.length; j++){ + var videoUrl = WWWROOT +'/disinfectSystem/baseData/uploadImageAndVideoAction!getVideoById.do?videoId='+data.videoArray[j].id+'&original=false'; + var bigVideoUrl = WWWROOT +'/disinfectSystem/baseData/uploadImageAndVideoAction!getVideoById.do?videoId='+data.videoArray[j].id+'&original=true'; + var videoList = "
"; + videoList += ""; + videoList += ""; + videoList += "
"; + videoList += "
"; + //videoList += "
"; + videoList += "已上传"; + videoList += "" +data.videoArray[j].duration+ ""; + videoList += ""; + $("#imgVideoBtn").before(videoList); + } + } + updateImgVideoNum(); + } + } + }) +} + + +/* 更新数量 */ +function updateImgVideoNum(){ + var lens = $(".spotlight_parent").length; + $("#videImgNum").html(lens); +} +//关闭视频 +function closeVideo(){ + $(".spotlight-group").show(); + $("#videoShow").hide(); + $(".close_video").hide(); + $(".uploading").show(); +} + +/* + 提交申请单时图片的id处理 + goodsName 包名 + imageFileId 图片id +*/ +var goodsNameImageFile2 = {}; +var goodsNameVideoeFile2 = {}; +function returnImageFileId(goodsName,imageFileId){ + if(goodsNameImageFile2[goodsName]){ + var imageFileArray = goodsNameImageFile2[goodsName]; + imageFileArray.push(imageFileId); + goodsNameImageFile2[goodsName] = imageFileArray; + }else{ + var imageFileArray = []; + imageFileArray.push(imageFileId); + goodsNameImageFile2[goodsName] = imageFileArray; + } +} + +/* + 提交申请单时视频的id处理 + goodsName 包名 + imageFileId 视频id +*/ +function returnVideoFileId(goodsName,videoFileId){ + if(goodsNameVideoeFile2 [goodsName]){ + var videoFileArray = goodsNameVideoeFile2 [goodsName]; + videoFileArray.push(videoFileId); + goodsNameVideoeFile2 [goodsName] = videoFileArray; + }else{ + var videoFileArray = []; + videoFileArray.push(videoFileId); + goodsNameVideoeFile2 [goodsName] = videoFileArray; + } + +} + +/* + event 事件对象 + that 当前点击的这一个 + isImgVideo 是视频还是图片 true 视频 false图片 + */ +function triggerLookImgVideo(event,that,isImgVideo){ + event.preventDefault(); + event.stopPropagation(); //阻止冒泡 + if(isImgVideo){//跳转视频 + $(that).parent().children(".video_img")[0].click(); + }else{//跳转图片 + $(that).parent().children(".spotlight")[0].click(); + } + +} + +/* 播放视频 + event 事件对象 + isLoading 是接口获取还是前台直接拍完的,true接口,false前台 + */ +function openVideoOrImg(event,isLoading,that){ + $(".uploading").hide(); + $(".close_video").show(); + event.preventDefault(); + var result = document.getElementById("videoShow"); + $("#videoShow").children("video").attr("src",""); + $("#videoShow").children("video").remove(); + + var num = $(that).attr("num"); + if(isLoading){ + var bigVideoUrls = $(that).attr("bigVideoUrl"); + result.innerHTML = result.innerHTML + ''; + $("#videoShow").show(); + }else{ + var simpleFile = new File([blobs[num]], 'msr-' + (new Date).toISOString().replace(/:|\./g, '-') + '.mp4', { + type: 'video/mp4' + }); + var reader = new FileReader(); + // 将文件以Data URL形式进行读入页面 + reader.readAsDataURL(simpleFile); + reader.onload = function(e){ + result.innerHTML = result.innerHTML + ''; + $("#videoShow").show(); + } + } + + $("#videoShow").show(); + $(".spotlight-group").hide(); +} + +/* 删除视频和图片 + event 事件对象 + that 当前点击的这一个 + isImgVideo 是视频还是图片 true 视频 false图片 + isLocalServer 是前台删除还是后台删除 true前台 fasle后台 + */ +function removeImgVideo(event,that,isImgVideo,isLocalServer){ + event.preventDefault(); //阻止默认事件 + event.stopPropagation(); //阻止冒泡 + if(isLocalServer ){//后台删除 + var imageId = $(that).attr("imageId"); + var videoId = $(that).attr("videoId"); + var imageIds = getImageIds(); + var videoIds = getVideoIds(); + $.ajax({ + type : 'post', + url : WWWROOT +'/disinfectSystem/baseData/uploadImageAndVideoAction!deleteImageAndVideo.do', + data: { + videoId:videoId, + imageId:imageId, + imageIds:imageIds, + videoIds:videoIds + }, + success : function(result) { + var data = JSON.parse(result); + if(data.success){ + if(imageType){ + $(that).parent().prev().attr("src",""); + $(that).parent().parent().remove(); + }else{ + $(that).parent().parent().children(".spotlight").attr("href",""); + $(that).parent().parent().children(".spotlight").children("img").attr("src",""); + $(that).parent().parent().remove(); + } + updateImgVideoNum(); + layer.msg(data.message, {icon: 1}); + } + } + }); + }else{//前台删除 + if(isImgVideo){//删视频 + $(that).parent().prev().attr("src",""); + $(that).parent().parent().remove(); + var num = $(that).parent().parent().children(".video_img").attr("num"); + blobs.splice(num,1); + }else{//删图片 + $(that).parent().parent().children(".spotlight").attr("href",""); + $(that).parent().parent().children(".spotlight").children("img").attr("src",""); + $(that).parent().parent().remove(); + var num = $(that).parent().parent().children(".spotlight").attr("num"); + blobs.splice(num,1); + } + layer.msg("删除成功", {icon: 1}); + $('.spotlight-width').find('.local').each(function(index,ele) { + $(this).children("a").attr("num",index);//前台删除blobs数组以后,对应的num值要重新赋值 + }) + updateImgVideoNum(); + } + +} + +function imgAndVideoBtn(){ + var winW = 1024; + var winH = 666; + var tops = (window.screen.availHeight -winH)/2; + var lefts = (window.screen.availWidth -winW)/2; + if(window.screen.height == 768){ + lefts = 0; + tops = 0; + } + // 弹出窗口 + var pageUrl = WWWROOT + '/disinfectsystem/test/takeVideoAndImg.jsp'; + var style = "resizable=yes,top="+tops+",left="+lefts+",width="+winW+",height="+winH+",status=no,menubar=no,toolbar=no,Scrollbars=no,Location=no,Direction=no,resizable=no"; + popwin=window.open(pageUrl,'图片视频拍摄',style); + if(popwin != null ){ + popwin.focus(); + } +} + +/* 上传视频或者图片 */ +function uploadingVideoImg(){ + if($(".spotlight_parent").length == 0){ + layer.alert('请先拍摄视频和图片!', { + skin: 'layui-layer-molv' //样式类名 + ,closeBtn: 0 + }); + return; + } + $('.spotlight_parent').each(function(index,ele) { + $(this).children("a").attr("num",index);//前台删除blobs数组以后,对应的num值要重新赋值 + }) + + var size = ""; + var fileTypes = ""; + for (var i = 0; i < blobs.length; i++) { + if(size == ""){ + size = blobs[i].size; + }else{ + size = size+","+blobs[i].size; + } + + if(fileTypes == ""){ + fileTypes = blobs[i].type.split('/')[0]; + }else{ + fileTypes = fileTypes +","+ blobs[i].type.split('/')[0]; + } + + } + var imageTypeEncode = encodeURI(imageType,"UTF-8");//请求头中文编码 + var videoTypeEncode = encodeURI(videoType,"UTF-8");//请求头中文编码 + //合并多个blob + var theBigBlob = new Blob(blobs, { + type: "video/mp4" + }); + $("#loading").show(); + $.ajax({ + type : 'post', + headers : {'size' : size, 'fileTypes' : fileTypes,'imageType':imageTypeEncode,'objectId':objectId,'videoType':videoTypeEncode}, + url : WWWROOT +'/disinfectSystem/baseData/uploadImageAndVideoAction!uploadImageAndVideo.do', + processData: false,//不需要将传输的数据序列化 + contentType: false, + data: theBigBlob, + success : function(result) { + var data = JSON.parse(result); + if(data.success){ + var imageIds = data.imageIds; + var videoIds = data.videoIds; + + //置空 + blobs = []; + size = null; + fileTypes = null; + + var imageIdsVal = getImageIds(); + if(imageIdsVal != ''){ + if(imageIds !=""){ + imageIds = imageIds +","+imageIdsVal; + }else{ + imageIds = imageIdsVal; + } + } + var videoIdsVal= getVideoIds(); + if(videoIdsVal != ''){ + if(videoIds !=""){ + videoIds = videoIds +","+videoIdsVal; + }else{ + videoIds = videoIdsVal; + } + } + + $("#imgVideoBtn").prevAll().remove(); + loadingVideoAndImg(imageIds,videoIds); + if(imageIds != ""){ + var imageIdsAll = imageIds.split(","); + for(var i = 0;i < imageIdsAll.length;i++){ + returnImageFileId(goodsName,imageIdsAll[i]); + } + } + + if(videoIds != ""){ + var videoIdsAll = videoIds.split(","); + for(var j = 0;j < videoIdsAll.length;j++){ + returnVideoFileId(goodsName,videoIdsAll[j]); + } + } + + //科室申领 + var imageIdsAndGoodsName = $("#iframe_recyclingApplication",window.parent.document).contents().find("#imageIdsAndGoodsName"); + imageIdsAndGoodsName.val(JSON.stringify(goodsNameImageFile2)); + var videoIdsAndGoodsName = $("#iframe_recyclingApplication",window.parent.document).contents().find("#videoIdsAndGoodsName"); + videoIdsAndGoodsName.val(JSON.stringify(goodsNameVideoeFile2)); + + var imageIdsDom = $("#iframe_recyclingApplication",window.parent.document).contents().find("#imageIds"); + imageIdsDom.val(imageIds); + var videoIdsDom = $("#iframe_recyclingApplication",window.parent.document).contents().find("#videoIds"); + videoIdsDom.val(videoIds); + + + //高级视图 + var imageIdsAndGoodsName2 = $("#iframe_enterpriseView",window.parent.document).contents().find("#mainFrame").contents().find("#imageIdsAndGoodsName"); + imageIdsAndGoodsName2.val(JSON.stringify(goodsNameImageFile2)); + var videoIdsAndGoodsName2 = $("#iframe_enterpriseView",window.parent.document).contents().find("#mainFrame").contents().find("#videoIdsAndGoodsName"); + videoIdsAndGoodsName2.val(JSON.stringify(goodsNameVideoeFile2)); + + var imageIdsDom2 = $("#iframe_enterpriseView",window.parent.document).contents().find("#mainFrame").contents().find("#imageIds"); + imageIdsDom2.val(imageIds); + var videoIdsDom2 = $("#iframe_enterpriseView",window.parent.document).contents().find("#mainFrame").contents().find("#videoIds"); + videoIdsDom2.val(videoIds); + $("#loading").hide(); + layer.msg(data.message, {icon: 1}); + }else{ + $("#loading").hide(); + layer.msg(data.message, {icon: 2}); + } + } + }) +} + +$(function(){ + $(".uploading").show(); + //加载图片和视频 + loadingVideoAndImg(imageIdsData,videoIdsData); +}) + +/* 页面卸载时,关掉摄像头页面 */ +window.onunload = function () { + if(popwin != null) { + popwin.close(); + } +} \ No newline at end of file Index: ssts-web/src/main/webapp/images/web/closeVideo.png =================================================================== diff -u Binary files differ Index: ssts-web/src/main/webapp/disinfectsystem/test/videoAndImg.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/test/videoAndImg.jsp (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/test/videoAndImg.jsp (revision 27172) @@ -0,0 +1,59 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ include file="/common/taglibs.jsp"%> + + + + +视频图片 + + + + + + + + + + + + + +
+
+ 上传中...... +
+
+ +
+

图片/视频(0/8)

+ +
+

+ + + + + 拍摄 + +

+
+ + \ No newline at end of file Index: ssts-web/src/main/webapp/common/imgAndVideo.css =================================================================== diff -u --- ssts-web/src/main/webapp/common/imgAndVideo.css (revision 0) +++ ssts-web/src/main/webapp/common/imgAndVideo.css (revision 27172) @@ -0,0 +1,230 @@ +/* 拍摄视频和图片 */ +*{padding: 0;margin:0} +a{color: black;text-decoration: none;} +.clearfloat:after{display:block;clear:both;content:"";visibility:hidden;height:0} +.img_video_wrapper{ + padding:3px; +} +.img_video_title{ + font-size: 18px; + color: #15861e; +} +.img_video_btn{ + width: 180px; + max-width: auto; + margin: 1vh 10px; + height: 151px; + text-align: center; + float:left; + list-style: none; + color: black; + text-decoration: none; + background: #d7d7d7; + margin-top: 28px; +} +.video_img{ + float:left; + cursor: pointer; + position: relative; +} + +/* 修改预览插件样式start */ +.spotlight_parent{ + position: relative; + width: 180px; + max-width: auto; + margin: 0vh 10px; + float: left; + height: 151px; + margin-top: 20px; +} +.spotlight,.video_img{ + float:left; +} +img, .image{ + width: 180px; + max-width: auto; + margin: 1vh 0px; + height: 151px +} +/* 修改预览插件样式end */ + .spotlight-width{ + /* width: 1280px; */ + margin: 0px auto; + margin-top: 19px; +} +.img_video_btn img{ + width: 60px; + height:60px; + margin-top: 29px; +} +#spotlight{ + background-color: #cde6cf !important; +} +.spotlight_parent .model,.spotlight_parent .model{ + display:none; + width: 180px; + height: 151px; + position: absolute; + top: 6px; + left: 0px; + background-color: #ffffff; + filter: alpha(opacity=60); + opacity: 0.6; + cursor: pointer; +} +.spotlight_parent .model span{ + width:74px; + height: 74px; + cursor: pointer; + background:url(../images/web/remove.png) no-repeat; + position: absolute; + top: 0px; + right: -31px; +} +.spotlight_parent:hover .model.on{ + display:block; + cursor: pointer; +} +.camera_wrapper{ + width: 930px; + margin: 0px auto; + margin-top: 24px; +} +.camera_content{ + height: 532px; + margin: 0px auto; +} +.camera_footer{ + height: 100px; + padding: 6px 0; +} +.take_photos_btn{ + width: 43%; + float:left; + height: 100px; + text-align: center; +} +.toggle_btn{ + width: 23%; + height: 74px; + float:right; + margin-top: 30px; +} +.camera_Btn{ + width:74px; + height: 74px; + margin-top: 17px; + background:url(../images/web/imgtakephoto.png) no-repeat; + display: inline-block; +} +.camera_Btn.on{ + background:url(../images/web/videoTake.png) no-repeat; +} +.camera_Btn.stop{ + background:url(../images/web/imgstopvideo.png) no-repeat; +} +.toggle_btn input{ + margin-bottom: 8px; + margin-right: 4px; +} +.video_show{ + display:none; +} +.video_show{ + width: 970px; + height: 518px; + position: absolute; + left: 50%; + margin-left: -485px; + margin-top: 20px; +} +/* .video_show.on1024{ + width: 900px; + height: 650px; + position: absolute; + left: 50%; + margin-left: -450px; +} */ +.close_video{ + display:none; + position: absolute; + top:0; + right:0; + width:52px; + height:40px; + background:url(../images/web/closeVideo.png) no-repeat 28px 14px; + cursor: pointer; +} +.duration{ + position: absolute; + bottom: 0px; + right: 2px; +} +.uploading_parent{ + background: none; + position: relative; +} +.uploading{ + width: 100px; + height: 40px; + background: #2c441be0 url(../images/web/upload.png) no-repeat 13px center; + padding-left: 33px; + border: none; + color: #fff; + font-family: "微软雅黑"; + font-size: 17px; + border-radius: 6px; + cursor: pointer; + outline: none; + position: absolute; + top: 21px; + rigth: 0; + right: 15px; +} +.video_form,.imgs_form{ + position: absolute; + bottom: 0px; + left: 50%; + width: 100px; + margin-left: -50px; + font-style: normal; +} +.loading{ + display: none; + width:100%; + height:100%; + background:#504343b3; + position: absolute; + top:0; + left:0; + bottom:0; + right:0; + z-index: 1; +} +.loading div{ + width: 160px; + height: 60px; + position: absolute; + top: 50%; + left: 50%; + margin-left: -80px; + margin-top: -30px; +} +.loading div img{ + width: 60px; + height: 60px; + vertical-align: middle; +} +.layui-layer-dialog .layui-layer-padding,.layui-layer-content{ + color:black; +} +.layui-layer-molv .layui-layer-title{ + background: #afd7af !important; + color: #333 !important; +} +.layui-layer-btn .layui-layer-btn0{ + border-color: #afd7af !important; + background-color: #afd7af !important; + color: #333 !important; +} \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseInfoForm.js =================================================================== diff -u -r27058 -r27172 --- ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseInfoForm.js (.../foreignTousseInfoForm.js) (revision 27058) +++ ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseInfoForm.js (.../foreignTousseInfoForm.js) (revision 27172) @@ -18,7 +18,7 @@ var oldSupplierName = null; //不是新建记录旧的供应商名称 //外来器械申请单id var foreignTousseApplicationId; - +var takeImgAndVideoWin; //外来器械材料种类颜色管理 var washClassifyTypeColor = sstsConfig.washClassifyTypeColorManager || { '平面类' : 'yellow-row', @@ -869,6 +869,10 @@ && goodsNameImageFile[foreignTousseInfoObject.oldTousseName].length > 0){ foreignTousseInfoObject.imageFileIds = goodsNameImageFile[foreignTousseInfoObject.oldTousseName].join(","); } + if(goodsNameVideoFile[foreignTousseInfoObject.oldTousseName] + && goodsNameVideoFile[foreignTousseInfoObject.oldTousseName].length > 0){ + foreignTousseInfoObject.videoFileIds = goodsNameVideoFile[foreignTousseInfoObject.oldTousseName].join(","); + } } top.Ext4.getCmp('foreignTousseInfo').setValue(JSON.stringify(foreignTousseInfoArray)); } @@ -882,7 +886,7 @@ * @param tousseName 包定义名称 * @param tousseDefinitionId 包定义id */ -function takePhone(tousseName,tousseDefinitionId){ +/* function takePhone(tousseName,tousseDefinitionId){ if(Ext4.chromeVersion < 62){ showResult("请使用62以上版本的chrome浏览器!" , null , sstsConfig.messagePauseTimeOnPackingPage); return ; @@ -898,12 +902,54 @@ if(popwin != null ){ popwin.focus(); } +} */ + +/** + * 拍照 + * @param tousseName 包定义名称 + * @param tousseDefinitionId 包定义id + */ +function takeImgAndVideo(tousseName,tousseDefinitionId){ + if(Ext4.chromeVersion < 62){ + showResult("请使用62以上版本的chrome浏览器!" , null , sstsConfig.messagePauseTimeOnPackingPage); + return ; + } + var imageIds = document.getElementById("imageIds").value; + var videoIds = document.getElementById("videoIds").value; + if(imageIds == ""){ + imageIds = null; + } + + if(videoIds == ""){ + videoIds = null; + } + if(tousseDefinitionId == "null"){ + tousseDefinitionId = ""; + } + + var urls = WWWROOT + '/disinfectsystem/test/videoAndImg.jsp?goodsName='+ tousseName +'&imageType='+imageTypeCameraApplication+'&videoType='+videoType+'&objectId='+tousseDefinitionId+'&videoIds='+videoIds+'&imageIds='+imageIds; + takeImgAndVideoWin = new top.Ext4.window.Window({ + id : 'playVideoWin', + layout : 'fit', + title : tousseName+'的图片/视频', + width :1020,//document.body.clientWidth + height:600,//document.body.clientHeight + modal : true, + border : false, + html:"", + plain : true + }); + + takeImgAndVideoWin.show(); } //记录每个包名对应的图片id +//var goodsNameImageFile = {}; var goodsNameImageFile = {}; +var goodsNameVideoFile = {}; //接收新上传的imageFile的id -function returnImageFileId(goodsName , imageFileId){ +/* function returnImageFileId(goodsName , imageFileId){ + if(goodsNameImageFile[goodsName]){ var imageFileArray = goodsNameImageFile[goodsName]; imageFileArray.push(imageFileId); @@ -913,15 +959,15 @@ imageFileArray.push(imageFileId); goodsNameImageFile[goodsName] = imageFileArray; } -} +} */ /** * 打开外来器械包申请单的窗口. * @param id 外来器械包申请单 * @param formType 操作类型 * @param ismodify 是点击修改按钮还是点击姓名列的文字链接打开弹窗的 */ -function openForeignTousseForm(id, formType,ismodify){ +function openForeignTousseForm(id, formType,ismodify){ foreignTousseApplicationId = id; currentWashClassifyType = null; @@ -1284,7 +1330,16 @@ text : '提交', id : 'commitBtn', hidden:(id != "" && ismodify),//点击姓名列的文字链接和点击工具栏的修改按钮,隐藏提交按钮 - handler : function() { + handler : function() { + goodsNameImageFile = document.getElementById("imageIdsAndGoodsName").value; + if(goodsNameImageFile != ""){ + goodsNameImageFile = JSON.parse(goodsNameImageFile); + } + + goodsNameVideoFile = document.getElementById("videoIdsAndGoodsName").value; + if(goodsNameVideoFile != ""){ + goodsNameVideoFile = JSON.parse(goodsNameVideoFile); + } checkAndsubmintForeignTousseForm(false); } },{ @@ -1612,11 +1667,15 @@ if(!isLeaf){ var btnHtml = ""; if(sstsConfig.showCameraPhoto){ - if(id){ + /* if(id){ //只有再次打开该单修改时,才能查看图片 btnHtml += " "; - } - btnHtml += " "; + } */ + //btnHtml += " "; + if(id == ""){ + tousseDefinitionId = null; + } + btnHtml += " "; } return btnHtml; } @@ -2457,6 +2516,15 @@ readOnlyDom.fieldCls = 'fieldReadOnlydisabled'; } } + + foreignTousseApplyWindow.on('close',function(w){ + document.getElementById("imageIdsAndGoodsName").value = ""; + document.getElementById("videoIdsAndGoodsName").value = ""; + document.getElementById("imageIds").value = ""; + document.getElementById("videoIds").value = ""; + }); + + foreignTousseApplyWindow.show(); if (id) {// 编辑 Index: ssts-web/src/main/webapp/images/web/takeVideo.png =================================================================== diff -u Binary files differ Index: ssts-web/src/main/webapp/disinfectsystem/test/takeVideoAndImg.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/test/takeVideoAndImg.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/test/takeVideoAndImg.js (revision 27172) @@ -0,0 +1,274 @@ +var imgWidth = 136; +var imgHeight = 105; +var mediaRecorder; +var chunks = []; +var recorderFile; +var beginTime; +var durationTime; +var base64DataBig2; +var times = null; + +//js 获取当前时间 +function getCurTime(){ +    var date=new Date(); +    var year=date.getFullYear();//当前年份 +    var month=date.getMonth();//当前月份 +    var data=date.getDate();//天 +    var hours=date.getHours();//小时 +    var minute=date.getMinutes();//分 +    var second=date.getSeconds();//秒 +    var time = year+"-"+formatTime((month+1))+"-"+formatTime(data)+" "+formatTime(hours)+":"+formatTime(minute)+":"+formatTime(second); + var timeAll = new Date(time).getTime(); + return timeAll; +} + +//补位 当某个字段不是两位数时补0 +function formatTime(str){ +    var num; +    str>=10?num=str:num="0"+str; +    return num; +}  + +/* 更新数量 */ +function updateParentImgVideoNum(){ + var lens = $(".spotlight_parent",window.opener.document).length;//子窗口给父窗口元素赋值 + $("#videImgNum",window.opener.document).html(lens); +} +function videoListShow(base64DataBig2,durationTime,num){ + /* 显示在多图片页面 */ + var list = "
"; + list += ""; + list += ""; + list += "
"; + // list += ""; + list += "未上传"; + list += ""+durationTime+""; + list += "
"; + $("#imgVideoBtn",window.opener.document).before(list);//子窗口给父窗口元素赋值 + updateParentImgVideoNum(); +} + +//计时器 +function intervalTime(startTime,endTime){ +     var date3 = endTime.getTime() - startTime.getTime();  //时间差的毫秒数 +     //计算出相差天数 +    var days = Math.floor(date3 / (24 * 3600 * 1000)); +        //计算出小时数 + +    var leave1 = date3 % (24 * 3600 * 1000);    //计算天数后剩余的毫秒数 +    var hours = Math.floor(leave1 / (3600 * 1000)); +    //计算相差分钟数 +    var leave2 = leave1 % (3600 * 1000);        //计算小时数后剩余的毫秒数 +    var minutes = Math.floor(leave2 / (60 * 1000)); + +    //计算相差秒数 +    var leave3 = leave2 % (60 * 1000);      //计算分钟数后剩余的毫秒数 +    var seconds = Math.round(leave3 / 1000); + + minutes = minutes > 9 ? minutes : "0"+minutes; + seconds = seconds > 9 ? seconds : "0"+seconds; + //var duration = days+":"+hours+":"+minutes+":"+seconds; + var duration = minutes+":"+seconds; + return duration;   +} + + function openCamera(){ + var video = document.getElementById('video'); + var videoWidth = 1024; + var videoHeight = 650; + + video.controls = false; + video.muted = true; + video.width = videoWidth; + video.height = videoHeight; + MediaUtils.getUserMedia(true, true, function (err, stream) { + if (err) { + throw err; + } else { + var options = { + audioBitsPerSecond : 128000,// 音频码率 + videoBitsPerSecond : 921600 // 视频码率 + }; + // 通过 MediaRecorder 记录获取到的媒体流 + mediaRecorder = new MediaRecorder(stream,options); + var chunks = [], startTime = 0; + video.srcObject = stream; + video.play(); + mediaRecorder.ondataavailable = function(e) { + mediaRecorder.blobs.push(e.data); + chunks.push(e.data); + }; + mediaRecorder.blobs = []; + mediaRecorder.onstop = function (e) { + recorderFile = new Blob(chunks, { 'type' : mediaRecorder.mimeType }); + //window.opener.recordVideoFile = recorderFile; + window.opener.blobs.push(recorderFile); + videoListShow(base64DataBig2,durationTime,window.opener.blobs.length-1); + chunks = []; + }; + } + }); +} +var MediaUtils = { + /** + * 获取用户媒体设备(处理兼容的问题) + * @param videoEnable {boolean} - 是否启用摄像头 + * @param audioEnable {boolean} - 是否启用麦克风 + * @param callback {Function} - 处理回调 + */ + getUserMedia: function (videoEnable, audioEnable, callback) { + navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia + || navigator.msGetUserMedia || window.getUserMedia; + var constraints = {video: videoEnable, audio: audioEnable}; + if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { + navigator.mediaDevices.getUserMedia(constraints).then(function (stream) { + callback(false, stream); + })['catch'](function(err) { + callback(err); + }); + } else if (navigator.getUserMedia) { + navigator.getUserMedia(constraints, function (stream) { + callback(false, stream); + }, function (err) { + callback(err); + }); + } else { + callback(new Error('Not support userMedia')); + } +}, + + /** + * 关闭媒体流 + * @param stream {MediaStream} - 需要关闭的流 + */ + closeStream: function (stream) { + if (typeof stream.stop === 'function') { + stream.stop(); + } + } +}; + +// 这段代 主要是获取摄像头的视频流并显示在Video 签中 +$(function() { + var canvas = document.getElementById("canvas"); + var context = canvas.getContext("2d"); + + /* 预览大图图片 */ + var canvasBig = document.getElementById("canvasBig"); + var contextBig = canvasBig.getContext("2d"); + + var video = document.getElementById("video"); + var videoObj = { + "video" : true + } + var errBack = function(error) { + //console.log("Video capture error: ", error.code); + }; + + if (navigator.mediaDevices.getUserMedia) { + navigator.mediaDevices.getUserMedia(videoObj).then(function(stream) { + video.srcObject = stream; + video.play(); + mediaRecorder = new MediaStreamRecorder(stream); + + }).catch(errBack); + } else { + + } + $("#takePhotos").prop("checked",true);//默认选中拍照单选框 + // 这个是拍照按钮的事件, + $("#cameraBtn").click(function() { + var lens = $(".spotlight_parent",window.opener.document).length;//子窗口给父窗口元素赋值 + $("#videImgNum",window.opener.document).html(lens); + if(lens >= 8){ + layer.alert('最多只能有8个视频或图片!', { + skin: 'layui-layer-molv' //样式类名 + ,closeBtn: 0 + }); + return; + } + + if($("#takePhotos").prop("checked")){//拍图片 + context.drawImage(video, 0, 0, imgWidth, imgHeight); + contextBig.drawImage(video, 0, 0, 1024, 650); + /* 显示在多图片页面 */ + var base64Data = canvas.toDataURL('image/jpeg', 1.0); + /* 预览大图 */ + var base64DataBig = canvasBig.toDataURL('image/jpeg', 1.0); + canvasBig.toBlob(function (blobObj){ + window.opener.blobs.push(blobObj); + }); + var list = "
"; + list += ""; + list += ""; + list += "
"; + list += "未上传"; + // list += ""; + list += "
"; + $("#imgVideoBtn",window.opener.document).before(list);//子窗口给父窗口元素赋值 + updateParentImgVideoNum(); + }else{//拍视频 + if($(this).hasClass('on')){ + mediaRecorder.start();//开始录制 + beginTime = new Date(); + $(this).removeClass("on"); + $(this).addClass("stop"); + + //超过5分钟就停止录制 + var startDate = new Date(); + //2. 获取当前分钟 + var min = startDate.getMinutes(); + //3. 设置当前时间+5分钟:把当前分钟数+5后的值重新设置为date对象的分钟数 + startDate.setMinutes(min+5); + var addFiveMinutes = startDate.getTime(); + + times = setInterval(function(){ +         var getCurTimes= getCurTime(); + if(getCurTimes >= addFiveMinutes){ + mediaRecorder.stop(); + clearInterval(times); + var endTime = new Date(); + var duration = intervalTime(beginTime,endTime); + durationTime = duration; + + $("#cameraBtn").removeClass("stop"); + $("#cameraBtn").addClass("on"); + layer.msg("录制成功,视频录制不能超过5分钟!", {icon: 7}); + context.drawImage(video, 0, 0, imgWidth, imgHeight); + contextBig.drawImage(video, 0, 0, 1024, 650); + //预览大图 + base64DataBig2 = canvasBig.toDataURL('image/jpeg', 1.0); + } +     },1000); + }else{ + $("#cameraBtn").addClass("on"); + $("#cameraBtn").removeClass("stop"); + mediaRecorder.stop(); + context.drawImage(video, 0, 0, imgWidth, imgHeight); + contextBig.drawImage(video, 0, 0, 1024, 650); + var endTime = new Date(); + var duration = intervalTime(beginTime,endTime); + durationTime = duration; + //预览大图 + base64DataBig2 = canvasBig.toDataURL('image/jpeg', 1.0); + layer.msg("录制成功!", {icon: 1}); + } + } + }); + + + // 点击拍照单选框 + $("#takePhotos").click(function() { + if($(this).prop("checked")) {//显示拍照图片 +     $("#cameraBtn").removeClass("on"); + $("#cameraBtn").removeClass("stop"); +   } + }); + + // 点击拍视频单选框 + $("#takeVideo").click(function() { + $("#cameraBtn").addClass("on"); + $("#takePhotos").prop("checked",false); + openCamera(); + }); +}); Index: ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseApplicationView.jsp =================================================================== diff -u -r26988 -r27172 --- ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseApplicationView.jsp (.../foreignTousseApplicationView.jsp) (revision 26988) +++ ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseApplicationView.jsp (.../foreignTousseApplicationView.jsp) (revision 27172) @@ -1,5 +1,6 @@ <%@page import="com.forgon.disinfectsystem.entity.foreigntousseapplication.ForeignTousseApplication"%> <%@page import="com.forgon.disinfectsystem.entity.basedatamanager.imagefilemanager.ImageFile"%> +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.videomanager.VideoFile" %> <%@page import="java.util.Date"%> <%@page import="java.text.SimpleDateFormat"%> <%@page import="com.forgon.security.service.OperationManager"%> @@ -103,6 +104,8 @@ //图片类型(申请采集图片) var imageTypeCameraApplication = '<%=ImageFile.IMAGE_TYPE_CAMERA_APPLICATION%>'; + //视频类型(申请采集视频) + var videoType = '<%=VideoFile.VIDEO_TYPE_CAMERA_APPLICATION%>'; var foreignToussePriceOfSysParams = '<%=pageContext.getAttribute("foreignToussePriceOfSysParams")%>'; @@ -170,5 +173,9 @@ + + + + \ No newline at end of file Index: ssts-web/src/main/webapp/images/web/imgstopvideo.png =================================================================== diff -u Binary files differ Index: ssts-web/src/main/webapp/disinfectsystem/test/takeVideoAndImg.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/test/takeVideoAndImg.jsp (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/test/takeVideoAndImg.jsp (revision 27172) @@ -0,0 +1,41 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ include file="/common/taglibs.jsp"%> + + + + + +视频图片拍摄 + + + + + + + + + +
+
+ +
+ +
+ + Index: ssts-web/src/main/webapp/images/web/loadinVideo.gif =================================================================== diff -u Binary files differ Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationView.jsp =================================================================== diff -u -r26988 -r27172 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationView.jsp (.../goodsApplicationView.jsp) (revision 26988) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsApplicationView.jsp (.../goodsApplicationView.jsp) (revision 27172) @@ -1,5 +1,6 @@ <%@page contentType="text/html; charset=UTF-8"%> <%@page import="com.forgon.disinfectsystem.entity.basedatamanager.imagefilemanager.ImageFile"%> +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.videomanager.VideoFile" %> <%@page import="com.forgon.disinfectsystem.entity.foreigntousseapplication.ForeignTousseApplication"%> <%@page import="com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier"%> <%@page import="com.forgon.security.service.OperationManager"%> @@ -186,6 +187,10 @@ + + + + @@ -447,6 +452,8 @@ //图片类型(申请采集图片) var imageTypeCameraApplication = '<%=ImageFile.IMAGE_TYPE_CAMERA_APPLICATION%>'; +//视频类型(申请采集视频) +var videoType = '<%=VideoFile.VIDEO_TYPE_CAMERA_APPLICATION%>'; <%--多选下拉框--%> Index: ssts-web/src/main/webapp/images/web/videoTake.png =================================================================== diff -u Binary files differ Index: ssts-web/src/main/webapp/images/web/remove.png =================================================================== diff -u Binary files differ Index: ssts-web/src/main/webapp/images/web/imgtakephoto.png =================================================================== diff -u Binary files differ Index: ssts-web/src/main/webapp/images/web/upload.png =================================================================== diff -u Binary files differ Index: ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseApplicationView.js =================================================================== diff -u -r27058 -r27172 --- ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseApplicationView.js (.../foreignTousseApplicationView.js) (revision 27058) +++ ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseApplicationView.js (.../foreignTousseApplicationView.js) (revision 27172) @@ -211,7 +211,7 @@ iconCls : 'btn_ext_application_add', hidden : SSTS_ForeignTousseApplication_Create, handler : function() { - openForeignTousseForm("","apply");; + openForeignTousseForm("","apply"); } }, '-', { text : '修改', Index: ssts-web/src/main/webapp/disinfectsystem/test/spotlight.bundle.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/test/spotlight.bundle.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/test/spotlight.bundle.js (revision 27172) @@ -0,0 +1,31 @@ +/** + * Spotlight.js v0.5.9 (Bundle) + * Copyright 2019 Nextapps GmbH + * Author: Thomas Wilkerling + * Licence: Apache-2.0 + * https://github.com/nextapps-de/spotlight + */ +(function(){'use strict';var aa={};function ba(a){for(var b=a.classList,c={},d=0;d=c){var w=O[0].cloneNode(!1);k(w,"left",100*p+"%");O[0].parentNode.appendChild(w)}w=void 0;W[p]=new Fa(v&&(v.href||v.src)||u.src||u.href,v&&v.title||u.title||(w=(u||document).getElementsByTagName("img")).length&&w[0].alt||d||"",v&&v.description||u.description||f||"")}I=b||1;l(M,"transform","translateX(-"+100*(I-1)+"%)");Ha()}} +function Ia(a,b,c,d){if(d||a[c])K[c]=b&&b[c]||d} +function Ja(a,b){K={};b&&Ka(b);Ka(a);Ia(a,b,"description");Ia(a,b,"title");Ia(a,b,"prefetch",!0);Ia(a,b,"preloader",!0);L=K.infinite;L="undefined"!==typeof L&&"false"!==L;sa="false"!==K.progress;ta=1*K.player||7E3;if((a=K.zoom)||""===a)K["zoom-in"]=K["zoom-out"]=a,delete K.zoom;if((a=K.control)||""===a){a="string"===typeof a?a.split(","):a;for(b=0;b
'; +k(Q,"transition","none");document.body.appendChild(Q);M=m("scene",Q)[0];ua=m("footer",Q)[0];va=m("title",ua)[0];wa=m("description",ua)[0];xa=m("arrow-left",Q)[0];ya=m("arrow-right",Q)[0];R=m("fullscreen",Q)[0];za=m("page",Q)[0];Aa=m("player",Q)[0];Ba=m("progress",Q)[0];Ca=m("preloader",Q)[0];V=document.documentElement||document.body;document.cancelFullScreen||(document.cancelFullScreen=document.exitFullscreen||document.webkitCancelFullScreen||document.webkitExitFullscreen||document.mozCancelFullScreen|| +function(){});V.requestFullScreen||(V.requestFullScreen=V.webkitRequestFullScreen||V.msRequestFullScreen||V.mozRequestFullScreen||k(R,"display","none")||function(){});var a=m("drag",Q)[0];Ea=[[window,"keydown",Oa],[window,"wheel",Pa],[window,"hashchange",Qa],[window,"resize",Ra],[a,"mousedown",Sa],[a,"mouseleave",Ta],[a,"mouseup",Ta],[a,"mousemove",Ua],[a,"touchstart",Sa,{passive:!1}],[a,"touchcancel",Ta],[a,"touchend",Ta],[a,"touchmove",Ua,{passive:!0}],[R,"",Va],[xa,"",Wa],[ya,"",X],[Aa,"",Xa], +[m("autofit",Q)[0],"",Ya],[m("zoom-in",Q)[0],"",Za],[m("zoom-out",Q)[0],"",$a],[m("close",Q)[0],"",ab],[m("theme",Q)[0],"",La]]},{once:!0});function Ra(){x=Q.clientWidth;y=Q.clientHeight;P&&(z=P.width,A=P.height,bb())}function bb(){k(P,"transform","translate(-50%, -50%) scale("+B+")")}function cb(a){for(var b=0;b.5*(0>a?1:a?-1:0)?$a():Za())} +function Qa(){N&&"#spotlight"===location.hash&&ab(!0)}function Xa(a){("boolean"===typeof a?a:!S)?S||(S=setInterval(X,ta),e(Aa,"on"),sa&&fb()):S&&(S=clearInterval(S),h(Aa,"on"),sa&&l(Ba,"transform",""));return S}function Y(){T?clearTimeout(T):e(Q,"menu");var a=K.autohide;T="false"!==a?setTimeout(function(){h(Q,"menu");T=null},1*a||3E3):1}function gb(a){"boolean"===typeof a&&(T=a?T:0);T?(T=clearTimeout(T),h(Q,"menu")):Y();return n(a)} +function Sa(a){C=!0;D=!1;var b=hb(a);E=z*B<=x;pa=b.x;qa=b.y;return n(a,!0)}function Ta(a){if(C&&!D)return C=!1,gb(a);E&&D&&(l(M,"transform","translateX("+-(100*(I-1)-r/x*100)+"%)"),r<-(y/10)&&X()||r>y/10&&Wa()||k(M,"transform","translateX(-"+100*(I-1)+"%)"),r=0,E=!1,k(N,"transform",""));C=!1;return n(a)} +function Ua(a){if(C){Da||(Da=requestAnimationFrame(ib));var b=hb(a),c=(z*B-x)/2;D=!0;r-=pa-(pa=b.x);E?F=!0:r>c?r=c:0y&&(c=(A*B-y)/2,t-=qa-(qa=b.y),t>c?t=c:0=b&&jb(B=b);a||Y()}function jb(a){B=a||1;bb()}function $a(a){var b=.65*B;1<=b&&(jb(B=b),t=r=0,F=!0,ib());a||Y()} +function eb(){location.hash="spotlight";location.hash="show";k(Q,"transition","");e(V,"hide-scrollbars");e(Q,"show");cb(!0);Ra();Y()}function ab(a){cb(!1);history.go(!0===a?-1:-2);h(V,"hide-scrollbars");h(Q,"show");S&&Xa(!1);P.parentNode.removeChild(P);N=P=W=null}function Wa(){if(1I;I=a;Ha(b);return!0}} +function fb(){l(Ba,{transitionDuration:"",transform:""});k(Ba,{transitionDuration:ta+"ms",transform:"translateX(0)"})}function La(a){"boolean"===typeof a?H=a:(H=!H,Y());H?e(Q,ra):h(Q,ra)} +function Ha(a){t=r=0;B=1;var b=K.animation,c=!0,d=!0,f=!0;if(b||""===b){c=d=f=!1;b="string"===typeof b?b.split(","):b;for(var p=0;p