Skip to content

Commit

Permalink
添加login
Browse files Browse the repository at this point in the history
  • Loading branch information
kk-cwh committed Apr 9, 2018
1 parent d7f9be4 commit 2a9faaa
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/views/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@ export default {
handleSubmit() {
this.$refs.loginForm.validate(valid => {
if (valid) {
// this.$store
// .dispatch("Login",{
// username: this.form.userName,
// password: this.form.password
// })
// .then(() => {
// this.$store.dispatch("GetUserInfo").then(() => {
// this.$Message.success("Success!");
// this.$router.push({name: "home_index"});
// });
// })
// .catch(() => {
// this.$Message.error("Login Fail!");
// });
this.$store
.dispatch("Login",{
username: this.form.userName,
password: this.form.password
})
.then(() => {
this.$store.dispatch("GetUserInfo").then(() => {
this.$Message.success("Success!");
this.$router.push({name: "home_index"});
});
})
.catch(() => {
this.$Message.error("Login Fail!");
});
Cookies.set('access', 0);
Cookies.set('user', 'admin');
Expand Down

0 comments on commit 2a9faaa

Please sign in to comment.