当前位置:网站首页>Check in system based on ibeacons
Check in system based on ibeacons
2022-04-23 14:04:00 【one billion twenty-nine million one hundred and seventy-nine th】
be based on ibeacons Sign in system
Specific function :
teacher : Initiate sign in , End check-in and check the number of check-in people
Student : Check in
Hardware :ibeacons One
Software :
The whole is divided into 2 part , Log in with different accounts , Identify people , This mainly uses global variables . stay app.js Set specific variables
globalData: {
userInfo: null,
tag:1,//tag Sign in status represents 1 Sign in not initiated 2 Is to initiate check-in
count:0//count The number of people signed in by the representative The default is 0
}
The code of the teacher part
(1)wxml
<view class="scan">
<view class="time-section">
<view class="time">
<view class="hourminuts">
<text>{
{hours}}:{
{minutes}}</text>
</view>
<view class="seconds">
<text>{
{seconds}}</text>
</view>
</view>
<view class="date">
<text>{
{month}} month {
{day}} Japan {
{week}}</text>
</view>
</view>
<view class="footer">
<button class="to-clock" hover-class="hover-to-clock" bindtap="toClock"> Initiate sign in </button>
<button class="to-clock" hover-class="hover-to-clock" bindtap="todistance"> End sign in </button>
<button class="to-clock" hover-class="hover-to-clock" bindtap="todistance1"> Attendance </button>
</view>
<view class="date">
<text>{
{count4}}</text>
</view>
</view>
(2)js Code
Initiate sign in
// Initiate sign in
toClock(){
//tag==2 Initiate sign in
app.globalData.tag=2
console.log(app.globalData.tag)
wx.showToast({
title: ' Check in initiated successfully ',
icon: 'loading',
duration: 2000
})
// var that = this
// that.timing()
},
End sign in
todistance(){
//tag==1 End sign in
app.globalData.tag=1
console.log(app.globalData.tag)
wx.showToast({
title: ' Check in ended successfully ',
icon: 'loading',
duration: 2000
})
// var that = this
// clearTimeout(that.con)
},
Check in number
// View the number of signers
todistance1(){
var count2=app.globalData.count
var count3=" Total attendance :"+count2
var that=this
that.setData({
count4:count3
})
},
Student part code
(1)wxml
<view class="scan">
<view class="time-section">
<view class="time">
<view class="hourminuts">
<text>{
{hours}}:{
{minutes}}</text>
</view>
<view class="seconds">
<text>{
{seconds}}</text>
</view>
</view>
<view class="date">
<text>{
{month}} month {
{day}} Japan {
{week}}</text>
</view>
</view>
<view class="footer">
<button class="to-clock" hover-class="hover-to-clock" bindtap="toClock"> Sign in </button>
</view>
<view class="date">
<text>{
{diatance}}</text>
</view>
</view>
(2)js Code
This part of the code involves searching ibeacons, Connect ibeacons, If the connection is successful, the check-in is successful , Get global variables +1 Can , The code is as follows :
// Find out ibeacons
wx.startBeaconDiscovery({
// Set up ibeacons Parameters of
uuids: ['E2C56DB5-DFFB-48D2-B060-D0F5A71096E0'],
// Successful connection
success: function () {
console.log(" Start scanning devices ")
// monitor iBeacon Update event of the device
wx.onBeaconUpdate(function (res) {
if (res && res.beacons && res.beacons.length > 0) {
console.log(" The equipment uuid yes :"+res.beacons[0].uuid)
console.log(" distance ibeacons The distance is :"+res.beacons[0].accuracy)
var distance=res.beacons[0].accuracy
// The distance is 3 rice
if(distance<3){
wx.showToast({
title: ' Sign in successfully ',
icon: 'loading',
duration: 2000
})
// Sign in successfully The number of +1
app.globalData.count=app.globalData.count+1
console.log(" Attendance "+app.globalData.count)
}else{
wx.showToast({
title: ' Trying to search ',
icon: 'loading',
duration: 2000
})
}
}
})
},
fail:function(){
wx.showToast({
title: ' Not in the range of equipment ',
icon: 'fail',
duration: 500
})
}
}),
WeChat's official account search results and the whole case search : The small white XBIT Can get
版权声明
本文为[one billion twenty-nine million one hundred and seventy-nine th]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231401298243.html
边栏推荐
猜你喜欢

基于Ocelot的gRpc网关

Quartus prime hardware experimental development (de2-115 board) experiment 1 CPU instruction calculator design

Autumn recruitment in 2021, salary ranking No

Quartus prime hardware experimental development (de2-115 board) experiment II function adjustable comprehensive timer design

趣谈网络协议

3300万IOPS、39微秒延迟、碳足迹认证,谁在认真搞事情?

微信小程序获取登录用户信息、openid和access_token

linux安装mysql后修改密码

Pytorch 经典卷积神经网络 LeNet

Choreographer全解析
随机推荐
Choreographer全解析
groutine
scikit-learn構建模型的萬能模板
request模块
Scientists say Australian plan to cull up to 10,000 wild horses doesn’t go far enough
PySide2
poi操作word模板替换数据并且导出word
基于微信小程序的wifi模块使用
Nifi 快速安装及文件同步操作
Jiannanchun understood the word game
记录一个奇怪的bug:缓存组件跳转之后出现组件复制
Quartus prime hardware experimental development (de2-115 board) experiment II function adjustable comprehensive timer design
crontab定时任务输出产生大量邮件耗尽文件系统inode问题处理
微信小程序 input隐藏和不可操作的设置
Special test 05 · double integral [Li Yanfang's whole class]
JMeter pressure test tool
JS force deduction brush question 102 Sequence traversal of binary tree
cnpm的诡异bug
关于pthread多线程一些好文章
Decimal 格式化小数位/DateTime 转换处理