1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <template>
- <view class="">
- <view class="top-img">
- <view class="logo-img">
- <!-- <image src="" mode=""></image> -->
- </view>
- </view>
- <button open-type="getUserInfo" class="authorize" @click="shouquan">授权登陆</button>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- }
- },
- onLoad() {
- },
- methods: {
- shouquan: function(e) {
- wx.getUserInfo({
- success: function(res) {
- console.log("调用成功")
- // var userInfo = res.userInfo
- getApp().globalData.nickName =res.userInfo.nickName
- getApp().globalData.avatarUrl =res.userInfo.avatarUrl
- getApp().globalData.gender = res.userInfo.gender //性别 0:未知、1:男、2:女
- getApp().globalData.province = res.userInfo.province
- getApp().globalData.city = res.userInfo.city
- getApp().globalData.country = res.userInfo.country
- console.log(res, "这是用户信息")
- wx.switchTab({
- url: '../index/index',
- })
- },
- fail: function(err) {
- console.log("授权失败", err)
- }
- })
- }
-
- }
- }
- </script>
- <style>
- .top-img {
- height: 300rpx;
- background-color: #007AFF;
- padding-top: 15%;
- padding-bottom: 15%;
- }
- .logo-img {
- height: 300rpx;
- width: 300rpx;
- background-color: #55ff00;
- border-radius: 50%;
- align-items: center;
- justify-content: center;
- /* margin-top: 300rpx; */
- margin-left: 30%;
- }
- .authorize {
- margin-top: 100rpx;
- margin: 100rpx 20rpx 0 20rpx;
- }
- </style>
|