From 9497fbad9254f75460110e4e77768111e78a5403 Mon Sep 17 00:00:00 2001
From: cqf
Date: Thu, 16 Jun 2022 15:12:53 +0800
Subject: [PATCH] 换取登录账号
---
src/views/login/index.vue | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 3a0e544..f13ab50 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'
@@ -133,6 +133,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 == "00000") {
+ //缓存账号密码
+ Cookies.set("hiddenDangerUsername",res.data.data.username)
+ Cookies.set("hiddenDangerPassword",res.data.data.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('/')
--
Gitblit v1.9.2