KindergartenAppletUI/pages/login/login.vue
2022-08-24 15:01:04 +08:00

109 lines
1.7 KiB
Vue

<!-- <template>
<view class="login">
<view class="login1">
<img src="/static/login.png" alt="" sizes="" srcset="">
</view>
<view class="btn">
<button @tap='wxGetUserInfo'>登录</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
onShow() {},
onLoad(options) {
console.log(options)
},
methods: {
login() {
wx.login({
provider: 'weixin',
success: function(loginRes) {
console.log(loginRes)
}
});
},
wxGetUserInfo() {
let that = this;
uni.getUserProfile({
desc: "获取用户信息",
lang: "zh_CN",
success(res) {
console.log(res)
that.login();
uni.navigateTo({
url:`/pages/index/index?userinfo=`+JSON.stringify(res.userInfo)
})
// that.yonghuwx = res.userInfo
// that.getPreOrderById()
},
fail(res) {
//失败则返回home页面
},
});
},
}
}
</script>
<style>
/* .login{
width: 650rpx;
height: 650rpx;
background-color: red;
} */
.login1 {
width: 270rpx;
height: 270rpx;
margin: 0 auto;
/* background-color: orange; */
/* display: flex;
align-items: center;
justify-content: center; */
}
.login {
width: 350rpx;
height: 400rpx;
/* background-color: red; */
margin: 0 auto;
margin-top: 34%;
/* display: flex;
align-items: center;
justify-content: center; */
/* display: flex;
align-items: center;
justify-content: center; */
/* margin-top: 30%;
margin-left: 20%; */
}
img {
width: 270rpx;
height: 270rpx;
}
.btn {
/* float: left; */
width: 200rpx;
height: 200rpx;
margin: 0 auto;
margin-top: 50rpx;
}
button {
color: #4486e8;
}
</style>
-->