首页 > 编程知识 正文

模板消息怎么发送,小程序给用户发信息

时间:2023-05-04 04:50:54 阅读:149481 作者:1285

page({

数据: {

motto: 'Hello令人满意的黑裤子

userInfo: {},

has userinfo :假,

userOpenID: ',

cani use : wx.cani use (button.open-type.get userinfo ) )。

(,

test submit :函数(e ) {

var self=this;

let _ access _ token=' 10 _ kptn 5b A0 ixkfnrua3mnraynvby6jpms 3a I2 azju1dxj8hgixtwni2pw 56 wsyivlxpgybjy8CD---ZZ2IBC ln4ulzzibc

leturl=' https://API.weixin.QQ.com/CGI-bin/message/wx open/template/send? access_token=' _access_token

console.log (e.detail.formid : ) e.detail.form id );

let _jsonData={

access_token: _access_token,

touser : ' or sur 0f N2 kg G8 ud VFW 8j ll6z 5v WC ',

template _ id : ' tvye1nsu _ oorjozrrjd5ahdrfuxgbc 7cc0sue jy 9x go ',

form_id: e.detail.formId,

页: '页/索引/索引',

数据: {

“keyword1': { 'value': '测试数据1 ',' color': '#173177' },

“keyword2': { 'value': '测试数据2 ',' color': '#173177' },

}

}

wx.request({ (

url: url,

数据: _ JSON data,

方法: ' post ',

success :函数(RES ) {

console.log(res )

(,

fail :函数(err ) {

console.log('requestfail ',err );

(,

complete :函数{

console.log (请求已完成! ' );

}

() )

(,

onload :函数(

wx.login({

success :函数(RES ) {

if(RES.code ) {

console.log(RES.code;

} else {

console.log ('登录失败!' res.errMsg )

}

}

);

if(app.globaldata.userinfo ) {

this.setData({ (

userinfo : app.global data.userinfo,

hasUserInfo: true

() )

}elseif(this.data.caniuse ) )。

app.userinforeadycallback=RES={

this.setData({ (

userInfo: res.userInfo,

hasUserInfo: true

() )

}

} else {

没有与open-type=getUserInfo版本兼容的处理

wx.getUserInfo({ ((

success: res={

app.global data.userinfo=RES.userinfo

this.setData({ (

userInfo: res.userInfo,

hasUserInfo: true

() )

}

() )

}

}

() )

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。