diff --git a/src/api/user.js b/src/api/user.js index 29723c8..13399ab 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -1,5 +1,6 @@ import request from '@/router/axios'; -import { baseUrl } from '@/config/env'; +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, } }) @@ -39,4 +43,4 @@ export const sendLogs = (list) => request({ export const logout = () => request({ url: baseUrl + '/user/logout', method: 'get' -}) \ No newline at end of file +}) diff --git a/src/page/index/index.vue b/src/page/index/index.vue index 55ea5b4..b7239a4 100644 --- a/src/page/index/index.vue +++ b/src/page/index/index.vue @@ -85,7 +85,7 @@ export default { }, // 10分钟检测一次token refreshToken() { - this.refreshTime = setInterval(() => { + /*this.refreshTime = setInterval(() => { const token = getStore({ name: "token", debug: true @@ -103,8 +103,8 @@ export default { this.refreshLock = false; }); } - }, 10000); + }, 10000);*/ } } }; - \ No newline at end of file + diff --git a/src/router/axios.js b/src/router/axios.js index 1aa4970..0774561 100644 --- a/src/router/axios.js +++ b/src/router/axios.js @@ -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 @@ -65,4 +65,4 @@ axios.interceptors.response.use(res => { return Promise.reject(new Error(error)); }) -export default axios; \ No newline at end of file +export default axios; diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 3165ed4..0f9f3f7 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -165,4 +165,4 @@ const user = { } } -export default user \ No newline at end of file +export default user diff --git a/vue.config.js b/vue.config.js index 7ff8617..14242dc 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,6 @@ // 基础路径 注意发布之前要先修改这里 let baseUrl = './' -let url = 'https://sword.bladex.vip' +let url = 'http://localhost' module.exports = { baseUrl: baseUrl, // 根据你的实际情况更改这里 lintOnSave: true, @@ -31,9 +31,9 @@ module.exports = { target: url, ws: true, pathRewrite: { - '^/api': '/api' + '^/api': '/' } } } } -} \ No newline at end of file +}