推送 云函数 一键登录
This commit is contained in:
+36
-19
@@ -138,25 +138,6 @@
|
||||
}
|
||||
|
||||
console.log('一键登录');
|
||||
uni.showLoading({
|
||||
title: '登录中2...'
|
||||
});
|
||||
|
||||
// 模拟登录过程
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '登录成功',
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
// 跳转到首页
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}, 1500);
|
||||
}, 2000);
|
||||
};
|
||||
|
||||
// 短信验证码登录
|
||||
@@ -342,6 +323,42 @@
|
||||
// 页面加载
|
||||
onLoad(() => {
|
||||
console.log('登录页面加载完成');
|
||||
// #ifdef APP
|
||||
|
||||
uni.getProvider({
|
||||
service: 'oauth',
|
||||
success: function (res) {
|
||||
console.log(res.provider)// ['qq', 'univerify']
|
||||
if(res.provider.indexOf('univerify') !== -1){
|
||||
uni.preLogin({
|
||||
provider: 'univerify',
|
||||
success(){ //预登录成功
|
||||
// 显示一键登录选项
|
||||
uni.redirectTo({
|
||||
url: '/pages/univerify/univerify'
|
||||
});
|
||||
},
|
||||
fail(res){ // 预登录失败
|
||||
// 不显示一键登录选项(或置灰)
|
||||
// 根据错误信息判断失败原因,如有需要可将错误提交给统计服务器
|
||||
console.log(res.errCode)
|
||||
console.log(res.errMsg)
|
||||
uni.redirectTo({
|
||||
url: '/pages_app/smsLogin/smsLogin'
|
||||
});
|
||||
}
|
||||
})
|
||||
}else{
|
||||
uni.redirectTo({
|
||||
url: '/pages_app/smsLogin/smsLogin'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// #endif
|
||||
});
|
||||
|
||||
// 页面显示
|
||||
|
||||
Reference in New Issue
Block a user