优化管理端和卖家端登录

master
paulGao 2022-01-17 18:00:49 +08:00
parent cf740d9605
commit 1bee69cefb
6 changed files with 47 additions and 11 deletions

View File

@ -7,6 +7,7 @@ import {
importRequest,
getRequestWithNoToken,
putRequestWithNoForm,
postRequestWithNoTokenData,
postRequestWithNoForm,
managerUrl
} from "@/libs/axios";
@ -47,7 +48,7 @@ export const getNoticePage = (params) => {
// 登陆
export const login = (params) => {
return getRequestWithNoToken("/user/login", params);
return postRequestWithNoTokenData("/user/login", params);
};
// 登出

View File

@ -342,3 +342,19 @@ export const postRequestWithNoToken = (url, params) => {
params: params
});
};
/**
* 无需token验证的请求 避免旧token过期导致请求失败
* @param {*} url
* @param {*} params
*/
export const postRequestWithNoTokenData = (url, params) => {
return service({
method: "post",
url: `${url}`,
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
data: params
});
};

View File

@ -111,10 +111,11 @@ export default {
if (!con.status) return;
this.loading = true;
login({
username: this.form.username,
password: this.md5(this.form.password),
})
let fd = new FormData();
fd.append('username',this.form.username)
fd.append('password',this.md5(this.form.password))
login(fd)
.then((res) => {
if (res && res.success) {
this.afterLogin(res);

View File

@ -5,7 +5,7 @@ import {
putRequest,
deleteRequest,
getRequestWithNoToken,
postRequestWithNoToken,
postRequestWithNoTokenData,
commonUrl,
} from "@/libs/axios";
@ -29,7 +29,7 @@ export const getSellerHomeData = params => {
// 登陆
export const login = params => {
return postRequestWithNoToken("/login/userLogin", params);
return postRequestWithNoTokenData("/login/userLogin", params);
};
// 登出

View File

@ -350,3 +350,20 @@ export const postRequestWithNoToken = (url, params) => {
params: params
});
};
/**
* 无需token验证的请求 避免旧token过期导致请求失败
* @param {*} url
* @param {*} params
*/
export const postRequestWithNoTokenData = (url, params) => {
return service({
method: "post",
url: `${url}`,
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
data: params
});
};

View File

@ -137,10 +137,11 @@ export default {
if (!con.status) return;
this.loading = true;
login({
username: this.form.username,
password: this.md5(this.form.password),
})
let fd = new FormData();
fd.append('username',this.form.username)
fd.append('password',this.md5(this.form.password))
login(fd)
.then((res) => {
this.loading = false;
if (res && res.success) {