yanghao 2 tuần trước cách đây
mục cha
commit
b7b642f2c2
1 tập tin đã thay đổi với 4 bổ sung44 xóa
  1. 4 44
      src/views/index.vue

+ 4 - 44
src/views/index.vue

@@ -149,9 +149,6 @@ const cards: Card[] = [
   },
 ];
 
-const loading2 = ref<any>(null);
-const redirect = ref<string>("");
-
 async function loginWithDingTalk() {
   const ddCorpId = import.meta.env.VITE_DD_CORPID;
   const ddClientId = import.meta.env.VITE_DD_CLIENTID;
@@ -163,36 +160,6 @@ async function loginWithDingTalk() {
     clientId: ddClientId,
     success: (res: any) => {
       const { code } = res;
-      // dingTalkLogin({ code, type: 10, state: new Date().getTime() }).then(
-      //   async (res) => {
-      //     console.log("res :>> ", res);
-      //     loading2.value = ElLoading.service({
-      //       lock: true,
-      //       text: "正在加载系统中...",
-      //       background: "rgba(0, 0, 0, 0.7)",
-      //     });
-
-      //     authUtil.setToken(res);
-
-      //     if (!redirect.value) {
-      //       redirect.value = "/";
-      //     }
-      //     if (redirect.value.indexOf("sso") !== -1) {
-      //       window.location.href = window.location.href.replace(
-      //         "/login?redirect=",
-      //         "",
-      //       );
-      //     } else {
-      //       router
-      //         .push({
-      //           path: redirect.value,
-      //         })
-      //         .then(() => {
-      //           loading2.value.close();
-      //         });
-      //     }
-      //   },
-      // );
 
       axios
         .post(
@@ -213,17 +180,10 @@ async function loginWithDingTalk() {
           console.log("钉钉免登res>>>>>>>>>>>>>>>>>>", res.data.data);
 
           authUtil.setToken(res.data.data);
-          if (!redirect.value) {
-            redirect.value = "/";
-          }
-
-          router
-            .push({
-              path: redirect.value,
-            })
-            .then(() => {
-              loading2.value.close();
-            });
+
+          router.replace({
+            path: "/",
+          });
         });
     },
     fail: (err: any) => {