yanghao пре 5 дана
родитељ
комит
f213c9a51e
1 измењених фајлова са 37 додато и 5 уклоњено
  1. 37 5
      src/views/flow/index.vue

+ 37 - 5
src/views/flow/index.vue

@@ -239,6 +239,7 @@ import {
   getCRMTasks,
   getSRMTasks,
   getEHRTasks,
+  ehrLogin,
 } from "@/api/user";
 import { useUserStore } from "@/stores/useUserStore";
 import { useThemeStore } from "@/stores/useThemeStore";
@@ -555,6 +556,34 @@ const go = async (item) => {
         }, 3000);
       }
     }
+
+    if (item.type === "EHR") {
+      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();
+      var isMobile = ua2.indexOf("dingtalk") > -1;
+
+      const res = await ehrLogin({
+        username: userStore.getUser.username,
+      });
+      if (ua2.includes("dingtalk") || ua2.includes("dingtalkwork")) {
+        if (isMobile && !isDesktop) {
+          dd.biz.util.openLink({
+            url: `${res.ehrUrl}/gateway/login/free?loginfree_licence=${res.licence}&signature=${res.sign}&redirect_url=/proxy/h5/apply-v1?subModule=entry`,
+            onSuccess: () => {},
+          });
+        } else if (isDesktop) {
+          const newTab = window.open("", "_blank");
+          newTab.location.href = `${res.ehrUrl}/gateway/login/free?loginfree_licence=${res.licence}&signature=${res.sign}&redirect_url=${"/proxy/ess/approval-v1?subModule=apply"}`;
+        }
+      } else {
+        const newTab = window.open("", "_blank");
+        newTab.location.href = `${res.ehrUrl}/gateway/login/free?loginfree_licence=${res.licence}&signature=${res.sign}&redirect_url=${"/proxy/ess/approval-v1?subModule=apply"}`;
+      }
+    }
   } else {
     router.push({ path: "/login" });
   }
@@ -849,11 +878,14 @@ onMounted(async () => {
       statsLoading.value = false;
     }
 
-    statsTimer = setInterval(() => {
-      loadTaskStats().catch((error) => {
-        console.error("loadTaskStats interval failed:", error);
-      });
-    }, 10 * 60 * 1000);
+    statsTimer = setInterval(
+      () => {
+        loadTaskStats().catch((error) => {
+          console.error("loadTaskStats interval failed:", error);
+        });
+      },
+      10 * 60 * 1000,
+    );
   } else {
     statsLoading.value = false;
   }