Skip to content

Commit

Permalink
fixbug: 修复登陆后还能跳登陆页问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Jan 3, 2022
1 parent 76ac8c5 commit 2711520
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export const configMainRouter = (app: App<Element>) => {
route.beforeEach((to, _from, next) => {
const userInfo = localStorage.getItem('userInfo');
if (userInfo) {
next();
if (to.path === '/login') next(_from.path);
else next();
} else {
if (to.path !== '/login') {
next({ path: '/login' });
Expand Down
19 changes: 9 additions & 10 deletions src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@

<div>
<h5>{{ t('sys.login.password') }}</h5>
<form>
<input
v-model="pwd"
type="password"
class="input"
autocomplete="on"
@focus="onPwdFocus"
@blur="onPwdBlur"
/>
</form>
<input
v-model="pwd"
type="password"
class="input"
autocomplete="on"
@focus="onPwdFocus"
@blur="onPwdBlur"
/>
</div>
</div>
<button class="btn enter-x" @click="onLogin">
Expand Down Expand Up @@ -104,6 +102,7 @@
<style lang="scss" scoped>
.wave {
position: fixed;
width: 100vw;
height: 100%;
left: 0;
bottom: 0;
Expand Down

0 comments on commit 2711520

Please sign in to comment.