<script>
(function($, doc) {
$.plusReady(function() {
plus.screen.lockOrientation("portrait-primary");
var phonecode = plus.device.uuid;
var state = JSON.stringify(app.getState());
var toMain = function() {
var id = setInterval(function () {
clearInterval(id);
var list = plus.webview.getWebviewById('tab4.html');
mui.fire(list,'rush');
var ws=plus.webview.currentWebview();
plus.webview.close(ws);
},20);
};
app.setState(null);
var authBtns = ['weixin'];
var auths = {};
var oauthArea = doc.querySelector('.oauth-area');
plus.oauth.getServices(function(services) {
for (var i in services) {
var service = services[i];
auths[service.id] = service;
if (~authBtns.indexOf(service.id)) {
var isInstalled = app.isInstalled(service.id);
var btn = document.createElement('div');
btn.setAttribute('class', 'oauth-btn' + (!isInstalled && service.id === 'weixin' ? (' disabled') : ''));
btn.authId = service.id;
btn.style.backgroundImage = 'url("img/weixin.png")';
oauthArea.appendChild(btn);
}
}
$(oauthArea).on('tap', '.oauth-btn', function() {
if (this.classList.contains('disabled')) {
plus.nativeUI.toast('您尚未安装微信客户端');
return;
}
var auth = auths[this.authId];
var waiting = plus.nativeUI.showWaiting("登录中...", {padlock:true});
auth.login(function() {
auth.getUserInfo(function() {
var name = auth.userInfo.nickname || auth.userInfo.name;
console.log(auth.userInfo.unionid);
mui.post('http://',{
userInfo:auth.userInfo,
phonecode:phonecode
},function(data){
console.log(JSON.stringify(data));
waiting.close();
app.createState(data.user.isvip,data.user.viptime,data.user.viptimes,data.user.username,data.user.id, data.user.nickname,data.user.headimgurl, function(err) {
if (err) {
plus.nativeUI.toast(err);
return;
}
toMain();
});
},'json'
);
}, function(e) {
plus.nativeUI.toast("获取用户信息失败:" + e.message+ e.code);
});
}, function(e) {
waiting.close();
plus.nativeUI.toast("登录认证失败:" + e.message+ e.code);
});
});
}, function(e) {
oauthArea.style.display = 'none';
console.log("获取登录认证失败:" + e.message+ e.code);
});
});
}(mui, document));
</script>
直接引用实例中的微信登录,魅族手机/小米手机上提示未安装微信。
这是什么原因?
1 个回复
1***@qq.com
同问,楼主~~~我也遇到这个问题了,请问楼主你解决了吗?