分享
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/**服务端地址**/
|
||||
//var BASE_PATH = "http://192.168.10.128:8084";
|
||||
var BASE_PATH = "http://192.168.10.53:8084";
|
||||
//var BASE_PATH = "http://192.168.10.53:8084";
|
||||
//var BASE_PATH = "http://192.168.10.170:8084";
|
||||
var BASE_PATH = "http://192.168.10.171:8084";
|
||||
/**是否显示过启动页面**/
|
||||
var lauchFlag = false;
|
||||
@@ -0,0 +1,60 @@
|
||||
plus.share.getServices(function(s) {
|
||||
shares = ss;
|
||||
for (var i in ss ) {
|
||||
var s = ss[i];
|
||||
var item = document.createElement("li");
|
||||
item.setAttribute("class", "ditem");
|
||||
item.setAttribute("onclick", (s.id == "weixin") ? "shareWeiXin(this.plusShare)" : "shareAction(this.plusShare)");
|
||||
item.innerText = s.description;
|
||||
item.plusShare = s;
|
||||
list.appendChild(item);
|
||||
}
|
||||
}, function(e) {
|
||||
alert("获取分享服务列表失败:" + e.message);
|
||||
});
|
||||
|
||||
function shareAction(s, ex) {
|
||||
outSet("分享操作:");
|
||||
if (!s) {
|
||||
outLine("无效的分享服务!");
|
||||
return;
|
||||
}
|
||||
if (s.authenticated) {
|
||||
outLine("---已授权---");
|
||||
shareMessage(s, ex);
|
||||
} else {
|
||||
outLine("---未授权---");
|
||||
s.authorize(function() {
|
||||
shareMessage(s, ex);
|
||||
}, function(e) {
|
||||
outLine("认证授权失败:" + e.code + " - " + e.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function shareMessage(s,ex){
|
||||
var msg={content:sharecontent.value,extra:{scene:ex}};
|
||||
if(pic&&pic.realUrl){
|
||||
msg.pictures=[pic.realUrl];
|
||||
}
|
||||
|
||||
s.send( msg, function(){
|
||||
alert( "分享到\""+s.description+"\"成功! " );
|
||||
}, function(e){
|
||||
alert( "分享到\""+s.description+"\"失败: "+e.code+" - "+e.message );
|
||||
} );
|
||||
}
|
||||
|
||||
function cancelAuth(){try{
|
||||
|
||||
for ( var i in shares ) {
|
||||
var s = shares[i];
|
||||
if ( s.authenticated ) {
|
||||
outLine( "取消\""+s.description+"\"");
|
||||
}
|
||||
s.forbid();
|
||||
}
|
||||
// 取消授权后需要更新服务列表
|
||||
updateServices();
|
||||
outLine( "操作成功!" );}catch(e){alert(e);}
|
||||
}
|
||||
@@ -1496,7 +1496,9 @@
|
||||
"fonts/mui.ttf",
|
||||
"images/icon-clear.png"
|
||||
],
|
||||
"refer": [],
|
||||
"refer": [
|
||||
"views/news/newsDetail.html"
|
||||
],
|
||||
"priority": 0
|
||||
}
|
||||
},
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<button class="button button-link button-nav pull-left" onclick="back(),plus.nativeUI.closeWaiting();">
|
||||
<span class="mui-icon mui-icon mui-icon-arrowleft"></span>
|
||||
</button>
|
||||
<button onclick="shareShow()">打开分享</button>
|
||||
<h1 class="title"></h1>
|
||||
</header>
|
||||
<div class="content contentText">
|
||||
@@ -50,6 +51,7 @@ $.config = {router: false}
|
||||
<script type="text/javascript" src="../../js/cn.js" charset="utf-8"></script>
|
||||
<script src="../../config.js"></script>
|
||||
<script type="text/javascript" src="../../js/common.js" ></script>
|
||||
<script type="text/javascript" src="../../js/shara/shara.js" ></script>
|
||||
<script>
|
||||
document.addEventListener('plusready', onPlusReady, false);
|
||||
function onPlusReady() {
|
||||
|
||||
Reference in New Issue
Block a user