分享
This commit is contained in:
@@ -23,15 +23,18 @@ function shareAction(sb,bh) {
|
|||||||
alert("无效的分享服务!");
|
alert("无效的分享服务!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var msg={content:sharehrefDes,extra:{scene:sb.x}};
|
var msg={content:sharehrefDes,extra:{scene:sb.x}};
|
||||||
if(bh){
|
if(bh){
|
||||||
msg.href=shareUrl;
|
msg.href=shareUrl;
|
||||||
if(sharehrefTitle&&sharehrefTitle!=""){
|
if(sharehrefTitle&&sharehrefTitle!=""){
|
||||||
msg.title=sharehrefTitle;
|
msg.title=sharehrefTitle;
|
||||||
}
|
}
|
||||||
if(sharehrefDes&&sharehrefDes!=""){
|
if(sharehrefDes&&sharehrefDes!=""){
|
||||||
msg.content=sharehrefDes;
|
if(sb.title=="新浪微博"){
|
||||||
|
msg.content=shareUrl+sharehrefDes;
|
||||||
|
}else{
|
||||||
|
msg.content=sharehrefDes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
msg.thumbs=["_www/logo.png"];
|
msg.thumbs=["_www/logo.png"];
|
||||||
msg.pictures=["_www/logo.png"];
|
msg.pictures=["_www/logo.png"];
|
||||||
@@ -63,7 +66,7 @@ function shareMessage(msg,s){
|
|||||||
alert("分享到\""+s.description+"\"成功! " );
|
alert("分享到\""+s.description+"\"成功! " );
|
||||||
|
|
||||||
}, function(e){
|
}, function(e){
|
||||||
alert( "分享到\""+s.description+"\"失败: "+JSON.stringify(e) );
|
alert( "分享到\""+s.description+"\"失败 !");
|
||||||
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
@@ -77,6 +80,8 @@ function shareMessage(msg,s){
|
|||||||
shareBts.push({title:'微信好友',s:ss,x:'WXSceneSession'}));
|
shareBts.push({title:'微信好友',s:ss,x:'WXSceneSession'}));
|
||||||
ss=shares['qq'];
|
ss=shares['qq'];
|
||||||
ss&&ss.nativeClient&&shareBts.push({title:'QQ',s:ss});
|
ss&&ss.nativeClient&&shareBts.push({title:'QQ',s:ss});
|
||||||
|
ss=shares['sinaweibo'];
|
||||||
|
ss&&shareBts.push({title:'新浪微博',s:ss});
|
||||||
// 弹出分享列表
|
// 弹出分享列表
|
||||||
shareBts.length>0?plus.nativeUI.actionSheet({title:'分享链接',cancel:'取消',buttons:shareBts},function(e){
|
shareBts.length>0?plus.nativeUI.actionSheet({title:'分享链接',cancel:'取消',buttons:shareBts},function(e){
|
||||||
(e.index>0)&&shareAction(shareBts[e.index-1],true);
|
(e.index>0)&&shareAction(shareBts[e.index-1],true);
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ $.config = {router: false}
|
|||||||
<script>
|
<script>
|
||||||
document.addEventListener('plusready', onPlusReady, false);
|
document.addEventListener('plusready', onPlusReady, false);
|
||||||
var shareUrl = BASE_PATH+"/news/newDetail?newsId=";
|
var shareUrl = BASE_PATH+"/news/newDetail?newsId=";
|
||||||
var sharehrefTitle = "我是一个超级无敌大帅哥";
|
var sharehrefTitle = "停车坐爱枫林晚,霜叶红于二月花";
|
||||||
var sharehrefDes = "不信你自己来看看啊!";
|
var sharehrefDes = "客观里面请!";
|
||||||
var shareId='';
|
var shareId='';
|
||||||
|
|
||||||
function onPlusReady() {
|
function onPlusReady() {
|
||||||
@@ -71,7 +71,7 @@ function onPlusReady() {
|
|||||||
url : BASE_PATH + "/rest/news/detail",
|
url : BASE_PATH + "/rest/news/detail",
|
||||||
data:{newsId:id},
|
data:{newsId:id},
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
async:true,
|
async:false,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
if(result.code==200){
|
if(result.code==200){
|
||||||
data = result.data
|
data = result.data
|
||||||
@@ -83,6 +83,8 @@ function onPlusReady() {
|
|||||||
var dateStr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
|
var dateStr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
|
||||||
$("#create_time").text(dateStr)
|
$("#create_time").text(dateStr)
|
||||||
$("#content").html(data.content)
|
$("#content").html(data.content)
|
||||||
|
sharehrefTitle = data.title
|
||||||
|
sharehrefDes = data.introduction
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error:function(){
|
error:function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user