yanghao 1 неделя назад
Родитель
Сommit
063ada03d9
2 измененных файлов с 72 добавлено и 28 удалено
  1. 36 14
      src/views/flow/crmDoneList.vue
  2. 36 14
      src/views/flow/crmTodoList.vue

+ 36 - 14
src/views/flow/crmDoneList.vue

@@ -292,8 +292,10 @@ import Header from "@components/home/header.vue";
 import { ref, onMounted } from "vue";
 import { getCRMTasks, ssoLogin } from "@/api/user";
 import { useUserStore } from "@/stores/useUserStore";
+import { getAccessToken } from "@/utils/auth";
 import { Icon } from "@iconify/vue";
 import router from "@/router";
+import * as dd from "dingtalk-jsapi";
 const userStore = useUserStore();
 
 const oaTasks = ref([]);
@@ -306,20 +308,40 @@ const pagination = ref({
 });
 
 const goBackPage = async (row) => {
-  // const res = await ssoLogin({
-  //   username: userStore.getUser.username,
-  // });
-  // if (res) {
-  //   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}`;
-  //   }, 50);
-  // }
+  if (userStore.getUser.username && getAccessToken()) {
+    const ua = window.navigator.userAgent.toLowerCase();
+    if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+      dd.biz.util.openLink({
+        url: `https://crm-tencent.xiaoshouyi.com/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=${getAccessToken()}`,
+
+        onSuccess: () => {
+          // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
+          setTimeout(() => {
+            dd.biz.util.openLink({
+              url: `https://crm-tencent.xiaoshouyi.com/bff/neoweb#/approval_workbench`,
+            });
+          }, 100);
+        },
+      });
+    } else {
+      const loading = ElLoading.service({
+        lock: true,
+        text: "正在跳转,请稍候...",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      const newTab = window.open("", "_blank");
+      newTab.location.href = `https://crm-tencent.xiaoshouyi.com/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=${getAccessToken()}`;
+
+      setTimeout(function () {
+        newTab.location.href = `https://crm-tencent.xiaoshouyi.com/bff/neoweb#/approval_workbench`;
+        setTimeout(() => {
+          loading.close();
+        }, 500);
+      }, 100);
+    }
+  } else {
+    router.push("/login");
+  }
 };
 
 const handleCurrentChange = async (page) => {

+ 36 - 14
src/views/flow/crmTodoList.vue

@@ -293,6 +293,8 @@ import Header from "@components/home/header.vue";
 import { ref, onMounted } from "vue";
 import { getCRMTasks, ssoLogin } from "@/api/user";
 import { useUserStore } from "@/stores/useUserStore";
+import { getAccessToken } from "@/utils/auth";
+import * as dd from "dingtalk-jsapi";
 import { Icon } from "@iconify/vue";
 import router from "@/router";
 const userStore = useUserStore();
@@ -342,20 +344,40 @@ const handleSizeChange = async (size) => {
 };
 
 const goBackPage = async (row) => {
-  // const res = await ssoLogin({
-  //   username: userStore.getUser.username,
-  // });
-  // if (res) {
-  //   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}`;
-  //   }, 50);
-  // }
+  if (userStore.getUser.username && getAccessToken()) {
+    const ua = window.navigator.userAgent.toLowerCase();
+    if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+      dd.biz.util.openLink({
+        url: `https://crm-tencent.xiaoshouyi.com/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=${getAccessToken()}`,
+
+        onSuccess: () => {
+          // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
+          setTimeout(() => {
+            dd.biz.util.openLink({
+              url: `https://crm-tencent.xiaoshouyi.com/bff/neoweb#/approval_workbench`,
+            });
+          }, 100);
+        },
+      });
+    } else {
+      const loading = ElLoading.service({
+        lock: true,
+        text: "正在跳转,请稍候...",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      const newTab = window.open("", "_blank");
+      newTab.location.href = `https://crm-tencent.xiaoshouyi.com/global/sso/callback/00APEB9EEEA9B2E338B686B7ECFA8585808C.action?token=${getAccessToken()}`;
+
+      setTimeout(function () {
+        newTab.location.href = `https://crm-tencent.xiaoshouyi.com/bff/neoweb#/approval_workbench`;
+        setTimeout(() => {
+          loading.close();
+        }, 500);
+      }, 100);
+    }
+  } else {
+    router.push("/login");
+  }
 };
 
 function timestampToDateTime(timestamp) {