110 lines
1.9 KiB
JavaScript
110 lines
1.9 KiB
JavaScript
// manage/rollcall/rollcall.js
|
|
import {
|
|
DBPost
|
|
} from '../../db/DBpost.js';
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function(options) {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function() {
|
|
|
|
},
|
|
scanQRCode: function() {
|
|
var that = this;
|
|
wx.scanCode({
|
|
success: function(res) {
|
|
var dbPost = new DBPost();
|
|
var res1 = res.result;
|
|
console.log(res.result);
|
|
if (res1.length == 19) {
|
|
that.setData({
|
|
num: res.result.substring(0, 9)
|
|
})
|
|
that.setData({
|
|
newdianming: '正常'
|
|
})
|
|
dbPost.newdianming(that.data.num, that.data.newdianming);
|
|
console.log(that.data.newdianming, that.data.num)
|
|
wx.showToast({
|
|
title: "点名成功",
|
|
duration: 100,
|
|
mask: true,
|
|
icon: "success"
|
|
})
|
|
} else if (res1.length != 19) {
|
|
wx.showModal({
|
|
title: "警告",
|
|
content: "您扫描了错误的二维码!请检查!",
|
|
showCancel: false,
|
|
confirmText: "继续"
|
|
})
|
|
}
|
|
},
|
|
fail: function(e) {
|
|
console.log(e);
|
|
}
|
|
})
|
|
},
|
|
sumit: function() {
|
|
wx.redirectTo({
|
|
url: '../absent/absent'
|
|
})
|
|
}
|
|
}) |