yanghao 2 天之前
父節點
當前提交
64ce1f2d2a
共有 5 個文件被更改,包括 104 次插入38 次删除
  1. 1 0
      index.html
  2. 45 16
      src/views/flow/index.vue
  3. 28 10
      src/views/flow/oaDoneList.vue
  4. 28 10
      src/views/flow/todoList.vue
  5. 2 2
      src/views/login.vue

+ 1 - 0
index.html

@@ -7,6 +7,7 @@
     <title>%VITE_APP_TITLE%</title>
     <script src="https://g.alicdn.com/dingding/dinglogin/0.0.5/ddLogin.js"></script>
     <script src='https://g.alicdn.com/code/npm/@ali/dingtalk-h5-remote-debug/0.1.3/index.js'></script>
+    <script src="https://g.alicdn.com/dingding/open-develop/1.9.2/dingtalk.js"></script>
     <!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/js-base64@3.6.0/base64.min.js"></script> -->
   </head>
   <body>

+ 45 - 16
src/views/flow/index.vue

@@ -181,7 +181,6 @@ import { useUserStore } from "@/stores/useUserStore";
 import { getAccessToken } from "@/utils/auth";
 import * as echarts from "echarts";
 import { useRouter } from "vue-router";
-import { pa } from "element-plus/es/locales.mjs";
 const router = useRouter();
 
 const userStore = useUserStore();
@@ -413,28 +412,58 @@ const go = async (item) => {
       });
 
       if (res) {
-        const newTab = window.open("", "_blank");
+        const ua = window.navigator.userAgent.toLowerCase();
+        if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+          const targetUrl1 = item.indexUrl + "?ssoToken=" + res + "#/main";
+          const targetUrl2 = item.flowUrl;
+          dd.biz.util.openLink({
+            url: targetUrl1, // 先跳你的 SSO 链接
+            onSuccess: () => {
+              // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
+              setTimeout(() => {
+                dd.biz.util.openLink({ url: targetUrl2 });
+              }, 100);
+            },
+          });
+        } else {
+          const newTab = window.open("", "_blank");
+
+          newTab.location.href = item.indexUrl + "?ssoToken=" + res + "#/main";
+
+          setTimeout(function () {
+            newTab.location.href = item.flowUrl;
+          }, 100);
+        }
+      }
+    }
 
-        newTab.location.href = item.indexUrl + "?ssoToken=" + res + "#/main";
+    if (item.type === "CRM") {
+      const ua = window.navigator.userAgent.toLowerCase();
+      if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+        dd.biz.util.openLink({
+          url:
+            item.indexUrl +
+            "/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=" +
+            getAccessToken(), // 先跳你的 SSO 链接
+          onSuccess: () => {
+            // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
+            setTimeout(() => {
+              dd.biz.util.openLink({ url: item.flowUrl });
+            }, 100);
+          },
+        });
+      } else {
+        const newTab = window.open("", "_blank");
+        newTab.location.href =
+          item.indexUrl +
+          "/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=" +
+          getAccessToken();
 
         setTimeout(function () {
           newTab.location.href = item.flowUrl;
         }, 100);
       }
     }
-
-    if (item.type === "CRM") {
-      const newTab = window.open("", "_blank");
-
-      newTab.location.href =
-        item.indexUrl +
-        "/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=" +
-        getAccessToken();
-
-      setTimeout(function () {
-        newTab.location.href = item.flowUrl;
-      }, 100);
-    }
   } else {
     router.push({ path: "/login" });
   }

+ 28 - 10
src/views/flow/oaDoneList.vue

@@ -223,17 +223,35 @@ const goBackPage = async (row) => {
   });
 
   if (res) {
-    const newTab = window.open("", "_blank");
+    const ua = window.navigator.userAgent.toLowerCase();
+    if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+      dd.biz.util.openLink({
+        url:
+          "https://yfoa.keruioil.com/wui/index.html" +
+          "?ssoToken=" +
+          res +
+          "#/main", // 先跳你的 SSO 链接
+        onSuccess: () => {
+          // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
+          setTimeout(() => {
+            dd.biz.util.openLink({
+              url: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`,
+            });
+          }, 100);
+        },
+      });
+    } else {
+      const newTab = window.open("", "_blank");
+      newTab.location.href =
+        "https://yfoa.keruioil.com/wui/index.html" +
+        "?ssoToken=" +
+        res +
+        "#/main";
 
-    newTab.location.href =
-      "https://yfoa.keruioil.com/wui/index.html" +
-      "?ssoToken=" +
-      res +
-      "#/main";
-
-    setTimeout(function () {
-      newTab.location.href = `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`;
-    }, 100);
+      setTimeout(function () {
+        newTab.location.href = `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`;
+      }, 100);
+    }
   }
 };
 

+ 28 - 10
src/views/flow/todoList.vue

@@ -185,17 +185,35 @@ const goBackPage = async (row) => {
   });
 
   if (res) {
-    const newTab = window.open("", "_blank");
-
-    newTab.location.href =
-      "https://yfoa.keruioil.com/wui/index.html" +
-      "?ssoToken=" +
-      res +
-      "#/main";
+    const ua = window.navigator.userAgent.toLowerCase();
+    if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+      dd.biz.util.openLink({
+        url:
+          "https://yfoa.keruioil.com/wui/index.html" +
+          "?ssoToken=" +
+          res +
+          "#/main", // 先跳你的 SSO 链接
+        onSuccess: () => {
+          // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
+          setTimeout(() => {
+            dd.biz.util.openLink({
+              url: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`,
+            });
+          }, 100);
+        },
+      });
+    } else {
+      const newTab = window.open("", "_blank");
+      newTab.location.href =
+        "https://yfoa.keruioil.com/wui/index.html" +
+        "?ssoToken=" +
+        res +
+        "#/main";
 
-    setTimeout(function () {
-      newTab.location.href = `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`;
-    }, 100);
+      setTimeout(function () {
+        newTab.location.href = `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`;
+      }, 100);
+    }
   }
 };
 

+ 2 - 2
src/views/login.vue

@@ -21,7 +21,7 @@
         <h1 class="text-2xl font-bold text-center">登录</h1>
 
         <!-- 用户名密码登陆 -->
-        <!-- <div>
+        <div>
           <el-form
             :model="form"
             :rules="rules"
@@ -62,7 +62,7 @@
               >
             </div>
           </div>
-        </div> -->
+        </div>
 
         <!-- 钉钉登陆 -->
         <div class="text-center">