1 Star 0 Fork 42

baitongda/news

forked from 黄秀杰/news 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
app.js 748 Bytes
Copy Edit Raw Blame History
秀杰 authored 2016-09-25 21:21 . first commit
//app.js
App({
onLaunch: function () {
//调用API从本地缓存中获取数据
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
},
getUserInfo:function(cb){
var that = this
if(this.globalData.userInfo){
typeof cb == "function" && cb(this.globalData.userInfo)
}else{
//调用登录接口
wx.login({
success: function () {
wx.getUserInfo({
success: function (res) {
that.globalData.userInfo = res.userInfo
typeof cb == "function" && cb(that.globalData.userInfo)
}
})
}
})
}
},
globalData:{
userInfo:null
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
wechat
1
https://gitee.com/baiotngda/news.git
git@gitee.com:baiotngda/news.git
baiotngda
news
news
master

Search