- wx-open-launch-weapp开放标签,path 后面不同的的参数怎样传给小程序?
请问,wx-open-launch-weapp开放标签,需要通过h5跳转小程序,并带流水号参数给小程序,path 这个值怎么通过if判断传入不同的参数?这里用的普通html5页面,本来可以跳转添加path判断以后跳转图片就不显示了,是判断的位置不对还是方法写错了求解答,谢谢 doShare(); function doShare() { let launch = document.getElementById('launch-btn') if(hxcjs.getUrlString("product_no").split("_")[1]=="YINGBAO"){ let path = `pages/index/index?source=wtProductB&to=h5tp&sourceType=wt&agentCode=${sales_agent}&linkUrl=${commonurl_front+'common/blank.html'}` launch.setAttribute('path',path) }else if(hxcjs.getUrlString("product_no").split("_")[1]=="YINGXIAO"){ let path = `pages/index/index?source=wtProduct&to=h5tp&sourceType=wt&agentCode=${sales_agent}&linkUrl=${commonurl_front+'common/blank.html'}` launch.setAttribute('path',path) } $.ajax({ url: 'https://uc-dev-bg.ihxlife.com/api/wechat/signatureinfo/get', data: { pageUrl: location.href.split('#')[0] }, type: 'GET', success: function (sdata) { var configData = { debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId: sdata.data.app_id, // timestamp: sdata.data.timestamp, nonceStr: sdata.data.nonceStr, signature: sdata.data.signature, jsApiList: ['showOptionMenu', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'hideMenuItems' ], // 必填,需要使用的JS接口列表,所有JS接口列表见附录2 openTagList: ['wx-open-launch-weapp'] }; // 加载微信SDK引入js wx.config(configData); wx.ready(function () { //alert('JS-SDK注册成功!可以使用了'); wx.showOptionMenu(); // console.log('link', link) }) } }) }
2023-01-09 - 点击确认不能跳转小程序,这是为什么?
https://img-mid.csdnimg.cn/release/static/image/mid/ask/990528017276117.png?x-oss-process=image/auto-orient,1/resize,w_320,m_lfit <div class="hktshare"> <div>会客厅</div> </div> <div class="del_mask" id="hktshare_pop" style="display: none;"> <div class="del_block"> <div class="del_content">即将打开"智能会客厅"小程序</div> <div> <div class="del_cancel" onclick="delhkt()">取消</div> <!-- <div class="del_sure" onclick="surehkt()">确定</div> --> <div class="wx_open_box"> <wx-open-launch-weapp id="launch-btn" username="gh_4b4a3e566703" path="pages/index/index?source=personalPlan&to=h5tp&linkUrl=https%3A%2F%2Fsales-dev.ihxlife.com%2Fimr%2Fyx_plan%2Fviews%2Fperson_plan%2Fper_produce_plan.html%3FagentCode%3D150007993%26agentState%3D0%26openid%3D%26planNo%3D2022041200000001%26createSource%3Dwmp%26pageName%3Dperson_plan"> <!-- <template> --> <button class="hktbtn" style="font-weight: 600;line-height: 1.6rem;font-size: 0.65rem;width: 49%;background-color: white;color: #4f7b97;">确认</button> <!-- </template> --> </wx-open-launch-weapp> </div> </div> </div> </div> <script src="https://sales-dev.ihxlife.com/HuaPM_V/bcard/h5/tpSwitch.js"></script> <script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> <script src="./lib/jquery-1.5.2.min.js"></script> <script src="./lib/jquery.qrcode.min.js?v=1.11"></script> <script> $.get("https://uc-dev-bg.ihxlife.com/api/v1/wechat/signatureinfo/get?pageUrl="+location.href.split('#')[0],function(data,status){ wx.config({ debug: true, // 调试时可开启 appId: 'wxfe7a30139d06a90e', // <!-- replace --> timestamp: data.data.timestamp, nonceStr: data.data.nonceStr, signature: data.data.signature, jsApiList: ["checkJsApi", "updateTimelineShareData", 'chooseImage', 'previewImage', 'onMenuShareTimeline', 'wx-open-launch-weapp' ], // 必填,随意一个接口即可 openTagList:['wx-open-launch-weapp'], // 填入打开小程序的开放标签名 }) wx.error(function (res) { alert(JSON.stringify(res)) }); // wx.navigateToMiniProgram({ // appId: 'wxfe7a30139d06a90e', // path: 'pages/index/index?source=personalPlan&to=h5tp&linkUrl=https%3A%2F%2Fsales-dev.ihxlife.com%2Fimr%2Fyx_plan%2Fviews%2Fperson_plan%2Fper_produce_plan.html%3FagentCode%3D150007993%26agentState%3D0%26openid%3D%26planNo%3D2022041200000001%26createSource%3Dwmp%26pageName%3Dperson_plan', // success(res) { // // 打开成功 // } // }) $('.hktbtn').click(() =>{ wx.miniProgram.navigateTo({ url:'pages/index/index?source=personalPlan&to=h5tp&linkUrl=https%3A%2F%2Fsales-dev.ihxlife.com%2Fimr%2Fyx_plan%2Fviews%2Fperson_plan%2Fper_produce_plan.html%3FagentCode%3D150007993%26agentState%3D0%26openid%3D%26planNo%3D2022041200000001%26createSource%3Dwmp%26pageName%3Dperson_plan' // 小程序配置路径 }) console.log("点击了会客厅") }) }); </script>
2023-01-03