From 3c738f4fe2762bba8087e5a22fc0dc06560eab0e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Thu, 08 Aug 2024 10:01:17 +0800
Subject: [PATCH] 三色任务与自查任务
---
utils/func.js | 45 ++++++++++++++++++++++++++++++---------------
1 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/utils/func.js b/utils/func.js
index b9ef044..eada620 100644
--- a/utils/func.js
+++ b/utils/func.js
@@ -1,6 +1,7 @@
import store from "@/store/index.js"
import {
- dynamicMenu
+ dynamicMenu,
+ getDetail
} from "@/api/system/role.js"
import {
logAdd
@@ -10,31 +11,39 @@
const install = (Vue, vm) => {
// 登录操作 1
- const login = (userInfo) => {
-
+ const login = async (userInfo, pageType) => {
vm.$u.vuex('userInfo', userInfo)
vm.$u.vuex('accessToken', userInfo.access_token)
vm.$u.vuex('isLogin', true)
-
let activeRoleId = userInfo.role_id.split(",")[0]
- console.log("当前激活角色的id:", activeRoleId)
-
- //添加当前激活的roleId(默认取第一个)
- vm.$u.vuex('activeRoleId', activeRoleId)
-
+ const resDetail = await getDetail({
+ id: activeRoleId
+ })
+ console.log("当前激活角色的id:", resDetail.data)
+ //添加当前激活的角色(默认取第一个)
+ store.commit('setActiveRole', resDetail.data)
//获取角色菜单
- dynamicMenu(activeRoleId).then(res => {
- let data = res.data
- let appMenu = data.filter(e => e.name == 'app')[0]
- console.log("当前角色菜单:", appMenu)
- vm.$u.vuex('menu', appMenu)
+ const {
+ data
+ } = await dynamicMenu({
+ roleId: activeRoleId,
+ roleName: resDetail.data.roleName
+ })
+ let appMenu = data.filter(e => e.name == 'app')[0].children
+ console.log("当前角色菜单:", appMenu)
+ store.commit('SET_MENU', appMenu)
+ if (pageType == 4 && resDetail.data.roleAlias == "mj") {
+ uni.navigateTo({
+ url: '/subPackage/school/security'
+ })
+ } else {
//跳转到首页
uni.switchTab({
url: '/pages/home/index'
})
+ }
- })
}
// 退出登录
@@ -46,6 +55,12 @@
})
vm.$u.vuex('accessToken', '')
vm.$u.vuex('isLogin', false)
+ if (uni.getStorageSync("pageType")) {
+ uni.removeStorageSync("pageType")
+ }
+ if (uni.getStorageSync("houseCode")) {
+ uni.removeStorageSync("houseCode")
+ }
uni.redirectTo({
url: '/pages/login/login-account'
})
--
Gitblit v1.9.3