//申请各个开发平台的开发者
微信: https://open.weixin.qq.com/
QQ: http://open.qq.com/
微博: http://open.weibo.com/
//设置 manifest.json -> SDK配置
//初始化QQ登录,微信登录,微博登录
```
var auths={};
mui.plusReady(function(){
// 获取登录认证通道
plus.oauth.getServices(function(services){
for(var i in services){
var service=services[i];
auths[service.id]=service;
}
},function(e){
outLine("获取登录认证失败:"+e.message);
});
});
```
//调用认证事件
```
// id 为 qq,weixin,weibo
function login(id){
console.log("----- 登录认证 -----");
var auth=auths[id];
if(auth){
var 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;
console.log("登录认证成功:");
console.log(JSON.stringify(auth.authResult));
userinfo(auth);
},function(e){
w&&w.close();w=null;
console.log("登录认证失败:");
console.log("["+e.code+"]:"+e.message);
plus.nativeUI.alert("详情错误信息请参考授权登录(OAuth)规范文档:http://www.html5plus.org/#specification#/specification/OAuth.html",null,"登录失败["+e.code+"]:"+e.message);
});
}else{
console.log("无效的登录认证通道!");
plus.nativeUI.alert("无效的登录认证通道!",null,"登录");
}
}
// 获取用户信息
function userinfo(a){
console.log("----- 获取用户信息 -----");
a.getUserInfo(function(){
console.log("获取用户信息成功:");
console.log(JSON.stringify(a.userInfo));
var nickname=a.userInfo.nickname||a.userInfo.name;
plus.nativeUI.alert("欢迎“"+nickname+"”登录!");
},function(e){
console.log("获取用户信息失败:");
console.log("["+e.code+"]:"+e.message);
plus.nativeUI.alert("获取用户信息失败!",null,"登录");
});
}
// 注销登录
function logoutAll(){
console.log("----- 注销登录认证 -----");
for(var i in auths){
logout(auths[i]);
}
}
function logout(auth){
auth.logout(function(){
outLine("注销\""+auth.description+"\"成功");
},function(e){
outLine("注销\""+auth.description+"\"失败:"+e.message);
});
}
```
- 界面初始化
- H5plus初始化
- 创建子页面
- 打开界面
- 参数传递
- 控制页面load显示
- 关闭界面
- 底部导航切换界面
- 自定义事件
- 页面预加载
- 消息框
- 原生模式ActionSheet
- 下拉刷新
- 上拉加载
- 上拉下拉整合
- 手势
- 遮罩
- 滑动导航选择
- 图片轮播
- 扩展-自定义导航
- Ajax-get请求
- Ajax-post请求
- 照相机
- 访问相册
- 蜂鸣提示音
- 手机震动
- 弹出菜单
- 设备信息
- 手机信息
- 发送短信
- 拨打电话
- 发送邮件
- 本地存储
- 图片上传
- 地理位置
- 设置IOS状态栏
- 手机通讯录
- 启动页设置
- PHP后台搭建
- JSON转换
- 隐藏本页面中滚动条
- 首次启动欢迎页
- 数据库增删改查和接口
- 推送
- 浏览器打开新页面
- PDF浏览
- 自定义下拉刷新
- 即时聊天
- 双击安卓返回键退出
- QQ登录