优化统一登录认证
This commit is contained in:
parent
656c70e1d4
commit
87f02e786e
@ -46,16 +46,11 @@ export function login2(data) {
|
||||
return http.request<BasicResponseModel>(
|
||||
{
|
||||
url: '/auth/oauth2/token',
|
||||
// auth:{
|
||||
// username:data.username,
|
||||
// password:data.password
|
||||
// },
|
||||
method: 'POST',
|
||||
data:formData,
|
||||
headers: {
|
||||
// "Content-Type": "application/json;charset=UTF-8",
|
||||
"Content-Type": "multipart/form-data",
|
||||
Authorization: "Basic YWRtaW46MTIzNDU2", // 客户端信息Base64明文:mall-admin:123456
|
||||
Authorization: "Basic YWRtaW46MTIzNDU2",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -60,14 +60,14 @@ export const useUserStore = defineStore({
|
||||
// 登录
|
||||
async login(userInfo) {
|
||||
try {
|
||||
// const response = await login(userInfo);
|
||||
const response = await login2(userInfo);
|
||||
const response = await login(userInfo);
|
||||
// const response = await login2(userInfo);
|
||||
const {code,data } = response;
|
||||
if (code === ResultEnum.SUCCESS) {
|
||||
const ex = 7 * 24 * 60 * 60 * 1000;
|
||||
storage.set(ACCESS_TOKEN, data.token, ex);
|
||||
storage.set(ACCESS_TOKEN, data.access_token, ex);
|
||||
storage.set(IS_LOCKSCREEN, false);
|
||||
this.setToken(data.token);
|
||||
this.setToken(data.access_token);
|
||||
}
|
||||
return Promise.resolve(response);
|
||||
} catch (e) {
|
||||
|
@ -136,7 +136,7 @@
|
||||
password:formInline.password,
|
||||
code:formInline.code,
|
||||
key:formInline.key,
|
||||
grant_type:"password"
|
||||
// grant_type:"password"
|
||||
};
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user