【uniapp】小程序分享好友和app分享好友

小程序分享好友获取佣金

    <!-- 分享按钮修改版 -->
        <button style="width: 200rpx; background-color: transparent; font-size: 12px"  open-type="share" class="publish">
            <view style="margin-top: 26rpx">分享</view>
        </button>
  // 小程序点击分享给微信好友
  onShareAppMessage(res) {
    if (res.from === 'button') {
      var that = this;
      this.tuigId = that.app.id; //邀请上级的id
      // 来自页面内分享按钮
      console.log(this.tuigId);
    }
    // 携带邀请上级的id让他进注册页这样就能获取到下属列表
    return {
      title: '邀请有礼',
      path: `/pages/login/register?referee=${this.tuigId}`,
      imageUrl: '/static/zsk.png'
    };
  },

app分享好友代码, this.tuigId是分享时携带的参数

    // 分享按钮,this.tuigId是分享时携带的参数
    btn() {
      uni.share({
        provider: 'weixin',
        scene: 'WXSceneSession',
        type: 0,
        href: `http://test-wap.zheshouka.com/pages/login/register?referee=${this.tuigId}`,
        title: '邀请有礼',
        summary: '邀请好友注册并销卡,即可获得奖励哦!',
        imageUrl: 'https://uapi.zheshouka.com/static/uniapp/img/logo.png',
        success: function (res) {
          console.log('success:' + JSON.stringify(res));
        },
        fail: function (err) {
          console.log('fail:' + JSON.stringify(err));
        }
      });
    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值