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

82 lines
1.6 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.

var daraObj=require("data/data.js")
import {
DBPost
} from 'db/DBpost.js';
App({
/**
* 当小程序初始化完成时,会触发 onLaunch全局只触发一次
*/
onLaunch: function () {
var dbPost = new DBPost();
var loginTime=dbPost.getloginTimeData();//获取上次登陆时间没有记录为0
if(loginTime){
var timestamp = + new Date();
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("无登录记录")
}
},
/**
* 当小程序启动,或从后台进入前台显示,会触发 onShow
*/
onShow: function (options) {
},
/**
* 当小程序从前台进入后台,会触发 onHide
*/
onHide: function () {
},
/**
* 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息
*/
onError: function (msg) {
},
globalData:{
xingming: "",
xuehao: "",
zhuanye: "",
xueyuan: "",
UQ: "",
nicheng:"",
mima:"",
shijian:"",
didian:"",
renyuan1:"",
renyuan2:"",
shijianchuo:"",
banji1:'',
banji2:'',
banji3:'',
banji4:'',
banji5:'',
queqin: [0],
bingjia: [0],
shijia: [0]
}
})