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

+ 22 - 1
src/views/index.vue

@@ -1116,6 +1116,13 @@ const handlePortalAppClick = async (app: PortalApp) => {
 
   if (app.label === "供应商管理(SRM)") {
     if (userStore.getUser.username && getAccessToken()) {
+      const ua = window.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 srmLogin({
         username: userStore.getUser.username,
       });
@@ -1125,7 +1132,21 @@ const handlePortalAppClick = async (app: PortalApp) => {
         return;
       }
 
-      if (res) {
+      if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+        if (isMobile && !isDesktop) {
+          dd.biz.util.openLink({
+            url: `https://srm-m.deepoil.cc:4430`,
+
+            onSuccess: () => {},
+          });
+        } else if (isDesktop) {
+          window.open(
+            `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`,
+            "_blank",
+          );
+        }
+      } else {
+        // 浏览器环境
         window.open(
           `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`,
           "_blank",