一键登录

This commit is contained in:
唐明明
2021-10-20 10:41:49 +08:00
parent 0fb9a41178
commit 9052c3001b
46 changed files with 1474 additions and 660 deletions

View File

@@ -22,12 +22,12 @@
</view>
<button class="btn" type="default" :disabled="phone == '' || code == ''" @click="login">登录</button>
<!-- 快捷登录 -->
<!-- <view class="quick">
<view class="quick">
<view class="quick-title">快捷登录</view>
<view class="quick-box">
<image class="quick-icon" src="@/static/icons/wechat.png" mode="widthFix" @click="onShowToast"></image>
<image class="quick-icon" src="@/static/icons/wechat.png" mode="widthFix" @click="onKeyAuth"></image>
</view>
</view> -->
</view>
<!-- 用户登录注册协议 -->
<view class="agreement">
未注册的手机号验证后将自动创建账号登录即表示同意接收
@@ -36,8 +36,6 @@
<view @click="$Router.push({name: 'agreement', params: {name : 'service'}})">用户服务协议</view>
</view>
<view class="beianNo">皖ICP备2021013714号-1</view>
<!-- https://beian.miit.gov.cn/ -->
</view>
</template>
@@ -46,6 +44,7 @@
getSms,
smsAuth
} from '@/apis/interfaces/auth'
import userAuth from '@/public/userAuth'
export default {
data() {
return {
@@ -57,7 +56,7 @@
}
},
onShow(){
this.parentId = this.$Route.query.invite || ''
this.parentId = getApp().globalData.parentId
},
methods: {
// 用户登录
@@ -106,11 +105,37 @@
})
})
},
// 提示信息
onShowToast(){
uni.showToast({
title: '微信登录暂未开放,敬请期待',
icon : 'none'
// 一键登录
onKeyAuth(){
uni.showLoading({
title: "加载中..."
})
uni.preLogin({
provider: 'univerify',
success : res=> {
let userLogin = new userAuth()
userLogin.keyLogin().then(res => {
if(this.$Route.toName){
this.$Router.back()
}else{
this.$Router.replaceAll({name: 'Index'})
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
fail : err=> {
uni.showToast({
title: '当前设备环境暂不支持一键登录',
icon : 'none'
})
},
complete() {
uni.hideLoading()
}
})
}
}
@@ -126,7 +151,7 @@
background: white;
.login-top {
height: 26vh;
height: 25vh;
width: 100%;
display: flex;
flex-direction: row;
@@ -244,16 +269,14 @@
}
.quick {
padding-top: $padding * 3;
padding-top: $padding * 2;
text-align: center;
.quick-title {
text-align: center;
color: $text-gray;
font-size: $title-size-sm;
padding-bottom: $padding;
}
.quick-box {
display: flex;
justify-content: center;
@@ -265,7 +288,7 @@
}
.agreement {
padding-top: 12vh;
padding-top: 5vh;
font-size: $title-size-sm;
color: $text-gray;
view {

View File

@@ -269,6 +269,7 @@
// 复制邀请码
copyCenter(e) {
// e.slice(0,2) + '$InviTaTiOn$CoDe/$-?' + e.substring(2)
uni.setClipboardData({
data: e,
success(){