|
@@ -446,7 +446,7 @@
|
|
|
<button class="btn btn-lg btn-success" onclick = "cl_openidA4photos(1,1)">打开高拍仪</button>
|
|
|
<button class="btn btn-lg btn-warning" onclick = "cl_closeidA4photos()">关闭高拍仪</button>
|
|
|
<button class="btn btn-lg btn-info" onclick="cl_takePhotos()">拍照</button>
|
|
|
- <button class="btn btn-lg btn-warning" onclick="submitHandler()">提交并关闭</button>
|
|
|
+ <button class="btn btn-lg btn-warning" onclick="submit()">提交并关闭</button>
|
|
|
<!--<button class="btn btn-lg btn-info">拍照</button>
|
|
|
<button class="btn btn-lg btn-success">上传</button>
|
|
|
<button class="btn btn-lg btn-warning">重置</button><button class="btn btn-lg btn-info">拍照</button>
|
|
@@ -509,12 +509,12 @@
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- function submitHandler() {
|
|
|
+ function submit() {
|
|
|
if ($.validate.form()) {
|
|
|
var creditCode = $('#creditCode').val()
|
|
|
console.log(creditCode)
|
|
|
$.operate.save( prefix+"/add", $('#form-file-add').serialize(),function(){
|
|
|
- window.location.href="/rlzy/print/"+creditCode
|
|
|
+ window.location.href="/rlzy/print/secound/13"
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -552,7 +552,7 @@
|
|
|
$("#idcard1").attr('style','color: red;font-size: 12px;display: block')
|
|
|
}
|
|
|
}
|
|
|
- var formFileLg = document.querySelector("#formFileLg")
|
|
|
+ /*var formFileLg = document.querySelector("#formFileLg")
|
|
|
formFileLg.onchange = function () {
|
|
|
var formData = new FormData()
|
|
|
formData.append("file",document.getElementById("formFileLg").files[0])
|
|
@@ -569,7 +569,7 @@
|
|
|
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
+ }*/
|
|
|
</script>
|
|
|
<script th:inline="javascript">
|
|
|
|
|
@@ -675,6 +675,21 @@
|
|
|
if (code == 0) {
|
|
|
Toast('res', '拍照成功');
|
|
|
addImage(image);
|
|
|
+ var formData = getFileFromBase64(image,"人力资源设立.jpg");
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ type: "post",
|
|
|
+ url: ctx + "common/upload",
|
|
|
+ data: formData,
|
|
|
+ cache: false,
|
|
|
+ contentType: false,
|
|
|
+ processData: false,
|
|
|
+ dataType: 'json',
|
|
|
+ success: function (result) {
|
|
|
+ console.log(result)
|
|
|
+ $('#baseFile').val(result.fileName)
|
|
|
+ }
|
|
|
+ });
|
|
|
} else if (code == -1) {
|
|
|
Toast('errs', '摄像头未打开拍照失败');
|
|
|
} else {
|
|
@@ -687,6 +702,24 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+ function getFileFromBase64 (data,fileName) {
|
|
|
+ var _base64 = "data:image/jpeg;base64," + data;
|
|
|
+ const dataArr = _base64.split(",");
|
|
|
+ const byteString = atob(dataArr[1]);
|
|
|
+ const options = {
|
|
|
+ type: "image/jpeg",
|
|
|
+ endings: "native"
|
|
|
+ };
|
|
|
+ const u8Arr = new Uint8Array(byteString.length);
|
|
|
+ for (let i = 0; i < byteString.length; i++) {
|
|
|
+ u8Arr[i] = byteString.charCodeAt(i);
|
|
|
+ }
|
|
|
+ let formData = new FormData();
|
|
|
+ let fileOfBlob = new File([u8Arr], fileName, options);//返回文件流
|
|
|
+ formData.append("file", fileOfBlob);
|
|
|
+ return formData
|
|
|
+ }
|
|
|
+
|
|
|
function goBack() {
|
|
|
history.go(-2);
|
|
|
}
|