美文网首页
uniapp微信小程序生成对应页面二维码

uniapp微信小程序生成对应页面二维码

作者: GiRaffe_ | 来源:发表于2021-09-15 16:36 被阅读0次
            getAccessToken(){  //获取access_token
                this.$httpRequest('POST','/getAccessToken').then(res=>{
                    if(res&&res.status==200){
                        this.shareToken = res.access_token;
                        this.getWxCode(res.access_token)
                    }
                })
            },
            getWxCode(shareToken) {  //获取小程序码
                let that = this
                uni.showLoading({
                    title: '加载中',
                    mask: true
                })
                uni.request({
                    url: `https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=${shareToken}`,
                    method: "POST",
                    data: {
                        access_token:shareToken,
                        width: 280,
                        path: 'pages/detail/detail?data='+this.detaiId
                    },
                    responseType: 'arraybuffer',
                    success: function(res) {
                        uni.hideLoading();
                        let src = uni.arrayBufferToBase64(res.data);
                        that.codeImg = 'data:image/png;base64,' + src;
                    }
                })
            },

    相关文章

      网友评论

          本文标题:uniapp微信小程序生成对应页面二维码

          本文链接:https://www.haomeiwen.com/subject/tsxlgltx.html