更换版本
This commit is contained in:
238
packageA/pages/vinsb/vinsb.js
Normal file
238
packageA/pages/vinsb/vinsb.js
Normal file
@@ -0,0 +1,238 @@
|
||||
!(function () {
|
||||
getApp();
|
||||
var t = getApp(),
|
||||
e = "https://aip.baidubce.com/rest/2.0/ocr/v1/vin_code";
|
||||
Page({
|
||||
data: {
|
||||
src: "",
|
||||
src_01: "",
|
||||
leixing: 2,
|
||||
result_1: [],
|
||||
xuanze: "VIN车架号识别",
|
||||
},
|
||||
onLoad: function (t) {
|
||||
t.type && this.setData({ typeapi: t.type });
|
||||
try {
|
||||
wx.removeStorageSync("result_1");
|
||||
} catch (t) {}
|
||||
this.setData({
|
||||
src: "https://api.ym23.com/addons/monai_market/static/images/car/vin.jpg",
|
||||
});
|
||||
},
|
||||
onReady: function () {},
|
||||
onShow: function () {},
|
||||
onHide: function () {},
|
||||
onUnload: 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 (t) {
|
||||
for (var e = this.data.result_1, a = [], o = 0, s = e.length; o < s; o++)
|
||||
a += e[o].words + "\n\n";
|
||||
wx.setClipboardData({
|
||||
data: a,
|
||||
success: function (t) {
|
||||
wx.showToast({
|
||||
icon: "success",
|
||||
title: "复制成功",
|
||||
duration: 1500,
|
||||
success: function () {},
|
||||
});
|
||||
},
|
||||
fail: function () {
|
||||
wx.showToast({ icon: "loading", title: "复制失败" });
|
||||
},
|
||||
});
|
||||
},
|
||||
shibie_1: function () {
|
||||
var o = this,
|
||||
s = this;
|
||||
1 == o.data.leixing
|
||||
? ((a = o.data.url),
|
||||
wx.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ["compressed"],
|
||||
sourceType: ["album", "camera"],
|
||||
success: function (a) {
|
||||
wx.showLoading({ title: "提取中.." });
|
||||
var i = a.tempFilePaths[0],
|
||||
n = a.tempFilePaths[0],
|
||||
c =
|
||||
t.util.url("entry/wxapp/Wenzisb") +
|
||||
"&m=" +
|
||||
t.siteInfo.m +
|
||||
"&api=" +
|
||||
e +
|
||||
"&type=" +
|
||||
s.data.typeapi;
|
||||
wx.uploadFile({
|
||||
url: c,
|
||||
filePath: i,
|
||||
name: "file",
|
||||
success: function (t) {
|
||||
wx.hideLoading(), console.log("上传参数b", t);
|
||||
var e = t.data,
|
||||
a = JSON.parse(e),
|
||||
i = JSON.parse(a.data);
|
||||
if ((console.log("上传参数", i), "87014" == i.errcode))
|
||||
return (
|
||||
wx.hideLoading(),
|
||||
void wx.showModal({
|
||||
title: "温馨提示",
|
||||
content: "你上传的图片存在违规,请重新上传。",
|
||||
success: function (t) {
|
||||
t.confirm || console.log("点击取消回调");
|
||||
},
|
||||
})
|
||||
);
|
||||
s.setData({ src: n }),
|
||||
"1" == s.data.typeapi &&
|
||||
(wx.setStorageSync("vinimgurl", a.message),
|
||||
wx.setStorageSync("cardata", i.words_result),
|
||||
wx.navigateBack({ delta: 1 })),
|
||||
"2" == s.data.typeapi &&
|
||||
(wx.setStorageSync("cardata", i.words_result),
|
||||
wx.navigateBack({ delta: 1 })),
|
||||
wx.hideLoading(),
|
||||
o.setData({ result_1: i.words_result, show: 1 }),
|
||||
0 == i.words_result.length
|
||||
? (wx.showLoading({ title: "不能识别!" }),
|
||||
setTimeout(function () {
|
||||
wx.hideLoading();
|
||||
}, 2e3))
|
||||
: wx.hideLoading();
|
||||
},
|
||||
fail: function () {
|
||||
console.log("错误");
|
||||
},
|
||||
});
|
||||
},
|
||||
}))
|
||||
: 2 == o.data.leixing &&
|
||||
wx.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ["compressed"],
|
||||
sourceType: ["album", "camera"],
|
||||
success: function (a) {
|
||||
wx.showLoading({ title: "提取中.." });
|
||||
var i = a.tempFilePaths[0],
|
||||
n = a.tempFilePaths[0],
|
||||
c =
|
||||
t.util.url("entry/wxapp/Wenzisb") +
|
||||
"&m=" +
|
||||
t.siteInfo.m +
|
||||
"&api=" +
|
||||
e +
|
||||
"&type=" +
|
||||
s.data.typeapi;
|
||||
wx.uploadFile({
|
||||
url: c,
|
||||
filePath: i,
|
||||
name: "file",
|
||||
success: function (t) {
|
||||
wx.hideLoading(), console.log("上传参数b", t);
|
||||
var e = t.data,
|
||||
a = JSON.parse(e),
|
||||
i = JSON.parse(a.data);
|
||||
if ((console.log("上传参数", i), "87014" == i.errcode))
|
||||
return (
|
||||
wx.hideLoading(),
|
||||
void wx.showModal({
|
||||
title: "温馨提示",
|
||||
content: "你上传的图片存在违规,请重新上传。",
|
||||
success: function (t) {
|
||||
t.confirm || console.log("点击取消回调");
|
||||
},
|
||||
})
|
||||
);
|
||||
s.setData({ src: n }),
|
||||
"1" == s.data.typeapi &&
|
||||
(wx.setStorageSync("vinimgurl", a.message),
|
||||
wx.setStorageSync("cardata", i.words_result),
|
||||
wx.navigateBack({ delta: 1 })),
|
||||
"2" == s.data.typeapi &&
|
||||
(wx.setStorageSync("cardata", i.words_result),
|
||||
wx.navigateBack({ delta: 1 })),
|
||||
wx.hideLoading(),
|
||||
o.setData({ result_1: i.words_result, show: 1 }),
|
||||
0 == i.words_result.length
|
||||
? (wx.showLoading({ title: "不能识别!" }),
|
||||
setTimeout(function () {
|
||||
wx.hideLoading();
|
||||
}, 2e3))
|
||||
: wx.hideLoading();
|
||||
},
|
||||
fail: function () {
|
||||
console.log("错误");
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
deletewenzi: function (t) {
|
||||
var e = this,
|
||||
a = t.target.dataset.index;
|
||||
e.data.result_1,
|
||||
wx.showActionSheet({
|
||||
itemList: ["复制"],
|
||||
success: function (o) {
|
||||
if ((console.log(a), console.log(o.tapIndex), 0 == o.tapIndex))
|
||||
wx.setClipboardData({
|
||||
data: t.target.dataset.words,
|
||||
success: function (t) {
|
||||
wx.showToast({
|
||||
icon: "success",
|
||||
title: a + "复制成功",
|
||||
duration: 1500,
|
||||
success: function () {},
|
||||
});
|
||||
},
|
||||
fail: function () {
|
||||
wx.showToast({ icon: "loading", title: "复制失败" });
|
||||
},
|
||||
});
|
||||
else if ((console.log(o.tapIndex), 1 == o.tapIndex))
|
||||
e.setData({
|
||||
xianshi: "display:none",
|
||||
upstyle: "display:hidden",
|
||||
xiugai_idx: t.target.dataset.index,
|
||||
upwenzi: e.data.result_1[a].words,
|
||||
});
|
||||
else if (2 == o.tapIndex) {
|
||||
delete e.data.result_1[a];
|
||||
for (var s = [], i = 0; i < e.data.result_1.length; i++)
|
||||
null != e.data.result_1[i] && s.push(e.data.result_1[i]);
|
||||
try {
|
||||
wx.setStorageSync("result_1", s);
|
||||
} catch (t) {}
|
||||
e.onShow();
|
||||
}
|
||||
},
|
||||
fail: function (t) {
|
||||
console.log(t.errMsg);
|
||||
},
|
||||
});
|
||||
},
|
||||
gohome: function () {
|
||||
wx.switchTab({ url: "/pages/picmake/index" });
|
||||
},
|
||||
onShareAppMessage: function (t) {
|
||||
return (
|
||||
this.data.url,
|
||||
{
|
||||
title: "汽车VIN车架号识别小工具!",
|
||||
imageUrl: "",
|
||||
path: "/packageA/pages/vinsb/vinsb",
|
||||
fail: function (t) {
|
||||
console.log("失败");
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
})();
|
||||
4
packageA/pages/vinsb/vinsb.json
Normal file
4
packageA/pages/vinsb/vinsb.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "汽车车架号识别",
|
||||
"usingComponents": {}
|
||||
}
|
||||
25
packageA/pages/vinsb/vinsb.wxml
Normal file
25
packageA/pages/vinsb/vinsb.wxml
Normal file
@@ -0,0 +1,25 @@
|
||||
<view class="page-view">
|
||||
<view class="top-title">
|
||||
<text class="top-title-b">汽车VIN车架号识别</text>
|
||||
<text class="top-title-l">请拍照/上传清晰VIN车架号照片</text>
|
||||
</view>
|
||||
<view class="top-box">
|
||||
<image bindtap="yinshua" class="img001_002" mode="aspectFill" src="{{src}}"></image>
|
||||
</view>
|
||||
<button bindtap="shibie_1" class="search-button">拍照 / 相册</button>
|
||||
<button class="search-button" openType="share">送给小伙伴</button>
|
||||
<view wx:if="{{show==1}}">
|
||||
<view class="shibie_01" wx:if="{{result_1['0']}}">
|
||||
<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}}">车架号:{{item.words}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="shibie_01" wx:else>
|
||||
<text class="xia">未找识别到信息</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="kongge"></view>
|
||||
</view>
|
||||
<import src="../footer/footer.wxml"></import>
|
||||
<template is="item" data="{{text:'forbar'}}"></template>
|
||||
122
packageA/pages/vinsb/vinsb.wxss
Normal file
122
packageA/pages/vinsb/vinsb.wxss
Normal 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: 340rpx;
|
||||
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: 146px;
|
||||
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%;
|
||||
}
|
||||
101
packageA/pages/vinsb/word.wxss
Normal file
101
packageA/pages/vinsb/word.wxss
Normal file
@@ -0,0 +1,101 @@
|
||||
.shibie {
|
||||
float: left;
|
||||
margin-left: 5%;
|
||||
width: 90%;
|
||||
}
|
||||
.shibie image {
|
||||
border: 1px dashed #bfbfbf;
|
||||
border-radius: 50px;
|
||||
margin: 20px 15%;
|
||||
width: 70%;
|
||||
}
|
||||
.shibie image,
|
||||
.xia {
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
.xia {
|
||||
background: #fafafa;
|
||||
color: #787878;
|
||||
font-size: 0.9em;
|
||||
margin: 6px 5%;
|
||||
padding: 2px 0;
|
||||
text-align: center;
|
||||
width: 90%;
|
||||
}
|
||||
.shibie_01 {
|
||||
border: 1px solid #3d61f0;
|
||||
border-radius: 5px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin: 5%;
|
||||
width: 90%;
|
||||
}
|
||||
.fenxiang {
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
top: 20px;
|
||||
width: 40px;
|
||||
}
|
||||
.fenxiang image {
|
||||
display: block;
|
||||
height: 20px;
|
||||
margin-left: -6px;
|
||||
margin-top: 9px;
|
||||
width: 20px;
|
||||
}
|
||||
.fenxiang[plain] {
|
||||
border: 0;
|
||||
}
|
||||
.bbtt {
|
||||
background: #3d61f0;
|
||||
border: 1px solid #3d61f0;
|
||||
bottom: 5px;
|
||||
left: 15%;
|
||||
padding: 5px 0;
|
||||
position: fixed;
|
||||
width: 70%;
|
||||
}
|
||||
.kongge {
|
||||
float: left;
|
||||
height: 50px;
|
||||
width: 100%;
|
||||
}
|
||||
.update {
|
||||
background: #f2f2f2;
|
||||
height: 100vh;
|
||||
left: 0;
|
||||
margin: 5px 4%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 92%;
|
||||
}
|
||||
.update textarea {
|
||||
border: 1rpx solid #3d61f0;
|
||||
border-radius: 5px;
|
||||
margin: 35px 1.9%;
|
||||
padding: 15px 1.9%;
|
||||
width: 92%;
|
||||
}
|
||||
.bb_ciugai {
|
||||
background: #3d61f0;
|
||||
border: 1px solid #3d61f0;
|
||||
color: #fff;
|
||||
margin: 0 30%;
|
||||
padding: 5px 0;
|
||||
width: 40%;
|
||||
}
|
||||
.shuoming {
|
||||
color: #3d61f0;
|
||||
float: left;
|
||||
font-weight: 900;
|
||||
margin: 10px 0;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
button::after {
|
||||
border: none;
|
||||
}
|
||||
Reference in New Issue
Block a user