说明:小程序客服消息接口,文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-message/customerServiceMessage.send.html
- 1.现在是发送了小程序文本链接,链接的地址是小程序的地址,点击该链接后,跳转到了小程序的首页,而不是链接中的小程序页面【两者的appid是一样的】
- 2.返回到微信,打开小程序客服消息,进去后 是同一个消息,通过小程序客服消息列表页面进去后,却可以跳转到 链接中的小程序页面。
appId:wx2c2e66ec0b516655
需要跳转的路径是:pages/maSearch
发送的文本消息是:请<a href=\"\" data-miniprogram-appid=\"wx2c2e66ec0b516655\" data-miniprogram-path=\"pages/maSearch\">点击</a>
文档没看着仔细,人家在概述你就讲了,用户在点击小程序链接的时候,需要获取到对应的路径和参数:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/customer-message.html
我写的代码如下
<!-- 接收用户消息 --> <button class="button" open-type="contact" bindcontact="handleContact" type="warn" plain="true">发送消息</button>
js
handleContact(e) { let queryString = Object.keys(e.detail.query).map(key => key + "=" + e.detail.query[key]).join("&"); let url = e.detail.path + "?" + queryString; wx.navigateTo({ url: url, }); }
说明一下:在使用测试的小程序是可以跳转到配置的页面的(不管是从小程序中直接跳转,还是返回到微信中点开小程序客服消息列表进去的,都可以跳转)。发完版之后,小程序中的消息是无法跳转的。
在小程序中客服消息页点击小程序链接或卡片,不是只会跳转到首页,是只会跳转(返回)到触发客服消息的那个小程序页,是正常情况哈。
一般跳到首页说明对应的页面不存在!