mo 2 years ago
parent
commit
ce60bf0cd3
2 changed files with 6 additions and 4 deletions
  1. 4 2
      src/utils/auth.js
  2. 2 2
      src/views/login/index.vue

+ 4 - 2
src/utils/auth.js

@@ -1,18 +1,20 @@
 import Cookies from 'js-cookie'
-import {Session} from './storage'
+import {Session,Local} from './storage'
 const TokenKey = 'loginToken'
 
 export function getToken() {
-  return  Session.get('token')
+  return Local.get('token') ||  Session.get('token')
 }
 
 export function setToken(token) {
   Session.set('token',token)
+  Local.set('token',token)
   return Cookies.set(TokenKey, token)
 
 }
 
 export function removeToken() {
   Session.set('token','')
+  Local.set('token','')
   return Cookies.remove(TokenKey)
 }

+ 2 - 2
src/views/login/index.vue

@@ -107,10 +107,10 @@
       this.loginForm.username = getCookie("username");
       this.loginForm.password = getCookie("password");
       if(this.loginForm.username === undefined||this.loginForm.username==null||this.loginForm.username===''){
-        this.loginForm.username = '15071003551';
+        this.loginForm.username = '';
       }
       if(this.loginForm.password === undefined||this.loginForm.password==null){
-        this.loginForm.password = 'a123456';
+        this.loginForm.password = '';
       }
     },
     methods: {