分享功能

This commit is contained in:
邓洁
2023-02-05 17:10:53 +08:00
parent 5819705f54
commit 6dfd04bb87
2 changed files with 44 additions and 2 deletions

View File

@@ -17,7 +17,9 @@
"delay": 0
},
/* */
"modules": {},
"modules": {
"Share": {}
},
/* */
"distribute": {
/* android */
@@ -43,7 +45,14 @@
/* ios */
"ios": {},
/* SDK */
"sdkConfigs": {}
"sdkConfigs": {
"share": {
"weixin": {
"appid": "wx8da30ba464a770ba",
"UniversalLinks": ""
}
}
}
}
},
/* */

View File

@@ -80,8 +80,41 @@
this.getBanner()
this.getImgUrl()
this.imgUrl = uni.getStorageSync('img_url')
wx.showShareMenu({
withShareTicket: true,
//设置下方的Menus菜单才能够让发送给朋友与分享到朋友圈两个按钮可以点击
menus: ["shareAppMessage", "shareTimeline"]
})
},
methods: {
//分享到微信好友
onShareAppMessage(res) {
// 此处的distSource为分享者的部分信息需要传递给其他人
let distSource = uni.getStorageSync('distSource');
if (distSource) {
return {
title: '食瞳',
type: 0,
path: '/pages/index/index?id=' + distSource,
summary: "",
imageUrl: "https://pupil.hchyun.com/uploads/product/zhanwei02.png"
}
}
},
//分享到朋友圈
onShareTimeline(res) {
let distSource = uni.getStorageSync('distSource');
if (distSource) {
return {
title: '食瞳',
type: 0,
query: 'id=' + distSource,
summary: "",
imageUrl: "https://pupil.hchyun.com/uploads/product/zhanwei02.png"
}
}
},
//获取按上架时间排列的产品列表length
getTimeLength(e) {
this.reachBottomLength = e