Commit 35777462 authored by mengcuiguang's avatar mengcuiguang

优化抖音图片检测

parent 02ae65c1
......@@ -14,8 +14,8 @@
</view>
</view>
<l-clipper v-if="showlip" :image-url="imgUri" :isShowPhotoBtn="false" type="2d" :minWidth="400" :maxHeight="400"
@success="imgUri = $event.url; showlip = false;" @cancel="showlip = false" />
<l-clipper v-if="showlip" :image-url="tempUri" :isShowPhotoBtn="false" type="2d" :minWidth="400" :maxHeight="400"
@success="tempUri = $event.url; showlip = false;" @cancel="showlip = false" />
</view>
</template>
......@@ -46,14 +46,16 @@
data() {
return {
imgUri: '',
tempUri: '',
userBean: {},
type: '',
ocrUrl: '',
scantype: '',
showlip: false
};
},
onLoad(option) {
this.imgUri = decodeURIComponent(option.uri)
this.tempUri = decodeURIComponent(option.uri)
this.type = option.type
if (this.type == 0) {
......@@ -79,6 +81,8 @@
// 图片转pdf
this.scantype = ScanTypeBean.scan_pdf
}
},
onShow() {
this.post({
......@@ -91,7 +95,12 @@
}
});
},
methods: {
methods: {
loadData() {
setTimeout(() => {
this.compress();
}, 500);
},
crop() {
this.showlip = true
},
......@@ -103,27 +112,25 @@
let that = this
// #ifdef MP-TOUTIAO
tt.compressImage({
src: that.imgUri,
src: that.tempUri,
quality: 80,
success: res => {
that.uploadImg(res.tempFilePath)
},
fail: err => {
that.uploadImg(that.imgUri)
that.uploadImg(that.tempUri)
}
})
// #endif
},
clickOcr() {
this.compress()
// if (this.userBean.expireTime <= 0) {
// // 开通VIP会员
// navigateTo(`/pagesA/vipPay/vipPay`)
// } else {
// this.compress()
// }
if (this.userBean.expireTime <= 0) {
// 开通VIP会员
navigateTo(`/pagesA/vipPay/vipPay`)
} else {
this.ocr(this.ocrUrl)
}
},
ocr(imgUrl) {
if (this.scantype == ScanTypeBean.fanyi) {
......@@ -147,16 +154,11 @@
success: ({
data
}) => {
if (that.userBean.expireTime <= 0) {
// 开通VIP会员
navigateTo(`/pagesA/vipPay/vipPay`)
} else {
that.goResult(data, myimgUrl);
}
that.goResult(data, imgUrl);
},
fail: () => {
setTimeout(() => {
message.notify('图片存在风险,请重新上传');
message.notify('图片异常,请重新上传');
setTimeout(() => {
navigateBack();
}, 500);
......@@ -177,20 +179,15 @@
success: ({
data
}) => {
if (that.userBean.expireTime <= 0) {
// 开通VIP会员
navigateTo(`/pagesA/vipPay/vipPay`)
} else {
that.goResult(data, myimgUrl);
}
that.goResult(data, myimgUrl);
},
fail: () => {
uni.hideLoading()
setTimeout(() => {
message.notify('图片存在风险,请重新上传');
setTimeout(() => {
navigateBack();
}, 500);
setTimeout(() => {
message.notify('图片异常,请重新上传');
setTimeout(() => {
navigateBack();
}, 500);
}, 1000);
}
});
......@@ -219,13 +216,38 @@
},
success: (uploadFileRes) => {
let myData = JSON.parse(uploadFileRes.data)
that.ocr(myData.data.url)
that.ocrUrl = myData.data.url
that.dyLink(that.ocrUrl)
},
fail: (res) => {
uni.hideLoading()
}
});
},
dyLink(url) {
let that = this;
this.post({
url: '/ai/image/dyLink',
data: {
imgUrl: url
},
showLoading: true,
success: ({
data
}) => {
that.imgUri = that.tempUri
},
fail: () => {
uni.hideLoading()
setTimeout(() => {
message.notify('图片存在风险,请重新上传');
setTimeout(() => {
navigateBack();
}, 500);
}, 1000);
}
});
},
goResult(data, imgUrl) {
uni.hideLoading()
if (this.type == 0) {
......
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