Kaynağa Gözat

ehr crm移动端跳转

yanghao 3 gün önce
ebeveyn
işleme
0be43e134b
2 değiştirilmiş dosya ile 49 ekleme ve 12 silme
  1. 9 7
      src/views/flow/index.vue
  2. 40 5
      src/views/index.vue

+ 9 - 7
src/views/flow/index.vue

@@ -232,7 +232,7 @@ import { useUserStore } from "@/stores/useUserStore";
 import { useThemeStore } from "@/stores/useThemeStore";
 import { getAccessToken } from "@/utils/auth";
 import { useRouter } from "vue-router";
-import dd from "dingtalk-jsapi";
+import * as dd from "dingtalk-jsapi";
 const router = useRouter();
 import { ElLoading, ElMessage } from "element-plus";
 const userStore = useUserStore();
@@ -502,13 +502,15 @@ const go = async (item) => {
       const ua = window.navigator.userAgent.toLowerCase();
       if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
         if (window.dd) {
-          // https://crm-tencent.xiaoshouyi.com
-
-          dd.biz.util.openLink({
-            url: "https://crm-tencent.xiaoshouyi.com",
+          const newTab = window.open("", "_blank");
+          newTab.location.href =
+            item.indexUrl +
+            "/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=" +
+            getAccessToken();
 
-            onSuccess: () => {},
-          });
+          setTimeout(function () {
+            newTab.location.href = item.flowUrl;
+          }, 3000);
         } else if (window.DingTalkPC) {
           const newTab = window.open("", "_blank");
           newTab.location.href =

+ 40 - 5
src/views/index.vue

@@ -980,9 +980,30 @@ const handlePortalAppClick = async (app: PortalApp) => {
   }
 
   if (app.label === "客户管理(CRM)") {
-    protectedOpen(
-      `https://crm-tencent.xiaoshouyi.com/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=${getAccessToken()}`,
-    );
+    if (userStore.getUser.username && getAccessToken()) {
+      const ua = window.navigator.userAgent.toLowerCase();
+      if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+        if (window.dd) {
+          dd.biz.util.openLink({
+            url: "https://crm-tencent.xiaoshouyi.com/bff/spa/crmh5/index.html#/neo/startPage",
+
+            onSuccess: () => {},
+          });
+        } else if (window.DingTalkPC) {
+          window.open(
+            `https://crm-tencent.xiaoshouyi.com/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=${getAccessToken()}`,
+            "_blank",
+          );
+        }
+      } else {
+        window.open(
+          `https://crm-tencent.xiaoshouyi.com/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=${getAccessToken()}`,
+          "_blank",
+        );
+      }
+    } else {
+      router.push({ path: "/login" });
+    }
   }
 
   if (app.label === "设备管理(PMS)") {
@@ -1054,8 +1075,22 @@ const handlePortalAppClick = async (app: PortalApp) => {
       const res = await ehrLogin({
         username: userStore.getUser.username,
       });
-
-      if (res) {
+      const ua = window.navigator.userAgent.toLowerCase();
+      if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+        if (window.dd) {
+          dd.biz.util.openLink({
+            url: `${res.ehrUrl}/gateway/login/free?loginfree_licence=${res.licence}&signature=${res.sign}&redirect_url=/proxy/h5/home`,
+
+            onSuccess: () => {},
+          });
+        } else if (window.DingTalkPC) {
+          window.open(
+            `${res.ehrUrl}/gateway/login/free?loginfree_licence=${res.licence}&signature=${res.sign}&redirect_url=${res.redirect}`,
+            "_blank",
+          );
+        }
+      } else {
+        // 浏览器环境
         window.open(
           `${res.ehrUrl}/gateway/login/free?loginfree_licence=${res.licence}&signature=${res.sign}&redirect_url=${res.redirect}`,
           "_blank",