美文网首页
如何获取小程序码

如何获取小程序码

作者: 新苡米 | 来源:发表于2022-06-15 11:12 被阅读0次

场景一

只申请小程序码
1.登陆微信小程序平台

想要生成微信的小程序码,首先要登陆到微信公众平台官网,直接在页面上输入已经注册好的小程序账号以及密码,成功登陆之后,直接选择页面右上方的【工具】,下拉找到【生成小程序码】这个选项,这是生成微信小程序码之前的操作。商家需要先注册微信小程序,才可以有小程序码使用。

项目里小程序码

前端

  weixin: {
        getAccessTokenURL:
          "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential",
        appid: "",   //小程序appid
        secret: "", //小程序秘钥
        base64: "",
        page: "pages/sign/sign",  //跳转页面
        env_version: "release",
      },

//  调取接口
 async accessToken() {
      let docNo = this.data.mainData.docNo;
      let weixin = this.weixin;
      let res = await this.api.getAccessToken({
        appid: weixin.appid,
        secret: weixin.secret,
        scene: docNo,
        page: weixin.page,
        check_path: true,
        env_version: weixin.env_version,
      });
      console.log(res);
      this.weixin.base64 = res;
    },
image.png

后端方法


image.png

相关文章

网友评论

      本文标题:如何获取小程序码

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