From 5ff010cd85d6b338d9ce9968b9375cc5bef19c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=92=BB=E9=A3=8E?= <1090115880@qq.com> Date: Mon, 1 Mar 2021 20:30:00 +0800 Subject: [PATCH] 3-1 --- pages/index/index.vue | 73 +++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 6f3e30f..9a70f9e 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -125,15 +125,15 @@ - - @@ -285,10 +285,23 @@ this.getActivity() }, methods: { + // 子组件分享按钮 获取分享内容 打开分享面板 shareBtn(data){ this.isShow = true this.onShareData = data }, + // 分享面板 复制链接 + copyLink(){ + // /pages/goodsDetail/goodsDetail?id=' + this.onShareData.id + // https://h5.reecook.cn/#/goods/detail/14337/R7M1V9 + let url = `/pages/goodsDetail/goodsDetail?id=${this.onShareData.id}` + uni.setClipboardData({ + data: url, + success: function () { + console.log('success'); + } + }); + }, // 获取用户当前城市 getCityName() { uni.getLocation({ @@ -642,32 +655,38 @@ this.getGoodsList() }, onShareAppMessage(res) { - console.log(this.onShareData) - let shareObj = { - title: '', - path: "/pages/index/index?invite=" + this.$store.state.invitationNo, - imageUrl: '' - } if (res.from === 'button') { // 来自页面内分享按钮 - console.log(res) - if (res.target.dataset.title) { - shareObj = { - title: "我在买" + res.target.dataset.title + ",快来看看吧!", - path: '/pages/goodsDetail/goodsDetail?id=' + res.target.dataset.id + "&type=share&invite=" + this.$store.state.invitationNo, - imageUrl: this.IMAGE_URL + res.target.dataset.url - } - } else { - shareObj = { - title: uni.getStorageSync("userInfo").nickname + '正在邀请您加入瑞库客,0成本带您玩转副业', - path: '/pages/login/login?type=share&invite=' + this.$store.state.invitationNo, - imageUrl: this.STATIC_URL + 'invite.jpg' - } + return { + title: "我在买" + this.onShareData.name + ",快来看看吧!", + path: '/pages/goodsDetail/goodsDetail?id=' + this.onShareData.id + "&type=share&invite=" + this.$store.state.invitationNo, + imageUrl: this.IMAGE_URL + this.onShareData.url } - } else { + } + // let shareObj = { + // title: '', + // path: "/pages/index/index?invite=" + this.$store.state.invitationNo, + // imageUrl: '' + // } + // if (res.from === 'button') { // 来自页面内分享按钮 + // console.log(res) + // if (res.target.dataset.title) { + // shareObj = { + // title: "我在买" + res.target.dataset.title + ",快来看看吧!", + // path: '/pages/goodsDetail/goodsDetail?id=' + res.target.dataset.id + "&type=share&invite=" + this.$store.state.invitationNo, + // imageUrl: this.IMAGE_URL + res.target.dataset.url + // } + // } else { + // shareObj = { + // title: uni.getStorageSync("userInfo").nickname + '正在邀请您加入瑞库客,0成本带您玩转副业', + // path: '/pages/login/login?type=share&invite=' + this.$store.state.invitationNo, + // imageUrl: this.STATIC_URL + 'invite.jpg' + // } + // } + // } else { - } - console.log(shareObj) - return shareObj + // } + // console.log(shareObj) + // return shareObj }, }