微信小程序摸版消息测试

微信小程序摸版消息测试

工具/原料

1.VS+小程序


方法/步骤

2.目的:实现消息摸版的下发。结果:测试成功步骤:1.小程序不校验域名请求OpenId(个人开发者不行)2.界面弄个表单<view><form name='pushMsgFm' report-submit bindsubmit='orderSign'><view> 单号: 0</view><view>测试发送消息</view><button form-type=submit>发送模板消息</button></form></view>

3.3.点击事件(真机点击得到form_id: e.detail.formId,表单id只有真机才会有):

4.orderSign:function(e)

5.{

6.console.log(e.detail.formId),

7.wx.request({

8.url: 'http://localhost:9561/api/values',

9.data: {

10.Openid: oBU4-5beiAsSLu40efAxL0, //事先获取的OpenId不会过期而唯一

11.form_id: e.detail.formId,

12.},

13.method: POST,

14.dataType: JSON,

15.success: function (res) {

16.console.log(res.data);

17.},

18.fail: function (e) {

19.wx.showToast({

20.title: '网络请求错误!',

21.icon: 'loading',

22.duration: 1500

23.})

24.},

25.})

26.},


注意事项

27.原文:https://blog.csdn.net/weixin_42401291/article/details/84388699

原作者:应用猎人

TAG标签: 微信小程序摸版消息测试信小程序摸电脑软件电脑游戏数码

http://www.xiaochengxub.com/read-97493.html