1.获取access_token
参数:
grant_type: 'client_credential',// 固定值
appid: '******',// 小程序id
secret: '******************',// 小程序秘钥 (开发管理/开发设置)
GET请求API:
`https://api.weixin.qq.com/cgi-bin/token?grant_type=${grant_type}&appid=${appid}&secret=${secret}`
2.获取小程序Scheme码
参数:
is_expire: false,//生成的 scheme 码类型,到期失效:true,永久有效:false。永久有效的scheme码
上限为10万个
timestamp:'',//如果scheme是到期失效的话需要配置此项,timestamp为Unix时间戳,单位为秒,不是毫秒
jump_wxa: {
path: 'pages/index/index',//path为需要跳转的小程序路径
//要打开的小程序版本。正式版为"release",体验版为"trial",开发版为"develop"。
env_version: 'develop',
query: 'merge=1&key=100000'//参数跳转过去携带的参数,最大1024个字符,只支持数字,大小写英
文以及部分特殊字符
}
POST请求API:
`https://api.weixin.qq.com/wxa/generatescheme?access_token=${access_token}`,
3.跳转:
window.location.href = "";