@@ -35,12 +37,15 @@
{{ adminInfo.phone | maskPhone }}
-
+
-
+
-
+
-
+
-
+
@@ -81,164 +95,166 @@
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index f0238e9..f1e5a35 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -63,6 +63,7 @@ import { maskPhone } from '@/filters'
// import SizeSelect from '@/components/SizeSelect'
// import LangSelect from '@/components/LangSelect'
// import Search from '@/components/HeaderSearch'
+import { removeToken } from '@/utils/auth'
export default {
components: {
@@ -89,8 +90,14 @@ export default {
this.$store.dispatch('app/toggleSideBar')
},
async logout() {
- await this.$store.dispatch('user/logout')
+
+
+ // await this.$store.dispatch('user/logout')
+ removeToken()
+
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
+
+
},
showAdminEditDialog() {
this.$store.dispatch('admin-info/initAdminInfo', true)
diff --git a/src/permission.js b/src/permission.js
index 5df1f42..507d46c 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -20,9 +20,7 @@ router.beforeEach(async (to, from, next) => {
// determine whether the user has logged in
const hasToken = getToken()
- console.log(hasToken)
-
- if ( hasToken) {
+ if (hasToken) {
if (to.path === '/login') {
// if is logged in, redirect to the home page
next({ path: '/' })
@@ -71,8 +69,8 @@ router.beforeEach(async (to, from, next) => {
NProgress.done()
}
}
-
-
+
+
})
diff --git a/src/utils/request.js b/src/utils/request.js
index 04cb9d6..5682252 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -18,14 +18,8 @@ service.interceptors.request.use(
// do something before request is sent
config.headers['Content-Type'] = 'application/x-www-form-urlencoded';
- if (store.getters.token) {
-
- console.log(getToken())
- // let each request carry token
- // ['X-Token'] is a custom headers key
- // please modify it according to the actual situation
- config.headers['api-token'] = getToken()
- }
+ config.headers['api-token'] = getToken() || ''
+
return config
},
error => {