当前位置:网站首页>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
边栏推荐
猜你喜欢
Crontab timing task output generates a large number of mail and runs out of file system inode problem processing
CentOS mysql多实例部署
微信小程序的订阅号开发(消息推送)
Universal template for scikit learn model construction
scikit-learn構建模型的萬能模板
微信小程序获取登录用户信息、openid和access_token
33 million IOPs, 39 microsecond delay, carbon footprint certification, who is serious?
Jenkins construction and use
Postman reference summary
Choreographer full resolution
随机推荐
scikit-learn構建模型的萬能模板
Crontab timing task output generates a large number of mail and runs out of file system inode problem processing
Oracle告警日志alert.log和跟踪trace文件中文乱码显示
try --finally
Jiannanchun understood the word game
What is the difference between blue-green publishing, rolling publishing and gray publishing?
基于Ocelot的gRpc网关
多重继承虚基类习题
China creates vast research infrastructure to support ambitious climate goals
Neuron and neural network
33 million IOPs, 39 microsecond delay, carbon footprint certification, who is serious?
基于微信小程序的wifi模块使用
微信小程序进行蓝牙初始化、搜索附近蓝牙设备及连接指定蓝牙(一)
3300万IOPS、39微秒延迟、碳足迹认证,谁在认真搞事情?
CentOS mysql多实例部署
接口文档yaml
微信小程序的订阅号开发(消息推送)
Programming travel function
基于ibeacons签到系统
Strange bug of cnpm