Explorar el Código

fix: oa sso修改

yanghao hace 3 semanas
padre
commit
d5205ec773
Se han modificado 3 ficheros con 12 adiciones y 31 borrados
  1. 2 2
      src/api/user.ts
  2. 10 22
      src/components/home/CardItem.vue
  3. 0 7
      vite.config.ts

+ 2 - 2
src/api/user.ts

@@ -42,8 +42,8 @@ export const login = (data: UserLoginVO) => {
 // SSO登录
 export const ssoLogin = (data: any) => {
   return request.post({
-    url: "/admin-api/system/auth/portal/login",
-
+    url: "/admin-api/system/auth/oaSsoToken",
+    headers: { "Content-Type": "application/json" },
     data,
   });
 };

+ 10 - 22
src/components/home/CardItem.vue

@@ -68,7 +68,6 @@ import { ssoLogin } from "@/api/user";
 import { useUserStore } from "@/stores/useUserStore";
 import { getAccessToken } from "@/utils/auth";
 const userStore = useUserStore();
-import axios from "axios";
 
 const router = useRouter();
 
@@ -102,27 +101,16 @@ const handleView = async (item: Item) => {
 
   if (item.label === "OA办公系统") {
     if (userStore.getUser.username && getAccessToken()) {
-      const res = axios
-        .post(
-          "/api/oa",
-          {
-            appid: "d4a44f9d-e5d7-41d5-a582-fc1efcc936c4",
-            loginid: userStore.getUser.username,
-          },
-          {
-            headers: {
-              "Content-Type": `application/x-www-form-urlencoded`,
-            },
-          }
-        )
-        .then((res) => {
-          if (res.status === 200) {
-            window.open(
-              "https://yfoa.keruioil.com/wui/index.html?ssoToken=" + res.data,
-              "_blank"
-            );
-          }
-        });
+      const res = await ssoLogin({
+        username: userStore.getUser.username,
+      });
+
+      if (res) {
+        window.open(
+          "https://yfoa.keruioil.com/wui/index.html?ssoToken=" + res,
+          "_blank"
+        );
+      }
     } else {
       window.open("https://yfoa.keruioil.com", "_blank");
     }

+ 0 - 7
vite.config.ts

@@ -14,13 +14,6 @@ export default defineConfig({
   server: {
     host: "0.0.0.0", // 监听所有网络接口
     port: 5173, // 可选:指定端口
-    proxy: {
-      "/api/oa": {
-        target: "https://yfoa.keruioil.com/ssologin/getToken",
-        changeOrigin: true,
-        rewrite: (path) => path.replace(/^\/api\/oa/, ""),
-      },
-    },
   },
   base: "./",
   plugins: [