提交 c751592a authored 作者: 钟是志's avatar 钟是志

Merge remote-tracking branch 'origin/master'

......@@ -9,23 +9,27 @@ import SignatureCanvas from 'react-signature-canvas'
import { message,Button } from 'antd';
import config from '@/webPublic/one_stop_public/config';
import { queryApiActionPath } from "../utils/queryConfig";
import baseX from 'base-x';
const Bs64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const base64 = baseX(Bs64);
import reqwest from 'reqwest';
function dataURLtoFile (dataurl, filename) {
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length
if(n<=2220){
message.error('请进行签名');
return null;
}
var u8arr = new Uint8Array(n);
function dataURLtoBlob(toDataURL) {
var arr = toDataURL.split(","),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, { type: mime });
return new Blob([u8arr], { type: mime });
}
function blobToFile(Blob, fileName) {
Blob.lastModifiedDate = new Date();
Blob.name = fileName;
return Blob;
}
export default class index extends Component {
constructor(props){
super(props);
......@@ -66,7 +70,8 @@ export default class index extends Component {
}
trim=()=>{
const formData = new FormData()
const file = dataURLtoFile(this.sigCanvas.toDataURL('image/png'))
const xx=dataURLtoBlob(this.sigCanvas.toDataURL('image/png'))
const file = blobToFile(xx,"sign.png")
if(file==null){
return
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论