|
@@ -1,17 +1,25 @@
|
|
//app.js
|
|
//app.js
|
|
App({
|
|
App({
|
|
onLaunch: function () {
|
|
onLaunch: function () {
|
|
|
|
+
|
|
|
|
+ var userinfo = wx.getStorageSync('sg-userinfo')
|
|
|
|
+ if(!userinfo) {
|
|
|
|
+ wx.redirectTo({
|
|
|
|
+ url: '/pages/login/index',
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
// 展示本地存储能力
|
|
// 展示本地存储能力
|
|
- var logs = wx.getStorageSync('logs') || []
|
|
|
|
- logs.unshift(Date.now())
|
|
|
|
- wx.setStorageSync('logs', logs)
|
|
|
|
|
|
+ // var logs = wx.getStorageSync('logs') || []
|
|
|
|
+ // logs.unshift(Date.now())
|
|
|
|
+ // wx.setStorageSync('logs', logs)
|
|
|
|
|
|
// 登录
|
|
// 登录
|
|
- wx.login({
|
|
|
|
- success: res => {
|
|
|
|
|
|
+ // wx.login({
|
|
|
|
+ // success: res => {
|
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
// 获取用户信息
|
|
// 获取用户信息
|
|
wx.getSetting({
|
|
wx.getSetting({
|
|
success: res => {
|
|
success: res => {
|