From 81e69cc8ac4473cb29868d533779357e70f52b17 Mon Sep 17 00:00:00 2001 From: zpc Date: Thu, 25 Jul 2024 00:14:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/common.js | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/common/common.js b/common/common.js index c9446f7..759bc76 100644 --- a/common/common.js +++ b/common/common.js @@ -463,27 +463,30 @@ export default { if (res.status == 1) { let _data = res.data; wx.config({ - debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 + debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId: _data.appId, timestamp: _data.timestamp, nonceStr: _data.noncestr, signature: _data.signature, jsApiList: [ 'checkJsApi', + 'showMenuItems', 'updateAppMessageShareData', + 'onMenuShareTimeline', ] }); wx.ready(function() { wx.checkJsApi({ jsApiList: [ 'openAddress', + 'onMenuShareTimeline', ], success: function(res) { - if (link.indexOf('http:') < 0 && link.indexOf( - 'https:') < 0) { - link = location.href.split('#')[0] + link; + if (link.indexOf('http:') < 0 && + link.indexOf('https:') < 0) { + link = location.href.split('#')[0] + "#" + link; } - + // alert('a') wx.updateAppMessageShareData({ title: title, // 分享标题 desc: desc, // 分享描述 @@ -493,6 +496,27 @@ export default { // 设置成功 } }) + uni.setClipboardData({ + data: `${link}` + }) + // alert('a1') + // wx.showMenuItems({ + // menuList: [ + // "menuItem:share:appMessage", + // "menuItem:share:timeline", + // "menuItem:share:qq", + // ] // 要显示的菜单项,所有menu项见附录3 + // }); + // alert('a3') + // wx.onMenuShareTimeline({ + // title: title, // 分享标题 + // link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 + // imgUrl: image, // 分享图标 + // success: function() { + // // 用户点击了分享后执行的回调函数 + // alert('用户点击了分享后执行的回调函数') + // } + // }) } });