From fa0fc3195858a592d2ad1bdad0fa6126602ebf55 Mon Sep 17 00:00:00 2001
From: zrj <646384940@qq.com>
Date: Fri, 07 Jun 2024 14:17:10 +0800
Subject: [PATCH] 路径配置修改
---
src/store/modules/user.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 7fb5f2f..20c3576 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -10,6 +10,8 @@
import { deepClone } from "@/util/util";
import website from "@/config/website";
import {
+ loginTo,
+ loginForm,
loginByUsername,
loginBySocial,
loginBySso,
@@ -17,8 +19,8 @@
logout,
refreshToken,
getButtons,
-} from "@/api/user";
-import { getTopMenu, getRoutes } from "@/api/system/menu";
+} from "@/ssoapi/user";
+import { getTopMenu, getRoutes } from "@/ssoapi/system/menu";
import md5 from "js-md5";
function findChildrenUrl(data) {
@@ -27,6 +29,10 @@
} else {
return data[0];
}
+}
+
+function findChildrenRole(data, str) {
+ return data.split(",").find((item) => item == str);
}
function addPath(ele, first) {
@@ -67,6 +73,44 @@
homeFirstTagPage: getStore({ name: "firstTagPage" }) || {},
},
actions: {
+ //自定义表单登录
+ loginTo({ dispatch, commit }, userInfo) {
+ return new Promise((resolve) => {
+ loginTo(
+ userInfo.tenantId,
+ userInfo.username,
+ md5(userInfo.password),
+ userInfo.client_id,
+ userInfo.response_type,
+ userInfo.redirect_uri
+ ).then((res) => {
+ // const data = res.data.data;
+ // commit("SET_TOKEN", data);
+ // commit("DEL_ALL_TAG");
+ // commit("CLEAR_LOCK");
+ resolve();
+ });
+ });
+ },
+ //表单登录
+ loginForm({ dispatch, commit }, userInfo) {
+ return new Promise((resolve) => {
+ loginForm(
+ userInfo.tenantId,
+ userInfo.username,
+ md5(userInfo.password),
+ userInfo.client_id,
+ userInfo.response_type,
+ userInfo.redirect_uri
+ ).then((res) => {
+ // const data = res.data.data;
+ // commit("SET_TOKEN", data);
+ // commit("DEL_ALL_TAG");
+ // commit("CLEAR_LOCK");
+ resolve();
+ });
+ });
+ },
//根据用户名登录
LoginByUsername({ dispatch, commit }, userInfo) {
return new Promise((resolve, reject) => {
@@ -87,6 +131,7 @@
message: data.error_description,
type: "error",
});
+ resolve({ error: "error" });
} else {
commit("SET_TOKEN", data.access_token);
commit("SET_REFRESH_TOKEN", data.refresh_token);
@@ -97,7 +142,12 @@
dispatch("GetMenu").then((menuData) => {
let fistMenu = findChildrenUrl(menuData);
- if (data.role_name == "jdgly" || data.role_name == "sqgly") {
+ if (
+ findChildrenRole(data.role_name, "admin") ||
+ findChildrenRole(data.role_name, "administrator") ||
+ findChildrenRole(data.role_name, "jdgly") ||
+ findChildrenRole(data.role_name, "sqgly")
+ ) {
setStore({ name: "showMenu", content: true });
commit("SET_HOMEFIRSTTAGPAGE", {
@@ -140,7 +190,7 @@
resolve({ fistMenu, menuData });
}
- // commit("DEL_ALL_TAG");
+ commit("DEL_ALL_TAG");
});
}
})
--
Gitblit v1.9.3