Commit f1095a4d authored by Amy Yang's avatar Amy Yang

refactor: 提交代码

parent 38e0479d
<template> <template>
<v-app id="app"> <v-app id="app">
<!-- <div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link> |
<router-link to="/login">Login</router-link>
</div> -->
<router-view/> <router-view/>
</v-app> </v-app>
</template> </template>
......
import Vue from 'vue' import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
import test from './modules/test' import test from './modules/test'
import system from './modules/system'
Vue.use(VueRouter) Vue.use(VueRouter)
const routes = [ const routes = [
...@@ -19,13 +20,14 @@ const routes = [ ...@@ -19,13 +20,14 @@ const routes = [
}, },
{ {
path: '/index', path: '/index',
name: 'AppLayout', name: 'Index',
// route level code-splitting // route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route // this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "AppLayout" */ '../views/layouts/AppLayout.vue'), component: () => import(/* webpackChunkName: "AppLayout" */ '../views/layouts/AppLayout.vue'),
children: [ children: [
test test,
system
] ]
} }
] ]
......
const routes = {
path: '/system',
name: 'System',
component: {
template: '<router-view></router-view>'
},
meta: {
},
children: [
{
path: 'user',
name: 'User',
component: () => import('@/views/system/User.vue'),
meta: {
icon: ''
}
},
{
path: 'role',
name: 'Role',
component: () => import('@/views/system/Role.vue'),
meta: {
icon: ''
}
}
]
}
export default routes
...@@ -12,29 +12,6 @@ ...@@ -12,29 +12,6 @@
> >
</p> </p>
</div> </div>
<!-- <v-col cols="12" sm="6" md="8" class="info justify-center">
<v-layout row wrap align-center justify-center fill-height >
<v-container>
<v-row class="justify-center">
<v-col cols="9" sm="6" md="9">
<h2 class="display-1 white--text font-weight-medium" align="left">Elegant Design with unlimited features, built with love</h2>
</v-col>
</v-row>
<v-row class="justify-center">
<v-col cols="9" sm="6" md="9">
<h6 class="subtitle-1 mt-4 white--text op-5 font-weight-regular" align="left">Wrappixel helps developers to build organized and well-coded admin dashboards full of beautiful and feature rich modules.</h6>
</v-col>
</v-row>
<v-row class="justify-center">
<v-col cols="9" sm="6" md="9">
<button type="button" class="mt-4 text-capitalize v-btn v-btn--depressed v-btn--flat v-btn--outlined theme--light v-size--x-large white--text">
<span class="v-btn__content">Learn More</span>
</button>
</v-col>
</v-row>
</v-container>
</v-layout>
</v-col>-->
<div class="right"> <div class="right">
<div> <div>
<v-card-title> <v-card-title>
...@@ -66,9 +43,9 @@ ...@@ -66,9 +43,9 @@
<v-row> <v-row>
<v-col> <v-col>
<v-text-field <v-text-field
name="username" v-model="loginForm.username"
:rules="[rules.required]" :rules="[rules.required]"
label="E-mail" label="Username"
outlined outlined
required required
></v-text-field> ></v-text-field>
...@@ -79,7 +56,7 @@ ...@@ -79,7 +56,7 @@
<v-text-field <v-text-field
:append-icon="show ? 'mdi-eye' : 'mdi-eye-off'" :append-icon="show ? 'mdi-eye' : 'mdi-eye-off'"
:type="show ? 'text' : 'password'" :type="show ? 'text' : 'password'"
name="password" v-model="loginForm.password"
label="Password" label="Password"
outlined outlined
value value
...@@ -108,7 +85,7 @@ ...@@ -108,7 +85,7 @@
type="submit" type="submit"
:loading="loading" :loading="loading"
:disabled="loading" :disabled="loading"
@click="loader = 'loading'" @click="submit"
color="primary" color="primary"
block block
>SIGN IN</v-btn >SIGN IN</v-btn
...@@ -132,30 +109,42 @@ ...@@ -132,30 +109,42 @@
export default { export default {
data () { data () {
return { return {
loader: null, loading: false,
loading: null,
show: false, show: false,
remember: false, remember: false,
password: 'Password', loginForm: {
username: '',
password: ''
},
rules: { rules: {
required: value => !!value || 'Required.', required: value => !!value || 'The field is required.',
emailMatch: () => "The email and password you entered don't match" userMatch: () => "The username you entered don't match"
} }
} }
}, },
watch: {
loader () {
const l = this.loader
this[l] = !this[l]
setTimeout(() => (this[l] = false), 3000)
this.loader = null
}
},
methods: { methods: {
submit () { submit () {
this.loading = true
this.$store
.dispatch('login', this.loginForm)
.then(() => {
console.log('xxx')
try {
this.$router.push({ name: 'Index' })
} catch (e) {
this.$router.push({ path: '/' })
}
})
.catch((res) => {
console.log('login-failed', res)
this.$message({
type: 'error',
text: this.$t('common.invalid_password_username')
})
})
.finally(() => {
this.loading = false
})
} }
} }
} }
...@@ -197,40 +186,4 @@ export default { ...@@ -197,40 +186,4 @@ export default {
} }
} }
} }
.custom-loader {
animation: loader 1s infinite;
display: flex;
}
@-moz-keyframes loader {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
@-webkit-keyframes loader {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
@-o-keyframes loader {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
@keyframes loader {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment