微信模板消息提示
form: function (e) {
var that = this;
var fId = e.detail.formId;
// 网络请求
var l = ‘https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=’ + that.data.access_token;
// 需要传的参数
var d = {
touser: that.data.openid, //用户的openid
template_id: ‘XX1hceIwI1XiQaUc5Z4qIrZnYQkYEHElSq5m6yIa0M8’,//这个是申请的模板消息id,位置在微信公众平台/模板消息中添加并获取
page: ‘/pages/index/index’, //点击通知跳转的页面
form_id: fId,
data: {
“keyword1”: {
“value”: “酒店”,
“color”: “#4a4a4a”
},
“keyword2”: {
“value”: “2018-03-22”,
“color”: “#9b9b9b”,
},
“keyword3”: {
“value”: “$300”,
“color”: “#9b9b9b”
}
},
color: ‘#ccc’,
emphasis_keyword: ‘keyword1.DATA’
}
wx.request({
url: l,
data: d,
method: ‘POST’, //此处不能有请求头
success: function (res) {
console.log(res, “push msg”);
},
fail: function (err) {
console.log(err, “push err”);
}
});
},
还有这个access_token该怎么获取??