Files
2026-03-08 20:07:52 +08:00

51 lines
1.6 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
// 分享到微信好友、朋友圈
import {
mapGetters
} from "vuex";
export default {
computed: mapGetters(['uid']),
data() {
return {
share: {
title: '', // 转发的标题
path: '', // 转发的路径,默认是当前页面,必须是以‘/’开头的完整路径,/pages/index/index
query: '' // 转发朋友圈中浏览器拼接参数
},
}
},
onLoad: function(options) {
let pages = getCurrentPages(),
view = pages[pages.length - 1];
let urlData = view.$page.fullPath;
if (urlData.indexOf('?') !== -1) {
urlData = urlData.includes("sd=") ? urlData : urlData + `&sd=${this.uid}`
} else {
urlData = urlData+`?sd=${this.uid}`;
}
this.share.path = urlData;
this.share.title = view.$vm.title;
this.share.query = urlData.split('?')[1];
},
// #ifdef MP
// 分享到微信好友
onShareAppMessage: function() {
//转发参数
return this.share
},
// 分享到朋友圈
onShareTimeline() {
return this.share
},
// #endif
}