You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
933 B
45 lines
933 B
// app.js
|
|
App({
|
|
onLaunch() {
|
|
// 展示本地存储能力
|
|
const logs = wx.getStorageSync('logs') || []
|
|
logs.unshift(Date.now())
|
|
wx.setStorageSync('logs', logs)
|
|
|
|
// 登录
|
|
wx.login({
|
|
success: res => {
|
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
|
}
|
|
})
|
|
},
|
|
|
|
globalData: {
|
|
// 本地环境
|
|
baseUrl:'http://192.168.51.22:8201/mall-portal',
|
|
// 线上环境
|
|
// baseUrl:'https://portal-api.macrozheng.com',
|
|
token: '',
|
|
userInfo:{},
|
|
bindvx:null
|
|
},
|
|
|
|
judLogin(){
|
|
wx.showModal({
|
|
title: '提示',
|
|
content: '尊敬的用户您还未登录,请先登录',
|
|
confirmText:'去登陆',
|
|
complete: (res) => {
|
|
if (res.confirm) {
|
|
wx.navigateTo({
|
|
url: '../login/login',
|
|
})
|
|
};
|
|
if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
})
|
|
|