在我的活动页加入分享

This commit is contained in:
2024-02-08 17:09:48 +08:00
parent 4daf63fb9e
commit 3303fb79a7
2 changed files with 111 additions and 0 deletions

View File

@@ -211,6 +211,25 @@
});
},
methods: {
// 分享给好友
onShareAppMessage: function() {
wx.showShareMenu(
{
withShareTicket:true,
menu:['111','222']
}
)
},
// 分享到朋友圈
onShareTimeline() {
return {
title: '公司团建', // 分享出的卡片标题
path: '/pages/home/cloudCard2', // 他人通过卡片进入小程序的路径可以在后面拼接URL的形式带参数
imageUrl: '/static/logo_icon.png', // 分享出去的图片默认为当前页面的截图。图片路径可以是本地文件路径或者网络图片路径。支持PNG及JPG。
};
},
setEnrollRequiredName(){
let enrollRequiredName = ""
if (this.page.activityDetails.enrollRequired.onRealName == 1){

View File

@@ -297,6 +297,7 @@
<script>
import fuiButton from "@/components/firstui/fui-dropdown-menu/fui-dropdown-menu.vue"
export default {
components: {
"fuiButton": fuiButton
},
@@ -491,6 +492,97 @@
},
methods: {
// 分享给好友
onShareAppMessage: function(res) {
// console.log("res", res)
// console.log("data", res.target.dataset)
// var data = res.target.dataset.info
// // ①
// let shareData = JSON.stringify({
// // params: {
// // code: data.code,
// // codeKey: data.codeKey,
// // customerSid: ''
// // },
// // functionName: 'bindCard',
// // url: '/pages/detail/detail_affeection?sid=' + data.sid
// url: '/pages/home/cloudCard2?shareSid=' + getApp().globalData.sid,
// functionName: 'share'
// })
// // 转码传输
// let value = encodeURIComponent(shareData)
// return {
// title: '汇融惠享-云菜窖',
// // ②
// path: '/pages/login/login?data=' + value,
// imageUrl: 'https://supervise.yxtsoft.com/lpk/image/share_invite.png', //自定义图片路径,显示图片长宽比是 5:4。
// success: function(res) {
// console.log('aaaa', "分享成功")
// },
// fail: function(res) {
// // 转发失败
// console.log('aaaa', "用户点击了取消")
// }
// }
let _this = this
const promise = new Promise(resolve => {
// 模拟网络请求
setTimeout(() => {
var params = {
customerSid: getApp().globalData.sid
}
_this.$api.recommendNewUsers(params).then((resp) => {
let shareData = JSON.stringify({
// params: {
// code: resp.transferCode,
// codeKey: resp.sid
// },
// functionName: 'bindCard',
// url: '/pages/bind/bind_cloudCard?code=' + resp
// .transferCode + "&codeKey=" + resp.sid
url: '/pages/home/myCellar?shareSid=' + getApp()
.globalData.sid + "&orderSid=" + resp.sid,
functionName: 'share'
})
// 转码传输
let value = encodeURIComponent(shareData)
resolve({
title: '汇融惠享-云菜窖',
// ②
path: '/pages/login/login?data=' + value,
imageUrl: 'https://supervise.yxtsoft.com/lpk/image/share_invite.png', //自定义图片路径,显示图片长宽比是 5:4。
})
}).catch(e => {
_this.shortToast('发生错误,请稍后再试.')
return
})
}, 0)
})
return promise
},
// 分享到朋友圈
onShareTimeline() {
return {
title: '邀请您使用汇融云菜窖小程序', // 分享出的卡片标题
path: '/pages/home/cloudCard2', // 他人通过卡片进入小程序的路径可以在后面拼接URL的形式带参数
imageUrl: '/static/logo_icon.png', // 分享出去的图片默认为当前页面的截图。图片路径可以是本地文件路径或者网络图片路径。支持PNG及JPG。
};
},
backClick() {
let that = this
uni.showModal({