第三方登录:
采用的是网上大家说的,使用隐藏的方式,也是官方demo的样例方式:
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("../../images/' + service.id + '.png")'
oauthArea.appendChild(btn);
}
}
在第三方支付:
采用官方的支付demo样例:
function checkServices(pc) {
if(!pc.serviceReady) {
var txt = null;
switch(pc.id) {
case 'alipay':
txt = '检测到系统未安装“支付宝快捷支付服务”,无法完成支付操作,是否立即安装?';
break;
default:
txt = '系统未安装“' + pc.description + '”服务,无法完成支付,是否立即安装?';
break;
}
plus.nativeUI.confirm(txt, function(e) {
if(e.index == 0) {
pc.installService();
}
}, pc.description);
}
}
苹果给的说明是:
We were required to install the WeChat app before we could log in via WeChat. Users should be able to log in with WeChat and access their accounts without having to install any additional apps.
Next Steps
If you would like to offer authentication through WeChat, please use a mechanism that allows users to log in with WeChat from within your app without first having to install an additional app.
We recommend implementing the Safari View Controller API to display web content within your app. The Safari View Controller allows the display of a URL and inspection of the certificate from an embedded browser in an app so that customers can verify the webpage URL and SSL certificate to confirm they are entering their sign in credentials into a legitimate page.
Resources
For additional information on the Safari View Controller API, please review the What's New in Safari webpage.
截图:
http://a661.phobos.apple.com/us/r30/Purple118/v4/2e/9f/d5/2e9fd5fd-a7fa-eeb9-55c6-e47d705f1a56/attachment-1234658063912012617Screenshot-0512-100318.png?downloadKey3=1526453312_d0975477104188e29a17c5dfe47bc8e1