diff --git a/fangija-zsyf/config.js b/fangija-zsyf/config.js index 2ec781f..8e5fe1f 100644 --- a/fangija-zsyf/config.js +++ b/fangija-zsyf/config.js @@ -2,5 +2,6 @@ //var BASE_PATH = "http://192.168.10.128:8084"; //var BASE_PATH = "http://192.168.10.47:8086"; var BASE_PATH = "http://192.168.10.53:8084"; +var BASE_PATH = "http://192.168.10.171:8084"; /**是否显示过启动页面**/ var lauchFlag = false; \ No newline at end of file diff --git a/fangija-zsyf/js/shara/sharaMine.js b/fangija-zsyf/js/shara/sharaMine.js new file mode 100644 index 0000000..3d84c86 --- /dev/null +++ b/fangija-zsyf/js/shara/sharaMine.js @@ -0,0 +1,89 @@ +/** + * + * 更新分享服务 + */ +function updateSerivces(){ + plus.share.getServices( function(s){ + shares={}; + for(var i in s){ + var t=s[i]; + shares[t.id]=t; + } + }, function(e){ + alert("获取分享服务列表失败:"+e.message ); + } ); +} +/** + * 分享操作 + * @param {JSON} sb 分享操作对象s.s为分享通道对象(plus.share.ShareService) + * @param {Boolean} bh 是否分享链接 + */ +function shareAction(sb,bh) { + if(!sb||!sb.s){ + alert("无效的分享服务!"); + return; + } + var msg={content:sharehrefDes,extra:{scene:sb.x}}; + if(bh){ + msg.href=shareUrl; + if(sharehrefTitle&&sharehrefTitle!=""){ + msg.title=sharehrefTitle; + } + if(sharehrefDes&&sharehrefDes!=""){ + if(sb.title=="新浪微博"){ + msg.content=shareUrl+sharehrefDes; + }else{ + msg.content=sharehrefDes; + } + } + msg.thumbs=["_www/logo.png"]; + msg.pictures=["_www/logo.png"]; + }else{ + if(pic&&pic.realUrl){ + msg.pictures=[pic.realUrl]; + } + } + // 发送分享 + if ( sb.s.authenticated ) { + shareMessage(msg,sb.s); + } else { + alert("---未授权---"); + sb.s.authorize( function(){ + shareMessage(msg,sb.s); + },function(e){ + alert("认证授权失败:"+e.code+" - "+e.message ); + + }); + } +} +/** + * 发送分享消息 + * @param {JSON} msg + * @param {plus.share.ShareService} s + */ +function shareMessage(msg,s){ + s.send( msg, function(){ + alert("分享到\""+s.description+"\"成功! " ); + + }, function(e){ + alert( "分享到\""+s.description+"\"失败 !"); + + } ); +} + + // 分析链接 + function shareHref(){ + var shareBts=[]; + // 更新分享列表 + var ss=shares['weixin']; + ss&&ss.nativeClient&&(shareBts.push({title:'微信朋友圈',s:ss,x:'WXSceneTimeline'}), + 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); + }):plus.nativeUI.alert('当前环境无法支持分享链接操作!'); + } \ No newline at end of file diff --git a/fangija-zsyf/manifest.json b/fangija-zsyf/manifest.json index 764862b..929aa72 100644 --- a/fangija-zsyf/manifest.json +++ b/fangija-zsyf/manifest.json @@ -39,9 +39,7 @@ "Console": { "description": "调试输出日志" }, - "Contacts": { - "description": "系统通讯录" - }, + "Device": { "description": "设备信息" }, @@ -63,9 +61,7 @@ "Invocation": { "description": "Native.js能力" }, - "Messaging": { - "description": "消息通讯" - }, + "Orientation": { "description": "方向传感器" }, @@ -111,7 +107,7 @@ "Push": { "description": "消息推送" - } + },"Statistic":{},"Share":{} }, "plus": { "error": { @@ -168,39 +164,7 @@ "password": "",/*Android应用打包使用密钥库中证书的密码*/ "aliasname": "",/*Android应用打包使用密钥库中证书的别名*/ "ImmersedStatusbar": true,/*Android平台开启沉浸式状态栏样式*/ - "permissions": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] + "permissions": ["","","","","","","","","","","","","","","","","","","","","","","","","",""] }, "orientation": [ "portrait-primary" @@ -291,7 +255,7 @@ } }, "plugins": { - "statics": {}, + "statics": {"umeng":{"appkey_ios":"5ab09d69a40fa374da0002e4","channelid_ios":"有房IOS","appkey_android":"5ab09e16f29d9854f200026e","channelid_android":"有房Android"}}, "maps": { "baidu": {/*配置应用使用百度地图,参考http://ask.dcloud.net.cn/article/29*/ "appkey_ios": "cmXf4GGYGYiu1fuVRN4847cGvgR25WTV",/*iOS平台百度地图appkey*/ @@ -307,7 +271,7 @@ "description": "个推推送" } }, - "share": {}, + "share": {"weixin":{"description":"可选,微信分享"}}, "payment": {}, "oauth": { "weixin": { diff --git a/fangija-zsyf/views/news/newsDetail.html b/fangija-zsyf/views/news/newsDetail.html index 4b296c7..df412a0 100644 --- a/fangija-zsyf/views/news/newsDetail.html +++ b/fangija-zsyf/views/news/newsDetail.html @@ -23,6 +23,9 @@ +

@@ -94,18 +97,26 @@ $.config = {router: false} +