|
@@ -37,23 +37,21 @@ function initSDK (url) {
|
37
|
37
|
export function share (opt = {}) {
|
38
|
38
|
const { origin, pathname } = window.location
|
39
|
39
|
// const defaultLink = origin + pathname
|
40
|
|
- const url=origin+pathname
|
41
|
|
- const defaultImg = `${url}img/share.jpg`
|
|
40
|
+ const defaultImg = `${origin}${pathname}img/share.jpg`
|
42
|
41
|
|
43
|
42
|
const link = window.location.href.split('#')[0]
|
44
|
|
- const imgUrl = defaultImg
|
|
43
|
+ const imgUrl = opt.imgUrl || defaultImg
|
45
|
44
|
|
46
|
45
|
initSDK(link)
|
47
|
|
-
|
48
|
46
|
window.wx.ready(function () {
|
49
|
47
|
jsApiList.map((apiName) => {
|
50
|
48
|
const fn = window.wx[apiName]
|
51
|
49
|
if (typeof fn === 'function') {
|
52
|
50
|
fn({
|
53
|
|
- title:'为岸线圆梦,摩天轮圆满大作战!', // 分享标题
|
|
51
|
+ title: opt.title || '为岸线圆梦,摩天轮圆满大作战!', // 分享标题
|
54
|
52
|
link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
55
|
53
|
imgUrl, // 分享图标
|
56
|
|
- desc: '快来助力华侨城欢乐滨江摩天轮挂轿厢',
|
|
54
|
+ desc: opt.desc || '快来助力华侨城欢乐滨江摩天轮挂轿厢',
|
57
|
55
|
success: () => {
|
58
|
56
|
console.log(apiName + ' 执行成功')
|
59
|
57
|
}
|