Kaynağa Gözat

oa移动端

yanghao 1 gün önce
ebeveyn
işleme
0dccd19e19
1 değiştirilmiş dosya ile 43 ekleme ve 5 silme
  1. 43 5
      src/views/index.vue

+ 43 - 5
src/views/index.vue

@@ -986,13 +986,51 @@ const handlePortalAppClick = async (app: PortalApp) => {
   }
 
   if (app.label === "OA办公") {
+    // if (userStore.getUser.username && getAccessToken()) {
+    //   const res = await ssoLogin({ username: userStore.getUser.username });
+    //   if (res) {
+    //     window.open(
+    //       `https://yfoa.keruioil.com/wui/index.html?ssoToken=${res}#/main`,
+    //       "_blank",
+    //     );
+    //   }
+    // } else {
+    //   router.push({ path: "/login" });
+    // }
+
     if (userStore.getUser.username && getAccessToken()) {
+      const ua = window.navigator.userAgent; // const ua = navigator.userAgent;
+      const isDesktop =
+        ua.includes("DingTalk") &&
+        (ua.includes("Windows") || ua.includes("Macintosh"));
+
+      let ua2 = navigator.userAgent.toLowerCase();
+      let isMobile = ua2.indexOf("dingtalk") > -1;
+
       const res = await ssoLogin({ username: userStore.getUser.username });
-      if (res) {
-        window.open(
-          `https://yfoa.keruioil.com/wui/index.html?ssoToken=${res}#/main`,
-          "_blank",
-        );
+      if (ua2.includes("dingtalk") || ua2.includes("dingtalkwork")) {
+        if (isMobile && !isDesktop) {
+          dd.biz.util.openLink({
+            url: `https://yfding.keruioil.com:9443/wxapi/wxclientmenu/a3c638fedfcd4945b58ec152a5bff0b7`,
+
+            onSuccess: () => {},
+          });
+        } else if (isDesktop) {
+          if (res) {
+            window.open(
+              `https://yfoa.keruioil.com/wui/index.html?ssoToken=${res}#/main`,
+              "_blank",
+            );
+          }
+        }
+      } else {
+        // 浏览器
+        if (res) {
+          window.open(
+            `https://yfoa.keruioil.com/wui/index.html?ssoToken=${res}#/main`,
+            "_blank",
+          );
+        }
       }
     } else {
       router.push({ path: "/login" });