|
|
@ -12,6 +12,11 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
localPath: '', |
|
|
|
localPath: '', |
|
|
|
shareLink: '', |
|
|
|
shareLink: '', |
|
|
|
|
|
|
|
shareH5:{ |
|
|
|
|
|
|
|
title: '嗨森逛分享', // 分享标题
|
|
|
|
|
|
|
|
link:"", // 分享链接
|
|
|
|
|
|
|
|
imgUrl: 'https://hsg.dctpay.com/filesystem/wxApplets/logo.png', // 分享图标
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
@ -23,8 +28,12 @@ export default { |
|
|
|
let that = this; |
|
|
|
let that = this; |
|
|
|
// let theUrl = window.location.href;
|
|
|
|
// let theUrl = window.location.href;
|
|
|
|
that.localPath = window.location.href; |
|
|
|
that.localPath = window.location.href; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
that.shareLink = app.globalData.h5url + '?accountId=0000016&key=&code=' + that.localPath.split('#')[1]; |
|
|
|
that.shareLink = app.globalData.h5url + '?accountId=0000016&key=&code=' + that.localPath.split('#')[1]; |
|
|
|
// console.log(theUrl.split('#')[0],decodeURIComponent(theUrl.split('#')[1]),theUrl,"theUrl",that.shareLink,"that.shareLink");
|
|
|
|
|
|
|
|
|
|
|
|
that.$set(this.shareH5,"link",that.shareLink) |
|
|
|
|
|
|
|
|
|
|
|
let datas = { |
|
|
|
let datas = { |
|
|
|
url: that.localPath.split('#')[0] |
|
|
|
url: that.localPath.split('#')[0] |
|
|
@ -57,47 +66,14 @@ export default { |
|
|
|
wx.ready(function() { //需在用户可能点击分享按钮前就先调用
|
|
|
|
wx.ready(function() { //需在用户可能点击分享按钮前就先调用
|
|
|
|
|
|
|
|
|
|
|
|
/* 分享给朋友 */ |
|
|
|
/* 分享给朋友 */ |
|
|
|
wx.updateAppMessageShareData({ |
|
|
|
wx.updateAppMessageShareData(that.shareH5); |
|
|
|
title: '嗨森逛分享', // 分享标题
|
|
|
|
|
|
|
|
// desc: '', // 分享描述
|
|
|
|
|
|
|
|
link: that.shareLink, // 分享链接
|
|
|
|
|
|
|
|
imgUrl: 'https://hsg.dctpay.com/filesystem/wxApplets/logo.png', // 分享图标
|
|
|
|
|
|
|
|
success: function(res) { |
|
|
|
|
|
|
|
// 回调函数
|
|
|
|
|
|
|
|
// uni.showToast({
|
|
|
|
|
|
|
|
// title: '分享成功',
|
|
|
|
|
|
|
|
// duration: 2000,
|
|
|
|
|
|
|
|
// icon: 'none'
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
cancel: function(r) {}, |
|
|
|
|
|
|
|
fail: function(res) {} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 自定义“分享到朋友圈” */ |
|
|
|
/* 自定义“分享到朋友圈” */ |
|
|
|
wx.updateTimelineShareData({ |
|
|
|
wx.updateTimelineShareData(that.shareH5); |
|
|
|
title: '嗨森逛分享', // 分享标题
|
|
|
|
|
|
|
|
// desc: '', // 分享描述
|
|
|
|
|
|
|
|
link: that.shareLink, // 分享链接
|
|
|
|
|
|
|
|
imgUrl: 'https://hsg.dctpay.com/filesystem/wxApplets/logo.png', // 分享图标
|
|
|
|
|
|
|
|
success: function(res) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// uni.showToast({
|
|
|
|
|
|
|
|
// title: '分享成功',
|
|
|
|
|
|
|
|
// duration: 2000,
|
|
|
|
|
|
|
|
// icon: 'none'
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
cancel: function(r) {}, |
|
|
|
|
|
|
|
fail: function(res) {} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// wx.error(function(res) {
|
|
|
|
|
|
|
|
// console.log(res);
|
|
|
|
|
|
|
|
// // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: res.return_msg, |
|
|
|
title: res.return_msg, |
|
|
@ -110,24 +86,8 @@ export default { |
|
|
|
//获取当前路由
|
|
|
|
//获取当前路由
|
|
|
|
getCurrentRouteYm() { |
|
|
|
getCurrentRouteYm() { |
|
|
|
let currentRoutes = getCurrentPages(); // 获取当前打开过的页面路由数组
|
|
|
|
let currentRoutes = getCurrentPages(); // 获取当前打开过的页面路由数组
|
|
|
|
|
|
|
|
|
|
|
|
console.log(currentRoutes[currentRoutes.length - 1]); |
|
|
|
console.log(currentRoutes[currentRoutes.length - 1]); |
|
|
|
let route = currentRoutes[currentRoutes.length - 1]; |
|
|
|
let route = currentRoutes[currentRoutes.length - 1]; |
|
|
|
// let currentRoute = currentRoutes[currentRoutes.length - 1].route //获取当前页面路由
|
|
|
|
|
|
|
|
// let currentParam = currentRoutes[currentRoutes.length - 1].options; //获取路由参数
|
|
|
|
|
|
|
|
// // 拼接参数
|
|
|
|
|
|
|
|
// let param = [];
|
|
|
|
|
|
|
|
// for (let key in currentParam) {
|
|
|
|
|
|
|
|
// param.push(key + '=' + currentParam[key])
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// let currentPath = '/' + currentRoute;
|
|
|
|
|
|
|
|
// let currentQuery = param.join('&');
|
|
|
|
|
|
|
|
// if (currentQuery) currentPath += '?' + currentQuery;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return {
|
|
|
|
|
|
|
|
// path: currentPath,
|
|
|
|
|
|
|
|
// query: currentQuery,
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
return decodeURIComponent(route.$page.fullPath) |
|
|
|
return decodeURIComponent(route.$page.fullPath) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -142,6 +102,12 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// onShow(){
|
|
|
|
|
|
|
|
// this.$nextTick(()=>{
|
|
|
|
|
|
|
|
// console.log(this.shareLink,this.shareH5,"this.shareLink---share--onshows")
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// },
|
|
|
|
/* 小程序分享 */ |
|
|
|
/* 小程序分享 */ |
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
onShareAppMessage(res) { |
|
|
|
onShareAppMessage(res) { |
|
|
|