Kaynağa Gözat

oa单点修改

yanghao 2 hafta önce
ebeveyn
işleme
60e29c7e97

+ 9 - 1
src/api/user.ts

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

+ 6 - 33
src/views/flow/oaDoneList.vue

@@ -214,46 +214,19 @@ const handleSizeChange = (size) => {
 
 const goBackPage = async (row) => {
   const res = await ssoLogin({
-    username: userStore.getUser.username,
+    workcode: userStore.getUser.username,
+    uri: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`,
   });
 
-  if (res) {
+  if (JSON.parse(res).ssoUrl) {
     const ua = window.navigator.userAgent.toLowerCase();
     if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
       dd.biz.util.openLink({
-        url:
-          "https://yfoa.keruioil.com/wui/index.html" +
-          "?ssoToken=" +
-          res +
-          "#/main", // 先跳你的 SSO 链接
-        onSuccess: () => {
-          // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
-          setTimeout(() => {
-            dd.biz.util.openLink({
-              url: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`,
-            });
-          }, 100);
-        },
+        url: JSON.parse(res).ssoUrl, // 先跳你的 SSO 链接
+        onSuccess: () => {},
       });
     } else {
-      const loading = ElLoading.service({
-        lock: true,
-        text: "正在跳转,请稍候...",
-        background: "rgba(0, 0, 0, 0.7)",
-      });
-      const newTab = window.open("", "_blank");
-      newTab.location.href =
-        "https://yfoa.keruioil.com/wui/index.html" +
-        "?ssoToken=" +
-        res +
-        "#/main";
-
-      setTimeout(function () {
-        newTab.location.href = `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`;
-        setTimeout(() => {
-          loading.close();
-        }, 500);
-      }, 100);
+      window.open(JSON.parse(res).ssoUrl, "_blank");
     }
   }
 };

+ 6 - 33
src/views/flow/todoList.vue

@@ -182,46 +182,19 @@ const pagination = ref({
 
 const goBackPage = async (row) => {
   const res = await ssoLogin({
-    username: userStore.getUser.username,
+    workcode: userStore.getUser.username,
+    uri: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`,
   });
 
-  if (res) {
+  if (JSON.parse(res).ssoUrl) {
     const ua = window.navigator.userAgent.toLowerCase();
     if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
       dd.biz.util.openLink({
-        url:
-          "https://yfoa.keruioil.com/wui/index.html" +
-          "?ssoToken=" +
-          res +
-          "#/main", // 先跳你的 SSO 链接
-        onSuccess: () => {
-          // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
-          setTimeout(() => {
-            dd.biz.util.openLink({
-              url: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`,
-            });
-          }, 100);
-        },
+        url: JSON.parse(res).ssoUrl, // 先跳你的 SSO 链接
+        onSuccess: () => {},
       });
     } else {
-      const loading = ElLoading.service({
-        lock: true,
-        text: "正在跳转,请稍候...",
-        background: "rgba(0, 0, 0, 0.7)",
-      });
-      const newTab = window.open("", "_blank");
-      newTab.location.href =
-        "https://yfoa.keruioil.com/wui/index.html" +
-        "?ssoToken=" +
-        res +
-        "#/main";
-
-      setTimeout(function () {
-        newTab.location.href = `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`;
-        setTimeout(() => {
-          loading.close();
-        }, 500);
-      }, 100);
+      window.open(JSON.parse(res).ssoUrl, "_blank");
     }
   }
 };

+ 15 - 118
src/views/index.vue

@@ -1062,18 +1062,6 @@ const handlePortalAppClick = async (app: PortalApp) => {
   }
 
   if (app.label === "OA办公") {
-    // if (userStore.getUser.username && getAccessToken()) {
-    //   const res = await ssoLogin({ username: userStore.getUser.username });
-    //   if (res) {
-    //     window.open(
-    //       `https://yfoa.keruioil.com/wui/index.html?ssoToken=${res}#/main`,
-    //       "_blank",
-    //     );
-    //   }
-    // } else {
-    //   router.push({ path: "/login" });
-    // }
-
     if (userStore.getUser.username && getAccessToken()) {
       const ua = window.navigator.userAgent; // const ua = navigator.userAgent;
       const isDesktop =
@@ -1429,138 +1417,47 @@ onMounted(async () => {
 
 const handleNoticeItemClick = async (notice: any) => {
   const res = await ssoLogin({
-    username: userStore.getUser.username,
+    workcode: userStore.getUser.username,
+    uri: `https://yfoa.keruioil.com/spa/document/index.jsp?openAttachment=0&id=${notice.id}`,
   });
 
-  if (res) {
-    const ua = window.navigator.userAgent.toLowerCase();
-    if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
-      dd.biz.util.openLink({
-        url:
-          "https://yfoa.keruioil.com/wui/index.html" +
-          "?ssoToken=" +
-          res +
-          "#/main", // 先跳你的 SSO 链接
-        onSuccess: () => {
-          // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
-          setTimeout(() => {
-            dd.biz.util.openLink({
-              url: `https://yfoa.keruioil.com/spa/document/index.jsp?openAttachment=0&id=${notice.id}`,
-            });
-          }, 100);
-        },
-      });
-    } else {
-      const loading = ElLoading.service({
-        lock: true,
-        text: "正在跳转,请稍候...",
-        background: "rgba(0, 0, 0, 0.7)",
-      });
-      const newTab = window.open("", "_blank");
-      newTab.location.href =
-        "https://yfoa.keruioil.com/wui/index.html" +
-        "?ssoToken=" +
-        res +
-        "#/main";
-
-      setTimeout(function () {
-        newTab.location.href = `https://yfoa.keruioil.com/spa/document/index.jsp?openAttachment=0&id=${notice.id}`;
-        setTimeout(() => {
-          loading.close();
-        }, 500);
-      }, 100);
-    }
-  }
+  window.open(JSON.parse(res).ssoUrl, "_blank");
 };
 
 const handleTask = async (row: any) => {
   const res = await ssoLogin({
-    username: userStore.getUser.username,
+    workcode: userStore.getUser.username,
+    uri: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`,
   });
 
-  if (res) {
+  if (JSON.parse(res).ssoUrl) {
     const ua = window.navigator.userAgent.toLowerCase();
     if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
       dd.biz.util.openLink({
-        url:
-          "https://yfoa.keruioil.com/wui/index.html" +
-          "?ssoToken=" +
-          res +
-          "#/main", // 先跳你的 SSO 链接
-        onSuccess: () => {
-          // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
-          setTimeout(() => {
-            dd.biz.util.openLink({
-              url: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`,
-            });
-          }, 100);
-        },
+        url: JSON.parse(res).ssoUrl, // 先跳你的 SSO 链接
+        onSuccess: () => {},
       });
     } else {
-      const loading = ElLoading.service({
-        lock: true,
-        text: "正在跳转,请稍候...",
-        background: "rgba(0, 0, 0, 0.7)",
-      });
-      const newTab = window.open("", "_blank");
-      newTab.location.href =
-        "https://yfoa.keruioil.com/wui/index.html" +
-        "?ssoToken=" +
-        res +
-        "#/main";
-
-      setTimeout(function () {
-        newTab.location.href = `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`;
-        setTimeout(() => {
-          loading.close();
-        }, 500);
-      }, 100);
+      window.open(JSON.parse(res).ssoUrl, "_blank");
     }
   }
 };
 
 const openConsult = async () => {
   const res = await ssoLogin({
-    username: userStore.getUser.username,
+    workcode: userStore.getUser.username,
+    uri: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1778289187850#/main/workflow/req?iscreate=1&workflowid=488`,
   });
 
-  if (res) {
+  if (JSON.parse(res).ssoUrl) {
     const ua = window.navigator.userAgent.toLowerCase();
     if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
       dd.biz.util.openLink({
-        url:
-          "https://yfoa.keruioil.com/wui/index.html" +
-          "?ssoToken=" +
-          res +
-          "#/main", // 先跳你的 SSO 链接
-        onSuccess: () => {
-          // 延迟跳目标业务地址(和你原来 setTimeout 逻辑一致)
-          setTimeout(() => {
-            dd.biz.util.openLink({
-              url: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1778289187850#/main/workflow/req?iscreate=1&workflowid=488`,
-            });
-          }, 100);
-        },
+        url: JSON.parse(res).ssoUrl, // 先跳你的 SSO 链接
+        onSuccess: () => {},
       });
     } else {
-      const loading = ElLoading.service({
-        lock: true,
-        text: "正在跳转,请稍候...",
-        background: "rgba(0, 0, 0, 0.7)",
-      });
-      const newTab = window.open("", "_blank");
-      newTab.location.href =
-        "https://yfoa.keruioil.com/wui/index.html" +
-        "?ssoToken=" +
-        res +
-        "#/main";
-
-      setTimeout(function () {
-        newTab.location.href = `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1778289187850#/main/workflow/req?iscreate=1&workflowid=488`;
-        setTimeout(() => {
-          loading.close();
-        }, 500);
-      }, 100);
+      window.open(JSON.parse(res).ssoUrl, "_blank");
     }
   }
 };

+ 2 - 2
src/views/login.vue

@@ -21,7 +21,7 @@
         <h1 class="text-2xl font-bold text-center text-black/90">登录</h1>
 
         <!-- 用户名密码登陆 -->
-        <!-- <div>
+        <div>
           <el-form
             :model="form"
             :rules="rules"
@@ -62,7 +62,7 @@
               >
             </div>
           </div>
-        </div> -->
+        </div>
 
         <!-- 钉钉登陆 -->
         <div class="text-center">