性能优化

取消无用的setData方法,提升运算性能
This commit is contained in:
Rain Sun 2018-10-02 13:24:04 +08:00
parent 1ee3712add
commit 3b4ba85b9d
10 changed files with 603 additions and 677 deletions

24
app.js
View File

@ -12,11 +12,25 @@ App({
*/ */
onLaunch: function () { onLaunch: function () {
var dbPost = new DBPost(); var dbPost = new DBPost();
var chose = dbPost.getxuehaoData(); var loginTime=dbPost.getloginTimeData();//获取上次登陆时间没有记录为0
if (chose) { if(loginTime){
wx.switchTab({ var timestamp = + new Date();
url: 'pages/post/post' timestamp = timestamp / 1000;
}) timestamp = parseInt(timestamp);
var difference=timestamp-loginTime;//两次时间差
if(difference>=86400){
wx.clearStorageSync();
wx.redirectTo({ url: 'welcome/login/login' })
console.log("登录超时")
}else{
wx.switchTab({
url: 'pages/post/post'
})
console.log("校验通过")
}
}else{
wx.redirectTo({ url: 'welcome/login/login' })
console.log("无登录记录")
} }
}, },

View File

@ -8,6 +8,7 @@ var jiaoshi = "";
var renyuan1 = ""; var renyuan1 = "";
var renyuan2 = ""; var renyuan2 = "";
var shijiancuo = ""; var shijiancuo = "";
var loginTime = "";
module.exports = { module.exports = {
@ -21,6 +22,5 @@ module.exports = {
renyuan1: renyuan1, renyuan1: renyuan1,
renyuan2: renyuan2, renyuan2: renyuan2,
shijianchuo: shijiancuo, shijianchuo: shijiancuo,
loginTime: loginTime,
} }

View File

@ -12,6 +12,7 @@ class DBPost {
this.storageKeyName12 = 'renyuan2'; this.storageKeyName12 = 'renyuan2';
this.storageKeyName13 = 'shijianchuo'; this.storageKeyName13 = 'shijianchuo';
this.storageKeyName15 = 'admin'; this.storageKeyName15 = 'admin';
this.storageKeyName16 = 'loginTime';
} }
@ -86,7 +87,13 @@ class DBPost {
} }
return res13; return res13;
} }
getloginTimeData(){
var res16 = wx.getStorageSync(this.storageKeyName16);
if(!res16) {
res16=0
}
return res16;
}
execSetStorageSync1(data) { execSetStorageSync1(data) {
@ -125,7 +132,9 @@ class DBPost {
execSetStorageSync15(data) { execSetStorageSync15(data) {
wx.setStorageSync(this.storageKeyName15, data); wx.setStorageSync(this.storageKeyName15, data);
} }
execSetStorageSync16(data) {
wx.setStorageSync(this.storageKeyName16, data);
}
newdianming(num,newdianming) { newdianming(num,newdianming) {
@ -165,6 +174,9 @@ class DBPost {
newadmin(a) { newadmin(a) {
this.execSetStorageSync15(a); this.execSetStorageSync15(a);
} }
newloginTime(a) {
this.execSetStorageSync16(a);
}
} }

View File

@ -1,6 +1,8 @@
// manage/absent/absent.js // manage/absent/absent.js
var app = getApp(); var app = getApp();
import { DBPost } from '../../db/DBpost.js'; import {
DBPost
} from '../../db/DBpost.js';
Page({ Page({
/** /**
@ -13,76 +15,76 @@ Page({
['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30'] ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30']
], ],
multiIndex: [0, 0, 0], multiIndex: [0, 0, 0],
yuanyinArray: [['事假', '病假', '正常']], yuanyinArray: [
['事假', '病假', '正常']
],
yuanyinIndex: [0], yuanyinIndex: [0],
yuanyin: 0, yuanyin: 0,
newxuehao: 0, newxuehao: 0,
xuehaonum:0, xuehaonum: 0,
yuanyinnum:0, yuanyinnum: 0,
disabled: true,//添加班级 disabled: true, //添加班级
opacity: 0.4 opacity: 0.4
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function() {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function() {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function() {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function() {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function() {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function() {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function() {
}, },
bindMultiPickerChange1: function (e) { bindMultiPickerChange1: function(e) {
this.setData({ this.data.xuehaonum= 1;
xuehaonum:1 if (this.data.xuehaonum && this.data.yuanyinnum) {
})
if (this.data.xuehaonum && this.data.yuanyinnum){
this.setData({ this.setData({
disabled: false disabled: false
}) })
@ -90,28 +92,18 @@ Page({
opacity: 1 opacity: 1
}) })
} }
console.log('picker发送选择改变携带值为', e.detail.value) console.log('picker发送选择改变携带值为', e.detail.value)
this.setData({ this.setData({
multiIndex: e.detail.value multiIndex: e.detail.value
}) })
this.setData({ this.data.xueyuan = this.data.multiArray[0][this.data.multiIndex[0]] //学院号!!!!!
xueyuan: this.data.multiArray[0][this.data.multiIndex[0]] //学院号!!!!! this.data.banji = this.data.multiArray[1][this.data.multiIndex[1]]
}) this.data.geren = this.data.multiArray[2][this.data.multiIndex[2]]
this.setData({
banji: this.data.multiArray[1][this.data.multiIndex[1]]
})
this.setData({
geren: this.data.multiArray[2][this.data.multiIndex[2]]
})
console.log('学院号', this.data.xueyuan); console.log('学院号', this.data.xueyuan);
console.log('班级号', this.data.banji); console.log('班级号', this.data.banji);
console.log('学号', this.data.geren); console.log('学号', this.data.geren);
}, },
bindMultiPickerColumnChange: function (e) { bindMultiPickerColumnChange: function(e) {
console.log('修改的列为', e.detail.column, ',值为', e.detail.value); console.log('修改的列为', e.detail.column, ',值为', e.detail.value);
var data = { var data = {
multiArray: this.data.multiArray, multiArray: this.data.multiArray,
@ -122,11 +114,11 @@ Page({
switch (e.detail.column) { switch (e.detail.column) {
case 0: case 0:
switch (data.multiIndex[0]) { //判断第一列目前的值 switch (data.multiIndex[0]) { //判断第一列目前的值
case 0://1705 case 0: //1705
data.multiArray[1] = ['111', '112', '113', '114', '115', '116', '117', '121', '122', '211', '212', '213', '221', '222']; //1.2 data.multiArray[1] = ['111', '112', '113', '114', '115', '116', '117', '121', '122', '211', '212', '213', '221', '222']; //1.2
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30']; //1.2.1 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30']; //1.2.1
break; break;
case 1://1805 case 1: //1805
data.multiArray[1] = ['112', '113', '114', '115', '116', '117', '121', '122', '123', '211', '212', '213', '214', '221', '222']; //1.2 data.multiArray[1] = ['112', '113', '114', '115', '116', '117', '121', '122', '123', '211', '212', '213', '214', '221', '222']; //1.2
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39']; //1.2.1 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39']; //1.2.1
break; break;
@ -137,7 +129,7 @@ Page({
case 1: case 1:
switch (data.multiIndex[0]) { switch (data.multiIndex[0]) {
case 0: case 0:
switch (data.multiIndex[1]) {//选择班级 switch (data.multiIndex[1]) { //选择班级
case 0: case 0:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38']; data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38'];
break; break;
@ -187,51 +179,51 @@ Page({
break; break;
case 1: case 1:
switch (data.multiIndex[1]) {//选择班级 switch (data.multiIndex[1]) { //选择班级
case 0: case 0:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39']; //1805112 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39']; //1805112
break; break;
case 1: case 1:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40'];//1805113 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40']; //1805113
break; break;
case 2: case 2:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41'];//1805114 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41']; //1805114
break; break;
case 3: case 3:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39'];//1805115 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39']; //1805115
break; break;
case 4: case 4:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39'];//1805116 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39']; //1805116
break; break;
case 5: case 5:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39'];//1805117 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39']; //1805117
break; break;
case 6: case 6:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37'];//1805121 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37']; //1805121
break; break;
case 7: case 7:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37'];//1805122 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37']; //1805122
break; break;
case 8: case 8:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36'];//1805123 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36']; //1805123
break; break;
case 9: case 9:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37'];//1805211 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37']; //1805211
break; break;
case 10: case 10:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37'];//1805212 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37']; //1805212
break; break;
case 11: case 11:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36'];//1805213 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36']; //1805213
break; break;
case 12: case 12:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36'];//1805214 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36']; //1805214
break; break;
case 13: case 13:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38'];//1805221 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38']; //1805221
break; break;
case 14: case 14:
data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37'];//1805222 data.multiArray[2] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37']; //1805222
break; break;
} }
@ -244,10 +236,8 @@ Page({
this.setData(data); this.setData(data);
}, },
bindMultiPickerChange2: function (e) { bindMultiPickerChange2: function(e) {
this.setData({ this.data.yuanyinnum= 1;
yuanyinnum: 1
})
if (this.data.xuehaonum && this.data.yuanyinnum) { if (this.data.xuehaonum && this.data.yuanyinnum) {
this.setData({ this.setData({
disabled: false disabled: false
@ -256,40 +246,35 @@ Page({
opacity: 1 opacity: 1
}) })
} }
console.log('picker发送选择改变携带值为', e.detail.value) console.log('picker发送选择改变携带值为', e.detail.value)
this.setData({ this.setData({
yuanyinIndex: e.detail.value yuanyinIndex: e.detail.value
}) })
this.setData({ this.data.yuanyin= this.data.yuanyinArray[0][this.data.yuanyinIndex[0]] //原因!!!!!
yuanyin: this.data.yuanyinArray[0][this.data.yuanyinIndex[0]] //原因!!!!!
})
console.log('原因', this.data.yuanyin); console.log('原因', this.data.yuanyin);
}, },
sumit1: function () { sumit1: function() {
var a = this.data.xueyuan var a = this.data.xueyuan
var b = this.data.banji var b = this.data.banji
var c = this.data.geren var c = this.data.geren
this.setData({ this.data.newxuehao= (a + b + c)
newxuehao: (a + b + c) console.log("学号为", this.data.newxuehao)
})
console.log("学号为",this.data.newxuehao)
console.log("原因为", this.data.yuanyin) console.log("原因为", this.data.yuanyin)
var dbPost = new DBPost(); var dbPost = new DBPost();
dbPost.newdianming(this.data.newxuehao, this.data.yuanyin); dbPost.newdianming(this.data.newxuehao, this.data.yuanyin);
console.log(this.data.newxuehao, this.data.yuanyin) console.log(this.data.newxuehao, this.data.yuanyin)
wx.showToast({ wx.showToast({
title: '录入成功', title: '录入成功',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
}, },
sumit2:function(){ sumit2: function() {
wx.redirectTo({ url: '../select/select' }) wx.redirectTo({
url: '../select/select'
})
} }
}) })

View File

@ -1,5 +1,7 @@
// welcome/signin/signin.js // welcome/signin/signin.js
import { DBPost } from '../db/DBpost.js'; import {
DBPost
} from '../db/DBpost.js';
var app = getApp(); var app = getApp();
Page({ Page({
@ -7,92 +9,96 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
multiArray: [['第一周', '第二周', '第三周', '第四周', '第五周', '第六周', '第七周', '第八周', '第九周', '第十周', '十一周', '十二周', '十三周', '十四周', '十五周', '十六周', '十七周', '十八周', '十九周'], ['周一', '周二', '周三', '周四', '周五'], ['一二节', '三四节', '五六节', '七八节', '九十节']], multiArray: [
['第一周', '第二周', '第三周', '第四周', '第五周', '第六周', '第七周', '第八周', '第九周', '第十周', '十一周', '十二周', '十三周', '十四周', '十五周', '十六周', '十七周', '十八周', '十九周'],
['周一', '周二', '周三', '周四', '周五'],
['一二节', '三四节', '五六节', '七八节', '九十节']
],
multiIndex: [0, 0, 0], multiIndex: [0, 0, 0],
renyuanArray: [['老师本人', '白正奇', '韩湛瑶', '辛原旭', '赵英博', '刚蔚杰', '高源东', '张震', '李英男', '王宁'], ['', '白正奇', '韩湛瑶', '辛原旭', '赵英博', '刚蔚杰', '高源东', '张震', '李英男', '王宁']], renyuanArray: [
['老师本人', '白正奇', '韩湛瑶', '辛原旭', '赵英博', '刚蔚杰', '高源东', '张震', '李英男', '王宁'],
['', '白正奇', '韩湛瑶', '辛原旭', '赵英博', '刚蔚杰', '高源东', '张震', '李英男', '王宁']
],
renyuanIndex: [0, 0], renyuanIndex: [0, 0],
disabled: true, //是否可用 disabled: true, //是否可用
opacity: 0.4, //不透明度 opacity: 0.4, //不透明度
newzhoushu: 0, //周数 newzhoushu: 0, //周数
newxingqi: 0, //星期 newxingqi: 0, //星期
newjieshu: 0, //节数 newjieshu: 0, //节数
newshijian:0, //时间 newshijian: 0, //时间
newrenyuan1: 0, //查课人员1 newrenyuan1: 0, //查课人员1
newrenyuan2: 0 , //查课人员2 newrenyuan2: 0, //查课人员2
newdidian:0, //地点 newdidian: 0, //地点
newjiaoshi:0, //教师 newjiaoshi: 0, //教师
newshijianchuo:0 //时间戳 newshijianchuo: 0 //时间戳
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function() {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function() {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function() {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function() {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function() {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function() {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function() {
}, },
bindKeyInput1: function (e) { //输入地点 bindKeyInput1: function(e) { //输入地点
var dbPost = new DBPost(); var dbPost = new DBPost();
this.setData({ this.setData({
newdidian: e.detail.value newdidian: e.detail.value
}) })
this.data.newdidian = e.detail.value;
dbPost.newdidian(this.data.newdidian); dbPost.newdidian(this.data.newdidian);
this.setData({
didian: dbPost.getdidianData()
});
console.log('填写地点为', this.data.newdidian); console.log('填写地点为', this.data.newdidian);
if (this.data.newdidian != 0 && this.data.newjiaoshi != 0) { //判断点击态
if (this.data.newdidian !=0 && this.data.newjiaoshi != 0) { //判断点击态 this.setData({
this.setData({
disabled: false, disabled: false,
opacity: 1 opacity: 1
}) })
@ -103,17 +109,13 @@ Page({
}) })
} }
}, },
bindKeyInput2: function (e) { //输入教师
bindKeyInput2: function(e) { //输入教师
var dbPost = new DBPost(); var dbPost = new DBPost();
this.setData({ this.data.newjiaoshi = e.detail.value;
newjiaoshi: e.detail.value
})
dbPost.newjiaoshi(this.data.newjiaoshi); dbPost.newjiaoshi(this.data.newjiaoshi);
this.setData({
jiaoshi: dbPost.getjiaoshiData()
});
console.log('填写教师为', this.data.newjiaoshi); console.log('填写教师为', this.data.newjiaoshi);
if (this.data.newdidian != 0 && this.data.newjiaoshi != 0) { //判断点击态 if (this.data.newdidian != 0 && this.data.newjiaoshi != 0) { //判断点击态
this.setData({ this.setData({
disabled: false, disabled: false,
opacity: 1 opacity: 1
@ -126,13 +128,7 @@ Page({
} }
}, },
bindMultiPickerChange1: function(e) {
bindMultiPickerChange1: function (e) {
console.log('picker1发送选择改变携带值为', e.detail.value) console.log('picker1发送选择改变携带值为', e.detail.value)
this.setData({ this.setData({
multiIndex: e.detail.value multiIndex: e.detail.value
@ -149,59 +145,31 @@ Page({
console.log('周数:', this.data.newzhoushu); console.log('周数:', this.data.newzhoushu);
console.log('星期:', this.data.newxingqi); console.log('星期:', this.data.newxingqi);
console.log('节数:', this.data.newjieshu); console.log('节数:', this.data.newjieshu);
this.setData({ this.data.newshijian = this.data.newzhoushu + "_" + this.data.newxingqi + "_" + this.data.newjieshu
newshijian: this.data.newzhoushu + "_" + this.data.newxingqi + "_" +this.data.newjieshu
})
var dbPost = new DBPost(); var dbPost = new DBPost();
dbPost.newshijian(this.data.newshijian); dbPost.newshijian(this.data.newshijian);
this.setData({
shijian: dbPost.getshijianData()
});
console.log('填写时间为', this.data.newshijian); console.log('填写时间为', this.data.newshijian);
}, },
bindMultiPickerChange2: function(e) {
bindMultiPickerChange2: function (e) {
console.log('picker2发送选择改变携带值为', e.detail.value) console.log('picker2发送选择改变携带值为', e.detail.value)
this.setData({ this.setData({
renyuanIndex: e.detail.value renyuanIndex: e.detail.value
}) })
this.setData({ this.data.newrenyuan1 = this.data.renyuanArray[0][this.data.renyuanIndex[0]]
newrenyuan1: this.data.renyuanArray[0][this.data.renyuanIndex[0]] this.data.newrenyuan2 = this.data.renyuanArray[1][this.data.renyuanIndex[1]]
})
this.setData({
newrenyuan2: this.data.renyuanArray[1][this.data.renyuanIndex[1]]
})
var dbPost = new DBPost(); var dbPost = new DBPost();
dbPost.newrenyuan1(this.data.newrenyuan1); dbPost.newrenyuan1(this.data.newrenyuan1);
this.setData({
renyuan1: dbPost.getrenyuan1Data()
});
dbPost.newrenyuan2(this.data.newrenyuan2); dbPost.newrenyuan2(this.data.newrenyuan2);
this.setData({
renyuan2: dbPost.getrenyuan2Data()
});
console.log('填写人员1为', this.data.newrenyuan1); console.log('填写人员1为', this.data.newrenyuan1);
console.log('填写人员2为', this.data.newrenyuan2); console.log('填写人员2为', this.data.newrenyuan2);
}, },
//提交按钮确认 //提交按钮确认
sumit: function () { sumit: function() {
wx.redirectTo({ url: 'rollcall/rollcall' }) wx.redirectTo({
url: 'rollcall/rollcall'
})
}, },
}) })

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@ Page({
zhuanye: dbPost.getzhuanyeData(), zhuanye: dbPost.getzhuanyeData(),
xueyuan: dbPost.getxueyuanData(), xueyuan: dbPost.getxueyuanData(),
admin: dbPost.getadminData(), admin: dbPost.getadminData(),
loginTime:dbPost.getloginTimeData(),
}); });
this.setData({ this.setData({
jiaoshi: dbPost.getjiaoshiData() jiaoshi: dbPost.getjiaoshiData()
@ -155,6 +156,7 @@ Page({
dbPost.newzhuanye(that.data.zhuanye); dbPost.newzhuanye(that.data.zhuanye);
dbPost.newxueyuan(that.data.xueyuan); dbPost.newxueyuan(that.data.xueyuan);
dbPost.newadmin(that.data.admin); dbPost.newadmin(that.data.admin);
dbPost.newloginTime(that.data.loginTime);
wx.switchTab({ url: '../../pages/post/post' }); wx.switchTab({ url: '../../pages/post/post' });
console.log(res.data); console.log(res.data);

View File

@ -99,16 +99,10 @@ Page({
console.log(this.data.type) console.log(this.data.type)
}, },
fankui(e) { //反馈内容输入 fankui(e) { //反馈内容输入
this.setData({ this.data.feedBack = e.detail.value
feedBack: e.detail.value
})
console.log(this.data.feedBack)
}, },
qqNum(e) { //qq号码输入 qqNum(e) { //qq号码输入
console.log(e.detail.value) this.data.qqNum = e.detail.value
this.setData({
qqNum: e.detail.value
})
}, },
submit() { submit() {
var qqNUm_ok = 0; var qqNUm_ok = 0;
@ -141,14 +135,14 @@ Page({
feedBack_error: true feedBack_error: true
}) })
} }
console.log("类型为", this.data.type) // console.log("类型为", this.data.type)
console.log("反馈内容为", this.data.feedBack) // console.log("反馈内容为", this.data.feedBack)
console.log("qq号码为", this.data.qqNum) // console.log("qq号码为", this.data.qqNum)
console.log("反馈", feedBack_ok) // console.log("反馈", feedBack_ok)
console.log("qq", qqNUm_ok) // console.log("qq", qqNUm_ok)
wx.showLoading(); wx.showLoading();
wx.hideLoading(); wx.hideLoading();
if(qqNUm_ok&&feedBack_ok){ if (qqNUm_ok && feedBack_ok) {
wx.switchTab({ wx.switchTab({
url: '../user/user' url: '../user/user'
}) })

View File

@ -17,18 +17,8 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function(options) { onLoad: function(options) {
wx.checkIsSupportSoterAuthentication({
success(res) {
console.log(res.supportMode);
// res.supportMode = [] 不具备任何被SOTER支持的生物识别方式
// res.supportMode = ['fingerPrint'] 只支持指纹识别
// res.supportMode = ['fingerPrint', 'facial'] 支持指纹识别和人脸识别
}
})
var dbPost = new DBPost(); var dbPost = new DBPost();
this.setData({ this.data.admin= dbPost.getadminData(),
admin: dbPost.getadminData(),
});
wx.setScreenBrightness({ wx.setScreenBrightness({
value: 0.5 value: 0.5
}) })
@ -83,20 +73,17 @@ Page({
}, },
sumit: function() { sumit: function() {
var timestamp = + new Date();
timestamp = timestamp / 1000;
timestamp =parseInt(timestamp);
console.log("当前时间戳为:" + timestamp);
this.data.newshijianchuo= timestamp;
var dbPost = new DBPost();
dbPost.newshijianchuo(this.data.newshijianchuo);
wx.navigateTo({ wx.navigateTo({
url: 'QRcode/QRcode' url: 'QRcode/QRcode'
}) })
var timestamp = Date.parse(new Date());
timestamp = timestamp / 1000;
console.log("当前时间戳为:" + timestamp);
this.setData({
newshijianchuo: timestamp + 0
})
var dbPost = new DBPost();
dbPost.newshijianchuo(this.data.newshijianchuo);
this.setData({
shijianchuo: dbPost.getshijianchuoData()
});
}, },
guanli: function() { guanli: function() {

View File

@ -96,6 +96,10 @@ Page({
dbPost.newadmin(result.data.admin); dbPost.newadmin(result.data.admin);
that.data.xuehao = result.data.xueHao; that.data.xuehao = result.data.xueHao;
console.log(that.data.xuehao); console.log(that.data.xuehao);
var timestamp = + new Date();
timestamp = timestamp / 1000;
timestamp = parseInt(timestamp);
dbPost.newloginTime(timestamp);
} }
if (!that.data.xuehao) { if (!that.data.xuehao) {
wx.hideLoading() wx.hideLoading()