xiebaomin 1 yıl önce
ebeveyn
işleme
f0f97d30b6

+ 25 - 23
src/main/resources/static/js/service-settlement/mixins/cmWXjssdk.js

@@ -23,7 +23,7 @@ var wxJssdkMixin = function () {
                             timestamp: data.timestamp, // 必填,生成签名的时间戳
                             nonceStr: data.noncestr, // 必填,生成签名的随机串
                             signature: data.signature, // 必填,签名
-                            jsApiList: this.jsApiList // 必填,需要使用的 JS 接口列表
+                            jsApiList: ['updateAppMessageShareData', 'onMenuShareAppMessage', 'updateTimelineShareData', 'onMenuShareTimeline'] // 必填,需要使用的 JS 接口列表
                         })
                         callback && callback(wx)
                         wx.error(function (err) {
@@ -38,7 +38,28 @@ var wxJssdkMixin = function () {
             setWxReady(wx) {
                 console.log('wx', wx)
                 wx.ready(function () {
-                    // wx.onMenuShareAppMessage({
+                    wx.onMenuShareAppMessage({
+                        title: '采美商城', // 分享标题
+                        desc: '采美商城', // 分享描述
+                        link: 'https://www.caimei365.com/serviceSettlement.html?id=0', // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
+                        imgUrl: 'https://static.caimei365.com/app/img/serviceProvider/H5/search-content-bg.png',
+                        success: () => {
+                        },
+                        fail: () => {
+                            window.location.reload();
+                        }
+                    })
+                    wx.onMenuShareTimeline({
+                        title: '采美商城', // 分享标题
+                        desc: '采美商城', // 分享描述
+                        link: 'https://www.caimei365.com/serviceSettlement.html?id=0', // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
+                        imgUrl: 'https://static.caimei365.com/app/img/serviceProvider/H5/search-content-bg.png',
+                        success: () => {
+                        },
+                        fail: () => {
+                        }
+                    })
+                    // wx.updateAppMessageShareData({
                     //     title: '采美商城', // 分享标题
                     //     desc: '采美商城', // 分享描述
                     //     link: 'https://www.caimei365.com/serviceSettlement.html?id=0', // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
@@ -49,7 +70,7 @@ var wxJssdkMixin = function () {
                     //         window.location.reload();
                     //     }
                     // })
-                    // wx.onMenuShareTimeline({
+                    // wx.updateTimelineShareData({
                     //     title: '采美商城', // 分享标题
                     //     desc: '采美商城', // 分享描述
                     //     link: 'https://www.caimei365.com/serviceSettlement.html?id=0', // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
@@ -57,28 +78,9 @@ var wxJssdkMixin = function () {
                     //     success: () => {
                     //     },
                     //     fail: () => {
+                    //         window.location.reload();
                     //     }
                     // })
-                    wx.updateAppMessageShareData({
-                        title: '采美商城', // 分享标题
-                        desc: '采美商城', // 分享描述
-                        link: 'https://www.caimei365.com/serviceSettlement.html?id=0', // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
-                        imgUrl: 'https://static.caimei365.com/app/img/serviceProvider/H5/search-content-bg.png',
-                        success: () => {
-                        },
-                        fail: () => {
-                        }
-                    })
-                    wx.updateTimelineShareData({
-                        title: '采美商城', // 分享标题
-                        desc: '采美商城', // 分享描述
-                        link: 'https://www.caimei365.com/serviceSettlement.html?id=0', // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
-                        imgUrl: 'https://static.caimei365.com/app/img/serviceProvider/H5/search-content-bg.png',
-                        success: () => {
-                        },
-                        fail: () => {
-                        }
-                    })
                 })
             }
         }