Esempio n. 1
0
wx.ready(function() {
  //分享到朋友圈
  wx.onMenuShareTimeline({
    title: $jweixin.data('title'),
    link: $jweixin.data('link'),
    imgUrl: $jweixin.data('imgUrl')
  });

  //分享给朋友
  wx.onMenuShareAppMessage({
    title: $jweixin.data('title'), // 分享标题
    desc: $jweixin.data('desc'), // 分享描述
    link: $jweixin.data('link'), // 分享链接
    imgUrl: $jweixin.data('imgUrl'), // 分享图标
    type: '', // 分享类型,music、video或link,不填默认为link
    dataUrl: '' // 如果type是music或video,则要提供数据链接,默认为空
  });

  //分享到QQ
  wx.onMenuShareQQ({
    title: $jweixin.data('title'), 
    desc: $jweixin.data('desc'), 
    link: $jweixin.data('link'), 
    imgUrl: $jweixin.data('imgUrl') 
  });

  //分享到QQ空间
  wx.onMenuShareQZone({
    title: $jweixin.data('title'), 
    desc: $jweixin.data('desc'),
    link: $jweixin.data('link'),
    imgUrl: $jweixin.data('imgUrl')
  });
});
Esempio n. 2
0
 wx.ready(function () {
   wx.onMenuShareTimeline({
     title: sharobj.share_title, // 分享标题
     desc: sharobj.share_description, // 分享描述
     // link: window.location.origin + '/app/dmstore?store_id=' + _this.storeid, // 分享链接
     link: href, // 分享链接
     imgUrl: sharobj.thumb, // 分享图标
     success: function () {
       success && success()
       // alert("分享到朋友圈成功")
     },
     cancel: function () {
       // alert("分享失败,您取消了分享!")
     }
   })
   wx.onMenuShareAppMessage({
     title: sharobj.share_title, // 分享标题
     desc: sharobj.share_description, // 分享描述
     link: href, // 分享链接
     imgUrl: sharobj.thumb, // 分享图标
     success: function () {
       success && success()
       // alert("成功分享给朋友")
     },
     cancel: function () {
       // alert("分享失败,您取消了分享!")
     }
   })
   wx.onMenuShareQQ({
     title: sharobj.share_title, // 分享标题
     desc: sharobj.share_description, // 分享描述
     link: href, // 分享链接
     imgUrl: sharobj.thumb, // 分享图标
     success: function () {
       success && success()
     },
     cancel: function () {}
   })
   wx.onMenuShareWeibo({
     title: sharobj.share_title, // 分享标题
     desc: sharobj.share_description, // 分享描述
     link: href, // 分享链接
     imgUrl: sharobj.thumb, // 分享图标
     success: function () {
       success && success()
       // alert("成功分享给朋友")
     },
     cancel: function () {
       // alert("分享失败,您取消了分享!")
     }
   })
   wx.onMenuShareQZone({
     title: sharobj.share_title, // 分享标题
     desc: sharobj.share_description, // 分享描述
     link: href, // 分享链接
     imgUrl: sharobj.thumb, // 分享图标
     success: function () {
       success && success()
       // alert("成功分享给朋友")
     },
     cancel: function () {
       // alert("分享失败,您取消了分享!")
     }
   })
 })
Esempio n. 3
0
        let that = this
        if (!wx) return
        option = option || {}
        configPage = configPage || (that.data.currPage.name + Math.random())
        if (wx['signReady'] == true) {
            if (configPage == wx['configPage']) { // 已经配置过此页面的分享
                return
            }
            if (option.title) {
                wx.hideMenuItems({menuList: ['menuItem:copyUrl']})
                wx.showAllNonBaseMenuItem()
                wx.onMenuShareAppMessage(option) // 分享给朋友
                wx.onMenuShareTimeline(option) // 分享到朋友圈
                wx.onMenuShareQQ(option) // 分享到QQ
                wx.onMenuShareWeibo(option) // 分享到腾讯微博
                wx.onMenuShareQZone(option) // 分享到QQ空间
            } else {
                wx.hideAllNonBaseMenuItem() // 屏蔽分享菜单
            }
            wx['configPage'] = configPage
        } else if (win['requestSignCount'] == undefined) {
            win['requestSignCount'] = 2
            that.weiXinCfgSignature(option, configPage)
        }
    },

    // 微信签名
    weiXinCfgSignature (option, configPage) {
        let loc = location
        let signUrl = loc.origin + loc.pathname + loc.search
        let that = this