From 3835cf1ca8d5ac8475052d3876ebeb4a2c4160f1 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 22 Jan 2024 14:22:02 +0800
Subject: [PATCH] 根据角色,动态切换首页,及首页变更的一系列相关调整
---
src/page/login/userlogin.vue | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/src/page/login/userlogin.vue b/src/page/login/userlogin.vue
index 57f8a2d..4601aed 100644
--- a/src/page/login/userlogin.vue
+++ b/src/page/login/userlogin.vue
@@ -53,6 +53,7 @@
</template>
<script>
+import Layout from "@/page/index/"
import { mapGetters } from "vuex"
import { info } from "@/api/system/tenant"
// import {getCaptcha} from "@/api/user";
@@ -176,15 +177,15 @@
},
props: [],
methods: {
- refreshCode () {
- if (this.website.captchaMode) {
- getCaptcha().then(res => {
- const data = res.data
- this.loginForm.key = data.key
- this.loginForm.image = data.image
- })
- }
- },
+ // refreshCode () {
+ // if (this.website.captchaMode) {
+ // getCaptcha().then(res => {
+ // const data = res.data
+ // this.loginForm.key = data.key
+ // this.loginForm.image = data.image
+ // })
+ // }
+ // },
showPassword () {
this.passwordType === ""
? (this.passwordType = "password")
@@ -208,7 +209,7 @@
text: '登录中,请稍后。。。',
spinner: "el-icon-loading"
})
- this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
+ this.$store.dispatch("LoginByUsername", this.loginForm).then((res) => {
if (this.website.switchMode) {
const deptId = this.userInfo.dept_id
const roleId = this.userInfo.role_id
@@ -222,15 +223,24 @@
return false
}
}
- this.$router.push({ path: this.tagWel.value })
+
+ if (JSON.stringify(res) == '{}') {
+ this.$router.push({ path: this.tagWel.value })
+ } else {
+ this.$router.$avueRouter.formatRoutes(res.menuData, true)
+
+ this.$router.push({ path: res.fistMenu.path })
+ }
+
loading.close()
}).catch(() => {
loading.close()
- this.refreshCode()
+ // this.refreshCode()
})
}
})
},
+
getTenant () {
let domain = getTopUrl()
// 临时指定域名,方便测试
--
Gitblit v1.9.3