|
|
|
// app.js
|
|
|
|
App({
|
|
|
|
onLaunch() {
|
|
|
|
// 展示本地存储能力
|
|
|
|
const logs = wx.getStorageSync('logs') || []
|
|
|
|
wx.setStorageSync('logs', logs)
|
|
|
|
|
|
|
|
// 登录
|
|
|
|
wx.login({
|
|
|
|
success: res => {
|
|
|
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
globalData: {
|
|
|
|
// 本地环境
|
|
|
|
baseUrl: 'http://192.168.51.4:8201/mall-portal',
|
|
|
|
// 线上环境
|
|
|
|
// baseUrl:'https://portal-api.macrozheng.com',
|
|
|
|
token: '',
|
|
|
|
userInfo: {},
|
|
|
|
bindvx: false,
|
|
|
|
openid: ''
|
|
|
|
},
|
|
|
|
|
|
|
|
//如果未登录提示跳转到等级界面
|
|
|
|
judLogin() {
|
|
|
|
wx.showModal({
|
|
|
|
title: '提示',
|
|
|
|
content: '您还未登录,请先登录',
|
|
|
|
confirmText: '去登陆',
|
|
|
|
complete: (res) => {
|
|
|
|
if (res.confirm) {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '../login/login',
|
|
|
|
})
|
|
|
|
};
|
|
|
|
if (res.cancel) {
|
|
|
|
// console.log('用户点击取消');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
})
|