|
@@ -35,23 +35,21 @@ function initSDK (url) {
|
35
|
35
|
export function share (opt = {}) {
|
36
|
36
|
const { origin, pathname } = window.location
|
37
|
37
|
// const defaultLink = origin + pathname
|
38
|
|
- const url=origin+pathname
|
39
|
|
- const defaultImg = `${url}img/share.jpg`
|
|
38
|
+ const defaultImg = `${origin}${pathname}img/share.jpg`
|
40
|
39
|
|
41
|
40
|
const link = origin + pathname // window.location.href
|
42
|
|
- const imgUrl = defaultImg
|
|
41
|
+ const imgUrl = opt.imgUrl || defaultImg
|
43
|
42
|
|
44
|
43
|
initSDK(link)
|
45
|
|
-
|
46
|
44
|
window.wx.ready(function () {
|
47
|
45
|
jsApiList.map((apiName) => {
|
48
|
46
|
const fn = window.wx[apiName]
|
49
|
47
|
if (typeof fn === 'function') {
|
50
|
48
|
fn({
|
51
|
|
- title:'为岸线圆梦,摩天轮圆满大作战!', // 分享标题
|
|
49
|
+ title: opt.title || '为岸线圆梦,摩天轮圆满大作战!', // 分享标题
|
52
|
50
|
link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
53
|
51
|
imgUrl, // 分享图标
|
54
|
|
- desc: '快来助力华侨城欢乐滨江摩天轮挂轿厢'
|
|
52
|
+ desc: opt.desc || '快来助力华侨城欢乐滨江摩天轮挂轿厢'
|
55
|
53
|
})
|
56
|
54
|
}
|
57
|
55
|
})
|
|
@@ -68,7 +66,9 @@ export function Login () {
|
68
|
66
|
window.localStorage.setItem("token", e.token);//保存数据
|
69
|
67
|
|
70
|
68
|
try {
|
71
|
|
- share()
|
|
69
|
+ share({
|
|
70
|
+ desc: '快来助力华侨城欢乐滨江摩天轮挂轿厢'
|
|
71
|
+ })
|
72
|
72
|
} catch (error) {
|
73
|
73
|
console.error(error)
|
74
|
74
|
}
|