From dcae66557a69a9158132959c2c2f56ab4692d99e Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 05 Jan 2022 10:53:12 +0800
Subject: [PATCH] 登录逻辑修改

---
 src/api/user.js |  127 +++++++++++++++++++++---------------------
 1 files changed, 64 insertions(+), 63 deletions(-)

diff --git a/src/api/user.js b/src/api/user.js
index d6a803f..c4285c6 100644
--- a/src/api/user.js
+++ b/src/api/user.js
@@ -1,93 +1,94 @@
 import request from '@/router/axios';
 import website from "@/config/website";
 
-export const loginByUsername = (tenantId, username, password, type, key, code) => request({
-  url: '/api/blade-auth/oauth/token',
-  method: 'post',
-  headers: {
-    'Tenant-Id': tenantId,
-    'Captcha-Key': key,
-    'Captcha-Code': code,
-  },
-  params: {
-    tenantId,
-    username,
-    password,
-    grant_type: (website.captchaMode ? "captcha" : "password"),
-    scope: "all",
-    type
-  }
+export const loginByUsername = (tenantId, username, password, type, key, code, loginType) => request({
+    url: '/api/blade-auth/oauth/token',
+    method: 'post',
+    headers: {
+        'Tenant-Id': tenantId,
+        'Captcha-Key': key,
+        'Captcha-Code': code,
+    },
+    params: {
+        tenantId,
+        username,
+        password,
+        grant_type: (website.captchaMode ? "captcha" : "password"),
+        scope: "all",
+        type,
+        loginType
+    }
 });
 
 export const loginBySocial = (tenantId, source, code, state) => request({
-  url: '/api/blade-auth/oauth/token',
-  method: 'post',
-  headers: {
-    'Tenant-Id': tenantId
-  },
-  params: {
-    tenantId,
-    source,
-    code,
-    state,
-    grant_type: "social",
-    scope: "all",
-  }
+    url: '/api/blade-auth/oauth/token',
+    method: 'post',
+    headers: {
+        'Tenant-Id': tenantId
+    },
+    params: {
+        tenantId,
+        source,
+        code,
+        state,
+        grant_type: "social",
+        scope: "all",
+    }
 })
 
 export const refreshToken = (refresh_token, tenantId) => request({
-  url: '/api/blade-auth/oauth/token',
-  method: 'post',
-  headers: {
-    'Tenant-Id': tenantId
-  },
-  params: {
-    tenantId,
-    refresh_token,
-    grant_type: "refresh_token",
-    scope: "all",
-  }
+    url: '/api/blade-auth/oauth/token',
+    method: 'post',
+    headers: {
+        'Tenant-Id': tenantId
+    },
+    params: {
+        tenantId,
+        refresh_token,
+        grant_type: "refresh_token",
+        scope: "all",
+    }
 });
 
 export const registerGuest = (form, oauthId) => request({
-  url: '/api/blade-user/register-guest',
-  method: 'post',
-  params: {
-    tenantId: form.tenantId,
-    name: form.name,
-    account: form.account,
-    password: form.password,
-    oauthId
-  }
+    url: '/api/blade-user/register-guest',
+    method: 'post',
+    params: {
+        tenantId: form.tenantId,
+        name: form.name,
+        account: form.account,
+        password: form.password,
+        oauthId
+    }
 });
 
 export const getButtons = () => request({
-  url: '/api/blade-system/menu/buttons',
-  method: 'get'
+    url: '/api/blade-system/menu/buttons',
+    method: 'get'
 });
 
 export const getCaptcha = () => request({
-  url: '/api/blade-auth/oauth/captcha',
-  method: 'get'
+    url: '/api/blade-auth/oauth/captcha',
+    method: 'get'
 });
 
 export const logout = () => request({
-  url: '/api/blade-auth/oauth/logout',
-  method: 'get'
+    url: '/api/blade-auth/oauth/logout',
+    method: 'get'
 });
 
 export const getUserInfo = () => request({
-  url: '/api/blade-auth/oauth/user-info',
-  method: 'get'
+    url: '/api/blade-auth/oauth/user-info',
+    method: 'get'
 });
 
 export const sendLogs = (list) => request({
-  url: '/api/blade-auth/oauth/logout',
-  method: 'post',
-  data: list
+    url: '/api/blade-auth/oauth/logout',
+    method: 'post',
+    data: list
 });
 
 export const clearCache = () => request({
-  url: '/api/blade-auth/oauth/clear-cache',
-  method: 'get'
-});
+    url: '/api/blade-auth/oauth/clear-cache',
+    method: 'get'
+});
\ No newline at end of file

--
Gitblit v1.9.3