Skip to content

Commit

Permalink
提交
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed May 14, 2018
1 parent 2de4429 commit ef2159c
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 153 deletions.
21 changes: 8 additions & 13 deletions src/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,24 @@ router.beforeEach((to, from, next) => {
next({
path: '/'
})
}


else
{
} else {
if (store.getters.roles.length === 0) {
store.dispatch('GetInfo').then(res => {
const roles = res.data.Roles
store.dispatch('GenerateRoutes', { roles }).then(() => {
store.dispatch('GenerateRoutes', {
roles
}).then(() => {
router.addRoutes(store.getters.addRouters)
next({ ...to })
next({ ...to
})
})
})
}
else {
} else {
next()
}
}

}


else {
} else {
if (whiteList.indexOf(to.path) !== -1) {
next()
} else {
Expand Down
42 changes: 17 additions & 25 deletions src/views/layout/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,26 @@
</template>

<script>
import {
mapGetters
} from 'vuex'
import SidebarItem from './SidebarItem'
export default {
components: {
SidebarItem
},
computed: {
...mapGetters([
'permission_routers',
'AllRouters'
]),
sidebar(){
return this.$store.getters.sidebar.opened
}
},
created() {
console.log(this.AllRouters)
import { mapGetters } from "vuex";
import SidebarItem from "./SidebarItem";
export default {
components: {
SidebarItem
},
computed: {
...mapGetters(["permission_routers", "AllRouters"]),
sidebar() {
return this.$store.getters.sidebar.opened;
}
},
created() {
console.log(this.AllRouters);
}
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.el-menu {
min-height: 100%;
}
.el-menu {
min-height: 100%;
}
</style>
220 changes: 105 additions & 115 deletions src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,128 +28,118 @@
</template>

<script>
export default {
name: "login",
data() {
return {
loginForm: {
username: "",
password: ""
},
loading: false
};
},
methods: {
handleLogin() {
this.loading = true;
this.$store
.dispatch("Login", this.loginForm)
.then(response => {
this.loading = false;
export default {
name: "login",
data() {
return {
loginForm: {
username: "",
password: ""
},
loading: false
};
},
methods: {
handleLogin() {
this.loading = true;
this.$store
.dispatch("Login", this.loginForm)
.then((response) => {
this.loading = false;
setTimeout(() => {
this.$router.push({
path: "/"
});
}, 2000);
})
.catch((error) => {
this.$message.error(error);
this.loading = false;
});
}
setTimeout(() => {
this.$router.push({
path: "/"
});
}, 2000);
})
.catch(error => {
this.$message.error(error);
this.loading = false;
});
}
};
}
};
</script>

<style rel="stylesheet/scss" lang="scss">
@import "src/styles/mixin.scss";
$bg: #2d3a4b;
$dark_gray: #889aa4;
$light_gray: #eee;
@import "src/styles/mixin.scss";
$bg: #2d3a4b;
$dark_gray: #889aa4;
$light_gray: #eee;
.login-container {
@include relative;
height: 100vh;
background-color: $bg;
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px #293444 inset !important;
-webkit-text-fill-color: #fff !important;
}
input {
background: transparent;
border: 0px;
-webkit-appearance: none;
border-radius: 0px;
padding: 12px 5px 12px 15px;
color: $light_gray;
height: 47px;
}
.el-input {
display: inline-block;
height: 47px;
width: 85%;
}
.tips {
font-size: 14px;
color: #fff;
margin-bottom: 10px;
}
.svg-container {
padding: 6px 5px 6px 15px;
color: $dark_gray;
vertical-align: middle;
width: 30px;
display: inline-block;
&_login {
font-size: 20px;
}
}
.title {
font-size: 26px;
font-weight: 400;
color: $light_gray;
margin: 0px auto 40px auto;
text-align: center;
font-weight: bold;
}
.login-form {
position: absolute;
left: 0;
right: 0;
width: 400px;
padding: 35px 35px 15px 35px;
margin: 120px auto;
}
.el-form-item {
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(0, 0, 0, 0.1);
border-radius: 5px;
color: #454545;
}
.show-pwd {
position: absolute;
right: 10px;
top: 7px;
font-size: 16px;
color: $dark_gray;
cursor: pointer;
}
.thirdparty-button {
position: absolute;
right: 35px;
bottom: 28px;
.login-container {
@include relative;
height: 100vh;
background-color: $bg;
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px #293444 inset !important;
-webkit-text-fill-color: #fff !important;
}
input {
background: transparent;
border: 0px;
-webkit-appearance: none;
border-radius: 0px;
padding: 12px 5px 12px 15px;
color: $light_gray;
height: 47px;
}
.el-input {
display: inline-block;
height: 47px;
width: 85%;
}
.tips {
font-size: 14px;
color: #fff;
margin-bottom: 10px;
}
.svg-container {
padding: 6px 5px 6px 15px;
color: $dark_gray;
vertical-align: middle;
width: 30px;
display: inline-block;
&_login {
font-size: 20px;
}
}
.title {
font-size: 26px;
font-weight: 400;
color: $light_gray;
margin: 0px auto 40px auto;
text-align: center;
font-weight: bold;
}
.login-form {
position: absolute;
left: 0;
right: 0;
width: 400px;
padding: 35px 35px 15px 35px;
margin: 120px auto;
}
.el-form-item {
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(0, 0, 0, 0.1);
border-radius: 5px;
color: #454545;
}
.show-pwd {
position: absolute;
right: 10px;
top: 7px;
font-size: 16px;
color: $dark_gray;
cursor: pointer;
}
.thirdparty-button {
position: absolute;
right: 35px;
bottom: 28px;
}
}
</style>

0 comments on commit ef2159c

Please sign in to comment.