|
@@ -19,11 +19,10 @@ const jsApiList = [
|
19
|
19
|
'onMenuShareQZone'
|
20
|
20
|
]
|
21
|
21
|
|
22
|
|
-function init() {
|
23
|
|
- const url = location.origin + location.pathname
|
|
22
|
+function init(url) {
|
24
|
23
|
request(`https://api.h5.njyunzhi.com/mp/jssdk?url=${encodeURIComponent(url)}`).then((res) => {
|
25
|
24
|
window.wx.config({
|
26
|
|
- debug: true, // process.env.NODE_ENV === 'development', // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
25
|
+ debug: process.env.NODE_ENV === 'development', // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
27
|
26
|
appId: res.appId, // 必填,公众号的唯一标识
|
28
|
27
|
timestamp: res.timestamp, // 必填,生成签名的时间戳
|
29
|
28
|
nonceStr: res.nonceStr, // 必填,生成签名的随机串
|
|
@@ -33,7 +32,7 @@ function init() {
|
33
|
32
|
})
|
34
|
33
|
}
|
35
|
34
|
|
36
|
|
-init()
|
|
35
|
+// init()
|
37
|
36
|
|
38
|
37
|
/**
|
39
|
38
|
* 分享到好友或者QQ
|
|
@@ -65,6 +64,7 @@ export function shareTimeline(opt) {
|
65
|
64
|
* @param {*} opt
|
66
|
65
|
*/
|
67
|
66
|
export function share(opt) {
|
|
67
|
+ init(opt.link)
|
68
|
68
|
window.wx.ready(function() {
|
69
|
69
|
jsApiList.map((apiName) => {
|
70
|
70
|
const api = window.wx[apiName]
|