|
@@ -1,6 +1,6 @@
|
1
|
1
|
|
2
|
2
|
|
3
|
|
-function request(url, options) {
|
|
3
|
+function request (url, options) {
|
4
|
4
|
return fetch(url, options)
|
5
|
5
|
.then(response => response.json())
|
6
|
6
|
.then(data => {
|
|
@@ -19,7 +19,7 @@ const jsApiList = [
|
19
|
19
|
'onMenuShareQZone'
|
20
|
20
|
]
|
21
|
21
|
|
22
|
|
-function init(url) {
|
|
22
|
+function init (url) {
|
23
|
23
|
request(`https://api.h5.njyunzhi.com/mp/jssdk?url=${encodeURIComponent(url)}`).then((res) => {
|
24
|
24
|
window.wx.config({
|
25
|
25
|
debug: process.env.NODE_ENV === 'development',
|
|
@@ -38,8 +38,8 @@ function init(url) {
|
38
|
38
|
* 分享到好友或者QQ
|
39
|
39
|
* @param {*} opt
|
40
|
40
|
*/
|
41
|
|
-export function shareData(opt) {
|
42
|
|
- window.wx.ready(function() {
|
|
41
|
+export function shareData (opt) {
|
|
42
|
+ window.wx.ready(function () {
|
43
|
43
|
window.wx.updateAppMessageShareData({
|
44
|
44
|
title: opt.title,
|
45
|
45
|
desc: opt.desc,
|
|
@@ -49,8 +49,8 @@ export function shareData(opt) {
|
49
|
49
|
})
|
50
|
50
|
}
|
51
|
51
|
|
52
|
|
-export function shareTimeline(opt) {
|
53
|
|
- window.wx.ready(function() {
|
|
52
|
+export function shareTimeline (opt) {
|
|
53
|
+ window.wx.ready(function () {
|
54
|
54
|
window.wx.updateTimelineShareData({
|
55
|
55
|
title: opt.title,
|
56
|
56
|
link: opt.link,
|
|
@@ -63,9 +63,9 @@ export function shareTimeline(opt) {
|
63
|
63
|
* 分享全部
|
64
|
64
|
* @param {*} opt
|
65
|
65
|
*/
|
66
|
|
-export function share(opt) {
|
|
66
|
+export function share (opt) {
|
67
|
67
|
init(opt.link)
|
68
|
|
- window.wx.ready(function() {
|
|
68
|
+ window.wx.ready(function () {
|
69
|
69
|
jsApiList.map((apiName) => {
|
70
|
70
|
const api = window.wx[apiName]
|
71
|
71
|
api({
|