Просмотр исходного кода

Merge branch 'master' of http://1.94.244.160:3000/ruiqigogs/yf-portal-vue

Zimo 2 недель назад
Родитель
Сommit
0e984e00f1
3 измененных файлов с 5 добавлено и 63 удалено
  1. 0 4
      components.d.ts
  2. 0 12
      src/api/user.ts
  3. 5 47
      src/views/index.vue

+ 0 - 4
components.d.ts

@@ -14,14 +14,10 @@ declare module 'vue' {
     CardItem: typeof import('./src/components/home/CardItem.vue')['default']
     ElButton: typeof import('element-plus/es')['ElButton']
     ElCard: typeof import('element-plus/es')['ElCard']
-    ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
     ElDrawer: typeof import('element-plus/es')['ElDrawer']
     ElDropdown: typeof import('element-plus/es')['ElDropdown']
     ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
     ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
-    ElForm: typeof import('element-plus/es')['ElForm']
-    ElFormItem: typeof import('element-plus/es')['ElFormItem']
-    ElInput: typeof import('element-plus/es')['ElInput']
     ElTabPane: typeof import('element-plus/es')['ElTabPane']
     ElTabs: typeof import('element-plus/es')['ElTabs']
     ElTag: typeof import('element-plus/es')['ElTag']

+ 0 - 12
src/api/user.ts

@@ -47,15 +47,3 @@ export const ssoLogin = (data: any) => {
     data,
   });
 };
-
-export const dingTalkLogin = (data: {
-  code: string;
-  type: number;
-  state: number;
-}) => {
-  return request.post({
-    url: "/system/auth/h5SocialLogin",
-    data,
-    headers: { "tenant-id": 1 },
-  });
-};

+ 5 - 47
src/views/index.vue

@@ -66,11 +66,9 @@
 </template>
 
 <script setup lang="ts">
-import { onMounted, ref } from "vue";
+import { onMounted } from "vue";
 import * as authUtil from "@/utils/auth";
 import * as dd from "dingtalk-jsapi";
-import { ElLoading } from "element-plus";
-import { dingTalkLogin } from "@/api/user";
 import Header from "@components/home/header.vue";
 import CardItem from "@components/home/CardItem.vue";
 import Footer from "@components/home/Footer.vue";
@@ -149,9 +147,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 +158,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 +178,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.push({
+            path: "/login",
+          });
         });
     },
     fail: (err: any) => {