소스 검색

srm移动端跳转

yanghao 1 주 전
부모
커밋
119efbfb21
1개의 변경된 파일39개의 추가작업 그리고 17개의 파일을 삭제
  1. 39 17
      src/views/flow/srmTodoMoblie.vue

+ 39 - 17
src/views/flow/srmTodoMoblie.vue

@@ -124,28 +124,50 @@ const goBackPage = async (row) => {
   const res = await srmLogin({
   const res = await srmLogin({
     username: userStore.getUser.username,
     username: userStore.getUser.username,
   });
   });
+  if (JSON.parse(res).msg === "账号未授权") {
+    dialogVisible.value = true;
+    return;
+  }
+
+  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();
+  let isMobile = ua2.indexOf("dingtalk") > -1;
   if (res) {
   if (res) {
-    const token = JSON.parse(res).msg;
-    const ua = window.navigator.userAgent.toLowerCase();
-
-    if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
-      dd.biz.util.openLink({
-        url: `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${token}`,
-        onSuccess: () => {
-          setTimeout(() => {
-            dd.biz.util.openLink({
-              url: `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`,
-            });
-          }, 300);
-        },
-      });
+    if (ua2.includes("dingtalk") || ua2.includes("dingtalkwork")) {
+      if (isMobile && !isDesktop) {
+        dd.biz.util.openLink({
+          url: `https://srm-m.deepoil.cc:7777?Authorization=${JSON.parse(res).msg}`,
+          // onSuccess: () => {
+          //   setTimeout(() => {
+          //     dd.biz.util.openLink({
+          //       url: `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`,
+          //     });
+          //   }, SRM_LOGIN_DELAY);
+          // },
+        });
+      } else if (isDesktop) {
+        dd.biz.util.openLink({
+          url: `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`,
+          onSuccess: () => {
+            setTimeout(() => {
+              dd.biz.util.openLink({
+                url: `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`,
+              });
+            }, SRM_LOGIN_DELAY);
+          },
+        });
+      }
     } else {
     } else {
       const newTab = window.open("", "_blank");
       const newTab = window.open("", "_blank");
-      newTab.location.href = `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${token}`;
-      setTimeout(() => {
+      newTab.location.href = `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`;
+      setTimeout(function () {
+        setTimeout(() => {}, 500);
         newTab.location.href = `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`;
         newTab.location.href = `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`;
-      }, 300);
+      }, SRM_LOGIN_DELAY);
     }
     }
   }
   }
 };
 };