3,143
社区成员
发帖
与我相关
我的任务
分享
<section data-role="page" id="pageSeeHouseTeamList">
<script>
wx.config({
debug: true,
appId: $("input[id$='hdfAppId']").val(),
timestamp: $("input[id$='hdfTimestamp']").val(),
nonceStr: $("input[id$='hdfNonce']").val(),
signature: $("input[id$='hdfSignature']").val(),
jsApiList: ['checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo']
});
wx.error(function (res) {
alert(res);
});
wx.ready(function () {
$("img[src$='share_03.gif']").on("click", function () {
var isOk = true;
wx.checkJsApi({
jsApiList: ['onMenuShareQQ'],
fail: function (res) {
alert("微信版本太低,不支持分享给朋友的功能!");
isOk = false;
},
success: function (res) {
alert("支持QQ分享。");
}
});
if (!isOk)
return;
var $div = $(this).closest("li").children("div");
wx.onMenuShareQQ({
title: $div.eq(0).children("a").text(), // 分享标题
desc: $div.eq(1).find("dt").text() + "," + $div.eq(1).find("dd").text(), // 分享描述
link: $div.eq(0).children("a").attr("href"), // 分享链接
imgUrl: $div.eq(1).children("a").css("background").replace("url(", "").replace(")", ""), // 分享图标
success: function (res) {
alert("分享给QQ好友成功");// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
},
fail: function (res) {
alert(res);//$.parseJSON(res).errMsg
}
});
});
$("img[src$='share_05.gif']").on("click", function () {
var $div = $(this).closest("li").children("div");
wx.onMenuShareTimeline({
title: $div.eq(0).children("a").text(), // 分享标题
link: $div.eq(0).children("a").attr("href"), // 分享链接
imgUrl: $div.eq(1).children("a").css("background").replace("url(", "").replace(")", ""), // 分享图标
success: function (res) {
alert("分享到朋友圈成功");// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
},
fail: function (res) {
alert(res);
}
});
});
$("img[src$='share_07.gif']").on("click", function () {
var $div = $(this).closest("li").children("div");
wx.onMenuShareWeibo({
title: $div.eq(0).children("a").text(), // 分享标题
link: $div.eq(0).children("a").attr("href"), // 分享链接
imgUrl: $div.eq(1).children("a").css("background").replace("url(", "").replace(")", ""), // 分享图标
success: function (res) {
alert("分享到腾讯微博成功");// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
},
fail: function (res) {
alert(res);
}
});
});
$("img[src$='share_16.gif']").on("click", function () {
var $div = $(this).closest("li").children("div");
wx.onMenuShareAppMessage({
title: $div.eq(0).children("a").text(), // 分享标题
desc: $div.eq(1).find("dt").text() + "," + $div.eq(1).find("dd").text(), // 分享描述
link: $div.eq(0).children("a").attr("href"), // 分享链接
imgUrl: $div.eq(1).children("a").css("background").replace("url(", "").replace(")", ""), // 分享图标
type: 'link', // 分享类型,music、video或link,不填默认为link
dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
success: function (res) {
alert("分享给微信朋友成功");// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
},
fail: function (res) {
alert(res);
}
});
});
});
</script>
<div data-role="content" style="padding:0px;background:#FFF;">
<input id="hdfAppId" type="hidden" runat="server" />
<input id="hdfTimestamp" type="hidden" runat="server" />
<input id="hdfNonce" type="hidden" runat="server" />
<input id="hdfSignature" type="hidden" runat="server" />
<input id="temp" type="hidden" runat="server" />
<ul class="ul-seeHouseTeamList">
<FC:RepeaterPlusNone ID="rptSeeHouseTeam" runat="server">
<ItemTemplate>
<li>
<div>
<a id="lnkTeamTitle" runat="server" href="/teamBuy/seeHouseTeamView-{0}.aspx" data-transition="slide"></a>
</div>
<div>
<a id="lnkHouse" runat="server" href="/teamBuy/seeHouseTeamView-{0}.aspx" data-transition="slide"></a>
<dl><dt><asp:Literal ID="ltlPrice" runat="server"></asp:Literal>元/平米</dt><dd><asp:Literal ID="ltlTeamInfo" runat="server"></asp:Literal></dd></dl>
</div>
<div>
<p>已报名<span style="color:#ff6600;"><asp:Literal ID="ltlJoinCount" runat="server"></asp:Literal></span>人</p>
<p>
分享
<img src="/themes/default/images/share_03.gif" />
<img src="/themes/default/images/share_05.gif" />
<img src="/themes/default/images/share_07.gif" />
<img src="/themes/default/images/share_16.gif" />
</p>
</div>
<div>
<a id="lnkJoin" runat="server" href="/userCenter/teamBuyJoin.aspx?tbid={0}" data-transition="slide">报 名</a>
</div>
</li>
</ItemTemplate>
<NoneTemplate><li style="text-align:center;height:100px;line-height:100px;">对不起,没找到数据!</li></NoneTemplate>
</FC:RepeaterPlusNone>
</ul>
</div>
</section>
wx.config({
debug: false,
appId: share_cfg.appid,
timestamp: share_cfg.timestamp,
nonceStr: share_cfg.nonceStr,
signature: share_cfg.signature,
jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','scanQRCode']
});
wx.ready(function(){
//share to timeline
wx.onMenuShareTimeline({
title: share_cfg.title,
link: share_cfg.link,
imgUrl: share_cfg.img,
success: function () {
shareLog();
},
cancel: function () {
}
});
wx.onMenuShareAppMessage({
desc: share_cfg.desc,
title: share_cfg.title,
link: share_cfg.link,
imgUrl: share_cfg.img,
type: 'link',
dataUrl: '',
success: function () {
shareLog()
},
cancel: function () {
}
});
});
wx.error(function(res){
});
我这边是正常使用的。。