Browse Source

判断是钉钉是移动还是pc修改

yanghao 2 days ago
parent
commit
c75f51c0e4
1 changed files with 5 additions and 9 deletions
  1. 5 9
      src/views/index.vue

+ 5 - 9
src/views/index.vue

@@ -988,10 +988,10 @@ const handlePortalAppClick = async (app: PortalApp) => {
 
       let ua2 = navigator.userAgent.toLowerCase();
       var isMobile = ua2.indexOf("dingtalk") > -1;
-      if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+      if (ua2.includes("dingtalk") || ua2.includes("dingtalkwork")) {
         if (isMobile && !isDesktop) {
           dd.biz.util.openLink({
-            url: "https://crm-tencent.xiaoshouyi.com/bff/spa/crmh5/index.html#/neo/startPage",
+            url: `https://crm-tencent.xiaoshouyi.com/bff/spa/crmh5/index.html#/neo/startPage?token=${getAccessToken()}`,
 
             onSuccess: () => {},
           });
@@ -1089,7 +1089,7 @@ const handlePortalAppClick = async (app: PortalApp) => {
       let ua2 = navigator.userAgent.toLowerCase();
       var isMobile = ua2.indexOf("dingtalk") > -1;
 
-      if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+      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/home`,
@@ -1115,7 +1115,6 @@ const handlePortalAppClick = async (app: PortalApp) => {
   }
 
   if (app.label === "供应商管理(SRM)") {
-    alert("判断点击SRM");
     if (userStore.getUser.username && getAccessToken()) {
       const ua = window.navigator.userAgent;
       const isDesktop =
@@ -1125,8 +1124,6 @@ const handlePortalAppClick = async (app: PortalApp) => {
       let ua2 = navigator.userAgent.toLowerCase();
       let isMobile = ua2.indexOf("dingtalk") > -1;
 
-      alert(`isMobile: ${isMobile}>>>>>>>>>>>>isDesktop: ${isDesktop}`);
-      // alert(`isDesktop: ${isDesktop}`);
       const res = await srmLogin({
         username: userStore.getUser.username,
       });
@@ -1136,10 +1133,9 @@ const handlePortalAppClick = async (app: PortalApp) => {
         return;
       }
 
-      if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
-        alert("SRM判断是钉钉");
+      if (ua2.includes("dingtalk") || ua2.includes("dingtalkwork")) {
         if (isMobile && !isDesktop) {
-          alert("SRM判断是钉钉手机端登录");
+          // alert("SRM判断是钉钉手机端登录");
           dd.biz.util.openLink({
             url: `https://srm-m.deepoil.cc:7777/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`,