Commit c68b63b1 authored by mengcuiguang's avatar mengcuiguang

优化检测图片接口

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