ソースを参照

oa移动跳转

yanghao 9 時間 前
コミット
292f6dc18c
2 ファイル変更51 行追加19 行削除
  1. 32 16
      src/views/flow/index.vue
  2. 19 3
      src/views/index.vue

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

@@ -421,10 +421,16 @@ const go = async (item) => {
         username: userStore.getUser.username,
       });
       if (res) {
-        const ua = window.navigator.userAgent.toLowerCase();
+        const ua = window.navigator.userAgent; // const ua = navigator.userAgent;
+        const isDesktop =
+          ua.includes("DingTalk") &&
+          (ua.includes("Windows") || ua.includes("Macintosh"));
 
-        if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
-          if (window.dd) {
+        let ua2 = navigator.userAgent.toLowerCase();
+        let isMobile = ua2.indexOf("dingtalk") > -1;
+
+        if (ua2.includes("dingtalk") || ua2.includes("dingtalkwork")) {
+          if (isMobile && !isDesktop) {
             const targetUrl = item.appUrl;
             if (targetUrl) {
               dd.biz.util.openLink({
@@ -457,12 +463,12 @@ const go = async (item) => {
                 },
               });
             }
-          } else if (window.DingTalkPC) {
-            const loading = ElLoading.service({
-              lock: true,
-              text: "正在跳转,请稍候...",
-              background: "rgba(0, 0, 0, 0.7)",
-            });
+          } else if (isDesktop) {
+            // const loading = ElLoading.service({
+            //   lock: true,
+            //   text: "正在跳转,请稍候...",
+            //   background: "rgba(0, 0, 0, 0.7)",
+            // });
 
             const newTab = window.open("", "_blank");
             newTab.location.href =
@@ -471,7 +477,7 @@ const go = async (item) => {
             setTimeout(() => {
               newTab.location.href = item.flowUrl;
               setTimeout(() => {
-                loading.close();
+                // loading.close();
               }, 500);
             }, 100);
           } else {
@@ -554,16 +560,26 @@ const handleDetailClick = (task, categoryTitle) => {
   if (isMobile) {
     // 示例:根据类型跳转
     if (task.name === "OA" && categoryTitle === "我的待办") {
-      router.push({
-        path: "/mobile-todo-list",
-        query: { type: task.name.toLowerCase() },
+      // router.push({
+      //   path: "/mobile-todo-list",
+      //   query: { type: task.name.toLowerCase() },
+      // });
+      dd.biz.util.openLink({
+        url: `https://yfding.keruioil.com:9443/wxapi/wxclientmenu/d5605d17b3cd4c1987e333ab0d945070`,
+
+        onSuccess: () => {},
       });
     }
 
     if (task.name === "OA" && categoryTitle === "已办事项") {
-      router.push({
-        path: "/oa-done-list",
-        query: { type: task.name.toLowerCase() },
+      // router.push({
+      //   path: "/oa-done-list",
+      //   query: { type: task.name.toLowerCase() },
+      // });
+      dd.biz.util.openLink({
+        url: `https://yfding.keruioil.com:9443/wxapi/wxclientmenu/d5605d17b3cd4c1987e333ab0d945070`,
+
+        onSuccess: () => {},
       });
     }
 

+ 19 - 3
src/views/index.vue

@@ -762,12 +762,28 @@ const handleQuickAccessCommand = (command: string) => {
     "done-srm": "/srm-done-list?type=srm",
   };
 
-  // const target = routeMap[command];
   let target = null;
 
-  console.log("isMobile:", isMobile);
-
+  console.log("执行快捷访问:", command);
   if (isMobile) {
+    if (command === "todo-oa") {
+      dd.biz.util.openLink({
+        url: `https://yfding.keruioil.com:9443/wxapi/wxclientmenu/d5605d17b3cd4c1987e333ab0d945070`,
+
+        onSuccess: () => {},
+      });
+    }
+
+    if (command === "done-oa") {
+      dd.biz.util.openLink({
+        url: `https://yfding.keruioil.com:9443/wxapi/wxclientmenu/d5605d17b3cd4c1987e333ab0d945070`,
+
+        onSuccess: () => {},
+      });
+    }
+  }
+
+  if (isMobile && command !== "todo-oa" && command !== "done-oa") {
     target = routeMap2[command];
   } else {
     target = routeMap[command];