Browse Source

second修改

master
corala 2 years ago
parent
commit
3487ffbcdd
5 changed files with 29 additions and 10 deletions
  1. +0
    -6
      pages/index/index.js
  2. +2
    -2
      pages/index/index.wxml
  3. +24
    -0
      pages/login/index.js
  4. +2
    -2
      pages/login/index.wxml
  5. +1
    -0
      utils/util.js

+ 0
- 6
pages/index/index.js View File

@@ -11,12 +11,6 @@ Page({
canIUseGetUserProfile: false,
canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false
},
// 事件处理函数
bindViewTap() {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad() {
if (wx.getUserProfile) {
this.setData({


+ 2
- 2
pages/index/index.wxml View File

@@ -2,7 +2,7 @@
<view class="container">
<view class="userinfo">
<block wx:if="{{canIUseOpenData}}">
<view class="userinfo-avatar" bindtap="bindViewTap">
<view class="userinfo-avatar">
<open-data type="userAvatarUrl"></open-data>
</view>
<open-data type="userNickName"></open-data>
@@ -13,7 +13,7 @@
<view wx:else> 请使用1.4.4及以上版本基础库 </view>
</block>
<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>
</block>
</view>


+ 24
- 0
pages/login/index.js View File

@@ -7,5 +7,29 @@ Page({
ischecked: true
},
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)
}
}
})
}
})

+ 2
- 2
pages/login/index.wxml View File

@@ -11,7 +11,7 @@
<view class="text">勾选表示您已阅读并同意</view>
<view class="text text1">《隐私协议》</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>

+ 1
- 0
utils/util.js View File

@@ -14,6 +14,7 @@ const formatNumber = n => {
return n[1] ? n : `0${n}`
}


module.exports = {
formatTime
}

Loading…
Cancel
Save