优化代码

This commit is contained in:
smallchill 2019-02-14 17:36:47 +08:00
parent 52dc1da5e2
commit fe1a5fff08
5 changed files with 15 additions and 11 deletions

View File

@ -1,5 +1,6 @@
import request from '@/router/axios';
import {baseUrl} from '@/config/env';
export const loginByUsername = (account, password, type) => request({
url: 'api/blade-auth/token',
method: 'post',
@ -7,6 +8,9 @@ export const loginByUsername = (account, password, type) => request({
account,
password,
type
},
meta:{
isSerialize:true,
}
})

View File

@ -85,7 +85,7 @@ export default {
},
// 10token
refreshToken() {
this.refreshTime = setInterval(() => {
/*this.refreshTime = setInterval(() => {
const token = getStore({
name: "token",
debug: true
@ -103,7 +103,7 @@ export default {
this.refreshLock = false;
});
}
}, 10000);
}, 10000);*/
}
}
};

View File

@ -34,7 +34,7 @@ axios.interceptors.request.use(config => {
config.headers['blade-auth'] = 'Bearer ' + getToken() // 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
}
//headers中配置serialize为true开启序列化
if (config.methods === 'post' && meta.isSerialize === true) {
if (config.method === 'post' && meta.isSerialize === true) {
config.data = serialize(config.data);
}
return config

View File

@ -1,6 +1,6 @@
// 基础路径 注意发布之前要先修改这里
let baseUrl = './'
let url = 'https://sword.bladex.vip'
let url = 'http://localhost'
module.exports = {
baseUrl: baseUrl, // 根据你的实际情况更改这里
lintOnSave: true,
@ -31,7 +31,7 @@ module.exports = {
target: url,
ws: true,
pathRewrite: {
'^/api': '/api'
'^/api': '/'
}
}
}