楼主最后问题是什么?怎么解决的?
公众号推送模版消息跳转小程序指定页面,跳转不成功?只会打开小程序[图片]
11-26使用开发者工具,单独打开路径是能跳转的
服务号模版消息跳转小程序无法到指定页面,只能跳转到首页,使用的是SDK4.4.0,是什么原因了?maven: com.github.binarywangweixin-java-mp4.4.0 java 关键代码: public String sendTemplateMessage(String templateId, String openId, String miniProgramAppId, String miniProgramPagePath, List data) { try { WxMpTemplateMessage message = WxMpTemplateMessage.builder() .toUser(openId) .templateId(templateId) .data(data) .build(); // message.setMiniProgram(new WxMpTemplateMessage.MiniProgram( // miniProgramAppId, // miniProgramPagePath, // true // )); WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram(); miniProgram.setAppid(miniProgramAppId); miniProgram.setPagePath(miniProgramPagePath); miniProgram.setUsePath(true); message.setMiniProgram(miniProgram); return templateMsgService.sendTemplateMsg(message); } catch (WxErrorException e) { log.error("模板消息发送失败: {}", e.getError().getErrorMsg()); throw new RuntimeException("发送模板消息失败", e); } } 调用关键方法: String msgId = wechatTemplateMessageService.sendTemplateMessage(wxYijiabaoConfig.getTemplateIdNewOrder(), wechatAccount.getMpOpenid(), wxMaProperties.getConfigs().get(1).getAppid(), "pages/redirect/redirect?path=pages/order/index", data); log.info("向社工发送模板消息成功【支付订单】 - {}", msgId); app.json { "pages": [ "pages/home/index", "pages/customer/index", "pages/customer/family-avatar", "pages/order/index", "pages/me/index", "pages/customer/detail", "pages/customer/add-family", "pages/login/index", "pages/login/mobile", "pages/me/me-card", "pages/order/detail", "pages/order/comment", "pages/collect/index", "pages/chat/item", "pages/im/index", "pages/redirect/redirect" ], "subPackages": [ { "root": "packageC", "pages": [ "pages/member/share", "pages/share/share", "pages/share/bind-worker", "pages/service/detail" ] }, { "root": "packageA", "pages": [ "pages/im/chat" ] } ], "window": { "navigationBarTextStyle": "black", "navigationBarTitleText": "益家保", "navigationBarBackgroundColor": "#F5F5F5", "backgroundColor": "#F5F5F5" }, "tabBar": { "color": "#333333", "selectedColor": "#FF5D2C", "borderStyle": "black", "backgroundColor": "#ffffff", "list": [ { "pagePath": "pages/home/index", "iconPath": "/static/image/tabbar/home.png", "selectedIconPath": "static/image/tabbar/home1.png", "text": "首页" }, { "pagePath": "pages/customer/index", "iconPath": "/static/image/tabbar/customer.png", "selectedIconPath": "/static/image/tabbar/customer1.png", "text": "客户" }, { "pagePath": "pages/order/index", "iconPath": "/static/image/tabbar/order.png", "selectedIconPath": "/static/image/tabbar/order1.png", "text": "订单" }, { "pagePath": "pages/me/index", "iconPath": "/static/image/tabbar/me.png", "selectedIconPath": "/static/image/tabbar/me1.png", "text": "我的" } ] }, "requiredPrivateInfos": [ "getLocation", "chooseLocation" ], "permission": { "scope.userLocation": { "desc": "用于发送位置消息,为您提供位置分享功能" } }, "ignoredFiles": [ "**/*.test.js", "**/*.spec.js", "unpackage/**/*", "node_modules/**/*" ], "usingComponents": {} } 由于我真正要跳转的是tabBar(pages/order/index),,所以搞了一个中间页来调整 : <template> <view> <!-- 空白页,仅用于跳转 --> </view> </template> <script> export default { data() { return { } }, onLoad(options) { console.log(' 中间页接收到的参数:', options) console.log(' 当前页面栈:', getCurrentPages()) const { path, query } = options // 延迟跳转,确保页面加载完成 setTimeout(() => { if (path) { // 如果是tabBar页面,使用switchTab if (this.isTabBarPage(path)) { uni.switchTab({ url: `/${path}${query ? '?' + query : ''}` }) } else { uni.redirectTo({ url: `/${path}${query ? '?' + query : ''}` }) } } else { // 默认跳转到我的名片 uni.switchTab({ url: '/pages/order/index' }) } }, 100) }, methods: { isTabBarPage(path) { const tabBarPages = [ 'pages/order/index', ] return tabBarPages.includes(path) }, } } </script> <style scoped lang="scss"> .redirect-page { display: flex; justify-content: center; align-items: center; height: 100vh; } .loading-text { font-size: 16px; color: #666; } </style>
11-25服务号模版消息,,能正常跳转到正式环境的小程序,但是无法跳转到指定的页面。 使用的sdk为: com.github.binarywangweixin-java-mp4.4.0 关键代码: public String sendTemplateMessage(String templateId, String openId, String miniProgramAppId, String miniProgramPagePath, List<WxMpTemplateData> data) { try { WxMpTemplateMessage message = WxMpTemplateMessage.builder() .toUser(openId) .templateId(templateId) .data(data) .build(); // message.setMiniProgram(new WxMpTemplateMessage.MiniProgram( // miniProgramAppId, // miniProgramPagePath, // true // )); WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram(); miniProgram.setAppid(miniProgramAppId); miniProgram.setPagePath(miniProgramPagePath); miniProgram.setUsePath(true); message.setMiniProgram(miniProgram); return templateMsgService.sendTemplateMsg(message); } catch (WxErrorException e) { log.error("模板消息发送失败: {}", e.getError().getErrorMsg()); throw new RuntimeException("发送模板消息失败", e); } }
由公众号模板跳转到小程序怎吗配置跳转到测试环境?由公众号模板跳转到小程序怎吗配置跳转到测试环境?
11-25我 今天更新版本也出现了一模一样的问题,上午还好好的,晚上更新版本后,就是这个问题了。
更新开发者工具后,用hbuilderx编译的项目报错,不知道是怎么回事?项目是用HBuilderx开发的,以前没问题,今天更新了一下开发者工具,再运行时就报TypeError: Cannot read property 'wx' of undefined;但是用手机真机调试又没问题,不知道这是怎么回事 [图片]
10-26