Commit cd91a926 by MichaelJier

feat

1. 支持微信分享纳入邀请
parent b5b60b1c
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
return { return {
title: this.channelInfo.shareTitle || this.channelInfo.channelName, title: this.channelInfo.shareTitle || this.channelInfo.channelName,
desc: this.channelInfo.shareSubTitle || window.location.href, desc: this.channelInfo.shareSubTitle || window.location.href,
link: window.location.href, link: this.updateQueryStringParameter(window.location.href, 'refererId', this.userInfo.id || 0),
imgUrl: this.channelInfo.shareImgUrl || this.channelInfo.mpsBackgroundUrl, imgUrl: this.channelInfo.shareImgUrl || this.channelInfo.mpsBackgroundUrl,
success() { success() {
self.shareSuccessBack(); self.shareSuccessBack();
...@@ -45,6 +45,19 @@ export default { ...@@ -45,6 +45,19 @@ export default {
} }
}, },
methods: { methods: {
updateQueryStringParameter(uri, key, value) {
if (!value) {
return uri;
}
const re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
const separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, '$1' + key + "=" + value + '$2');
}
else {
return uri + separator + key + "=" + value;
}
},
_toggleShare(bol) { _toggleShare(bol) {
if (UserAgent.isWx()) { if (UserAgent.isWx()) {
this.isShow = bol; this.isShow = bol;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment