File tree Expand file tree Collapse file tree 6 files changed +20
-12
lines changed Expand file tree Collapse file tree 6 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,19 @@ import Dao from '@/base/dao';
22
33class CommonDao extends Dao {
44 async login ( options = { } ) {
5+ const { data = { } } = options ;
6+
57 return this . delay ( 1000 )
68 . then ( ( ) => {
7- return {
8- code : 'SUCCESS'
9- } ;
9+ if ( data . username === 'admin' && data . password === '123456' ) {
10+ return {
11+ code : 'SUCCESS'
12+ } ;
13+ } else {
14+ return {
15+ code : 'ERROR'
16+ } ;
17+ }
1018 } )
1119 . then ( this . checkCode ) ;
1220 }
Original file line number Diff line number Diff line change 11<template >
22 <div class =" app-layout-aside" >
33 <div class =" app-layout-aside-logo" >
4- <a href =" /" >
4+ <router-link to =" /" >
55 <img :src =" logoImg" />
66 <h1 >{{ ui.appName }}</h1 >
7- </a >
7+ </router-link >
88 </div >
99 <el-menu
1010 :default-active =" currentNav"
Original file line number Diff line number Diff line change 114114
115115<script >
116116import { mapActions , mapState , mapGetters } from ' vuex' ;
117- import { CommonUtil } from ' @/common/utils' ;
118117import defaultAvatarImg from ' @/static/images/avatar.png' ;
119118import AppDrawer from ' ./AppDrawer' ;
120119
@@ -176,7 +175,7 @@ export default {
176175
177176 logout () {
178177 this .removeGlobalAppData ().then (() => {
179- CommonUtil . gotoLoginURL ( );
178+ this . $router . push ( ' /login ' );
180179 });
181180 }
182181 }
Original file line number Diff line number Diff line change @@ -4,9 +4,7 @@ export default function AuthInterceptor(store) {
44 if ( store . getters . isLoginedUser ) {
55 next ( ) ;
66 } else {
7- // next('/login');
8- window . location . href = '/login' ;
9- next ( false ) ;
7+ next ( '/login' ) ;
108 }
119 } ;
1210
Original file line number Diff line number Diff line change @@ -90,7 +90,10 @@ export default {
9090 userLoginData () {
9191 const { username , password } = this ;
9292
93- return ` username=${ username} &password=${ password} ` ;
93+ return {
94+ username,
95+ password
96+ };
9497 }
9598 },
9699
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ const afterEachHooks = [PageTitle(store)];
1717
1818const router = new Router ( {
1919 config : {
20- mode : 'history ' ,
20+ mode : 'hash ' ,
2121 base : process . env . BASE_URL || '/' ,
2222 routes : routes
2323 } ,
You can’t perform that action at this time.
0 commit comments