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

109 lines
2.0 KiB
JavaScript

import {
DBPost
} from '../../db/DBpost.js';
Page({
/**
* 页面的初始数据
*/
data: {
newdianming: 0,
num: 0,
disabled: true,
admin: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
var dbPost = new DBPost();
this.data.admin= dbPost.getadminData(),
wx.setScreenBrightness({
value: 0.5
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: 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({
url: 'QRcode/QRcode'
})
},
guanli: function() {
if (this.data.admin != 0) {
wx.vibrateShort()
wx.showModal({
title: '确认',
content: '是否开始点名',
confirmColor: '#10aeff',
success: function (res) {
if (res.confirm) {
wx.redirectTo({
url: '../../manage/manage'
})
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
}
})