taxun

参考: https://www.jianshu.com/p/64f73586e63a 

https://developers.weixin.qq.com/miniprogram/dev/reference/api/Page.html#onShareTimeline

 

 

https://www.jianshu.com/p/41990bc2167c

 

 

 

https://www.jb51.net/article/187128.htm

 

 onLoad: function(options) {
        wx.showShareMenu({
            withShareTicket: true,
            menus: [\'shareAppMessage\', \'shareTimeline\'],
            success(res) {
                console.log(res)
            },
            fail(e) {
                console.log(e)
            }
        })
    },


   onShareAppMessage: function() {
        return {
            title: "名巢未来酒店",
            desc: \'Minnest\',
            path: \'/pages/order/index/index\'
        }
    },
    onShareTimeline: function() {
        return {
            title: \'测试小程序分享至朋友圈\',
            path: \'../test/test\',
            imageUrl: \'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1594374964481&di=3ceba827e91e126012c43de3887a58c7&imgtype=0&src=http%3A%2F%2Fdmimg.5054399.com%2Fallimg%2Fpkm%2Fpk%2F13.jpg\'
        }
    },

  

  /**
     * 分享
     */
    onShareAppMessage: function() {
        var openId = wx.getStorageSync(\'openId\');
        var queryPath = \'/pages/home/index/index\' + (openId ? \'?shareOpenId=\' + openId : \'\');
        console.log(queryPath);
        return {
            title: "名巢未来酒店",
            desc: \'Minnest\',
            path: queryPath
        }
    },

    /**
     * 分享到朋友圈
     */
    onShareTimeline: function() {
        var openId = wx.getStorageSync(\'openId\');
        var queryPath = \'/pages/home/index/index\' + (openId ? \'?shareOpenId=\' + openId : \'\');
        return {
            title: \'名巢未来酒店\',
            query: queryPath
        }
    },

  

  onLoad: function(options) {
        this.getLocation();
        this.getAds();
        this.initTimeList();
        this.getCouponCards(() => {
            this.setData({
                showCouponsModal: true
            })
        });
        // 进入首页进行加载判断
        this.getnologinpic();
        wx.showShareMenu({
            withShareTicket:true,
            menus:[\'shareAppMessage\', \'shareTimeline\']
        })
        // 获取分享人
        if (options && options.shareOpenId) {
            var params = {
                url: \'/api/system/users\',
                body: {
                    openid: options.shareOpenId,
                }
            }
            request.doRequest(
                params,
                function(data) {
                    if (data.data.length != 0) {
                        wx.setStorage({
                          data: data.data[0].id,
                          key: \'shareUser\',
                        })
                    } else {
                        wx.setStorage({
                            data: 0,
                            key: \'shareUser\',
                        })
                    }
                },
            )
        } else {
            wx.setStorage({
                data: 0,
                key: \'shareUser\',
            })
        }
    },

  

分类:

技术点:

相关文章: