Skip to content
This repository was archived by the owner on May 12, 2020. It is now read-only.

Commit 000a37b

Browse files
committed
feat(login): set default account
1 parent dce6601 commit 000a37b

7 files changed

Lines changed: 48 additions & 10 deletions

File tree

src/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import App from './App'
66
// Including Vue prototype functions (eg. this.$_plugins_messageBox())
77
import './plugins/element.js'
88

9-
// Shouldn't use Router instance directly without 'PERMISSION/index' processing.
10-
import router from './permission'
9+
// Shouldn't use Router instance directly without 'access/index' processing.
10+
import router from './access'
1111
import store from './store'
1212

1313
import 'STYLE/transition/index.scss'

src/pages/Home/index.vue

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1-
<template functional>
2-
<div class="home">
3-
<h3>{{ parent.$t('pages.withoutVerification') }}</h3>
1+
<template>
2+
<div class="home" v-if="isCompleted">
3+
<h3>{{ $t('pages.withoutVerification') }}</h3>
44
<p>
5-
{{ parent.$t('pages.currentRoute') }}
6-
<strong>{{ parent.$route.path }}</strong>
5+
{{ $t('pages.currentRoute') }}
6+
<strong>{{ $route.path }}</strong>
77
</p>
88
</div>
99
</template>
1010

1111
<script>
1212
export default {
13-
name: 'home'
13+
name: 'home',
14+
15+
data() {
16+
return {
17+
isCompleted: false
18+
}
19+
},
20+
21+
created() {
22+
// simulate data fetching
23+
setTimeout(() => {
24+
this.isCompleted = true
25+
}, 2000)
26+
}
1427
}
1528
</script>
1629

src/pages/Login/index.vue

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,23 @@
4040
>{{ $t('submitButton') }}</el-button
4141
>
4242
</el-form-item>
43+
44+
<div class="login__way">
45+
<el-button
46+
class="login__way__item"
47+
size="mini"
48+
type="text"
49+
@click="asDefault('admin')"
50+
>as admin</el-button
51+
>
52+
<el-button
53+
class="login__way__item"
54+
size="mini"
55+
type="text"
56+
@click="asDefault('user')"
57+
>as user</el-button
58+
>
59+
</div>
4360
</el-form>
4461
</div>
4562
<el-footer class="login__footer">
@@ -85,6 +102,10 @@ export default {
85102
switchLoading(state) {
86103
this.isLoading = state
87104
},
105+
asDefault(type = 'admin') {
106+
this.userInfo.username = type
107+
this.userInfo.password = type
108+
},
88109
...mapActions('login', ['userLogout'])
89110
},
90111
@@ -162,6 +183,10 @@ export default {
162183
&__submit
163184
width: 100%
164185
186+
&__way
187+
&__item
188+
text-transform: uppercase
189+
165190
&__footer
166191
.author__info
167192
margin: 0

src/router/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ export function resetRouter() {
2525
/**
2626
* ! NOTICE
2727
* This router instance should not be added directly without
28-
* `PERMISSION/index` processing.
28+
* `ACCESS/index` processing.
2929
*/
3030
export default router

vue.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function aliasCreator(chainConfig) {
8484
.set('STORE', path.resolve(PATH.SOURCE_PATH, './store'))
8585
.set('UTILS', path.resolve(PATH.SOURCE_PATH, './utils'))
8686
.set('API', path.resolve(PATH.SOURCE_PATH, './api'))
87-
.set('PERMISSION', path.resolve(PATH.SOURCE_PATH, './permission'))
87+
.set('ACCESS', path.resolve(PATH.SOURCE_PATH, './access'))
8888
.set('ASSETS', path.resolve(PATH.SOURCE_PATH, './assets'))
8989
.set('LANG', path.resolve(PATH.SOURCE_PATH, './lang'))
9090
}

0 commit comments

Comments
 (0)