代码片段:
formSubmit: e => { //console.log(e.detail.formID) wx.request({ url: "https://api.weixin.qq.com/cgi-bin/token?xxxxxxxx" , success: jieguo => { console.log(jieguo.data.access_token) wx.login({ success: res => { wx.request({ url: "https://api.weixin.qq.com/sns/jscode2session?yyyyyyy&js_code=" + res.code + "&grant_type=authorization_code" , success: info => { console.log(info.data.openid) wx.request({ url: "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" + jieguo.data.access_token, data: { touser: info.data.openid, template_id: "EYJ2_crt1IU9FSuJhxZhhkDrh6EVoX7hhhgAdDrFAjE" , page: "pages/guanliyuan/guanliyuan" , form_id: e.detail.formID, data: { |
然后返回
有些多此一举啊,为什么不在后端发送呢?还方便以后换模版什么的
你是说后台服务器嘛,刚开始做还没搭建,主要想试试api