3方登录

This commit is contained in:
hubingliang
2018-03-30 14:59:33 +08:00
parent 33a1d0f758
commit 60999a8d94
2 changed files with 36 additions and 13 deletions
+35 -4
View File
@@ -1,8 +1,39 @@
var auths = {}
function plusReady() {
plus.oauth.getServices(function(services) {
alert("111111111111111111111111")
auths = services;
}, function(e) {
alert("获取登录服务列表失败:" + e.message + " - " + e.code);
});
}
document.addEventListener('plusready',plusReady,false);
// 登录认证
function webChatLogin(){
var auth=auths['weixin'];
if(auth){
var w=null;
if(plus.os.name=="Android"){
w=plus.nativeUI.showWaiting();
}
document.addEventListener("pause",function(){
setTimeout(function(){
w&&w.close();w=null;
},2000);
}, false );
auth.login(function(){
w&&w.close();w=null;
userinfo(auth);
},function(e){
w&&w.close();w=null;
$.toast("登录认证失败:["+e.code+"]:"+e.message);
});
}else{
$.toast("无效的登录认证通道!");
$.toast("无效的登录认证通道!",null,"登录");
}
}
$("#wxLogin").addEventListener('tap',function() {
console.log("微信");
authLogin('weixin');
})
function authLogin(type) {
console.log("hhhhhhhhhhhhhhhhhhh")
}
+1 -9
View File
@@ -72,7 +72,7 @@
<span>第三方登录</span>
</p>
<p>
<a class="icon icon-loginMode01" id="wxLogin"></a>
<a class="icon icon-loginMode01" id="wxLogin" onclick="webChatLogin()"></a>
<a href="05_mine00_login04_set.html" class="icon icon-loginMode02"></a>
<a href="05_mine00_login04_set.html" class="icon icon-loginMode03" id="qqLogin"></a>
</p>
@@ -101,14 +101,6 @@ $.config = {router: false}
<script type="text/javascript" src="../../js/login/wxLogin.js" ></script>
<script>
var auths = ''
mui.plusReady(function() {
plus.oauth.getServices(function(services) {
auths = services;
}, function(e) {
alert("获取登录服务列表失败:" + e.message + " - " + e.code);
});
})
/* 勾选-已阅读 */