huxinglu před 4 roky
rodič
revize
3b74a857d7
5 změnil soubory, kde provedl 10 přidání a 10 odebrání
  1. +1
    -1
      src/api/api.js
  2. +2
    -2
      src/api/system/lscity.js
  3. +1
    -1
      src/router/index.js
  4. +1
    -1
      src/views/login/index.vue
  5. +5
    -5
      src/vuex/modules/user.js

+ 1
- 1
src/api/api.js Zobrazit soubor

@@ -18,7 +18,7 @@ axios.defaults.validateStatus = function (status) {
axios.interceptors.request.use(
config => {
config.headers['Content-Type'] = 'application/json;charset=UTF-8'
config.headers['Authorization'] = Cookies.get('token') ? Cookies.get('token') : ''
config.headers['Authorization'] = Cookies.get(location.host+'-token') ? Cookies.get(location.host+'-token') : ''
return config;
},
err => {

+ 2
- 2
src/api/system/lscity.js Zobrazit soubor

@@ -7,8 +7,8 @@ export default {

getCityList(){
return axios({
method: "POST",
url: '/api/lscity/getCityList',
method: "GET",
url: '/api/syscity/getCityList',
data: {}
})
},

+ 1
- 1
src/router/index.js Zobrazit soubor

@@ -65,7 +65,7 @@ router.beforeEach(async (to, from, next) => {
next()
return
}
let token = Cookies.get('token')
let token = Cookies.get(location.host+'-token')
if (!token) {
if (to.name != 'login') {
next({

+ 1
- 1
src/views/login/index.vue Zobrazit soubor

@@ -99,7 +99,7 @@ export default {
.login(this.form)
.then(res => {
const { token } = res.data;
Cookies.set("token", token);
Cookies.set(location.host+'-token', token);
let redirect = this.$route.query.redirect;
if (redirect) {
this.$router.push({ path: redirect });

+ 5
- 5
src/vuex/modules/user.js Zobrazit soubor

@@ -85,7 +85,7 @@ const actions = {
// get user info
getInfo({ commit, state }) {
return new Promise((resolve, reject) => {
api.getInfo({token:Cookies.get('token')}).then(res => {
api.getInfo({token:Cookies.get(location.host+'-token')}).then(res => {
commit('SET_INFO', res.data.info?res.data.info:{})
commit('SET_PERMISSION', res.data.permission?res.data.permission:[])
if(res.data.permission.length>0){
@@ -97,7 +97,7 @@ const actions = {
}
resolve(res.data.info)
}).catch(e => {
Cookies.set('token','')
Cookies.set(location.host+'-token','')
commit('SET_INFO', null)
commit('SET_MENU', [])
commit('SET_ROLES', null)
@@ -112,8 +112,8 @@ const actions = {
// user logout
logout({ commit, state }) {
return new Promise((resolve, reject) => {
api.logout(Cookies.get('token')).then(res => {
Cookies.set('token','')
api.logout(Cookies.get(location.host+'-token')).then(res => {
Cookies.set(location.host+'-token','')
commit('SET_INFO', null)
commit('SET_MENU', [])
commit('SET_ROLES', null)
@@ -129,7 +129,7 @@ const actions = {
// remove token
resetToken({ commit }) {
return new Promise(resolve => {
Cookies.set('token','')
Cookies.set(location.host+'-token','')
commit('SET_INFO', null)
commit('SET_MENU', [])
commit('SET_ROLES', null)

Načítá se…
Zrušit
Uložit