1234567891011121314151617 |
- const appid="wxcacf6eb6e7478e29";
- function setwxconfig(data){
- alert(JSON.stringify(data));
- wx.config({
- debug:true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
- appId:appid, // 必填,企业号的唯一标识,此处填写企业号corpid
- timestamp:data.timestamp , // 必填,生成签名的时间戳
- nonceStr:data.nonceStr, // 必填,生成签名的随机串
- signature: data.signature,// 必填,签名,见附录1
- jsApiList:['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
- });
- wx.error(function(res){
- alert(asd);
- // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
- alert(JSON.stringify(res));
- });
- }
|