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