Explorar el Código

getWxconfig隐藏

armg hace 2 semanas
padre
commit
998f039542
Se han modificado 1 ficheros con 41 adiciones y 38 borrados
  1. 41 38
      src/utils/index.ts

+ 41 - 38
src/utils/index.ts

@@ -189,45 +189,48 @@ export const toXiaoChengxu = (appid) => {
 
 // 获取微信API授权信息
 export const getWxconfig = () => {
+  // if(window.localStorage.getItem('agentFromAI') !== 'xlskf'){
+  //   return;
+  // }
   // const jsApiList = [ 'downloadFile', 'saveImageToPhotosAlbum', 'closeWindow', 'hideMenuItems'];
-  let url = window.location.href.split("#")[0];
-  const formData = new FormData();
-  formData.append('url', url);
-  formData.append('agent', '1');
-  wecomTicket(formData).then(response => {
-    if (response.StatusCode == 200) {
-      let qiyeData = response.Data;
-      wx.agentConfig({
-        debug: false,
-        corpid: qiyeData.appid,
-        agentid: qiyeData.agentID,
-        timestamp: qiyeData.timestamp,
-        nonceStr: qiyeData.noncestr,
-        signature: qiyeData.signature,
-        jsApiList: ["hideMenuItems"],
-        success: function (res) {
-          wx.hideMenuItems({
-            menuList: [
-              "menuItem:share:wechat",
-              "menuItem:openWithBrowser",
-              "menuItem:share:email",         // 通过邮件转发
-              "menuItem:copyUrl",
-              "menuItem:share:wechat_friend",
-              "menuItem:share:timeline",
-              "menuItem:share:appMessage",
-              "menuItem:openWithSafari"
-            ],
-            success: () => {
-              // console.log('菜单隐藏成功');
-            },
-            fail: (err) => {
-              // console.log('菜单隐藏失败:', err);
-            }
-          });
-        }
-      });
-    }
-  });
+  // let url = window.location.href.split("#")[0];
+  // const formData = new FormData();
+  // formData.append('url', url);
+  // formData.append('agent', '1');
+  // wecomTicket(formData).then(response => {
+  //   if (response.StatusCode == 200) {
+  //     let qiyeData = response.Data;
+  //     wx.agentConfig({
+  //       debug: false,
+  //       corpid: qiyeData.appid,
+  //       agentid: qiyeData.agentID,
+  //       timestamp: qiyeData.timestamp,
+  //       nonceStr: qiyeData.noncestr,
+  //       signature: qiyeData.signature,
+  //       jsApiList: ["hideMenuItems"],
+  //       success: function (res) {
+  //         wx.hideMenuItems({
+  //           menuList: [
+  //             "menuItem:share:wechat",
+  //             "menuItem:openWithBrowser",
+  //             "menuItem:share:email",         // 通过邮件转发
+  //             "menuItem:copyUrl",
+  //             "menuItem:share:wechat_friend",
+  //             "menuItem:share:timeline",
+  //             "menuItem:share:appMessage",
+  //             "menuItem:openWithSafari"
+  //           ],
+  //           success: () => {
+  //             // console.log('菜单隐藏成功');
+  //           },
+  //           fail: (err) => {
+  //             // console.log('菜单隐藏失败:', err);
+  //           }
+  //         });
+  //       }
+  //     });
+  //   }
+  // });
 }
 
 /**