From d5fac02a6fdc6564ff5da88056245d0fa579f3c6 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 30 Oct 2023 17:07:23 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/jczz_app
---
utils/func.js | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/utils/func.js b/utils/func.js
index b9ef044..3362a2b 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,30 +11,33 @@
const install = (Vue, vm) => {
// 登录操作 1
- const login = (userInfo) => {
+ const login = async (userInfo) => {
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(activeRoleId)
- //跳转到首页
- uni.switchTab({
- url: '/pages/home/index'
- })
+ let appMenu = data.filter(e => e.name == 'app')[0].children
+ console.log("当前角色菜单:", appMenu)
+ store.commit('SET_MENU', appMenu)
+ //跳转到首页
+ uni.switchTab({
+ url: '/pages/home/index'
})
}
--
Gitblit v1.9.3