@@ -10,7 +10,7 @@ App({ | |||
wx.login({ | |||
success: res => { | |||
// 发送 res.code 到后台换取 openId, sessionKey, unionId | |||
console.log(res) | |||
// console.log(res) | |||
wx.request({ | |||
url: '', | |||
data: { | |||
@@ -22,7 +22,7 @@ App({ | |||
// 获取用户信息 | |||
wx.getSetting({ | |||
success: res => { | |||
console.log(res) | |||
// console.log(res) | |||
if (res.authSetting['scope.userInfo']) { | |||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | |||
wx.getUserInfo({ |
@@ -7,6 +7,8 @@ Page({ | |||
data: { | |||
myTicketArrows: false, | |||
historyTicketArrows: false, | |||
getUser:false, | |||
getUserArr:[], | |||
mydeg: -90, | |||
historydeg: -90, | |||
historyArr: [ | |||
@@ -154,5 +156,17 @@ Page({ | |||
wx.navigateTo({ | |||
url: '../givePage/givePage', | |||
}) | |||
}, | |||
getUser:function(e){ | |||
console.log(e) | |||
this.setData({ | |||
getUserArr: e.detail.userInfo | |||
}) | |||
if (this.data.getUserArr){ | |||
this.setData({ | |||
getUser: true | |||
}) | |||
} | |||
console.log(this.data.getUserArr) | |||
} | |||
}) |
@@ -5,10 +5,11 @@ | |||
<image class="userCircle" src="../images/userCircle.png"></image> | |||
<view class="userAll"> | |||
<view class="userHeader"> | |||
<image src="../images/centerBg.png"></image> | |||
<image class="userImg" src="{{getUserArr.avatarUrl}}"></image> | |||
</view> | |||
<view class="userName">老门框用户</view> | |||
<view class="userPhone">12345678910</view> | |||
<button wx:if="{{!getUser}}" plain="true" size="mini" class="getUser" open-type="getUserInfo" bindgetuserinfo="getUser">登陆</button> | |||
<view class="userName">{{getUserArr.nickName}}</view> | |||
<view wx:if="{{getUser}}" class="userPhone">12345678910</view> | |||
</view> | |||
<view class="myTicketAll"> |
@@ -22,6 +22,10 @@ | |||
overflow: hidden; | |||
border-radius: 50%; | |||
} | |||
.userImg{ | |||
width: 200rpx; | |||
height: 200rpx; | |||
} | |||
.userAll{ | |||
text-align: center; | |||
position:absolute; | |||
@@ -38,7 +42,7 @@ | |||
font-size:40rpx; | |||
color:rgba(51,51,51,1); | |||
font-weight:bold; | |||
margin-top: 31rpx; | |||
/* margin-top: 31rpx; */ | |||
margin-bottom: 16rpx; | |||
} | |||
.userPhone{ | |||
@@ -48,6 +52,7 @@ | |||
.myTicketAll{ | |||
padding: 0 64rpx; | |||
/* margin-top: 80rpx; */ | |||
} | |||
.myTicketTop{ | |||
display: flex; | |||
@@ -164,4 +169,8 @@ | |||
font-family:SourceHanSansCN; | |||
font-weight:bold; | |||
color:rgba(235,97,0,1); | |||
} | |||
.getUser{ | |||
} |