From bc2747387df0693aa46a55bb556985aaf881d843 Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期三, 24 八月 2022 19:18:32 +0800
Subject: [PATCH] 导入
---
src/views/login/index.vue | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 3effba1..3bd85be 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -35,7 +35,7 @@
</template>
<script>
- import { loginByUsername } from '@/api/login'
+ import { getAccount,loginByUsername,getUserInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import Cookies from 'js-cookie'
import { initRouter } from '@/utils/router'
@@ -92,6 +92,7 @@
_this.loading = true
loginByUsername(loginForm)
.then((response) => {
+ debugger
const res = response.data
if (res.code == 200) {
sessionStorage.setItem('isdepartment',res.result.isdepartment)
@@ -138,6 +139,26 @@
Cookies.set('token_expired_at', data.tokenexpired)
_this.$store.commit('SET_NAME', data.realname)
_this.$store.commit('SET_USER_TYPE', data.type)
+ //换取账号密码
+ getUserInfo().then(res => {
+ if (res.data.code == 200) {
+ loginForm.department = res.data.result.department
+ // loginForm.department = "公司领导"
+ getAccount(loginForm).then(res => {
+ if (res.data.code == 200) {
+ //缓存账号密码
+ Cookies.set("hiddenDangerUsername",res.data.result.username)
+ Cookies.set("hiddenDangerPassword",res.data.result.password)
+ } else {
+ this.$message({type: 'error', message: res.data.msg, duration: 3000})
+ }
+ })
+
+ } else {
+ this.$message({type: 'error', message: "用户信息获取失败!请重试", duration: 3000})
+ }
+ })
+
// 加载菜单
initRouter(_this)
_this.$router.replace('/')
@@ -174,7 +195,7 @@
.login-container {
min-height: 100%;
width: 100%;
- background: url("../../assets/bg.jpg") center no-repeat;
+ background: url("../../assets/bg_login.png") center no-repeat;
//background-size: auto 100%;
// background-color: #2d3a4b;
overflow: hidden;
@@ -215,7 +236,7 @@
display: inline-block;
height: 474px;
width: 572px;
- background: url("../../assets/img_bg_login.png") center no-repeat;
+ background: url("../../assets/bg.jpg") center no-repeat;
}
.login-main-form{
display: inline-block;
--
Gitblit v1.9.2