公司小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
2.3 KiB

<!--微信授权登录界面-->
<template>
<view>
<!-- #ifdef MP-WEIXIN -->
<view v-if="isCanUse" class="back">
<u-navbar
title="微信授权登录"
:safeAreaInsetTop="true"
:fixed="true"
bgColor="#FFFFFF00"
:placeholder="true"
3 years ago
@leftClick="onBackTouched"
/>
<view class="body">
<view class='header'>
<image src='../../static/images/wx_icon.png'></image>
</view>
<u-gap height="50rpx" />
<view class='content'>
<view>申请获取以下权限</view>
<text>获得你的公开信息(昵称头像地区等)</text>
</view>
3 years ago
<button class='bottom' type='primary' open-type="getUserInfo" withCredentials="true" lang="zh_CN" @click="doGetUserInfo">
授权登录
</button>
</view>
</view>
<!-- #endif -->
</view>
</template>
<script>
export default {
data() {
return {
SessionKey: '',
OpenId: '',
nickName: null,
avatarUrl: null,
isCanUse: uni.getStorageSync('isCanUse')||true//默认为true
};
},
methods: {
3 years ago
async doGetUserInfo(){
var Player = getApp().globalData.Player;
Player.clear();
uni.clearStorageSync();
3 years ago
var success = await this.$utils.wechatLogin();
if(success){
//如果登录成功了,这个时候就要返回了
this.onBackTouched(success);
}
3 years ago
},
///点击了返回按钮以后
onBackTouched(isSuccess = false){
uni.navigateBack();
3 years ago
},
onLoad() {//默认加载
//this.login();
}
},
}
</script>
<style scoped>
.body{
width: 100%;
//background-color: #0081FF;
position: relative;
}
.header {
border-bottom: 1px solid #ccc;
text-align: center;
width: 750rpx;
height: 300rpx;
line-height: 450rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.header image {
width: 200rpx;
height: 200rpx;
}
.content {
margin-left: 50rpx;
margin-bottom: 90rpx;
}
.content text {
display: block;
color: #9d9d9d;
margin-top: 40rpx;
}
.bottom {
border-radius: 80rpx;
margin: 70rpx 50rpx;
font-size: 35rpx;
}
</style>