更换版本

This commit is contained in:
2024-01-22 18:48:00 +08:00
parent 9f65ea8fd9
commit 00e6dcaec0
1158 changed files with 70609 additions and 51780 deletions

View File

@@ -0,0 +1,244 @@
var e, t, s;
(e = getApp()),
(t = getApp()),
(s = "https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license"),
Page({
data: {
url: e.globalData.ceshiurl,
src: "",
src_01: "",
leixing: 2,
result_1: [],
xuanze: "行驶证识别",
},
onLoad: function (e) {
e.type && this.setData({ typeapi: e.type }),
e.name && this.setData({ name: e.name });
try {
wx.removeStorageSync("result_1");
} catch (e) {}
this.setData({
src: "https://api.ym23.com/addons/monai_market/static/images/car/xsz_example.jpg",
}),
this.getad();
},
onReady: function () {},
onShow: function () {},
onHide: function () {},
onUnload: function () {},
getad: function () {},
copyBtn: function () {
var e = this;
1 == this.data.vadopen
? t.videoad(this.data.videoId, "看完视频广告复制~").then((t) => {
console.log("回调广告:", t), 1 == t && e.copyBtnb();
})
: e.copyBtnb();
},
copyBtnb: function (e) {
for (var t = this.data.result_1, a = [], s = 0, o = t.length; s < o; s++)
a += t[s].words + "\n\n";
wx.setClipboardData({
data: a,
success: function (e) {
wx.showToast({
icon: "success",
title: "复制成功",
duration: 1500,
success: function () {},
});
},
fail: function () {
wx.showToast({ icon: "loading", title: "复制失败" });
},
});
},
shibie_1: function () {
var e = this,
o = this;
1 == e.data.leixing
? ((a = e.data.url),
wx.chooseImage({
count: 1,
sizeType: ["compressed"],
sourceType: ["album", "camera"],
success: function (a) {
wx.showLoading({ title: "提取中.." });
var n = a.tempFilePaths[0],
i = a.tempFilePaths[0],
c =
t.util.url("entry/wxapp/Wenzisb") +
"&m=" +
t.siteInfo.m +
"&api=" +
s +
"&type=" +
o.data.typeapi;
wx.uploadFile({
url: c,
filePath: n,
name: "file",
success: function (t) {
wx.hideLoading(), console.log("上传参数b", t);
var a = t.data,
s = JSON.parse(a),
n = JSON.parse(s.data);
if ((console.log("上传参数", n), "87014" == n.errcode))
return (
wx.hideLoading(),
void wx.showModal({
title: "温馨提示",
content: "你上传的图片存在违规,请重新上传。",
success: function (e) {
e.confirm || console.log("点击取消回调");
},
})
);
o.setData({ src: i }),
"1" == o.data.typeapi &&
(wx.setStorageSync("xszimgurl", s.message),
wx.setStorageSync("cardata", n.words_result),
wx.navigateBack({ delta: 1 })),
"2" == o.data.typeapi &&
(wx.setStorageSync("cardata", n.words_result),
wx.navigateBack({ delta: 1 })),
wx.hideLoading(),
e.setData({ result_1: n.words_result, show: 1 }),
0 == n.words_result.length
? (wx.showLoading({ title: "不能识别!" }),
setTimeout(function () {
wx.hideLoading();
}, 2e3))
: wx.hideLoading();
},
fail: function () {
console.log("错误");
},
});
},
}))
: 2 == e.data.leixing &&
wx.chooseImage({
count: 1,
sizeType: ["compressed"],
sourceType: ["album", "camera"],
success: function (a) {
wx.showLoading({ title: "提取中.." });
var n = a.tempFilePaths[0],
i = a.tempFilePaths[0],
c =
t.util.url("entry/wxapp/Wenzisb") +
"&m=" +
t.siteInfo.m +
"&api=" +
s +
"&type=" +
o.data.typeapi;
wx.uploadFile({
url: c,
filePath: n,
name: "file",
success: function (t) {
wx.hideLoading(), console.log("上传参数b", t);
var a = t.data,
s = JSON.parse(a),
n = JSON.parse(s.data);
if ((console.log("上传参数", n), "87014" == n.errcode))
return (
wx.hideLoading(),
void wx.showModal({
title: "温馨提示",
content: "你上传的图片存在违规,请重新上传。",
success: function (e) {
e.confirm || console.log("点击取消回调");
},
})
);
o.setData({ src: i }),
console.log("传递参数", o.data.typeapi),
"1" == o.data.typeapi &&
(wx.setStorageSync("xszimgurl", s.message),
wx.setStorageSync("keyname", o.data.name),
wx.setStorageSync("cardata", n.words_result),
wx.navigateBack({ delta: 1 })),
"2" == o.data.typeapi &&
(wx.setStorageSync("cardata", n.words_result),
wx.setStorageSync("keyname", o.data.name),
wx.navigateBack({ delta: 1 })),
wx.hideLoading(),
e.setData({ result_1: n.words_result, show: 1 }),
0 == n.words_result.length
? (wx.showLoading({ title: "不能识别!" }),
setTimeout(function () {
wx.hideLoading();
}, 2e3))
: wx.hideLoading();
},
fail: function () {
console.log("错误");
},
});
},
});
},
deletewenzi: function (e) {
var t = this,
a = e.target.dataset.index;
t.data.result_1,
wx.showActionSheet({
itemList: ["复制"],
success: function (s) {
if ((console.log(a), console.log(s.tapIndex), 0 == s.tapIndex))
wx.setClipboardData({
data: e.target.dataset.words,
success: function (e) {
wx.showToast({
icon: "success",
title: a + "复制成功",
duration: 1500,
success: function () {},
});
},
fail: function () {
wx.showToast({ icon: "loading", title: "复制失败" });
},
});
else if ((console.log(s.tapIndex), 1 == s.tapIndex))
t.setData({
xianshi: "display:none",
upstyle: "display:hidden",
xiugai_idx: e.target.dataset.index,
upwenzi: t.data.result_1[a].words,
});
else if (2 == s.tapIndex) {
delete t.data.result_1[a];
for (var o = [], n = 0; n < t.data.result_1.length; n++)
null != t.data.result_1[n] && o.push(t.data.result_1[n]);
try {
wx.setStorageSync("result_1", o);
} catch (e) {}
t.onShow();
}
},
fail: function (e) {
console.log(e.errMsg);
},
});
},
gohome: function () {
wx.switchTab({ url: "/pages/picmake/index" });
},
onShareAppMessage: function (e) {
return (
this.data.url,
{
title: "汽车行驶证识别小工具!",
imageUrl: "",
path: "/packageA/pages/xszsb/xszsb",
fail: function (e) {
console.log("失败");
},
}
);
},
});

View File

@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "汽车行驶证上传识别",
"usingComponents": {}
}

View File

@@ -0,0 +1,24 @@
<import src="../footer/footer.wxml"></import>
<view class="page-view">
<view class="top-title">
<text class="top-title-b">汽车行驶证识别</text>
<text class="top-title-l">请拍照/上传清晰行驶证照片</text>
</view>
<view class="top-box">
<image bindtap="shibie_1" class="img001_002" mode="widthFix" src="{{src}}"></image>
</view>
<button bindtap="shibie_1" class="search-button">拍照 / 相册</button>
<view wx:if="{{show==1}}">
<view class="shibie_01" wx:if="{{result_1['住址']}}">
<text class="shuoming" style="{{ding}}">~戳文字可进行复制~</text>
<view wx:for="{{result_1}}" wx:key="{{index}}">
<text bindtap="deletewenzi" class="xia" data-index="{{index}}" data-words="{{item.words}}">{{index}}:{{item.words}}</text>
</view>
</view>
<view class="shibie_01" wx:else>
<text class="xia">未找识别到信息</text>
</view>
</view>
<template is="item" data="{{text:'forbar'}}"></template>
<view class="kongge"></view>
</view>

View File

@@ -0,0 +1,122 @@
@import "/packageA/pages/vinsb/word.wxss";
page {
background: #f8f8f8;
}
.page-view {
background: linear-gradient(#3960fe, #4e71fc, #f8f8f8);
height: 495rpx;
width: 100%;
}
.top-title {
color: #fff;
padding-top: 30rpx;
text-align: center;
}
.top-title-b {
display: block;
font-size: 50rpx;
font-weight: 700;
}
.top-title-l {
display: block;
font-size: 25rpx;
margin-bottom: 20rpx;
margin-top: 20rpx;
}
.top-box {
background-color: #fff;
border-radius: 14rpx;
height: 440rpx;
margin: 30rpx;
padding: 30rpx;
}
.box-text {
display: inline-block;
width: 70%;
}
.brand-text {
display: block;
font-size: 36rpx;
font-weight: 700;
height: 46rpx;
line-height: 46rpx;
}
.container {
align-items: center;
box-sizing: border-box;
display: -webkit-flex;
display: flex;
flex-direction: column;
height: 100%;
justify-content: space-between;
padding: 200rpx 0;
}
.img_001 {
width: 100%;
}
.img001_001 {
border: 5px solid #0082dc;
border-radius: 10px;
height: 120px;
margin: 7px 7% 7px 18%;
width: 200px;
}
.t01 {
color: #000;
margin: 10px 0;
}
.t01,
.t02 {
display: block;
float: left;
font-size: 0.9em;
font-weight: 800;
}
.t02 {
color: #ee2c2c;
margin: 10px 0 10px 2px;
}
.img_002 {
width: 100%;
}
.img001_002 {
border-radius: 6px;
height: 86px;
width: 100%;
}
.hf {
height: 100px;
}
.box {
background: #f8f8ff;
}
.bt {
margin: 40px 20% 20px;
width: 60%;
}
.bt button {
background: #0082dc;
border-radius: 50px;
color: #fff;
margin: 5px 0 20px;
}
button::after {
border: none;
}
.bt text {
color: #969696;
display: block;
font-size: 0.8em;
margin: 20px 0;
text-align: center;
width: 100%;
}
.adContainer {
margin: 0 5%;
width: 90%;
}
.img001_003 {
border-radius: 5px;
margin: 15px 25% 2px;
width: 50%;
}