提交 82523cfb authored 作者: 常超凡's avatar 常超凡

最新代码

上级 313080e6
......@@ -7,7 +7,7 @@ App({
extraData: null
},
// 根据不同产品展示不同的页面背景
page_bg:'',
page_bg: '',
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
......@@ -58,6 +58,8 @@ App({
}
// console.log('到这里extraData',extraData)
wx.setStorageSync('extraData', strData)
wx.setStorageSync('labeljson', JSON.parse(strData)?.cpid_jm || JSON.parse(strData)?.cpid || '')
// wx.setStorageSync('fenggu', JSON.parse(strData)?.company || '')
// 启动摄像头预览
......
......@@ -11,6 +11,7 @@ Page({
* 页面的初始数据
*/
data: {
src:'https://res.wx.qq.com/wxdoc/dist/assets/img/0.4cb08bb4.jpg',
height: 0,
width: 0,
showPage: '' // '' 为拍照 ,'error'为不通过,'success' 为通过
......@@ -34,15 +35,20 @@ Page({
let flag = true
const that = this
const listener = this.cameraContext.onCameraFrame(async (frame) => {
console.log(frame.width,frame.height);
if (flag) {
flag = false
// 文件系统
const fileSystem = wx.getFileSystemManager()
that.setData({
height: frame.height,
width: frame.width
})
// 实时帧渲染到canvas
await wx.canvasPutImageData({
canvasId: 'myCanvas',
x:0,
y:-frame.height/5,
x:-frame.width / 4,
y:-frame.height / 3,
width: frame.width,
height: frame.height,
data: new Uint8ClampedArray(frame.data),
......@@ -66,22 +72,28 @@ Page({
// console.log('qe_result',qr_result)
// console.log('qr_result.data.codeinfo',qr_result.data.codeinfo)
if (qr_result.data.codeinfo) {
that.setData({
height: frame.height,
width: frame.width
})
// 原图(默认放大两倍)
const photo1 = await that.handleTakePoto(that.cameraContext, 1)
// 放大图(四倍)
// await new Promise((resovle) => {
// setTimeout(() => {
// resovle()
// },300)
// })
console.log('5555');
const photo2 = await that.handleTakePoto(that.cameraContext, 4,{flash:'on'})
console.log(photo2.tempImagePath,'photo1');
// this.setData({
// src:photo2.tempImagePath
// })
// 原图base64
const base64_1 = fileSystem.readFileSync(photo1.tempImagePath, 'base64')
// 放大四倍图 base64
const base64_2 = fileSystem.readFileSync(photo2.tempImagePath, 'base64')
// 请求接口
Promise.all([that.handleApiCheck(base64_1), that.handleApiCheck(base64_2)])
Promise.all([that.handleApiCheck(base64_1,'small'), that.handleApiCheck(base64_2,'big')])
.then(value => {
let pageType = 'error'
const result1 = value[0],
......@@ -131,22 +143,33 @@ Page({
await context.setZoom({
zoom
})
if (zoom == 4) {
await new Promise((resovle) => {
setTimeout(() => {
resovle()
},300)
})
}
return await context.takePhoto({
flash:param?.flash || 'off',
quality: param?.quality || 'high',
quality:'high',
selfieMirror: param?.selfieMirror || false,
// success(res) {
// console.log(res,zoom,222222);
// }
})
},
// 接口请求
handleApiCheck(base64) {
handleApiCheck(base64,type) {
return new Promise((resolve, reject) => {
wx.request({
url: 'https://www.7856.work:4433/api/Bym_classfily_post/',
method: 'POST',
data: {
device_id: '50',
base: base64
base: base64,
type
},
success(res) {
resolve(res)
......
<!--pages/beiyinmei/beiyinmei.wxml-->
<view wx:if="{{!showPage}}" style="height: 100vh;width: 100vw;position: relative;z-index: 99;">
<camera device-position="back" frame-size="medium" flash="auto" style="width: 100%; height: 100%;" mode="normal">
<camera device-position="back" frame-size="high" flash="on" style="width: 100%; height: 100%;" mode="normal">
<view class="prompt">
<image src="/assets/imgs/拍照框.png" style="width: 25%;" mode="widthFix" />
<text>请把二维码放置拍照框内</text>
......@@ -24,5 +24,5 @@
</view>
<view style="visibility: hidden;position: fixed;top: 99999px;left: 0px;">
<canvas canvas-id="myCanvas" id="myCanvas" style="width:400px;height: 400px;" />
<canvas canvas-id="myCanvas" id="myCanvas" style="width:500px;height:500px;" />
</view>
......@@ -41,14 +41,13 @@
<canvas canvas-id="myCanvas" style='width:{{frame.width}}px; height:{{frame.height}}px;'></canvas>
<image src="{{src}}" mode="widthFix" style='width: {{windowWidth}}px; height: {{windowWidth}}px;border: 1px solid red; '></image>
</view> -->
<view class="ai-check-box">
<view class="photo-box">
<camera wx:if='{{isShowCamera}}' style="height: 100%;width: 100%;" flash="on" devic-position="back" frame-size="large" resolution="high">
</camera>
<view class="content">
<text style='font-size:34rpx'>请将识别框对准结构三维码</text>
<image src="/assets/imgs/拍照框.png" mode="widthFix" style="margin:75rpx 0; width: 35%;"/>
<image src="/assets/imgs/拍照框.png" mode="widthFix" style="margin:80rpx 0; width: 35%; width: 300rpx;"/>
<view class="progress-box">
<text >请保持结构三维码在识别框内等待进度条完成</text>
<progress percent="{{progressNumber}}" active stroke-width="10" show-info color="#0270FF" border-radius='100' active-mode='forwards' style="margin-top: 20rpx;"/>
......
......@@ -14,6 +14,7 @@ Page({
dongtaishuju: 0,
phone_model: '',
benchmarkLevel: 0,
showModal:false,
content: "1.识别时请将整个结构三维码放到识别框中,保持画面清晰稳定直到显示认证结果\r\n2.确保标签与背景保持在同一平面内,便于手机相机聚焦\r\n3.AI验证的标签需要与扫描进入主页的这枚标签一致(否则会提示码不同)",
showCover: true,
status_zhi: '',
......@@ -112,22 +113,31 @@ Page({
// console.log('status_zhi',status_zhi)
}
if (this.data.showmodel === true) {
wx.showModal({
title: '注意事项:',
content: this.data.content,
showCancel: false, // 是否显示取消按钮,默认值 true
// cancelText: '非常自信', // 取消按钮的文字,默认值 '取消'
confirmText: '我已知晓', // 确定按钮的文字,默认值 '确定'
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
this.setData({
showModal:true
})
// wx.showModal({
// title: '注意事项:',
// content: this.data.content,
// showCancel: false, // 是否显示取消按钮,默认值 true
// // cancelText: '非常自信', // 取消按钮的文字,默认值 '取消'
// confirmText: '我已知晓', // 确定按钮的文字,默认值 '确定'
// success: function (res) {
// if (res.confirm) {
// console.log('用户点击确定')
// }
// },
// fail: function (res) {
// console.log(res)
// }
// })
}
},
fail: function (res) {
console.log(res)
}
handleColseModal(){
this.setData({
showModal:false
})
}
},
/**ss
* 跳转到拍照界面
......
......@@ -12,7 +12,7 @@
<!-- 内容盒子 -->
<view class="index-content full">
<image class="title-image" src="/assets/imgs/index/首页标题.png" mode='widthFix' style="width: 90%;"></image>
<image src="https://ai.tj5.cc:35437/static/fenggu/AI.png" mode="widthFix" style="margin-top: 40rpx; width: 80%;"/>
<image src="https://ai.tj5.cc:35437/static/fenggu/AI.png" mode="widthFix" style="margin-top: 40rpx; width: 80%;" />
<!-- 按钮 -->
<view class="btns">
......@@ -23,5 +23,18 @@
<!-- 底部文字 -->
<text class="bottom-text">海南天鉴防伪科技有限公司提供技术支持</text>
<!-- modal -->
<view wx:if="{{showModal}}" class="modal-box">
<view class="card">
<view style="margin: 20rpx 0;font-weight: 700;font-size: 38rpx;">注意事项</view>
<view class="context-text">
<text>1. 识别时请将整个结构三维码放到识别框中,保持画面清晰稳定直到显示认证结果</text>
<text>2. 确保标签与背景保持在同一平面内,便于手机相机聚焦</text>
<text>3. AI验证的标签需要与扫描进入主页的这枚标签一致(否则会提示码不同)</text>
</view>
<view style="margin: 20rpx 0;font-weight: 700;font-size: 38rpx;color: #1666cfb4;" bind:tap="handleColseModal">我已知晓</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
......@@ -48,3 +48,40 @@ page {
color: #fff;
text-align: center;
}
.modal-box {
position: absolute;
top: 0;
left: 0;
z-index: 999;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.4);
}
.modal-box .card {
position: absolute;
top: 45%;
left: 50%;
transform: translate(-50%,-50%);
padding: 20rpx 40rpx;
width: 70%;
background-color: #fff;
border-radius: 20rpx;
}
.modal-box .card .context-text {
display: flex;
flex-direction: column;
text-align: left;
text-indent: -28rpx;
margin-left: 38rpx;
color: #999;
padding-bottom: 20rpx;
border-bottom: 2rpx solid #eee;
}
.modal-box .card .context-text text {
margin: 10rpx 0;
}
\ No newline at end of file
// pages/result/result.js
Page({
/**
* 页面的初始数据
*/
......@@ -8,25 +7,20 @@ Page({
aiState: 0, //展示成功或失败页面,
time1: '', //本次认证时间
time2: '', //认证耗时
bg_color:'',
Labeldiff:0 //展示码不同页面
bg_color: '',
Labeldiff: 0,//展示码不同页面
},
onLoad(options) {
const {
aiState,
time1,
time2,
Labeldiff
} = options
// console.log(options,time1);
console.log('options.Labeldiff',options.Labeldiff)
const { aiState, time1, time2, Labeldiff } = options
console.log(options, time1)
console.log('options.Labeldiff', options.Labeldiff)
this.setData({
aiState: aiState || 0,
time1: time1 || '',
time2: time2 && (new Date().getTime() - time2) / 1000 || '',
time2: (time2 && (new Date().getTime() - time2) / 100) || '',
bg_color: getApp().page_bg,
Labeldiff:Labeldiff || 0
Labeldiff: Labeldiff || 0
})
},
// 返回首页
......@@ -36,21 +30,16 @@ Page({
})
},
// 重新拍照
handleGoTakePhoto(){
handleGoTakePhoto() {
wx.reLaunch({
url: `/pages/cameraTakePhoto/cameraTakePhoto`
})
},
handleOpenVideo() {
wx.navigateTo({
url: '/pages/video/video',
url: '/pages/video/video'
})
},
onReady() {
},
onShow() {
},
onReady() {},
onShow() {}
})
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论