当前位置:网站首页>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
边栏推荐
猜你喜欢
nodejs通过require读取本地json文件出现Unexpected token / in JSON at position
Record a strange bug: component copy after cache component jump
Elmo (bilstm-crf + Elmo) (conll-2003 named entity recognition NER)
Quartus Prime硬件实验开发(DE2-115板)实验二功能可调综合计时器设计
Choreographer全解析
freeCodeCamp----arithmetic_ Arranger exercise
分库分表 & ShardingSphere
微信小程序获取登录用户信息、openid和access_token
visio安装报错 1:1935 2:{XXXXXXXX...
程序编译调试学习记录
随机推荐
Program compilation and debugging learning record
freeCodeCamp----arithmetic_ Arranger exercise
FDFS start
微信小程序获取登录用户信息、openid和access_token
Quartus Prime硬件实验开发(DE2-115板)实验一CPU指令运算器设计
visio安装报错 1:1935 2:{XXXXXXXX...
JS 力扣刷题 102. 二叉树的层序遍历
Go语言 RPC通讯
Ptorch classical convolutional neural network lenet
JS 烧脑面试题大赏
趣谈网络协议
org.apache.parquet.schema.InvalidSchemaException: A group type can not be empty. Parquet does not su
室内外地图切换(室内基于ibeacons三点定位)
AtomicIntegerArray源码分析与感悟
Decentralized Collaborative Learning Framework for Next POI Recommendation
Crontab timing task output generates a large number of mail and runs out of file system inode problem processing
容差分析相关的计算公式
STM32 learning record 0007 - new project (based on register version)
Mock测试
jacob打印word