|
|
|
@@ -8,7 +8,7 @@ App({ |
|
|
|
useOpenid: true, |
|
|
|
// 使用openid进行统计时,是否授权友盟自动获取Openid, |
|
|
|
// 如若需要,请到友盟后台"设置管理-应用信息"(https://mp.umeng.com/setting/appset)中设置appId及secret |
|
|
|
autoGetOpenid: false, |
|
|
|
autoGetOpenid: true, |
|
|
|
debug: true, //是否打开调试模式 |
|
|
|
uploadUserInfo: true // 自动上传用户信息,设为false取消上传,默认为false |
|
|
|
}, |
|
|
|
@@ -19,44 +19,10 @@ App({ |
|
|
|
wx.setStorageSync('logs', logs) |
|
|
|
}, |
|
|
|
globalData: { |
|
|
|
// httpurl: 'https://cktest.2weisou.com/meta/', // 生产 |
|
|
|
httpurl: 'http://192.168.1.117:9998/',// 柏伟 |
|
|
|
httpurl: 'https://cktest.2weisou.com/meta/', // 生产 |
|
|
|
// httpurl: 'http://192.168.1.117:9998/',// 柏伟 |
|
|
|
userInfo: null, |
|
|
|
token: '', |
|
|
|
gameurl: ''// 游戏链接 |
|
|
|
}, |
|
|
|
//登录-获取token |
|
|
|
loginGettoken(){ |
|
|
|
let that = this |
|
|
|
wx.setStorageSync('token', '') |
|
|
|
wx.setStorageSync('userInfo', '') |
|
|
|
wx.login({ |
|
|
|
success (res) { |
|
|
|
if (res.code) { |
|
|
|
//发起网络请求 |
|
|
|
wx.request({ |
|
|
|
url:that.globalData.httpurl+ 'auth/mobile/token/social?grant_type=mobil&mobile=MINI_C@'+res.code+'@'+'', |
|
|
|
method: "POST", |
|
|
|
data: { |
|
|
|
}, |
|
|
|
header: { |
|
|
|
Authorization: "Basic YXBwbGV0OmFwcGxldA==", |
|
|
|
}, |
|
|
|
success(res1) { |
|
|
|
if (res1.statusCode == 200) { |
|
|
|
that.globalData.token = res1.data.access_token |
|
|
|
that.globalData.userInfo = res1.data.user_info |
|
|
|
// console.log(that.globalData.token) |
|
|
|
// console.log(that.globalData.userInfo) |
|
|
|
wx.setStorageSync('token', res1.data.access_token) |
|
|
|
wx.setStorageSync('userInfo', res1.data.user_info) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
console.log('登录失败!' + res.errMsg) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
}) |