登录
This commit is contained in:
parent
b10d13d4a2
commit
638232d525
@ -37,6 +37,32 @@ export function login(params) {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
export function login2(data) {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("username", data.username);
|
||||||
|
formData.append("password", data.password);
|
||||||
|
formData.append("code", data.code);
|
||||||
|
formData.append("grant_type", data.grant_type);
|
||||||
|
return http.request<BasicResponseModel>(
|
||||||
|
{
|
||||||
|
url: '/auth/oauth2/token',
|
||||||
|
auth:{
|
||||||
|
...data
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json;charset=UTF-8",
|
||||||
|
Authorization: "Basic YWRtaW46MTIzNDU2", // 客户端信息Base64明文:mall-admin:123456
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
isTransformResponse: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 用户登录
|
* @description: 用户登录
|
||||||
|
@ -5,7 +5,7 @@ import { ACCESS_TOKEN, CURRENT_USER, IS_LOCKSCREEN } from '@/store/mutation-type
|
|||||||
import { ResultEnum } from '@/enums/httpEnum';
|
import { ResultEnum } from '@/enums/httpEnum';
|
||||||
|
|
||||||
const Storage = createStorage({ storage: localStorage });
|
const Storage = createStorage({ storage: localStorage });
|
||||||
import { getUserInfo, login } from '@/api/system/user';
|
import { getUserInfo, login,login2 } from '@/api/system/user';
|
||||||
import { storage } from '@/utils/Storage';
|
import { storage } from '@/utils/Storage';
|
||||||
|
|
||||||
export interface IUserState {
|
export interface IUserState {
|
||||||
@ -60,7 +60,8 @@ export const useUserStore = defineStore({
|
|||||||
// 登录
|
// 登录
|
||||||
async login(userInfo) {
|
async login(userInfo) {
|
||||||
try {
|
try {
|
||||||
const response = await login(userInfo);
|
// const response = await login(userInfo);
|
||||||
|
const response = await login2(userInfo);
|
||||||
const {code,data } = response;
|
const {code,data } = response;
|
||||||
if (code === ResultEnum.SUCCESS) {
|
if (code === ResultEnum.SUCCESS) {
|
||||||
const ex = 7 * 24 * 60 * 60 * 1000;
|
const ex = 7 * 24 * 60 * 60 * 1000;
|
||||||
|
@ -135,7 +135,8 @@
|
|||||||
username:formInline.username,
|
username:formInline.username,
|
||||||
password:formInline.password,
|
password:formInline.password,
|
||||||
code:formInline.code,
|
code:formInline.code,
|
||||||
key:formInline.key
|
key:formInline.key,
|
||||||
|
grant_type:"password"
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user