studyplus/manage/manage.js
Rain Sun 3b4ba85b9d 性能优化
取消无用的setData方法,提升运算性能
2018-10-02 13:24:04 +08:00

175 lines
4.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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