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.

131 lines
2.7 KiB

1 year ago
<template>
<view class="bg">
<view class="logo flex-center">LOGO</view>
<view :class="['btn', 'flex-center', {'btns': flag}]" @click="getUserInfo()">快捷登录</view>
<image src="https://static.ticket.sz-trip.com/yandu/images/user/tips.png" class="tips" v-show="!flag"></image>
<footer class="flex-between">
<view @click="flag = !flag" :style="{border: flag ? 'none' : ''}"><image src="https://static.ticket.sz-trip.com/yandu/images/user/dui.png" v-show="flag"></image></view>
我已阅读并同意 <span @click="gotoPath('/subPackages/user/privacy')">用户服务协议隐私政策</span>
</footer>
</view>
</template>
<script>
export default {
data() {
return {
flag: false
}
},
methods: {
getUserInfo() {
if(!this.flag) return;
var _this = this
uni.login({
provider: 'weixin',
success(loginRes) {
uni.getUserInfo({
withCredentials: true,
success(res) {
_this.Post({
code: loginRes.code,
userInfo: res.userInfo,
encryptedData: res.encryptedData,
iv: res.iv,
wechat_qrcode: uni.getStorageSync('wechat_qrcode')?uni.getStorageSync('wechat_qrcode'):''
}, '/api/mini_program/login').then(resTwo => {
_this.$store.commit('changeUserInfo', resTwo.data.userinfo)
if (_this.$store.state.user.toPath.includes('user/user')) {
uni.switchTab({
url: _this.$store.state.user.toPath
})
} else {
uni.navigateBack({})
}
})
}
})
},
fail(err) {
console.log(err);
},
})
}
}
}
</script>
<style lang="scss" scoped>
.bg {
height: 100vh;
}
.logo {
width: 156rpx;
height: 156rpx;
background: #87CD93;
border-radius: 50%;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
position: absolute;
top: 66.67rpx;
left: 50%;
transform: translate(-50%, 0);
}
.btn {
width: 667rpx;
height: 93rpx;
background: #CCCCCC;
border-radius: 20rpx;
font-weight: 500;
font-size: 35rpx;
color: #FFFFFF;
position: absolute;
top: 301rpx;
left: 50%;
transform: translate(-50%,0)
}
.btns {
background: #71B580;
}
.tips {
position: absolute;
left: 54rpx;
bottom: 155rpx;
width: 293.33rpx;
height: 72.67rpx;
}
footer {
padding: 0 68rpx;
position: absolute;
bottom: 94rpx;
font-weight: 500;
font-size: 25rpx;
color: #333333;
width: 100%;
view {
width: 48rpx;
height: 48rpx;
border-radius: 50%;
overflow: hidden;
border: 1rpx solid #666666;
image {
width: 100%;
height: 100%;
}
}
span {
color: rgba(113, 181, 128, 1);
}
}
</style>