Commit c68b63b1 authored by mengcuiguang's avatar mengcuiguang

优化检测图片接口

parent 3d95ad47
......@@ -23,7 +23,9 @@
import {
pdfFn
} from '../../utils/pdf.js'
import {
navigateBack
} from '@/utils/fun';
import common from '@/mixins/common';
import {
ScanIndexBean,
......@@ -34,6 +36,7 @@
import {
navigateTo,
message,
redirectTo
} from '@/utils/fun';
......@@ -113,12 +116,14 @@
},
clickOcr() {
if (this.userBean.expireTime <= 0) {
// 开通VIP会员
navigateTo(`/pagesA/vipPay/vipPay`)
} else {
this.compress()
}
this.compress()
// if (this.userBean.expireTime <= 0) {
// // 开通VIP会员
// navigateTo(`/pagesA/vipPay/vipPay`)
// } else {
// this.compress()
// }
},
ocr(imgUrl) {
if (this.scantype == ScanTypeBean.fanyi) {
......@@ -142,7 +147,21 @@
success: ({
data
}) => {
that.goResult(data, imgUrl);
if (that.userBean.expireTime <= 0) {
// 开通VIP会员
navigateTo(`/pagesA/vipPay/vipPay`)
} else {
that.goResult(data, myimgUrl);
}
},
fail: () => {
setTimeout(() => {
message.notify('请重新上传图片');
setTimeout(() => {
navigateBack();
}, 500);
}, 1000);
uni.hideLoading()
}
});
},
......@@ -158,10 +177,21 @@
success: ({
data
}) => {
that.goResult(data, myimgUrl);
if (that.userBean.expireTime <= 0) {
// 开通VIP会员
navigateTo(`/pagesA/vipPay/vipPay`)
} else {
that.goResult(data, myimgUrl);
}
},
fail: () => {
uni.hideLoading()
setTimeout(() => {
message.notify('请重新上传图片');
setTimeout(() => {
navigateBack();
}, 500);
}, 1000);
}
});
},
......@@ -241,15 +271,15 @@
generatePDF(imageUrls) {
let that = this
pdfFn(imageUrls, 2).then((resl) => {
var fs = tt.getFileSystemManager();
console.log("123==",imageUrls)
var fs = tt.getFileSystemManager();
console.log("123==", imageUrls)
fs.writeFile({
filePath: tt.env.USER_DATA_PATH +'/'+ that.getCurrentTime() + '.pdf',
filePath: tt.env.USER_DATA_PATH + '/' + that.getCurrentTime() + '.pdf',
data: resl.docBase64,
encoding: "base64",
success: resx => {
tt.openDocument({
filePath: tt.env.USER_DATA_PATH +'/'+ that.getCurrentTime() +
filePath: tt.env.USER_DATA_PATH + '/' + that.getCurrentTime() +
'.pdf',
showMenu: true,
success: function(resxl) {
......
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