<!-- 微信分享 --> <script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> <script type="text/javascript"> $(function(){ // $.ajaxSettings.async = false; $.post("{dede:global.cfg_basehost/}/member/getmid.php",{a:"Getmid"},function(result){ if(result == 'notlogin'){ //alert("请登陆"); location.href="{dede:global.cfg_basehost/}"; return; } else { var mid=result; var link="{dede:global.cfg_basehost/}{dede:type typeid='0′ row=1}[field:typelink/]{/dede:type}?tjrmid="+mid; // alert(link); var url = encodeURIComponent(location.href.split("#")[0]); $.ajax({ type: "get", url: "{dede:global.cfg_basehost/}/wechat.php?link=" + url, dataType: "json", contentType: "application/json; charset=utf-8", success: function(e) { var d = e.appid, i = e.timestamp, t = e.noncestr, n = e.signature; wx.config({ debug: 0,//如果分享失败,把0改成1开启错误提示看看 appId: d, timestamp: i, nonceStr: t, signature: n, jsApiList: ["onMenuShareTimeline", "onMenuShareAppMessage"] }), wx.ready(function() { wx.onMenuShareTimeline({ title: "{dede:field name='title'/}", desc: "{dede:field name='description' function='html2text(@me)'/}", link: "{dede:global.cfg_basehost/}{dede:field.id runphp='yes'}$id=@me;@me='';$url=GetOneArchive($id);@me=$url['arcurl'];{/dede:field.id}?tjrmid="+mid, imgUrl: "http://www.asksns.cn/m-images/weixin-fx-logo.jpg" }), wx.onMenuShareAppMessage({ title: "{dede:field name='title'/}", desc: "{dede:field name='description' function='html2text(@me)'/}", link: "{dede:global.cfg_basehost/}{dede:field.id runphp='yes'}$id=@me;@me='';$url=GetOneArchive($id);@me=$url['arcurl'];{/dede:field.id}?tjrmid="+mid, imgUrl: "http://www.asksns.cn/m-images/weixin-fx-logo.jpg" }) }) } }); //alert(link); //alert(mid); // return true; } }); }); </script>