mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-10-30 09:48:43 +08:00
feat: add vue3(element-plus)
This commit is contained in:
62
yudao-ui-admin-vue3/src/api/login/index.ts
Normal file
62
yudao-ui-admin-vue3/src/api/login/index.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { defHttp } from '@/config/axios'
|
||||
import { getRefreshToken } from '@/utils/auth'
|
||||
import type { UserLoginVO, TokenType, UserInfoVO } from './types'
|
||||
|
||||
export interface CodeImgResult {
|
||||
captchaOnOff: boolean
|
||||
img: string
|
||||
uuid: string
|
||||
}
|
||||
export interface SmsCodeVO {
|
||||
mobile: string
|
||||
scene: number
|
||||
}
|
||||
export interface SmsLoginVO {
|
||||
mobile: string
|
||||
code: string
|
||||
}
|
||||
|
||||
// 获取验证码
|
||||
export const getCodeImgApi = () => {
|
||||
return defHttp.get<CodeImgResult>({ url: '/system/captcha/get-image' })
|
||||
}
|
||||
|
||||
// 登录
|
||||
export const loginApi = (params: UserLoginVO) => {
|
||||
return defHttp.post<TokenType>({ url: '/system/auth/login', params })
|
||||
}
|
||||
|
||||
// 刷新访问令牌
|
||||
export const refreshToken = () => {
|
||||
return defHttp.post({ url: '/system/auth/refresh-token?refreshToken=' + getRefreshToken() })
|
||||
}
|
||||
|
||||
// 使用租户名,获得租户编号
|
||||
export const getTenantIdByNameApi = (name: string) => {
|
||||
return defHttp.get({ url: '/system/tenant/get-id-by-name?name=' + name })
|
||||
}
|
||||
|
||||
// 登出
|
||||
export const loginOutApi = () => {
|
||||
return defHttp.delete({ url: '/system/auth/logout' })
|
||||
}
|
||||
|
||||
// 获取用户权限信息
|
||||
export const getInfoApi = () => {
|
||||
return defHttp.get<UserInfoVO>({ url: '/system/auth/get-permission-info' })
|
||||
}
|
||||
|
||||
// 路由
|
||||
export const getAsyncRoutesApi = () => {
|
||||
return defHttp.get({ url: '/system/auth/list-menus' })
|
||||
}
|
||||
|
||||
//获取登录验证码
|
||||
export const sendSmsCodeApi = (params: SmsCodeVO) => {
|
||||
return defHttp.post({ url: '/system/auth/send-sms-code', params })
|
||||
}
|
||||
|
||||
// 短信验证码登录
|
||||
export const smsLoginApi = (params: SmsLoginVO) => {
|
||||
return defHttp.post({ url: '/system/auth/sms-login', params })
|
||||
}
|
||||
Reference in New Issue
Block a user