zhujindu 11 months ago
parent
commit
32d83dfbb8
2 changed files with 16 additions and 1 deletions
  1. 2 1
      src/utils/TXApiFun.js
  2. 14 0
      src/views/home/index.vue

+ 2 - 1
src/utils/TXApiFun.js

@@ -110,7 +110,7 @@ export function getTicketFun(jsApiList = ['getLocation'], configType = 'config')
             timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
             nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
             signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
-            jsApiList: ['ready', 'onMenuShareAppMessage', ...jsApiList], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
+            jsApiList: ['ready', ...jsApiList], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
           });
           console.log('获取签名成功');
           resolve('获取签名成功');
@@ -136,6 +136,7 @@ export function getTicketFun(jsApiList = ['getLocation'], configType = 'config')
       } else {
         console.log('获取签名失败');
         reject('获取签名失败');
+        alert('获取签名失败');
       }
     });
   });

+ 14 - 0
src/views/home/index.vue

@@ -85,6 +85,20 @@ export default {
     }
   },
   created() {
+    getTicketFun(['onMenuShareAppMessage'], 'agentConfig').then(() => {
+      wx.onMenuShareAppMessage({
+        title: '企业微信',
+        desc: '让每个企业都有自己的微信',
+        link: 'https://work.weixin.qq.com/',
+        imgUrl: 'https://res.mail.qq.com/node/ww/wwmng/style/images/index_share_logo$13c64306.png',
+        success() {
+          // 用户确认分享后回调
+        },
+        cancel() {
+          // 用户取消分享后回调
+        },
+      });
+    });
     this.getDict();
   },
   methods: {