Commit e57e39a0 authored by zhengke's avatar zhengke

修改

parent 66ecb65a
...@@ -247,6 +247,9 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo ...@@ -247,6 +247,9 @@ export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLo
if (configObj.isCreateCover && configObj.isCreateCover == 1) { if (configObj.isCreateCover && configObj.isCreateCover == 1) {
url += "&isCreateCover=1" url += "&isCreateCover=1"
} }
if (configObj.isOcr && configObj.isOcr == 1) {
url += "&ocr=1"
}
} }
let formData = new FormData() let formData = new FormData()
formData.append('myfile', fileObj) formData.append('myfile', fileObj)
......
...@@ -76,6 +76,11 @@ ...@@ -76,6 +76,11 @@
SetEducationContractSign, SetEducationContractSign,
SetBackClassProtocolSign SetBackClassProtocolSign
} from '../api/sale/contract' } from '../api/sale/contract'
import {
UploadSelfFile
} from '../api/common/common'
export default { export default {
data() { data() {
return { return {
...@@ -95,7 +100,7 @@ ...@@ -95,7 +100,7 @@
Type: 1, //1为电子合同签字 2为退课协议签字 Type: 1, //1为电子合同签字 2为退课协议签字
BackMsg: { BackMsg: {
Id: 0, Id: 0,
sign:'' sign: ''
} }
}; };
}, },
...@@ -223,13 +228,75 @@ ...@@ -223,13 +228,75 @@
// _this.basedata = dataurl; // _this.basedata = dataurl;
_this.msg.Sign = canvas1.toDataURL(type); _this.msg.Sign = canvas1.toDataURL(type);
_this.BackMsg.sign = canvas1.toDataURL(type); _this.BackMsg.sign = canvas1.toDataURL(type);
let newArr = [];
var fileName = `${_this.uuid(10,10)}.png`;
var path = `/assets/sign/`;
let configObj= {
isOcr:1
}
newArr.push(_this.dataURLtoFile(_this.msg.Sign, fileName));
console.log(newArr[0],'newArr[0]');
UploadSelfFile(path, newArr[0], x => {
console.log(x, 'xxxxxxx');
}, configObj);
_this.SaveMsg(); _this.SaveMsg();
}; };
}; };
}, },
dataURLtoFile(dataurl, filename) { //将base64转换为文件
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, {
type: mime
});
},
uuid(len, radix) {
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
var uuid = [],
i;
radix = radix || chars.length;
if (len) {
// Compact form
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
} else {
var r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
}
}
}
return uuid.join('');
},
//上传图片验证有无签字
uploadFile(files) {
UploadSelfFile("course", files[0], (res) => {
if (res.Code == 1) {
}
});
},
//提交数据 //提交数据
SaveMsg() { SaveMsg() {
if (this.Type == 1) { if (this.Type == 1) {
console.log(this.msg, 'msg');
console.log(this.base64ToBlob(this.msg.Sign), 'Sign');
return
SetEducationContractSign(this.msg).then(res => { SetEducationContractSign(this.msg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
this.$q.notify({ this.$q.notify({
...@@ -249,7 +316,7 @@ ...@@ -249,7 +316,7 @@
} }
}) })
} }
if(this.Type == 2){ if (this.Type == 2) {
SetBackClassProtocolSign(this.BackMsg).then(res => { SetBackClassProtocolSign(this.BackMsg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
this.$q.notify({ this.$q.notify({
...@@ -294,14 +361,14 @@ ...@@ -294,14 +361,14 @@
}, },
//返回上一级 //返回上一级
goback() { goback() {
if(this.Type==1){ if (this.Type == 1) {
this.$router.push({ this.$router.push({
path: '/contractConfirm', path: '/contractConfirm',
query: { query: {
ContractId: this.msg.ContractId ContractId: this.msg.ContractId
} }
}); });
}else{ } else {
this.$router.push({ this.$router.push({
path: '/courseRefundH5', path: '/courseRefundH5',
query: { query: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment