parent
14efd9eebb
commit
68c8e0a8b0
6 changed files with 161 additions and 73 deletions
@ -0,0 +1,9 @@ |
||||
import request from '@/router/axios'; |
||||
|
||||
export const getUserinfo = params => { |
||||
return request({ |
||||
url: '/smartpark/user/getUserInfo', |
||||
method: 'get', |
||||
params: params |
||||
}) |
||||
} |
||||
@ -0,0 +1,45 @@ |
||||
<template> |
||||
<div></div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getUserinfo } from "@/api/authorization"; |
||||
import { mapGetters } from "vuex"; |
||||
|
||||
export default { |
||||
name: "authorization", |
||||
|
||||
data() { |
||||
return {}; |
||||
}, |
||||
mounted() { |
||||
this.getUserinfo(); |
||||
}, |
||||
methods: { |
||||
getUserinfo() { |
||||
getUserinfo().then((res) => { |
||||
this.$store.dispatch("user/setUserInfo", res); |
||||
// console.log("获取用户信息", res.data.result); |
||||
const loading = this.$loading({ |
||||
lock: true, |
||||
text: "登录中,请稍后。。。", |
||||
spinner: "el-icon-loading", |
||||
}); |
||||
this.$store |
||||
.dispatch("AuthLoginByUsername", res.data.result) |
||||
.then(() => { |
||||
console.log("登录成功"); |
||||
this.$router.push({ path: '/firstOrder/list' }); |
||||
loading.close(); |
||||
}) |
||||
.catch(() => { |
||||
loading.close(); |
||||
this.refreshCode(); |
||||
}); |
||||
}); |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
|
||||
<style></style> |
||||
Loading…
Reference in new issue