| @@ -11,12 +11,6 @@ Page({ | |||||
| canIUseGetUserProfile: false, | canIUseGetUserProfile: false, | ||||
| canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false | canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false | ||||
| }, | }, | ||||
| // 事件处理函数 | |||||
| bindViewTap() { | |||||
| wx.navigateTo({ | |||||
| url: '../logs/logs' | |||||
| }) | |||||
| }, | |||||
| onLoad() { | onLoad() { | ||||
| if (wx.getUserProfile) { | if (wx.getUserProfile) { | ||||
| this.setData({ | this.setData({ | ||||
| @@ -2,7 +2,7 @@ | |||||
| <view class="container"> | <view class="container"> | ||||
| <view class="userinfo"> | <view class="userinfo"> | ||||
| <block wx:if="{{canIUseOpenData}}"> | <block wx:if="{{canIUseOpenData}}"> | ||||
| <view class="userinfo-avatar" bindtap="bindViewTap"> | |||||
| <view class="userinfo-avatar"> | |||||
| <open-data type="userAvatarUrl"></open-data> | <open-data type="userAvatarUrl"></open-data> | ||||
| </view> | </view> | ||||
| <open-data type="userNickName"></open-data> | <open-data type="userNickName"></open-data> | ||||
| @@ -13,7 +13,7 @@ | |||||
| <view wx:else> 请使用1.4.4及以上版本基础库 </view> | <view wx:else> 请使用1.4.4及以上版本基础库 </view> | ||||
| </block> | </block> | ||||
| <block wx:else> | <block wx:else> | ||||
| <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image> | |||||
| <image class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image> | |||||
| <text class="userinfo-nickname">{{userInfo.nickName}}</text> | <text class="userinfo-nickname">{{userInfo.nickName}}</text> | ||||
| </block> | </block> | ||||
| </view> | </view> | ||||
| @@ -7,5 +7,29 @@ Page({ | |||||
| ischecked: true | ischecked: true | ||||
| }, | }, | ||||
| onLoad() { | onLoad() { | ||||
| }, | |||||
| backGame(){ | |||||
| wx.navigateTo({ | |||||
| url: '' | |||||
| }) | |||||
| }, | |||||
| login(){ | |||||
| wx.login({ | |||||
| success (res) { | |||||
| console.log(res) | |||||
| if (res.code) { | |||||
| //发起网络请求 | |||||
| // wx.request({ | |||||
| // url: 'https://example.com/onLogin', | |||||
| // data: { | |||||
| // code: res.code | |||||
| // } | |||||
| // }) | |||||
| } else { | |||||
| console.log('登录失败!' + res.errMsg) | |||||
| } | |||||
| } | |||||
| }) | |||||
| } | } | ||||
| }) | }) | ||||
| @@ -11,7 +11,7 @@ | |||||
| <view class="text">勾选表示您已阅读并同意</view> | <view class="text">勾选表示您已阅读并同意</view> | ||||
| <view class="text text1">《隐私协议》</view> | <view class="text text1">《隐私协议》</view> | ||||
| </view> | </view> | ||||
| <view class="btn" >微信一键登录</view> | |||||
| <view class="btn btn1">返回游戏</view> | |||||
| <view class="btn" bindtap="login">微信一键登录</view> | |||||
| <view class="btn btn1" bindtap="backGame">返回游戏</view> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -14,6 +14,7 @@ const formatNumber = n => { | |||||
| return n[1] ? n : `0${n}` | return n[1] ? n : `0${n}` | ||||
| } | } | ||||
| module.exports = { | module.exports = { | ||||
| formatTime | formatTime | ||||
| } | } | ||||