Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
best_AI
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
常超凡
best_AI
Commits
2cb1c171
提交
2cb1c171
authored
3月 30, 2024
作者:
羊富学
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
贝因美
上级
c8f5c84a
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
205 行增加
和
23 行删除
+205
-23
beiyinmei.js
pages/beiyinmei/beiyinmei.js
+105
-21
beiyinmei.wxml
pages/beiyinmei/beiyinmei.wxml
+22
-2
beiyinmei.wxss
pages/beiyinmei/beiyinmei.wxss
+78
-0
没有找到文件。
pages/beiyinmei/beiyinmei.js
浏览文件 @
2cb1c171
...
...
@@ -9,45 +9,129 @@ Page({
* 页面的初始数据
*/
data
:
{
canvas
:
{
height
:
10
0
,
width
:
100
},
src
:
'https://res.wx.qq.com/wxdoc/dist/assets/img/draw-image.22401fa6.png'
,
height
:
0
,
width
:
0
,
showPage
:
false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad
(
options
)
{
let
flag
=
true
this
.
cameraContext
=
wx
.
createCameraContext
()
this
.
cameraContext
.
setZoom
({
zoom
:
2
})
this
.
cameraFrame
()
// this.cameraFrameApi()
},
// 视频流(后端校验二维码)
cameraFrameApi
()
{
let
flag
=
true
const
that
=
this
const
listener
=
this
.
cameraContext
.
onCameraFrame
((
frame
)
=>
{
if
(
flag
)
{
flag
=
false
that
.
setData
({
width
:
frame
.
width
,
height
:
frame
.
height
,
})
wx
.
canvasPutImageData
({
canvasId
:
'myCanvas'
,
width
:
frame
.
width
,
height
:
frame
.
height
,
data
:
new
Uint8ClampedArray
(
frame
.
data
),
success
(
rew
)
{
console
.
log
(
rew
,
99
);
wx
.
canvasToTempFilePath
({
canvasId
:
'myCanvas'
,
x
:
frame
.
width
/
2
-
150
,
y
:
frame
.
height
/
2
-
150
,
width
:
300
,
height
:
300
,
destWidth
:
300
,
destHeight
:
300
,
quality
:
'high'
,
fileType
:
'jpg'
,
success
(
path
)
{
console
.
log
(
path
.
tempFilePath
,
66
);
const
base
=
wx
.
getFileSystemManager
().
readFileSync
(
path
.
tempFilePath
,
'base64'
)
that
.
setData
({
src
:
'data:image/jpeg;base64,'
+
base
})
wx
.
request
({
url
:
'https://ai.tj5.cc:35437/object/'
,
method
:
"POST"
,
data
:
{
base
},
success
(
g
)
{
console
.
log
(
g
,
'cccc'
);
flag
=
true
}
})
},
fail
(
rr
)
{
console
.
log
(
rr
,
5555
);
}
})
},
fail
(
err
)
{
console
.
log
(
err
);
}
})
}
})
listener
.
start
()
},
// 视频流(前端判断二维码)
cameraFrame
()
{
let
flag
=
true
const
that
=
this
const
listener
=
this
.
cameraContext
.
onCameraFrame
((
frame
)
=>
{
if
(
flag
)
{
flag
=
false
const
data
=
new
Uint8ClampedArray
(
frame
.
data
);
const
d
=
qrcode
.
decodefrank
(
frame
.
width
,
frame
.
height
,
data
)
if
(
d
)
{
wx
.
showToast
({
title
:
'通过'
})
this
.
cameraContext
.
takePhoto
({
quality
:
'high'
,
success
(
res
){
console
.
log
(
res
,
'ss'
);
quality
:
'high'
,
selfieMirror
:
false
,
success
(
res
)
{
// flag = true
const
base
=
wx
.
getFileSystemManager
().
readFileSync
(
res
.
tempImagePath
,
'base64'
)
console
.
log
(
base
);
wx
.
request
({
url
:
'https://www.7856.work:4433/api/Bym_classfily_post/'
,
method
:
'POST'
,
data
:{
device_id
:
'50'
,
base
:
base
url
:
'https://www.7856.work:4433/api/Bym_classfily_post/'
,
method
:
'POST'
,
data
:
{
device_id
:
'50'
,
base
:
base
},
success
(
res
){
console
.
log
(
res
);
success
(
rs
)
{
// console.log(rs,9999,rs.data.result,555);
// wx.showToast({
// title: 'dddd过',
// })
if
(
rs
.
data
.
result
==
2
)
{
wx
.
showToast
({
title
:
'通过'
,
icon
:
'success'
})
that
.
setData
({
showPage
:
true
})
}
else
{
wx
.
showToast
({
title
:
'未通过'
,
icon
:
'error'
})
flag
=
true
}
},
fail
(
e
){
fail
(
e
)
{
console
.
log
(
e
);
}
})
...
...
pages/beiyinmei/beiyinmei.wxml
浏览文件 @
2cb1c171
<!--pages/beiyinmei/beiyinmei.wxml-->
<view style="height: 100vh;width: 100vw;position: relative;z-index: 99;">
<camera device-position="back" frame-size="
large" flash="off" binderror="error
" style="width: 100%; height: 100%;" mode="normal">
<view
wx:if="{{!showPage}}"
style="height: 100vh;width: 100vw;position: relative;z-index: 99;">
<camera device-position="back" frame-size="
medium" flash="off
" style="width: 100%; height: 100%;" mode="normal">
<view class="prompt">
<image src="/assets/imgs/拍照框.png" style="width: 40%;" mode="widthFix" />
<text>请把二维码放置拍照框内</text>
</view>
</camera>
</view>
<view wx:else class="success-content full">
<view class="content-text">
<image src="/assets/imgs/成功.png" mode="widthFix" style="width: 40%;" />
<image src="/assets/imgs/通过.png" mode="widthFix" style="width: 50%;" />
<!-- <view class="btn" bind:tap="handleBack">返回主页面</view> -->
<!-- <navigator class="btn" open-type="exit" target="miniProgram">点击按钮返回主页</navigator> -->
</view>
</view>
<view style="visibility: hidden;position: fixed;top: 999px;left: 0px;">
<canvas canvas-id="myCanvas" id="myCanvas" style="width: 400px;height: 400px;" />
</view>
<!-- <view style="position: fixed;top: 0px;left: 0px;z-index: 999;">
<image src="{{src}}" mode="widthFix"/>
</view> -->
\ No newline at end of file
pages/beiyinmei/beiyinmei.wxss
浏览文件 @
2cb1c171
/* pages/beiyinmei/beiyinmei.wxss */
.prompt {
position: absolute;
top: 50%;
...
...
@@ -14,4 +17,78 @@
.prompt text {
margin-top: 50px;
}
.result-container {
position: relative;
width: 100vw;
height: 100vh;
box-sizing: border-box;
overflow: hidden;
}
.full {
position: relative;
width: 100%;
height: 100%;
box-sizing: border-box
}
.bg-img {
position: absolute;
top: 0;
left: 0;
z-index: -1;
width: 100%;
height: 100%;
}
.btn {
width: 60%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 20rpx;
}
.success-content,.error-content {
display: flex;
flex-direction: column;
}
.content-text {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.success-content .query-text {
margin: 40rpx 0;
display: flex;
flex-direction: column;
align-items: center;
}
.success-content .btn {
margin-top: 40rpx;
color: #008AF4;
border: 4rpx solid #008AF4;
}
.error-content .btns {
margin-top: 40rpx;
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
font-size: 34rpx;
}
.error-content .btns .btn:first-child {
background-color: #FFB44C;
}
.error-content .btns .btn:last-child {
margin-top: 20rpx;
color: #FFB44C;
border:4rpx solid #FFB44C;
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论