1 Star 0 Fork 0

ck/WXStockApp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
Quinn_929 提交于 2017-01-23 14:45 . first commit
/**
* Created by cj on 2016/1/9.
* 程序全局共享的逻辑和数据
*/
import Promise from "resources/lib/promise.min"
//全局工具类
const CONST = require("common/const.js").const;
const loginHelper = require("common/login.js").loginHelper;
var stockData = require("./modules/market/kline/stockData.js");
App({
globalData:{
userInfo:null,
systemInfo:null,
netWorkType: "",
WIFI_REFRESH_INTERVAL: 5 * 1000,//wifi网络时刷新间隔 秒
MOBILE_REFRESH_INTERVAL: 30 * 1000,//手机网络时刷新间隔 秒
screenWidth: 0
},
/**
* app 启动时执行一次
*/
onLaunch:function () {
let that = this;
let expires = wx.getStorageSync(CONST.sessionExpiresKey) || 0;
//session 过期,登录
if (parseInt(expires) < Date.now()) {
loginHelper.login().then(userInfo => {
that.globalData.userInfo = userInfo;
});
}
this.getSystemInfo()
this.getSysNetWork()
stockData.getAllStocks()
},
//获取系统信息
getSystemInfo:function () {
!this.globalData.systemInfo &&
wx.getSystemInfo({
success:res => {
this.globalData.systemInfo = res
this.globalData.screenWidth = res.windowWidth
}
});
},
getSysNetWork:function () {
wx.getNetworkType({
success:res => {
this.globalData.netWorkType = res.networkType
}
})
},
getUserInfo:function () {
let userInfo = this.globalData.userInfo || wx.getStorageSync(CONST.UserInfoKey);
return userInfo;
}
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/glacierck/WXStockApp.git
git@gitee.com:glacierck/WXStockApp.git
glacierck
WXStockApp
WXStockApp
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385