企业微信JS-SDK禁止分享功能

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37164847/article/details/89393167

使用JS-SDK实现点击右上角,不能分享功能:

     

       function fenxiang(){
                var index_url=location.href.split('#')[0];//url不能写死
                $.ajax({ 
                    type : "get",
                    url : share_url,
                    dataType : "json",
                    async : false,
                    data:{url:index_url},
                    success : function(data) {
                        //console.log("请求微信分享接口="+JSON.stringify(data));
                        wx.config({
                            debug: false,//生产环境需要关闭debug模式
                            appId: data.corpid,//appId通过微信服务号后台查看
                            timestamp: data.timestamp,//生成签名的时间戳
                            nonceStr: data.nonceStr,//生成签名的随机字符串
                            signature: data.signature,//签名
                            jsApiList: [//需要调用的JS接口列表
                                'onMenuShareTimeline',//分享到朋友圈分享给好友
                                'onMenuShareAppMessage',//转发
                                'onMenuShareWechat',//分享到微信
                                'shareAppMessage'//自定义转发到会话   
                            ] 
                        });
                        wx.ready(function () {
                           //禁用右上角菜单按钮
                           wx.hideOptionMenu();                                
                        });    
                    },
                    error: function(xhr, status, error) {
                        console.log("获取微信参数失败=="+error);
                    }
                })                    
            }

猜你喜欢

转载自blog.csdn.net/qq_37164847/article/details/89393167