Browse Source

srm单点

yanghao 2 weeks ago
parent
commit
a7cac4f80b
2 changed files with 28 additions and 0 deletions
  1. 9 0
      src/api/user.ts
  2. 19 0
      src/views/index.vue

+ 9 - 0
src/api/user.ts

@@ -48,6 +48,15 @@ export const ssoLogin = (data: any) => {
   });
 };
 
+// SRM SSO登录
+export const srmLogin = (data: any) => {
+  return request.post({
+    url: "/admin-api/system/auth/srm-sso-token",
+    headers: { "Content-Type": "application/json" },
+    data,
+  });
+};
+
 export const zentaoSsoLogin = (data: any) => {
   return request.post({
     url: "/admin-api/system/auth/zentaoSsoToken",

+ 19 - 0
src/views/index.vue

@@ -338,6 +338,7 @@ import {
   getNotices,
   getRedHeadFiles,
   getNews,
+  srmLogin,
 } from "@/api/user";
 import { useUserStore } from "@/stores/useUserStore";
 import { getAccessToken } from "@/utils/auth";
@@ -483,6 +484,7 @@ let boldLabes = ref([
   "项目管理(PM)",
   "鸿盘",
   "智能钻井",
+  "供应商管理(SRM)",
 ]);
 
 const getGreeting = () => {
@@ -682,6 +684,23 @@ const handlePortalAppClick = async (app: PortalApp) => {
     }
   }
 
+  if (app.label === "供应商管理(SRM)") {
+    if (userStore.getUser.username && getAccessToken()) {
+      const res = await srmLogin({
+        username: userStore.getUser.username,
+      });
+
+      if (res) {
+        window.open(
+          `https://srmqas.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`,
+          "_blank",
+        );
+      }
+    } else {
+      router.push({ path: "/login" });
+    }
+  }
+
   if (app.label === "智能钻井") {
     if (userStore.getUser.username && getAccessToken()) {
       window.open(`http://172.21.0.224:8001/#/login`, "_blank");