[更新]
This commit is contained in:
@@ -43,20 +43,24 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 微信授权登录
|
||||||
*/
|
*/
|
||||||
userInfo(e){
|
getuserInfo() {
|
||||||
if(e.detail.errMsg == "getUserInfo:ok"){
|
wx.getUserProfile({
|
||||||
|
desc : "获取你的昵称、头像、地区及性别",
|
||||||
|
success : e => {
|
||||||
|
console.log(e)
|
||||||
|
if(e.errMsg == "getUserProfile:ok"){
|
||||||
this.setData({
|
this.setData({
|
||||||
isLogin : true,
|
isLogin : true,
|
||||||
userInfo : e.detail.rawData,
|
userInfo : e.rawData,
|
||||||
iv : e.detail.iv,
|
iv : e.iv,
|
||||||
encryptedData : e.detail.encryptedData
|
encryptedData : e.encryptedData
|
||||||
})
|
})
|
||||||
|
|
||||||
// 检查用户登录Code是否过期
|
// 检查用户登录Code是否过期
|
||||||
wx.checkSession({
|
wx.checkSession({
|
||||||
success: res=>{
|
success: res=>{
|
||||||
|
console.log(res)
|
||||||
this.userLogin()
|
this.userLogin()
|
||||||
},
|
},
|
||||||
fail: err=>{
|
fail: err=>{
|
||||||
@@ -72,13 +76,15 @@ Page({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
|
||||||
wx.showToast({
|
|
||||||
title: '拒绝了登录授权',
|
|
||||||
icon : 'none'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
fail : res => {
|
||||||
|
//拒绝授权
|
||||||
|
this.showErrorModal('您拒绝了请求');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登录
|
* 用户登录
|
||||||
|
|||||||
@@ -2,4 +2,5 @@
|
|||||||
<view class="loginImg">
|
<view class="loginImg">
|
||||||
<image src="/static/img/login_img.png" mode="widthFix"></image>
|
<image src="/static/img/login_img.png" mode="widthFix"></image>
|
||||||
</view>
|
</view>
|
||||||
<button class="loginBtn" size="mini" hover-class="none" open-type="getUserInfo" bindgetuserinfo="userInfo" lang="zh_CN" disabled="{{isLogin}}">用户授权</button>
|
|
||||||
|
<button class="loginBtn" size="mini" hover-class="none" bindtap="getuserInfo" disabled="{{isLogin}}">用户授权</button>
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"compileHotReLoad": false,
|
"compileHotReLoad": false,
|
||||||
"useMultiFrameRuntime": true,
|
"useMultiFrameRuntime": true,
|
||||||
"useApiHook": true,
|
"useApiHook": true,
|
||||||
"useApiHostProcess": false,
|
"useApiHostProcess": true,
|
||||||
"babelSetting": {
|
"babelSetting": {
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"disablePlugins": [],
|
"disablePlugins": [],
|
||||||
|
|||||||
Reference in New Issue
Block a user