no message

This commit is contained in:
A1300399510
2024-01-03 15:28:16 +08:00
parent e5e3d10123
commit 4665ee5043
64 changed files with 769 additions and 731 deletions

View File

@@ -51,14 +51,24 @@ const get = (url, params) => {
const post = (url, params) => {
return new Promise((resolve, reject) => {
//是将对象 序列化成URL的形式以&进行拼接
axios.post(url, QS.stringify(params)).then(res => resolve(res.data)).catch(err => {
// console.log(err, "err");
if (err.data.code == 401) resolve(err.data);
else reject(err.data)
axios.post(url, QS.stringify(params)).then(res => {
let data = res.data
if (data.code == 401 && !process.server) goLogin()
resolve(data)
}).catch(err => {
if (err.data.code == 401) {
goLogin()
resolve(err.data);
} else reject(err.data)
})
});
}
// 打开登录
const goLogin = () => {
if (typeof ajax_login === "function") ajax_login()
}
export default {
get,
post,