From 8e4ab7acddbdb84fd755acf7e75cf471f50cba60 Mon Sep 17 00:00:00 2001 From: houzhongjian <houzhongyi@126.com> Date: 星期四, 31 十月 2024 10:16:47 +0800 Subject: [PATCH] 优化部分页面及配置 --- src/api/login/index.ts | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/api/login/index.ts b/src/api/login/index.ts index c354be2..bc3b924 100644 --- a/src/api/login/index.ts +++ b/src/api/login/index.ts @@ -1,5 +1,8 @@ import request from '@/config/axios' -import type { UserLoginVO } from './types' +import {Oauth2TokenVO, UserLoginVO} from './types' +import { config } from '@/config/axios/config' + +const { plat_url} = config export interface SmsCodeVO { mobile: string @@ -13,31 +16,38 @@ // 登录 export const login = (data: UserLoginVO) => { - return request.post({ url: '/system/auth/login', data }) + return request.post({ url: plat_url + '/system/auth/login', data }) +} + +// 密码授权登录 +export const oauth2Login = (data: Oauth2TokenVO) => { + return request.post({ url: plat_url + '/system/oauth2/token?' // 客户端 + + "client_id=" + data.clientId + + "&client_secret=" + data.clientSecret, data }) } // 使用租户名,获得租户编号 export const getTenantIdByName = (name: string) => { - return request.get({ url: '/system/tenant/get-id-by-name?name=' + name }) + return request.get({ url: plat_url + '/system/tenant/get-id-by-name?name=' + name }) } // 登出 export const loginOut = () => { - return request.post({ url: '/system/auth/logout' }) + return request.post({ url: plat_url + '/system/auth/logout' }) } // 获取用户权限信息 export const getInfo = () => { - return request.get({ url: '/system/auth/get-permission-info' }) + return request.get({ url: plat_url + '/system/auth/get-permission-info' }) } // 获取验证图片以及 token export const getCode = (data) => { - return request.postOriginal({ url: 'captcha/get', data }) + return request.postOriginal({ url: plat_url + '/system/captcha/get', data }) } // 滑动或者点选验证 export const reqCheck = (data) => { - return request.postOriginal({ url: 'captcha/check', data }) + return request.postOriginal({ url: plat_url + '/system/captcha/check', data }) } -- Gitblit v1.9.3