|
@@ -19,32 +19,28 @@ App({
|
|
|
// }
|
|
|
const self = this
|
|
|
// 登录
|
|
|
- const auth = await wxp.getSetting()
|
|
|
- if (!auth.authSetting['scope.userInfo']){
|
|
|
- console.log('您还没有授权');
|
|
|
- requestApi.HEAD.token = ''
|
|
|
- wx.setStorageSync('token', '')
|
|
|
- return
|
|
|
- }
|
|
|
+ this.isAuth();
|
|
|
+ // const auth = await wxp.getSetting()
|
|
|
+ // if (!auth.authSetting['scope.userInfo']){
|
|
|
+ // console.log('您还没有授权');
|
|
|
+ // requestApi.HEAD.token = ''
|
|
|
+ // wx.setStorageSync('token', '')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
|
|
|
- const info = await wxp.getUserInfo()
|
|
|
- this.globalData.userInfo = info.userInfo
|
|
|
- if (this.userInfoReadyCallback) {
|
|
|
- this.userInfoReadyCallback(res)
|
|
|
+ // const info = await wxp.getUserInfo()
|
|
|
+ // console.log(info)
|
|
|
+ // this.globalData.userInfo = info.userInfo
|
|
|
+ // if (this.userInfoReadyCallback) {
|
|
|
+ // this.userInfoReadyCallback(res)
|
|
|
+ // }
|
|
|
+ if(this.globalData.userInfo){
|
|
|
+ await self.wxLogin(this.globalData.userInfo);
|
|
|
}
|
|
|
- await self.wxLogin(info.userInfo);
|
|
|
+
|
|
|
},
|
|
|
globalData: {
|
|
|
userInfo: null,
|
|
|
- noShow: false,
|
|
|
-
|
|
|
- // base_url: "https://api.overseasdragon.com.cn",
|
|
|
- // base_img_url: "https://smdd.overseasdragon.com.cn",
|
|
|
- // base_img_url:"https://smdd.overseasdragon.com.cn",
|
|
|
- // base_url: "https://member.overseasdragon.com.cn",
|
|
|
- // bloc_code: "BAIXIONG",
|
|
|
- // header: { 'content-type': 'application/json' },
|
|
|
-
|
|
|
},
|
|
|
wxLogin:async function(data){
|
|
|
console.log(data)
|
|
@@ -101,7 +97,6 @@ App({
|
|
|
}
|
|
|
},
|
|
|
isAuth: async function(){
|
|
|
- let userInfo = wx.getStorageSync({key: 'userInfo'})
|
|
|
console.log(this.globalData.userInfo);
|
|
|
if (!this.globalData.userInfo){
|
|
|
console.log('您还没有授权');
|