feat: 权限逻辑处理

This commit is contained in:
xuziqiang
2024-06-14 11:49:51 +08:00
parent 08972bfbfb
commit da3d5840df
9 changed files with 201 additions and 111 deletions

View File

@@ -109,9 +109,9 @@ export const appConfigStore = defineStore({
userLogin(data: loginData) {
if (this.userLoginApi) {
console.log(data);
// return httpRequest({ api: this.userLoginApi, params: data, pathParams: {}, requestConfig });
return httpRequest({ api: this.userLoginApi, params: data, pathParams: {}, requestConfig });
return http.post(this.userLoginApi, data);
// return http.post(this.userLoginApi, data);
} else {
return null;
}

View File

@@ -1,5 +1,3 @@
import { defineStore } from 'pinia';
import { appConfigStore } from '/nerv-base/store/modules/app-config';
export const authorizationService = defineStore({
@@ -72,6 +70,8 @@ export const authorizationService = defineStore({
this.dealResourceTree(this.userResourceList);
} else {
const res = await this.appConfig.userResource();
console.log(res, 'hshshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh');
this.userResourceList = res.data ? res.data : [];
if (this.appConfig.defaultResource) {
this.userResourceList.push(this.appConfig.defaultResource);
@@ -92,6 +92,8 @@ export const authorizationService = defineStore({
//初始化菜单树
async initMenuResource() {
const res = await this.appConfig.userResource();
console.log(res, 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
this.initMenus = [];
if (this.appConfig.resourceName && res.data && res.data.length) {
res.data.forEach((item) => {